summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/lib.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (ignore 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
@@ -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
100void Lib::run() 100void Lib::run()
101{ 101{
102 assert( false ); 102 initialize();
103 m_initialized = true;
103} 104}
104 105
105void Lib::initialize() 106void 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 {
274QString Lib::metaInfo( int number) const { 275QString 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
280int Lib::error() const { 281int 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
287void 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
286void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) 297void 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
293void Lib::handleXineEvent( const xine_event_t* t ) { 304void 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
297void Lib::handleXineEvent( int type ) { 308void Lib::handleXineEvent( int type ) {