author | zecke <zecke> | 2005-04-17 13:56:34 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-04-17 13:56:34 (UTC) |
commit | 3d5e5c098ccb686588380bc1f220beafbc5a6d76 (patch) (unidiff) | |
tree | 92fad8a98ea341ec290dc7f9fca7759470b795f6 /noncore/multimedia/opieplayer2/lib.cpp | |
parent | 49335d66d8e96b1fc86ecfe95cd343c8960126bc (diff) | |
download | opie-3d5e5c098ccb686588380bc1f220beafbc5a6d76.zip opie-3d5e5c098ccb686588380bc1f220beafbc5a6d76.tar.gz opie-3d5e5c098ccb686588380bc1f220beafbc5a6d76.tar.bz2 |
Opie Player2 XINE update:
-update xine code alphablend, yuv2rgb to be up to date
-XINELib:
-use the XINE infrastructure to change the gui width/height
-use the XINE infrastructure to change the brightness
-Update the NULL Video Driver:
-make use of frame_dest_cb and and dest_size_cb (callback)
to update the size of the gui
-use alphablend
-merge the video_out_fb xine driver
To Alwin: your testvideo now lockups op2. with valgrind I see
it has to do with the yuv2rgb conversion methods
Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (ignore 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 | |||
@@ -48,24 +48,19 @@ _;:, .> :=|. This program is free software; you can | |||
48 | #include <unistd.h> | 48 | #include <unistd.h> |
49 | 49 | ||
50 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, | 50 | typedef 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 ); |
52 | typedef void (*vo_scale_cb) (void*, int, int, double, | ||
53 | int*, int*, int*, int*, double*, int*, int* ); | ||
54 | typedef void (*dest_size_cb) (void*, int, int, double, int*, int*, double*); | ||
55 | |||
52 | 56 | ||
53 | extern "C" { | 57 | extern "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 | ||
70 | using namespace XINE; | 65 | using namespace XINE; |
71 | 66 | ||
@@ -126,9 +121,12 @@ void Lib::initialize() | |||
126 | 121 | ||
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); |
134 | 132 | ||
@@ -138,10 +136,8 @@ void Lib::initialize() | |||
138 | 136 | ||
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 | ||
147 | Lib::~Lib() { | 143 | Lib::~Lib() { |
@@ -164,12 +160,10 @@ Lib::~Lib() { | |||
164 | 160 | ||
165 | void Lib::resize ( const QSize &s ) { | 161 | void 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 | ||
174 | int Lib::majorVersion() { | 168 | int Lib::majorVersion() { |
175 | int major, minor, sub; | 169 | int major, minor, sub; |
@@ -421,33 +415,35 @@ bool Lib::isShowingVideo() const { | |||
421 | 415 | ||
422 | void Lib::showVideoFullScreen( bool fullScreen ) { | 416 | void 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 | ||
428 | bool Lib::isVideoFullScreen() const { | 422 | bool 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 | ||
434 | void Lib::setScaling( bool scale ) { | 429 | void 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 | ||
440 | void Lib::setGamma( int value ) { | 436 | void 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 | ||
446 | bool Lib::isScaling() const { | 441 | bool 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 | ||
452 | void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { | 448 | void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { |
453 | ( (Lib*)user_data)->handleXineEvent( t ); | 449 | ( (Lib*)user_data)->handleXineEvent( t ); |
@@ -457,15 +453,39 @@ void Lib::xine_display_frame( void* user_data, uint8_t *frame, | |||
457 | int width, int height, int bytes ) { | 453 | int width, int height, int bytes ) { |
458 | ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); | 454 | ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); |
459 | } | 455 | } |
460 | 456 | ||
457 | void Lib::xine_vo_scale_cb( void *user_data, int video_with, int video_height, | ||
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; | ||
465 | |||
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 | |||
474 | void 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() ) | ||
478 | return; | ||
479 | |||
480 | *dest_width = size.width(); | ||
481 | *dest_height = size.height(); | ||
482 | } | ||
483 | |||
461 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { | 484 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { |
462 | assert( m_initialized ); | 485 | assert( m_initialized ); |
463 | 486 | ||
464 | if ( !m_video ) { | 487 | if ( !m_video ) |
465 | return; | 488 | return; |
466 | } | ||
467 | |||
468 | // assert( m_wid ); | ||
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 | } |