summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/lib.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp74
1 files changed, 47 insertions, 27 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 4ae8490..84d28ce 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -49,22 +49,17 @@ _;:, .> :=|. This program is free software; you can
49 49
50typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, 50typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
51 int width, int height,int bytes ); 51 int width, int height,int bytes );
52typedef void (*vo_scale_cb) (void*, int, int, double,
53 int*, int*, int*, int*, double*, int*, int* );
54typedef void (*dest_size_cb) (void*, int, int, double, int*, int*, double*);
55
52 56
53extern "C" { 57extern "C" {
54 xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); 58 xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void *, vo_scale_cb, dest_size_cb );
55 int null_is_showing_video( const xine_vo_driver_t* self ); 59 int null_is_showing_video( const xine_vo_driver_t* self );
56 void null_set_show_video( const xine_vo_driver_t* self, int show ); 60 void null_set_show_video( const xine_vo_driver_t* self, int show );
57 int null_is_fullscreen( const xine_vo_driver_t* self );
58 void null_set_fullscreen( const xine_vo_driver_t* self, int screen );
59 int null_is_scaling( const xine_vo_driver_t* self );
60 void null_set_scaling( const xine_vo_driver_t* self, int scale );
61 void null_set_gui_width( const xine_vo_driver_t* self, int width );
62 void null_set_gui_height( const xine_vo_driver_t* self, int height );
63 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); 61 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb );
64 void null_set_videoGamma( const xine_vo_driver_t* self , int value );
65 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); 62 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data );
66
67 void null_preload_decoders( xine_stream_t *stream );
68} 63}
69 64
70using namespace XINE; 65using namespace XINE;
@@ -127,7 +122,10 @@ void Lib::initialize()
127 // allocate oss for sound 122 // allocate oss for sound
128 // and fb for framebuffer 123 // and fb for framebuffer
129 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); 124 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL );
130 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); 125 m_videoOutput = ::init_video_out_plugin( m_xine, NULL,
126 xine_display_frame, this,
127 xine_vo_scale_cb,
128 xine_dest_cb );
131 129
132 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); 130 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
133 xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); 131 xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1);
@@ -139,8 +137,6 @@ void Lib::initialize()
139 m_queue = xine_event_new_queue (m_stream); 137 m_queue = xine_event_new_queue (m_stream);
140 xine_event_create_listener_thread (m_queue, xine_event_handler, this); 138 xine_event_create_listener_thread (m_queue, xine_event_handler, this);
141 139
142 ::null_preload_decoders( m_stream );
143
144 m_duringInitialization = false; 140 m_duringInitialization = false;
145} 141}
146 142
@@ -165,10 +161,8 @@ Lib::~Lib() {
165void Lib::resize ( const QSize &s ) { 161void Lib::resize ( const QSize &s ) {
166 assert( m_initialized || m_duringInitialization ); 162 assert( m_initialized || m_duringInitialization );
167 163
168 if ( s. width ( ) && s. height ( ) ) { 164 if ( s. width ( ) && s. height ( ) )
169 ::null_set_gui_width( m_videoOutput, s. width() ); 165 m_videoSize = s;
170 ::null_set_gui_height( m_videoOutput, s. height() );
171 }
172} 166}
173 167
174int Lib::majorVersion() { 168int Lib::majorVersion() {
@@ -422,31 +416,33 @@ bool Lib::isShowingVideo() const {
422void Lib::showVideoFullScreen( bool fullScreen ) { 416void Lib::showVideoFullScreen( bool fullScreen ) {
423 assert( m_initialized ); 417 assert( m_initialized );
424 418
425 ::null_set_fullscreen( m_videoOutput, fullScreen ); 419 #warning use xine
426} 420}
427 421
428bool Lib::isVideoFullScreen() const { 422bool Lib::isVideoFullScreen() const {
429 assert( m_initialized ); 423 assert( m_initialized );
430 424
431 return ::null_is_fullscreen( m_videoOutput ); 425 #warning use xine
426 return false;
432} 427}
433 428
434void Lib::setScaling( bool scale ) { 429void Lib::setScaling( bool scale ) {
435 assert( m_initialized ); 430 assert( m_initialized );
436 431
437 ::null_set_scaling( m_videoOutput, scale ); 432 xine_set_param( m_stream, XINE_PARAM_VO_ASPECT_RATIO,
433 scale ? XINE_VO_ASPECT_AUTO : XINE_VO_ASPECT_SQUARE );
438} 434}
439 435
440void Lib::setGamma( int value ) { 436void Lib::setGamma( int value ) {
441 assert( m_initialized ); 437 assert( m_initialized );
442 438 xine_set_param( m_stream, XINE_PARAM_VO_BRIGHTNESS, value );
443 ::null_set_videoGamma( m_videoOutput, value );
444} 439}
445 440
446bool Lib::isScaling() const { 441bool Lib::isScaling() const {
447 assert( m_initialized ); 442 assert( m_initialized );
448 443
449 return ::null_is_scaling( m_videoOutput ); 444 int aratio = xine_get_param( m_stream, XINE_PARAM_VO_ASPECT_RATIO );
445 return aratio == XINE_VO_ASPECT_AUTO;
450} 446}
451 447
452void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { 448void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) {
@@ -458,14 +454,38 @@ void Lib::xine_display_frame( void* user_data, uint8_t *frame,
458 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); 454 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes );
459} 455}
460 456
461void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { 457void Lib::xine_vo_scale_cb( void *user_data, int video_with, int video_height,
462 assert( m_initialized ); 458 double video_pixel_aspect,
459 int *dest_x, int *dest_y, int *dest_width,
460 int *dest_height, double *dest_pixel_aspect,
461 int *win_x, int *win_y ) {
462 QSize size = ((Lib*)user_data)->m_videoSize;
463 if (!size.isValid())
464 return;
463 465
464 if ( !m_video ) { 466 *dest_x = 0;
467 *dest_y = 0;
468 *dest_width = size.width();
469 *dest_height = size.height();
470 *win_x = 0;
471 *win_y = 0;
472}
473
474void Lib::xine_dest_cb( void* user_data, int, int, double,
475 int *dest_width, int* dest_height, double* ) {
476 QSize size = ((Lib*)user_data)->m_videoSize;
477 if ( !size.isValid() )
465 return; 478 return;
479
480 *dest_width = size.width();
481 *dest_height = size.height();
466 } 482 }
467 483
468// assert( m_wid ); 484void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
485 assert( m_initialized );
486
487 if ( !m_video )
488 return;
469 489
470 if (m_wid) m_wid-> setVideoFrame ( frame, width, height, bytes ); 490 if (m_wid) m_wid-> setVideoFrame ( frame, width, height, bytes );
471} 491}