Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 8afb318..f1b9773 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -28,25 +28,25 @@ | |||
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include "xinevideowidget.h" | 34 | #include "xinevideowidget.h" |
35 | #include "frame.h" | 35 | #include "frame.h" |
36 | #include "lib.h" | 36 | #include "lib.h" |
37 | 37 | ||
38 | /* OPIE */ | 38 | /* OPIE */ |
39 | #include <opie2/odebug.h> | 39 | #include <opie2/odebug.h> |
40 | using namespace Opie::Core; | 40 | #include <qpe/global.h> |
41 | 41 | ||
42 | /* QT */ | 42 | /* QT */ |
43 | #include <qtextstream.h> | 43 | #include <qtextstream.h> |
44 | #include <qdir.h> | 44 | #include <qdir.h> |
45 | #include <qgfx_qws.h> | 45 | #include <qgfx_qws.h> |
46 | 46 | ||
47 | /* STD */ | 47 | /* STD */ |
48 | #include <assert.h> | 48 | #include <assert.h> |
49 | #include <unistd.h> | 49 | #include <unistd.h> |
50 | 50 | ||
51 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, | 51 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, |
52 | int width, int height,int bytes ); | 52 | int width, int height,int bytes ); |
@@ -317,37 +317,47 @@ void Lib::ensureInitialized() | |||
317 | 317 | ||
318 | void Lib::setWidget( XineVideoWidget *widget ) | 318 | void Lib::setWidget( XineVideoWidget *widget ) |
319 | { | 319 | { |
320 | m_wid = widget; | 320 | m_wid = widget; |
321 | resize ( m_wid-> size ( ) ); | 321 | resize ( m_wid-> size ( ) ); |
322 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | 322 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); |
323 | m_wid->repaint(); | 323 | m_wid->repaint(); |
324 | } | 324 | } |
325 | 325 | ||
326 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) | 326 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) |
327 | { | 327 | { |
328 | assert( sendType == ThreadUtil::Channel::OneWay ); | 328 | assert( sendType == ThreadUtil::Channel::OneWay ); |
329 | handleXineEvent( msg->type() ); | 329 | handleXineEvent( msg->type(), msg->data(), msg->msg() ); |
330 | delete msg; | 330 | delete msg; |
331 | } | 331 | } |
332 | 332 | ||
333 | void Lib::handleXineEvent( const xine_event_t* t ) { | 333 | void Lib::handleXineEvent( const xine_event_t* t ) { |
334 | send( new ThreadUtil::ChannelMessage( t->type ), OneWay ); | 334 | int prog = -1; const char* name = 0; |
335 | if ( t->type == XINE_EVENT_PROGRESS ) { | ||
336 | xine_progress_data_t *pt = static_cast<xine_progress_data_t*>( t->data ); | ||
337 | prog = pt->percent; | ||
338 | name = pt->description; | ||
339 | } | ||
340 | |||
341 | send( new ThreadUtil::ChannelMessage( t->type, prog, name ), OneWay ); | ||
335 | } | 342 | } |
336 | 343 | ||
337 | void Lib::handleXineEvent( int type ) { | 344 | void Lib::handleXineEvent( int type, int data, const char* name ) { |
338 | assert( m_initialized ); | 345 | assert( m_initialized ); |
339 | 346 | ||
340 | if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { | 347 | if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { |
341 | emit stopped(); | 348 | emit stopped(); |
349 | }else if ( type == XINE_EVENT_PROGRESS ) { | ||
350 | QString str = name == 0 ? QString::null : QString::fromUtf8( name ); | ||
351 | Global::statusMessage( tr( "Progress: %1 %2" ).arg( name, data ) );; | ||
342 | } | 352 | } |
343 | } | 353 | } |
344 | 354 | ||
345 | 355 | ||
346 | void Lib::setShowVideo( bool video ) { | 356 | void Lib::setShowVideo( bool video ) { |
347 | assert( m_initialized ); | 357 | assert( m_initialized ); |
348 | 358 | ||
349 | m_video = video; | 359 | m_video = video; |
350 | ::null_set_show_video( m_videoOutput, video ); | 360 | ::null_set_show_video( m_videoOutput, video ); |
351 | } | 361 | } |
352 | 362 | ||
353 | bool Lib::isShowingVideo() const { | 363 | bool Lib::isShowingVideo() const { |