Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 84194b7..299239b 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -119,28 +119,25 @@ void Lib::initialize() | |||
119 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); | 119 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); |
120 | 120 | ||
121 | 121 | ||
122 | //xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); | 122 | //xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); |
123 | 123 | ||
124 | 124 | ||
125 | // null_display_handler( m_videoOutput, xine_display_frame, this ); | 125 | // null_display_handler( m_videoOutput, xine_display_frame, this ); |
126 | 126 | ||
127 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); | 127 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); |
128 | 128 | ||
129 | if (m_wid != 0 ) { | 129 | if (m_wid != 0 ) { |
130 | printf( "!0\n" ); | 130 | printf( "!0\n" ); |
131 | resize ( m_wid-> size ( ) ); | 131 | setWidget( m_wid ); |
132 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | ||
133 | |||
134 | // m_wid->repaint(); | ||
135 | } | 132 | } |
136 | 133 | ||
137 | m_queue = xine_event_new_queue (m_stream); | 134 | m_queue = xine_event_new_queue (m_stream); |
138 | 135 | ||
139 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); | 136 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); |
140 | m_duringInitialization = false; | 137 | m_duringInitialization = false; |
141 | } | 138 | } |
142 | 139 | ||
143 | Lib::~Lib() { | 140 | Lib::~Lib() { |
144 | assert( isRunning() == false ); | 141 | assert( isRunning() == false ); |
145 | assert( m_initialized ); | 142 | assert( m_initialized ); |
146 | 143 | ||
@@ -285,24 +282,32 @@ int Lib::error() const { | |||
285 | }; | 282 | }; |
286 | 283 | ||
287 | void Lib::ensureInitialized() | 284 | void Lib::ensureInitialized() |
288 | { | 285 | { |
289 | if ( m_initialized ) | 286 | if ( m_initialized ) |
290 | return; | 287 | return; |
291 | 288 | ||
292 | qDebug( "waiting for initialization thread to finish" ); | 289 | qDebug( "waiting for initialization thread to finish" ); |
293 | wait(); | 290 | wait(); |
294 | qDebug( "initialization thread finished!" ); | 291 | qDebug( "initialization thread finished!" ); |
295 | } | 292 | } |
296 | 293 | ||
294 | void Lib::setWidget( XineVideoWidget *widget ) | ||
295 | { | ||
296 | m_wid = widget; | ||
297 | resize ( m_wid-> size ( ) ); | ||
298 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | ||
299 | m_wid->repaint(); | ||
300 | } | ||
301 | |||
297 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) | 302 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) |
298 | { | 303 | { |
299 | assert( sendType == ThreadUtil::Channel::OneWay ); | 304 | assert( sendType == ThreadUtil::Channel::OneWay ); |
300 | handleXineEvent( msg->type() ); | 305 | handleXineEvent( msg->type() ); |
301 | delete msg; | 306 | delete msg; |
302 | } | 307 | } |
303 | 308 | ||
304 | void Lib::handleXineEvent( const xine_event_t* t ) { | 309 | void Lib::handleXineEvent( const xine_event_t* t ) { |
305 | send( new ThreadUtil::ChannelMessage( t->type ), OneWay ); | 310 | send( new ThreadUtil::ChannelMessage( t->type ), OneWay ); |
306 | } | 311 | } |
307 | 312 | ||
308 | void Lib::handleXineEvent( int type ) { | 313 | void Lib::handleXineEvent( int type ) { |
@@ -372,14 +377,17 @@ void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { | |||
372 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, | 377 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, |
373 | int width, int height, int bytes ) { | 378 | int width, int height, int bytes ) { |
374 | ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); | 379 | ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); |
375 | } | 380 | } |
376 | 381 | ||
377 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { | 382 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { |
378 | assert( m_initialized ); | 383 | assert( m_initialized ); |
379 | 384 | ||
380 | if ( !m_video ) { | 385 | if ( !m_video ) { |
381 | qWarning("not showing video now"); | 386 | qWarning("not showing video now"); |
382 | return; | 387 | return; |
383 | } | 388 | } |
389 | |||
390 | assert( m_wid ); | ||
391 | |||
384 | m_wid-> setVideoFrame ( frame, width, height, bytes ); | 392 | m_wid-> setVideoFrame ( frame, width, height, bytes ); |
385 | } | 393 | } |