Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 99d5de6..20fd1e2 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -70,7 +70,9 @@ extern "C" { | |||
70 | 70 | ||
71 | using namespace XINE; | 71 | using namespace XINE; |
72 | 72 | ||
73 | Lib::Lib( XineVideoWidget* widget ) { | 73 | Lib::Lib( XineVideoWidget* widget ) |
74 | { | ||
75 | ThreadUtil::AutoLock lock( m_initGuard ); | ||
74 | m_initialized = false; | 76 | m_initialized = false; |
75 | m_video = false; | 77 | m_video = false; |
76 | m_wid = widget; | 78 | m_wid = widget; |
@@ -87,6 +89,11 @@ Lib::Lib( XineVideoWidget* widget ) { | |||
87 | f.close(); | 89 | f.close(); |
88 | } | 90 | } |
89 | 91 | ||
92 | start(); | ||
93 | } | ||
94 | |||
95 | void Lib::run() | ||
96 | { | ||
90 | initialize(); | 97 | initialize(); |
91 | } | 98 | } |
92 | 99 | ||
@@ -124,7 +131,10 @@ void Lib::initialize() | |||
124 | 131 | ||
125 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); | 132 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); |
126 | 133 | ||
134 | ThreadUtil::AutoLock lock( m_initGuard ); | ||
127 | m_initialized = true; | 135 | m_initialized = true; |
136 | |||
137 | send( new ThreadUtil::ChannelMessage( InitializationMessageType ), OneWay ); | ||
128 | } | 138 | } |
129 | 139 | ||
130 | Lib::~Lib() { | 140 | Lib::~Lib() { |
@@ -284,12 +294,19 @@ int Lib::error() const { | |||
284 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) | 294 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) |
285 | { | 295 | { |
286 | assert( sendType == ThreadUtil::Channel::OneWay ); | 296 | assert( sendType == ThreadUtil::Channel::OneWay ); |
287 | handleXineEvent( msg->type() ); | 297 | switch ( msg->type() ) { |
298 | case XineMessageType: | ||
299 | handleXineEvent( static_cast<XineMessage *>( msg )->xineEvent ); | ||
300 | break; | ||
301 | case InitializationMessageType: | ||
302 | emit initialized(); | ||
303 | break; | ||
304 | } | ||
288 | delete msg; | 305 | delete msg; |
289 | } | 306 | } |
290 | 307 | ||
291 | void Lib::handleXineEvent( const xine_event_t* t ) { | 308 | void Lib::handleXineEvent( const xine_event_t* t ) { |
292 | send( new ThreadUtil::ChannelMessage( t->type ), OneWay ); | 309 | send( new XineMessage( t->type ), OneWay ); |
293 | } | 310 | } |
294 | 311 | ||
295 | void Lib::handleXineEvent( int type ) { | 312 | void Lib::handleXineEvent( int type ) { |