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
@@ -1,234 +1,239 @@
1 /* 1 /*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 LJP <> 5 Copyright (c) 2002 LJP <>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
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 <stdio.h> 34#include <stdio.h>
35#include <stdlib.h> 35#include <stdlib.h>
36#include <qimage.h> 36#include <qimage.h>
37#include <qtextstream.h> 37#include <qtextstream.h>
38#include <qpe/resource.h> 38#include <qpe/resource.h>
39 39
40#include <qfile.h> 40#include <qfile.h>
41#include <qdir.h> 41#include <qdir.h>
42 42
43#include <qgfx_qws.h> 43#include <qgfx_qws.h>
44#include <qdirectpainter_qws.h> 44#include <qdirectpainter_qws.h>
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 ) {
93 initialize(); 95 initialize();
94 m_initialized = true; 96 m_initialized = true;
95 } 97 }
96 else 98 else
97 start(); 99 start();
98} 100}
99 101
100void Lib::run() 102void Lib::run()
101{ 103{
102 qDebug( "Lib::run() started" ); 104 qDebug( "Lib::run() started" );
103 initialize(); 105 initialize();
104 m_initialized = true; 106 m_initialized = true;
105 qDebug( "Lib::run() finished" ); 107 qDebug( "Lib::run() finished" );
106} 108}
107 109
108void Lib::initialize() 110void Lib::initialize()
109{ 111{
110 m_duringInitialization = true; 112 m_duringInitialization = true;
111 m_xine = xine_new( ); 113 m_xine = xine_new( );
112 114
113 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 115 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
114 xine_config_load( m_xine, QFile::encodeName( configPath ) ); 116 xine_config_load( m_xine, QFile::encodeName( configPath ) );
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
163 if ( s. width ( ) && s. height ( ) ) { 168 if ( s. width ( ) && s. height ( ) ) {
164 ::null_set_gui_width( m_videoOutput, s. width() ); 169 ::null_set_gui_width( m_videoOutput, s. width() );
165 ::null_set_gui_height( m_videoOutput, s. height() ); 170 ::null_set_gui_height( m_videoOutput, s. height() );
166 } 171 }
167} 172}
168 173
169int Lib::majorVersion() { 174int Lib::majorVersion() {
170 int major, minor, sub; 175 int major, minor, sub;
171 xine_get_version ( &major, &minor, &sub ); 176 xine_get_version ( &major, &minor, &sub );
172 return major; 177 return major;
173} 178}
174 179
175int Lib::minorVersion() { 180int Lib::minorVersion() {
176 int major, minor, sub; 181 int major, minor, sub;
177 xine_get_version ( &major, &minor, &sub ); 182 xine_get_version ( &major, &minor, &sub );
178 return minor; 183 return minor;
179} 184}
180 185
181int Lib::subVersion() { 186int Lib::subVersion() {
182 int major, minor, sub; 187 int major, minor, sub;
183 xine_get_version ( &major, &minor, &sub ); 188 xine_get_version ( &major, &minor, &sub );
184 return sub; 189 return sub;
185} 190}
186 191
187int Lib::play( const QString& fileName, int startPos, int start_time ) { 192int Lib::play( const QString& fileName, int startPos, int start_time ) {
188 assert( m_initialized ); 193 assert( m_initialized );
189 194
190 QString str = fileName.stripWhiteSpace(); 195 QString str = fileName.stripWhiteSpace();
191 if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { 196 if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) {
192 return 0; 197 return 0;
193 } 198 }
194 return xine_play( m_stream, startPos, start_time); 199 return xine_play( m_stream, startPos, start_time);
195} 200}
196 201
197void Lib::stop() { 202void Lib::stop() {
198 assert( m_initialized ); 203 assert( m_initialized );
199 204
200 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); 205 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
201 xine_stop( m_stream ); 206 xine_stop( m_stream );
202} 207}
203 208
204void Lib::pause( bool toggle ) { 209void Lib::pause( bool toggle ) {
205 assert( m_initialized ); 210 assert( m_initialized );
206 211
207 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); 212 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL );
208} 213}
209 214
210int Lib::speed() const { 215int Lib::speed() const {
211 assert( m_initialized ); 216 assert( m_initialized );
212 217
213 return xine_get_param ( m_stream, XINE_PARAM_SPEED ); 218 return xine_get_param ( m_stream, XINE_PARAM_SPEED );
214} 219}
215 220
216void Lib::setSpeed( int speed ) { 221void Lib::setSpeed( int speed ) {
217 assert( m_initialized ); 222 assert( m_initialized );
218 223
219 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); 224 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed );
220} 225}
221 226
222int Lib::status() const { 227int Lib::status() const {
223 assert( m_initialized ); 228 assert( m_initialized );
224 229
225 return xine_get_status( m_stream ); 230 return xine_get_status( m_stream );
226} 231}
227 232
228int Lib::currentPosition() const { 233int Lib::currentPosition() const {
229 assert( m_initialized ); 234 assert( m_initialized );
230 235
231 int pos, time, length; 236 int pos, time, length;
232 xine_get_pos_length( m_stream, &pos, &time, &length ); 237 xine_get_pos_length( m_stream, &pos, &time, &length );
233 return pos; 238 return pos;
234} 239}
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
@@ -1,139 +1,140 @@
1 /* 1 /*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 LJP <> 5 Copyright (c) 2002 LJP <>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
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;
68 69
69 int depth, bpp, bytes_per_pixel; 70 int depth, bpp, bytes_per_pixel;
70 int yuv2rgb_mode; 71 int yuv2rgb_mode;
71 int yuv2rgb_swap; 72 int yuv2rgb_swap;
72 int yuv2rgb_gamma; 73 int yuv2rgb_gamma;
73 uint8_t *yuv2rgb_cmap; 74 uint8_t *yuv2rgb_cmap;
74 yuv2rgb_factory_t *yuv2rgb_factory; 75 yuv2rgb_factory_t *yuv2rgb_factory;
75 76
76 vo_overlay_t *overlay; 77 vo_overlay_t *overlay;
77 vo_scale_t sc; 78 vo_scale_t sc;
78 79
79 int gui_width; 80 int gui_width;
80 int gui_height; 81 int gui_height;
81 int gui_changed; 82 int gui_changed;
82 83
83 double display_ratio; 84 double display_ratio;
84 void* caller; 85 void* caller;
85 display_xine_frame_t frameDis; 86 display_xine_frame_t frameDis;
86}; 87};
87 88
88typedef struct opie_frame_s opie_frame_t; 89typedef struct opie_frame_s opie_frame_t;
89struct opie_frame_s { 90struct opie_frame_s {
90 vo_frame_t frame; 91 vo_frame_t frame;
91 92
92 int format; 93 int format;
93 int flags; 94 int flags;
94 95
95 vo_scale_t sc; 96 vo_scale_t sc;
96 97
97 uint8_t *chunk[3]; 98 uint8_t *chunk[3];
98 99
99 uint8_t *data; /* rgb */ 100 uint8_t *data; /* rgb */
100 int bytes_per_line; 101 int bytes_per_line;
101 102
102 yuv2rgb_t *yuv2rgb; 103 yuv2rgb_t *yuv2rgb;
103 uint8_t *rgb_dst; 104 uint8_t *rgb_dst;
104 int yuv_stride; 105 int yuv_stride;
105 int stripe_height, stripe_inc; 106 int stripe_height, stripe_inc;
106 107
107 null_driver_t *output; 108 null_driver_t *output;
108}; 109};
109 110
110static uint32_t null_get_capabilities( vo_driver_t *self ){ 111static uint32_t null_get_capabilities( vo_driver_t *self ){
111 null_driver_t* this = (null_driver_t*)self; 112 null_driver_t* this = (null_driver_t*)self;
112 return this->m_capabilities; 113 return this->m_capabilities;
113} 114}
114 115
115static void null_frame_copy (vo_frame_t *vo_img, uint8_t **src) { 116static void null_frame_copy (vo_frame_t *vo_img, uint8_t **src) {
116 opie_frame_t *frame = (opie_frame_t *) vo_img ; 117 opie_frame_t *frame = (opie_frame_t *) vo_img ;
117 118
118 if (!frame->output->m_show_video) { 119 if (!frame->output->m_show_video) {
119 /* printf("nullvideo: no video\n"); */ 120 /* printf("nullvideo: no video\n"); */
120 return; 121 return;
121 } 122 }
122 123
123 if (frame->format == XINE_IMGFMT_YV12) { 124 if (frame->format == XINE_IMGFMT_YV12) {
124 frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, 125 frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst,
125 src[0], src[1], src[2]); 126 src[0], src[1], src[2]);
126 } else { 127 } else {
127 128
128 frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, 129 frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst,
129 src[0]); 130 src[0]);
130 } 131 }
131 132
132 frame->rgb_dst += frame->stripe_inc; 133 frame->rgb_dst += frame->stripe_inc;
133} 134}
134 135
135static void null_frame_field (vo_frame_t *vo_img, int which_field) { 136static void null_frame_field (vo_frame_t *vo_img, int which_field) {
136 137
137 opie_frame_t *frame = (opie_frame_t *) vo_img ; 138 opie_frame_t *frame = (opie_frame_t *) vo_img ;
138 139
139 switch (which_field) { 140 switch (which_field) {
@@ -519,96 +520,116 @@ int null_is_showing_video( xine_vo_driver_t* self ){
519 null_driver_t* this = (null_driver_t*)self->driver; 520 null_driver_t* this = (null_driver_t*)self->driver;
520 return this->m_show_video; 521 return this->m_show_video;
521} 522}
522void null_set_show_video( xine_vo_driver_t* self, int show ) { 523void null_set_show_video( xine_vo_driver_t* self, int show ) {
523 ((null_driver_t*)self->driver)->m_show_video = show; 524 ((null_driver_t*)self->driver)->m_show_video = show;
524} 525}
525 526
526int null_is_fullscreen( xine_vo_driver_t* self ){ 527int null_is_fullscreen( xine_vo_driver_t* self ){
527 return ((null_driver_t*)self->driver)->m_video_fullscreen; 528 return ((null_driver_t*)self->driver)->m_video_fullscreen;
528} 529}
529void null_set_fullscreen( xine_vo_driver_t* self, int screen ){ 530void null_set_fullscreen( xine_vo_driver_t* self, int screen ){
530 ((null_driver_t*)self->driver)->m_video_fullscreen = screen; 531 ((null_driver_t*)self->driver)->m_video_fullscreen = screen;
531} 532}
532int null_is_scaling( xine_vo_driver_t* self ){ 533int null_is_scaling( xine_vo_driver_t* self ){
533 return ((null_driver_t*)self->driver)->m_is_scaling; 534 return ((null_driver_t*)self->driver)->m_is_scaling;
534} 535}
535 536
536void null_set_videoGamma( xine_vo_driver_t* self , int value ) { 537void null_set_videoGamma( xine_vo_driver_t* self , int value ) {
537 ((null_driver_t*) self->driver) ->yuv2rgb_gamma = value; 538 ((null_driver_t*) self->driver) ->yuv2rgb_gamma = value;
538 ((null_driver_t*) self->driver) ->yuv2rgb_factory->set_gamma( ((null_driver_t*) self->driver) ->yuv2rgb_factory, value ); 539 ((null_driver_t*) self->driver) ->yuv2rgb_factory->set_gamma( ((null_driver_t*) self->driver) ->yuv2rgb_factory, value );
539} 540}
540 541
541void null_set_scaling( xine_vo_driver_t* self, int scale ) { 542void null_set_scaling( xine_vo_driver_t* self, int scale ) {
542 ((null_driver_t*)self->driver)->m_is_scaling = scale; 543 ((null_driver_t*)self->driver)->m_is_scaling = scale;
543} 544}
544 545
545void null_set_gui_width( xine_vo_driver_t* self, int width ) { 546void null_set_gui_width( xine_vo_driver_t* self, int width ) {
546 ((null_driver_t*)self->driver)->gui_width = width; 547 ((null_driver_t*)self->driver)->gui_width = width;
547} 548}
548void null_set_gui_height( xine_vo_driver_t* self, int height ) { 549void null_set_gui_height( xine_vo_driver_t* self, int height ) {
549 ((null_driver_t*)self->driver)->gui_height = height; 550 ((null_driver_t*)self->driver)->gui_height = height;
550} 551}
551 552
552 553
553void null_set_mode( xine_vo_driver_t* self, int depth, int rgb ) { 554void null_set_mode( xine_vo_driver_t* self, int depth, int rgb ) {
554 null_driver_t* this = (null_driver_t*)self->driver; 555 null_driver_t* this = (null_driver_t*)self->driver;
555 556
556 this->bytes_per_pixel = (depth + 7 ) / 8; 557 this->bytes_per_pixel = (depth + 7 ) / 8;
557 this->bpp = this->bytes_per_pixel * 8; 558 this->bpp = this->bytes_per_pixel * 8;
558 this->depth = depth; 559 this->depth = depth;
559 printf("depth %d %d\n", depth, this->bpp); 560 printf("depth %d %d\n", depth, this->bpp);
560 printf("pixeltype %d\n", rgb ); 561 printf("pixeltype %d\n", rgb );
561 switch ( this->depth ) { 562 switch ( this->depth ) {
562 case 32: 563 case 32:
563 if( rgb == 0 ) 564 if( rgb == 0 )
564 this->yuv2rgb_mode = MODE_32_RGB; 565 this->yuv2rgb_mode = MODE_32_RGB;
565 else 566 else
566 this->yuv2rgb_mode = MODE_32_BGR; 567 this->yuv2rgb_mode = MODE_32_BGR;
567 case 24: 568 case 24:
568 if( this->bpp == 32 ) { 569 if( this->bpp == 32 ) {
569 if( rgb == 0 ) { 570 if( rgb == 0 ) {
570 this->yuv2rgb_mode = MODE_32_RGB; 571 this->yuv2rgb_mode = MODE_32_RGB;
571 } else { 572 } else {
572 this->yuv2rgb_mode = MODE_32_BGR; 573 this->yuv2rgb_mode = MODE_32_BGR;
573 } 574 }
574 }else{ 575 }else{
575 if( rgb == 0 ) 576 if( rgb == 0 )
576 this->yuv2rgb_mode = MODE_24_RGB; 577 this->yuv2rgb_mode = MODE_24_RGB;
577 else 578 else
578 this->yuv2rgb_mode = MODE_24_BGR; 579 this->yuv2rgb_mode = MODE_24_BGR;
579 }; 580 };
580 break; 581 break;
581 case 16: 582 case 16:
582 if( rgb == 0 ) { 583 if( rgb == 0 ) {
583 this->yuv2rgb_mode = MODE_16_RGB; 584 this->yuv2rgb_mode = MODE_16_RGB;
584 } else { 585 } else {
585 this->yuv2rgb_mode = MODE_16_BGR; 586 this->yuv2rgb_mode = MODE_16_BGR;
586 } 587 }
587 break; 588 break;
588 case 15: 589 case 15:
589 if( rgb == 0 ) { 590 if( rgb == 0 ) {
590 this->yuv2rgb_mode = MODE_15_RGB; 591 this->yuv2rgb_mode = MODE_15_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