-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 13 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 3 |
3 files changed, 16 insertions, 2 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 @@ -99,7 +99,8 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) void Lib::run() { - assert( false ); + initialize(); + m_initialized = true; } void Lib::initialize() @@ -283,6 +284,16 @@ int Lib::error() const { 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 ); diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h index 9dd7385..6b67f67 100644 --- a/noncore/multimedia/opieplayer2/lib.h +++ b/noncore/multimedia/opieplayer2/lib.h @@ -177,6 +177,8 @@ namespace XINE { */ int error() const; + void ensureInitialized(); + signals: void stopped(); diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 1aa3daa..7c54499 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp @@ -45,7 +45,6 @@ XineControl::XineControl( XineVideoWidget *xineWidget, QObject *parent, const char *name ) : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) { - libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget ); init(); @@ -56,6 +55,8 @@ XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, QObject *parent, const char *name ) : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) { + xine->ensureInitialized(); + init(); } |