Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 74 |
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 @@ -50,20 +50,15 @@ _;:, .> :=|. This program is free software; you can typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, int width, int height,int bytes ); +typedef void (*vo_scale_cb) (void*, int, int, double, + int*, int*, int*, int*, double*, int*, int* ); +typedef void (*dest_size_cb) (void*, int, int, double, int*, int*, double*); + extern "C" { - xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); + xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void *, vo_scale_cb, dest_size_cb ); int null_is_showing_video( const xine_vo_driver_t* self ); void null_set_show_video( const xine_vo_driver_t* self, int show ); - int null_is_fullscreen( const xine_vo_driver_t* self ); - void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); - int null_is_scaling( const xine_vo_driver_t* self ); - void null_set_scaling( const xine_vo_driver_t* self, int scale ); - void null_set_gui_width( const xine_vo_driver_t* self, int width ); - void null_set_gui_height( const xine_vo_driver_t* self, int height ); void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); - void null_set_videoGamma( const xine_vo_driver_t* self , int value ); void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); - - void null_preload_decoders( xine_stream_t *stream ); } @@ -128,5 +123,8 @@ void Lib::initialize() // and fb for framebuffer m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); - m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); + m_videoOutput = ::init_video_out_plugin( m_xine, NULL, + xine_display_frame, this, + xine_vo_scale_cb, + xine_dest_cb ); m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); @@ -140,6 +138,4 @@ void Lib::initialize() xine_event_create_listener_thread (m_queue, xine_event_handler, this); - ::null_preload_decoders( m_stream ); - m_duringInitialization = false; } @@ -166,8 +162,6 @@ void Lib::resize ( const QSize &s ) { assert( m_initialized || m_duringInitialization ); - if ( s. width ( ) && s. height ( ) ) { - ::null_set_gui_width( m_videoOutput, s. width() ); - ::null_set_gui_height( m_videoOutput, s. height() ); - } + if ( s. width ( ) && s. height ( ) ) + m_videoSize = s; } @@ -423,5 +417,5 @@ void Lib::showVideoFullScreen( bool fullScreen ) { assert( m_initialized ); - ::null_set_fullscreen( m_videoOutput, fullScreen ); + #warning use xine } @@ -429,5 +423,6 @@ bool Lib::isVideoFullScreen() const { assert( m_initialized ); - return ::null_is_fullscreen( m_videoOutput ); + #warning use xine + return false; } @@ -435,11 +430,11 @@ void Lib::setScaling( bool scale ) { assert( m_initialized ); - ::null_set_scaling( m_videoOutput, scale ); + xine_set_param( m_stream, XINE_PARAM_VO_ASPECT_RATIO, + scale ? XINE_VO_ASPECT_AUTO : XINE_VO_ASPECT_SQUARE ); } void Lib::setGamma( int value ) { assert( m_initialized ); - - ::null_set_videoGamma( m_videoOutput, value ); + xine_set_param( m_stream, XINE_PARAM_VO_BRIGHTNESS, value ); } @@ -447,5 +442,6 @@ bool Lib::isScaling() const { assert( m_initialized ); - return ::null_is_scaling( m_videoOutput ); + int aratio = xine_get_param( m_stream, XINE_PARAM_VO_ASPECT_RATIO ); + return aratio == XINE_VO_ASPECT_AUTO; } @@ -459,12 +455,36 @@ void Lib::xine_display_frame( void* user_data, uint8_t *frame, } -void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { - assert( m_initialized ); +void Lib::xine_vo_scale_cb( void *user_data, int video_with, int video_height, + double video_pixel_aspect, + int *dest_x, int *dest_y, int *dest_width, + int *dest_height, double *dest_pixel_aspect, + int *win_x, int *win_y ) { + QSize size = ((Lib*)user_data)->m_videoSize; + if (!size.isValid()) + return; - if ( !m_video ) { + *dest_x = 0; + *dest_y = 0; + *dest_width = size.width(); + *dest_height = size.height(); + *win_x = 0; + *win_y = 0; +} + +void Lib::xine_dest_cb( void* user_data, int, int, double, + int *dest_width, int* dest_height, double* ) { + QSize size = ((Lib*)user_data)->m_videoSize; + if ( !size.isValid() ) return; + + *dest_width = size.width(); + *dest_height = size.height(); } -// assert( m_wid ); +void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { + assert( m_initialized ); + + if ( !m_video ) + return; if (m_wid) m_wid-> setVideoFrame ( frame, width, height, bytes ); |