summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/lib.cpp
Side-by-side diff
Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index cef46a1..84194b7 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -78,49 +78,50 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
m_wid = widget;
printf("Lib");
QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
// get the configuration
// not really OO, should be an extra class, later
if ( !QFile::exists(configPath) ) {
QFile f(configPath);
f.open(IO_WriteOnly);
QTextStream ts( &f );
ts << "misc.memcpy_method:glibc\n";
f.close();
}
if ( initMode == InitializeImmediately ) {
initialize();
m_initialized = true;
}
else
assert( false );
}
void Lib::run()
{
- assert( false );
+ initialize();
+ m_initialized = true;
}
void Lib::initialize()
{
m_duringInitialization = true;
m_xine = xine_new( );
QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
xine_config_load( m_xine, QFile::encodeName( configPath ) );
xine_init( m_xine );
// allocate oss for sound
// and fb for framebuffer
m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL );
m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this );
//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL);
// null_display_handler( m_videoOutput, xine_display_frame, this );
m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
@@ -262,48 +263,58 @@ void Lib::seekTo( int time ) {
// since its now milliseconds we need *1000
xine_play( m_stream, 0, time*1000 );
}
Frame Lib::currentFrame() const {
assert( m_initialized );
Frame frame;
return frame;
};
QString Lib::metaInfo( int number) const {
assert( m_initialized );
return xine_get_meta_info( m_stream, number );
}
int Lib::error() const {
assert( m_initialized );
return xine_get_error( m_stream );
};
+void Lib::ensureInitialized()
+{
+ if ( m_initialized )
+ return;
+
+ qDebug( "waiting for initialization thread to finish" );
+ wait();
+ qDebug( "initialization thread finished!" );
+}
+
void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType )
{
assert( sendType == ThreadUtil::Channel::OneWay );
handleXineEvent( msg->type() );
delete msg;
}
void Lib::handleXineEvent( const xine_event_t* t ) {
send( new ThreadUtil::ChannelMessage( t->type ), OneWay );
}
void Lib::handleXineEvent( int type ) {
assert( m_initialized );
if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) {
emit stopped();
}
}
void Lib::setShowVideo( bool video ) {
assert( m_initialized );
m_video = video;