summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp5
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c21
2 files changed, 26 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 8896cfe..d04af08 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -45,48 +45,50 @@
45 45
46#include <assert.h> 46#include <assert.h>
47 47
48#include "xinevideowidget.h" 48#include "xinevideowidget.h"
49#include "frame.h" 49#include "frame.h"
50#include "lib.h" 50#include "lib.h"
51 51
52 52
53typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, 53typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
54 int width, int height,int bytes ); 54 int width, int height,int bytes );
55 55
56extern "C" { 56extern "C" {
57 xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); 57 xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * );
58 int null_is_showing_video( const xine_vo_driver_t* self ); 58 int null_is_showing_video( const xine_vo_driver_t* self );
59 void null_set_show_video( const xine_vo_driver_t* self, int show ); 59 void null_set_show_video( const xine_vo_driver_t* self, int show );
60 int null_is_fullscreen( const xine_vo_driver_t* self ); 60 int null_is_fullscreen( const xine_vo_driver_t* self );
61 void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); 61 void null_set_fullscreen( const xine_vo_driver_t* self, int screen );
62 int null_is_scaling( const xine_vo_driver_t* self ); 62 int null_is_scaling( const xine_vo_driver_t* self );
63 void null_set_scaling( const xine_vo_driver_t* self, int scale ); 63 void null_set_scaling( const xine_vo_driver_t* self, int scale );
64 void null_set_gui_width( const xine_vo_driver_t* self, int width ); 64 void null_set_gui_width( const xine_vo_driver_t* self, int width );
65 void null_set_gui_height( const xine_vo_driver_t* self, int height ); 65 void null_set_gui_height( const xine_vo_driver_t* self, int height );
66 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); 66 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb );
67 void null_set_videoGamma( const xine_vo_driver_t* self , int value ); 67 void null_set_videoGamma( const xine_vo_driver_t* self , int value );
68 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); 68 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data );
69
70 void null_preload_decoders( xine_stream_t *stream );
69} 71}
70 72
71using namespace XINE; 73using namespace XINE;
72 74
73Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) 75Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
74{ 76{
75 m_initialized = false; 77 m_initialized = false;
76 m_duringInitialization = false; 78 m_duringInitialization = false;
77 m_video = false; 79 m_video = false;
78 m_wid = widget; 80 m_wid = widget;
79 printf("Lib"); 81 printf("Lib");
80 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 82 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
81 // get the configuration 83 // get the configuration
82 84
83 // not really OO, should be an extra class, later 85 // not really OO, should be an extra class, later
84 if ( !QFile::exists(configPath) ) { 86 if ( !QFile::exists(configPath) ) {
85 QFile f(configPath); 87 QFile f(configPath);
86 f.open(IO_WriteOnly); 88 f.open(IO_WriteOnly);
87 QTextStream ts( &f ); 89 QTextStream ts( &f );
88 ts << "misc.memcpy_method:glibc\n"; 90 ts << "misc.memcpy_method:glibc\n";
89 f.close(); 91 f.close();
90 } 92 }
91 93
92 if ( initMode == InitializeImmediately ) { 94 if ( initMode == InitializeImmediately ) {
@@ -115,48 +117,51 @@ void Lib::initialize()
115 117
116 xine_init( m_xine ); 118 xine_init( m_xine );
117 119
118 // allocate oss for sound 120 // allocate oss for sound
119 // and fb for framebuffer 121 // and fb for framebuffer
120 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); 122 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL );
121 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); 123 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this );
122 124
123 125
124//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); 126//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL);
125 127
126 128
127// null_display_handler( m_videoOutput, xine_display_frame, this ); 129// null_display_handler( m_videoOutput, xine_display_frame, this );
128 130
129 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); 131 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
130 132
131 if (m_wid != 0 ) { 133 if (m_wid != 0 ) {
132 printf( "!0\n" ); 134 printf( "!0\n" );
133 setWidget( m_wid ); 135 setWidget( m_wid );
134 } 136 }
135 137
136 m_queue = xine_event_new_queue (m_stream); 138 m_queue = xine_event_new_queue (m_stream);
137 139
138 xine_event_create_listener_thread (m_queue, xine_event_handler, this); 140 xine_event_create_listener_thread (m_queue, xine_event_handler, this);
141
142 ::null_preload_decoders( m_stream );
143
139 m_duringInitialization = false; 144 m_duringInitialization = false;
140} 145}
141 146
142Lib::~Lib() { 147Lib::~Lib() {
143 assert( isRunning() == false ); 148 assert( isRunning() == false );
144 assert( m_initialized ); 149 assert( m_initialized );
145 150
146// free( m_config ); 151// free( m_config );
147 152
148 xine_close( m_stream ); 153 xine_close( m_stream );
149 154
150 xine_event_dispose_queue( m_queue ); 155 xine_event_dispose_queue( m_queue );
151 156
152 xine_dispose( m_stream ); 157 xine_dispose( m_stream );
153 158
154 xine_exit( m_xine ); 159 xine_exit( m_xine );
155 /* FIXME either free or delete but valgrind bitches against both */ 160 /* FIXME either free or delete but valgrind bitches against both */
156 //free( m_videoOutput ); 161 //free( m_videoOutput );
157 //delete m_audioOutput; 162 //delete m_audioOutput;
158} 163}
159 164
160void Lib::resize ( const QSize &s ) { 165void Lib::resize ( const QSize &s ) {
161 assert( m_initialized || m_duringInitialization ); 166 assert( m_initialized || m_duringInitialization );
162 167
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c
index c988854..e2eb663 100644
--- a/noncore/multimedia/opieplayer2/nullvideo.c
+++ b/noncore/multimedia/opieplayer2/nullvideo.c
@@ -20,48 +20,49 @@
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
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 <stdlib.h> 34#include <stdlib.h>
35#include <stdio.h> 35#include <stdio.h>
36 36
37#include <math.h> 37#include <math.h>
38 38
39#include <xine.h> 39#include <xine.h>
40#include <xine/video_out.h> 40#include <xine/video_out.h>
41#include <xine/xine_internal.h> 41#include <xine/xine_internal.h>
42#include <xine/xineutils.h> 42#include <xine/xineutils.h>
43#include <xine/vo_scale.h> 43#include <xine/vo_scale.h>
44#include <xine/buffer.h>
44 45
45#include <pthread.h> 46#include <pthread.h>
46#include "alphablend.h" 47#include "alphablend.h"
47#include "yuv2rgb.h" 48#include "yuv2rgb.h"
48 49
49#define printf(x,...) 50#define printf(x,...)
50 51
51/* 52/*
52#define LOG 53#define LOG
53*/ 54*/
54 55
55/* the caller for our event draw handler */ 56/* the caller for our event draw handler */
56typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, 57typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
57 int width, int height,int bytes ); 58 int width, int height,int bytes );
58 59
59typedef struct null_driver_s null_driver_t; 60typedef struct null_driver_s null_driver_t;
60 61
61struct null_driver_s { 62struct null_driver_s {
62 vo_driver_t vo_driver; 63 vo_driver_t vo_driver;
63 64
64 uint32_t m_capabilities; 65 uint32_t m_capabilities;
65 int m_show_video; 66 int m_show_video;
66 int m_video_fullscreen; 67 int m_video_fullscreen;
67 int m_is_scaling; 68 int m_is_scaling;
@@ -591,24 +592,44 @@ void null_set_mode( xine_vo_driver_t* self, int depth, int rgb ) {
591 } else { 592 } else {
592 this->yuv2rgb_mode = MODE_15_BGR; 593 this->yuv2rgb_mode = MODE_15_BGR;
593 } 594 }
594 break; 595 break;
595 case 8: 596 case 8:
596 if( rgb == 0 ) { 597 if( rgb == 0 ) {
597 this->yuv2rgb_mode = MODE_8_RGB; 598 this->yuv2rgb_mode = MODE_8_RGB;
598 } else { 599 } else {
599 this->yuv2rgb_mode = MODE_8_BGR; 600 this->yuv2rgb_mode = MODE_8_BGR;
600 } 601 }
601 break; 602 break;
602 }; 603 };
603 //free(this->yuv2rgb_factory ); 604 //free(this->yuv2rgb_factory );
604 // this->yuv2rgb_factory = yuv2rgb_factory_init (this->yuv2rgb_mode, this->yuv2rgb_swap, 605 // this->yuv2rgb_factory = yuv2rgb_factory_init (this->yuv2rgb_mode, this->yuv2rgb_swap,
605 // this->yuv2rgb_cmap); 606 // this->yuv2rgb_cmap);
606}; 607};
607 608
608void null_display_handler( xine_vo_driver_t* self, display_xine_frame_t t, 609void null_display_handler( xine_vo_driver_t* self, display_xine_frame_t t,
609 void* user_data ) { 610 void* user_data ) {
610 null_driver_t* this = (null_driver_t*) self->driver; 611 null_driver_t* this = (null_driver_t*) self->driver;
611 this->caller = user_data; 612 this->caller = user_data;
612 this->frameDis = t; 613 this->frameDis = t;
613} 614}
614 615
616void null_preload_decoders( xine_stream_t *stream )
617{
618 static const uint32_t preloadedAudioDecoders[] = { BUF_AUDIO_MPEG, BUF_AUDIO_VORBIS };
619 static const uint8_t preloadedAudioDecoderCount = sizeof( preloadedAudioDecoders ) / sizeof( preloadedAudioDecoders[ 0 ] );
620 static const uint32_t preloadedVideoDecoders[] = { BUF_VIDEO_MPEG, BUF_VIDEO_MPEG4, BUF_VIDEO_DIVX5 };
621 static const uint8_t preloadedVideoDecoderCount = sizeof( preloadedVideoDecoders ) / sizeof( preloadedVideoDecoders[ 0 ] );
622
623 uint8_t i;
624
625 for ( i = 0; i < preloadedAudioDecoderCount; ++i ) {
626 audio_decoder_t *decoder = get_audio_decoder( stream, ( preloadedAudioDecoders[ i ] >> 16 ) & 0xff );
627 free_audio_decoder( stream, decoder );
628 }
629
630 for ( i = 0; i < preloadedVideoDecoderCount; ++i ) {
631 video_decoder_t *decoder = get_video_decoder( stream, ( preloadedVideoDecoders[ i ] >> 16 ) & 0xff );
632 free_video_decoder( stream, decoder );
633 }
634}
635