Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 13 |
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 | |||
@@ -90,25 +90,26 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) | |||
90 | } | 90 | } |
91 | 91 | ||
92 | if ( initMode == InitializeImmediately ) { | 92 | if ( initMode == InitializeImmediately ) { |
93 | initialize(); | 93 | initialize(); |
94 | m_initialized = true; | 94 | m_initialized = true; |
95 | } | 95 | } |
96 | else | 96 | else |
97 | assert( false ); | 97 | assert( false ); |
98 | } | 98 | } |
99 | 99 | ||
100 | void Lib::run() | 100 | void Lib::run() |
101 | { | 101 | { |
102 | assert( false ); | 102 | initialize(); |
103 | m_initialized = true; | ||
103 | } | 104 | } |
104 | 105 | ||
105 | void Lib::initialize() | 106 | void Lib::initialize() |
106 | { | 107 | { |
107 | m_duringInitialization = true; | 108 | m_duringInitialization = true; |
108 | m_xine = xine_new( ); | 109 | m_xine = xine_new( ); |
109 | 110 | ||
110 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 111 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
111 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); | 112 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); |
112 | 113 | ||
113 | xine_init( m_xine ); | 114 | xine_init( m_xine ); |
114 | 115 | ||
@@ -274,24 +275,34 @@ Frame Lib::currentFrame() const { | |||
274 | QString Lib::metaInfo( int number) const { | 275 | QString Lib::metaInfo( int number) const { |
275 | assert( m_initialized ); | 276 | assert( m_initialized ); |
276 | 277 | ||
277 | return xine_get_meta_info( m_stream, number ); | 278 | return xine_get_meta_info( m_stream, number ); |
278 | } | 279 | } |
279 | 280 | ||
280 | int Lib::error() const { | 281 | int Lib::error() const { |
281 | assert( m_initialized ); | 282 | assert( m_initialized ); |
282 | 283 | ||
283 | return xine_get_error( m_stream ); | 284 | return xine_get_error( m_stream ); |
284 | }; | 285 | }; |
285 | 286 | ||
287 | void Lib::ensureInitialized() | ||
288 | { | ||
289 | if ( m_initialized ) | ||
290 | return; | ||
291 | |||
292 | qDebug( "waiting for initialization thread to finish" ); | ||
293 | wait(); | ||
294 | qDebug( "initialization thread finished!" ); | ||
295 | } | ||
296 | |||
286 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) | 297 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) |
287 | { | 298 | { |
288 | assert( sendType == ThreadUtil::Channel::OneWay ); | 299 | assert( sendType == ThreadUtil::Channel::OneWay ); |
289 | handleXineEvent( msg->type() ); | 300 | handleXineEvent( msg->type() ); |
290 | delete msg; | 301 | delete msg; |
291 | } | 302 | } |
292 | 303 | ||
293 | void Lib::handleXineEvent( const xine_event_t* t ) { | 304 | void Lib::handleXineEvent( const xine_event_t* t ) { |
294 | send( new ThreadUtil::ChannelMessage( t->type ), OneWay ); | 305 | send( new ThreadUtil::ChannelMessage( t->type ), OneWay ); |
295 | } | 306 | } |
296 | 307 | ||
297 | void Lib::handleXineEvent( int type ) { | 308 | void Lib::handleXineEvent( int type ) { |