summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-14 17:00:16 (UTC)
committer simon <simon>2002-12-14 17:00:16 (UTC)
commitbbdeff25bd0cc5ff59d52fd8bf25cdfbeac8f251 (patch) (unidiff)
tree6357471675db58fbf6d1d9d168618635c2e5cbf6
parent354b07f236773c0dbb642972a7dffb598ea1af2f (diff)
downloadopie-bbdeff25bd0cc5ff59d52fd8bf25cdfbeac8f251.zip
opie-bbdeff25bd0cc5ff59d52fd8bf25cdfbeac8f251.tar.gz
opie-bbdeff25bd0cc5ff59d52fd8bf25cdfbeac8f251.tar.bz2
- skip the free_(audio|video)_decoder calls. today's libvorbis doesn't
like it
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c
index e2eb663..a49f9d3 100644
--- a/noncore/multimedia/opieplayer2/nullvideo.c
+++ b/noncore/multimedia/opieplayer2/nullvideo.c
@@ -1,635 +1,635 @@
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#include <xine/buffer.h>
45 45
46#include <pthread.h> 46#include <pthread.h>
47#include "alphablend.h" 47#include "alphablend.h"
48#include "yuv2rgb.h" 48#include "yuv2rgb.h"
49 49
50#define printf(x,...) 50#define printf(x,...)
51 51
52/* 52/*
53#define LOG 53#define LOG
54*/ 54*/
55 55
56/* the caller for our event draw handler */ 56/* the caller for our event draw handler */
57typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, 57typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
58 int width, int height,int bytes ); 58 int width, int height,int bytes );
59 59
60typedef struct null_driver_s null_driver_t; 60typedef struct null_driver_s null_driver_t;
61 61
62struct null_driver_s { 62struct null_driver_s {
63 vo_driver_t vo_driver; 63 vo_driver_t vo_driver;
64 64
65 uint32_t m_capabilities; 65 uint32_t m_capabilities;
66 int m_show_video; 66 int m_show_video;
67 int m_video_fullscreen; 67 int m_video_fullscreen;
68 int m_is_scaling; 68 int m_is_scaling;
69 69
70 int depth, bpp, bytes_per_pixel; 70 int depth, bpp, bytes_per_pixel;
71 int yuv2rgb_mode; 71 int yuv2rgb_mode;
72 int yuv2rgb_swap; 72 int yuv2rgb_swap;
73 int yuv2rgb_gamma; 73 int yuv2rgb_gamma;
74 uint8_t *yuv2rgb_cmap; 74 uint8_t *yuv2rgb_cmap;
75 yuv2rgb_factory_t *yuv2rgb_factory; 75 yuv2rgb_factory_t *yuv2rgb_factory;
76 76
77 vo_overlay_t *overlay; 77 vo_overlay_t *overlay;
78 vo_scale_t sc; 78 vo_scale_t sc;
79 79
80 int gui_width; 80 int gui_width;
81 int gui_height; 81 int gui_height;
82 int gui_changed; 82 int gui_changed;
83 83
84 double display_ratio; 84 double display_ratio;
85 void* caller; 85 void* caller;
86 display_xine_frame_t frameDis; 86 display_xine_frame_t frameDis;
87}; 87};
88 88
89typedef struct opie_frame_s opie_frame_t; 89typedef struct opie_frame_s opie_frame_t;
90struct opie_frame_s { 90struct opie_frame_s {
91 vo_frame_t frame; 91 vo_frame_t frame;
92 92
93 int format; 93 int format;
94 int flags; 94 int flags;
95 95
96 vo_scale_t sc; 96 vo_scale_t sc;
97 97
98 uint8_t *chunk[3]; 98 uint8_t *chunk[3];
99 99
100 uint8_t *data; /* rgb */ 100 uint8_t *data; /* rgb */
101 int bytes_per_line; 101 int bytes_per_line;
102 102
103 yuv2rgb_t *yuv2rgb; 103 yuv2rgb_t *yuv2rgb;
104 uint8_t *rgb_dst; 104 uint8_t *rgb_dst;
105 int yuv_stride; 105 int yuv_stride;
106 int stripe_height, stripe_inc; 106 int stripe_height, stripe_inc;
107 107
108 null_driver_t *output; 108 null_driver_t *output;
109}; 109};
110 110
111static uint32_t null_get_capabilities( vo_driver_t *self ){ 111static uint32_t null_get_capabilities( vo_driver_t *self ){
112 null_driver_t* this = (null_driver_t*)self; 112 null_driver_t* this = (null_driver_t*)self;
113 return this->m_capabilities; 113 return this->m_capabilities;
114} 114}
115 115
116static 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) {
117 opie_frame_t *frame = (opie_frame_t *) vo_img ; 117 opie_frame_t *frame = (opie_frame_t *) vo_img ;
118 118
119 if (!frame->output->m_show_video) { 119 if (!frame->output->m_show_video) {
120 /* printf("nullvideo: no video\n"); */ 120 /* printf("nullvideo: no video\n"); */
121 return; 121 return;
122 } 122 }
123 123
124 if (frame->format == XINE_IMGFMT_YV12) { 124 if (frame->format == XINE_IMGFMT_YV12) {
125 frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, 125 frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst,
126 src[0], src[1], src[2]); 126 src[0], src[1], src[2]);
127 } else { 127 } else {
128 128
129 frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, 129 frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst,
130 src[0]); 130 src[0]);
131 } 131 }
132 132
133 frame->rgb_dst += frame->stripe_inc; 133 frame->rgb_dst += frame->stripe_inc;
134} 134}
135 135
136static 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) {
137 137
138 opie_frame_t *frame = (opie_frame_t *) vo_img ; 138 opie_frame_t *frame = (opie_frame_t *) vo_img ;
139 139
140 switch (which_field) { 140 switch (which_field) {
141 case VO_TOP_FIELD: 141 case VO_TOP_FIELD:
142 frame->rgb_dst = (uint8_t *)frame->data; 142 frame->rgb_dst = (uint8_t *)frame->data;
143 frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; 143 frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line;
144 break; 144 break;
145 case VO_BOTTOM_FIELD: 145 case VO_BOTTOM_FIELD:
146 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; 146 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ;
147 frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; 147 frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line;
148 break; 148 break;
149 case VO_BOTH_FIELDS: 149 case VO_BOTH_FIELDS:
150 frame->rgb_dst = (uint8_t *)frame->data; 150 frame->rgb_dst = (uint8_t *)frame->data;
151 break; 151 break;
152 } 152 }
153} 153}
154 154
155 155
156/* take care of the frame*/ 156/* take care of the frame*/
157static void null_frame_dispose( vo_frame_t* vo_img){ 157static void null_frame_dispose( vo_frame_t* vo_img){
158 opie_frame_t* frame = (opie_frame_t*)vo_img; 158 opie_frame_t* frame = (opie_frame_t*)vo_img;
159 159
160 if (frame->data) 160 if (frame->data)
161 free( frame->data ); 161 free( frame->data );
162 free (frame); 162 free (frame);
163} 163}
164 164
165/* end take care of frames*/ 165/* end take care of frames*/
166 166
167static vo_frame_t* null_alloc_frame( vo_driver_t* self ){ 167static vo_frame_t* null_alloc_frame( vo_driver_t* self ){
168 168
169 null_driver_t* this = (null_driver_t*)self; 169 null_driver_t* this = (null_driver_t*)self;
170 opie_frame_t* frame; 170 opie_frame_t* frame;
171 171
172#ifdef LOG 172#ifdef LOG
173 fprintf (stderr, "nullvideo: alloc_frame\n"); 173 fprintf (stderr, "nullvideo: alloc_frame\n");
174#endif 174#endif
175 175
176 frame = (opie_frame_t*)malloc ( sizeof(opie_frame_t) ); 176 frame = (opie_frame_t*)malloc ( sizeof(opie_frame_t) );
177 177
178 memset( frame, 0, sizeof( opie_frame_t) ); 178 memset( frame, 0, sizeof( opie_frame_t) );
179 memcpy (&frame->sc, &this->sc, sizeof(vo_scale_t)); 179 memcpy (&frame->sc, &this->sc, sizeof(vo_scale_t));
180 180
181 pthread_mutex_init (&frame->frame.mutex, NULL); 181 pthread_mutex_init (&frame->frame.mutex, NULL);
182 182
183 frame->output = this; 183 frame->output = this;
184 184
185 /* initialize the frame*/ 185 /* initialize the frame*/
186 frame->frame.driver = self; 186 frame->frame.driver = self;
187 frame->frame.copy = null_frame_copy; 187 frame->frame.copy = null_frame_copy;
188 frame->frame.field = null_frame_field; 188 frame->frame.field = null_frame_field;
189 frame->frame.dispose = null_frame_dispose; 189 frame->frame.dispose = null_frame_dispose;
190 190
191 /* 191 /*
192 * colorspace converter for this frame 192 * colorspace converter for this frame
193 */ 193 */
194 frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory); 194 frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory);
195 195
196 return (vo_frame_t*) frame; 196 return (vo_frame_t*) frame;
197} 197}
198 198
199static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img, 199static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img,
200 uint32_t width, uint32_t height, 200 uint32_t width, uint32_t height,
201 int ratio_code, int format, int flags ){ 201 int ratio_code, int format, int flags ){
202 null_driver_t* this = (null_driver_t*) self; 202 null_driver_t* this = (null_driver_t*) self;
203 opie_frame_t* frame = (opie_frame_t*)img; 203 opie_frame_t* frame = (opie_frame_t*)img;
204 /* not needed now */ 204 /* not needed now */
205 205
206#ifdef LOG 206#ifdef LOG
207 fprintf (stderr, "nullvideo: update_frame_format\n"); 207 fprintf (stderr, "nullvideo: update_frame_format\n");
208#endif 208#endif
209 209
210 flags &= VO_BOTH_FIELDS; 210 flags &= VO_BOTH_FIELDS;
211 211
212 /* find out if we need to adapt this frame */ 212 /* find out if we need to adapt this frame */
213 213
214 if ((width != frame->sc.delivered_width) 214 if ((width != frame->sc.delivered_width)
215 || (height != frame->sc.delivered_height) 215 || (height != frame->sc.delivered_height)
216 || (ratio_code != frame->sc.delivered_ratio_code) 216 || (ratio_code != frame->sc.delivered_ratio_code)
217 || (flags != frame->flags) 217 || (flags != frame->flags)
218 || (format != frame->format) 218 || (format != frame->format)
219 || (this->sc.user_ratio != frame->sc.user_ratio) 219 || (this->sc.user_ratio != frame->sc.user_ratio)
220 || (this->gui_width != frame->sc.gui_width) 220 || (this->gui_width != frame->sc.gui_width)
221 || (this->gui_height != frame->sc.gui_height)) { 221 || (this->gui_height != frame->sc.gui_height)) {
222 222
223 frame->sc.delivered_width = width; 223 frame->sc.delivered_width = width;
224 frame->sc.delivered_height = height; 224 frame->sc.delivered_height = height;
225 frame->sc.delivered_ratio_code = ratio_code; 225 frame->sc.delivered_ratio_code = ratio_code;
226 frame->flags = flags; 226 frame->flags = flags;
227 frame->format = format; 227 frame->format = format;
228 frame->sc.user_ratio = this->sc.user_ratio; 228 frame->sc.user_ratio = this->sc.user_ratio;
229 frame->sc.gui_width = this->gui_width; 229 frame->sc.gui_width = this->gui_width;
230 frame->sc.gui_height = this->gui_height; 230 frame->sc.gui_height = this->gui_height;
231 frame->sc.gui_pixel_aspect = 1.0; 231 frame->sc.gui_pixel_aspect = 1.0;
232 232
233 vo_scale_compute_ideal_size ( &frame->sc ); 233 vo_scale_compute_ideal_size ( &frame->sc );
234 vo_scale_compute_output_size( &frame->sc ); 234 vo_scale_compute_output_size( &frame->sc );
235 235
236#ifdef LOG 236#ifdef LOG
237 fprintf (stderr, "nullvideo: gui %dx%d delivered %dx%d output %dx%d\n", 237 fprintf (stderr, "nullvideo: gui %dx%d delivered %dx%d output %dx%d\n",
238 frame->sc.gui_width, frame->sc.gui_height, 238 frame->sc.gui_width, frame->sc.gui_height,
239 frame->sc.delivered_width, frame->sc.delivered_height, 239 frame->sc.delivered_width, frame->sc.delivered_height,
240 frame->sc.output_width, frame->sc.output_height); 240 frame->sc.output_width, frame->sc.output_height);
241#endif 241#endif
242 242
243 /* 243 /*
244 * (re-) allocate 244 * (re-) allocate
245 */ 245 */
246 if( frame->data ) { 246 if( frame->data ) {
247 if( frame->chunk[0] ){ 247 if( frame->chunk[0] ){
248 free( frame->chunk[0] ); 248 free( frame->chunk[0] );
249 frame->chunk[0] = NULL; 249 frame->chunk[0] = NULL;
250 } 250 }
251 if( frame->chunk[1] ){ 251 if( frame->chunk[1] ){
252 free ( frame->chunk[1] ); 252 free ( frame->chunk[1] );
253 frame->chunk[1] = NULL; 253 frame->chunk[1] = NULL;
254 } 254 }
255 if( frame->chunk[2] ){ 255 if( frame->chunk[2] ){
256 free ( frame->chunk[2] ); 256 free ( frame->chunk[2] );
257 frame->chunk[2] = NULL; 257 frame->chunk[2] = NULL;
258 } 258 }
259 free ( frame->data ); 259 free ( frame->data );
260 } 260 }
261 261
262 frame->data = xine_xmalloc (frame->sc.output_width 262 frame->data = xine_xmalloc (frame->sc.output_width
263 * frame->sc.output_height 263 * frame->sc.output_height
264 * this->bytes_per_pixel ); 264 * this->bytes_per_pixel );
265 265
266 if( format == XINE_IMGFMT_YV12 ) { 266 if( format == XINE_IMGFMT_YV12 ) {
267 frame->frame.pitches[0] = 8*((width + 7) / 8); 267 frame->frame.pitches[0] = 8*((width + 7) / 8);
268 frame->frame.pitches[1] = 8*((width + 15) / 16); 268 frame->frame.pitches[1] = 8*((width + 15) / 16);
269 frame->frame.pitches[2] = 8*((width + 15) / 16); 269 frame->frame.pitches[2] = 8*((width + 15) / 16);
270 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,(void **)&frame->chunk[0]); 270 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,(void **)&frame->chunk[0]);
271 frame->frame.base[1] = xine_xmalloc_aligned (16, frame->frame.pitches[1] * ((height+ 1)/2), (void **)&frame->chunk[1]); 271 frame->frame.base[1] = xine_xmalloc_aligned (16, frame->frame.pitches[1] * ((height+ 1)/2), (void **)&frame->chunk[1]);
272 frame->frame.base[2] = xine_xmalloc_aligned (16, frame->frame.pitches[2] * ((height+ 1)/2), (void **)&frame->chunk[2]); 272 frame->frame.base[2] = xine_xmalloc_aligned (16, frame->frame.pitches[2] * ((height+ 1)/2), (void **)&frame->chunk[2]);
273 273
274 }else{ 274 }else{
275 frame->frame.pitches[0] = 8*((width + 3) / 4); 275 frame->frame.pitches[0] = 8*((width + 3) / 4);
276 276
277 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height, 277 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,
278 (void **)&frame->chunk[0]); 278 (void **)&frame->chunk[0]);
279 frame->chunk[1] = NULL; 279 frame->chunk[1] = NULL;
280 frame->chunk[2] = NULL; 280 frame->chunk[2] = NULL;
281 } 281 }
282 282
283 frame->stripe_height = 16 * frame->sc.output_height / frame->sc.delivered_height; 283 frame->stripe_height = 16 * frame->sc.output_height / frame->sc.delivered_height;
284 frame->bytes_per_line = frame->sc.output_width * this->bytes_per_pixel; 284 frame->bytes_per_line = frame->sc.output_width * this->bytes_per_pixel;
285 285
286 /* 286 /*
287 * set up colorspace converter 287 * set up colorspace converter
288 */ 288 */
289 289
290 switch (flags) { 290 switch (flags) {
291 case VO_TOP_FIELD: 291 case VO_TOP_FIELD:
292 case VO_BOTTOM_FIELD: 292 case VO_BOTTOM_FIELD:
293 frame->yuv2rgb->configure (frame->yuv2rgb, 293 frame->yuv2rgb->configure (frame->yuv2rgb,
294 frame->sc.delivered_width, 294 frame->sc.delivered_width,
295 16, 295 16,
296 2*frame->frame.pitches[0], 296 2*frame->frame.pitches[0],
297 2*frame->frame.pitches[1], 297 2*frame->frame.pitches[1],
298 frame->sc.output_width, 298 frame->sc.output_width,
299 frame->stripe_height, 299 frame->stripe_height,
300 frame->bytes_per_line*2); 300 frame->bytes_per_line*2);
301 frame->yuv_stride = frame->bytes_per_line*2; 301 frame->yuv_stride = frame->bytes_per_line*2;
302 break; 302 break;
303 case VO_BOTH_FIELDS: 303 case VO_BOTH_FIELDS:
304 frame->yuv2rgb->configure (frame->yuv2rgb, 304 frame->yuv2rgb->configure (frame->yuv2rgb,
305 frame->sc.delivered_width, 305 frame->sc.delivered_width,
306 16, 306 16,
307 frame->frame.pitches[0], 307 frame->frame.pitches[0],
308 frame->frame.pitches[1], 308 frame->frame.pitches[1],
309 frame->sc.output_width, 309 frame->sc.output_width,
310 frame->stripe_height, 310 frame->stripe_height,
311 frame->bytes_per_line); 311 frame->bytes_per_line);
312 frame->yuv_stride = frame->bytes_per_line; 312 frame->yuv_stride = frame->bytes_per_line;
313 break; 313 break;
314 } 314 }
315#ifdef LOG 315#ifdef LOG
316 fprintf (stderr, "nullvideo: colorspace converter configured.\n"); 316 fprintf (stderr, "nullvideo: colorspace converter configured.\n");
317#endif 317#endif
318 } 318 }
319 319
320 /* 320 /*
321 * reset dest pointers 321 * reset dest pointers
322 */ 322 */
323 323
324 if (frame->data) { 324 if (frame->data) {
325 switch (flags) { 325 switch (flags) {
326 case VO_TOP_FIELD: 326 case VO_TOP_FIELD:
327 frame->rgb_dst = (uint8_t *)frame->data; 327 frame->rgb_dst = (uint8_t *)frame->data;
328 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; 328 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line;
329 break; 329 break;
330 case VO_BOTTOM_FIELD: 330 case VO_BOTTOM_FIELD:
331 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; 331 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ;
332 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; 332 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line;
333 break; 333 break;
334 case VO_BOTH_FIELDS: 334 case VO_BOTH_FIELDS:
335 frame->rgb_dst = (uint8_t *)frame->data; 335 frame->rgb_dst = (uint8_t *)frame->data;
336 frame->stripe_inc = frame->stripe_height * frame->bytes_per_line; 336 frame->stripe_inc = frame->stripe_height * frame->bytes_per_line;
337 break; 337 break;
338 } 338 }
339 } 339 }
340} 340}
341 341
342static void null_display_frame( vo_driver_t* self, vo_frame_t *frame_gen ){ 342static void null_display_frame( vo_driver_t* self, vo_frame_t *frame_gen ){
343 null_driver_t* this = (null_driver_t*) self; 343 null_driver_t* this = (null_driver_t*) self;
344 opie_frame_t* frame = (opie_frame_t*)frame_gen; 344 opie_frame_t* frame = (opie_frame_t*)frame_gen;
345 display_xine_frame_t display = this->frameDis; 345 display_xine_frame_t display = this->frameDis;
346 346
347 if (!this->m_show_video) 347 if (!this->m_show_video)
348 return; 348 return;
349 349
350 if( display != NULL ) { 350 if( display != NULL ) {
351 (*display)(this->caller, frame->data, 351 (*display)(this->caller, frame->data,
352 frame->sc.output_width, frame->sc.output_height, 352 frame->sc.output_width, frame->sc.output_height,
353 frame->bytes_per_line ); 353 frame->bytes_per_line );
354 } 354 }
355 355
356 frame->frame.displayed (&frame->frame); 356 frame->frame.displayed (&frame->frame);
357} 357}
358 358
359 359
360/* blending related */ 360/* blending related */
361static void null_overlay_clut_yuv2rgb (null_driver_t *this, 361static void null_overlay_clut_yuv2rgb (null_driver_t *this,
362 vo_overlay_t *overlay, 362 vo_overlay_t *overlay,
363 opie_frame_t *frame) { 363 opie_frame_t *frame) {
364 int i; 364 int i;
365 clut_t* clut = (clut_t*) overlay->color; 365 clut_t* clut = (clut_t*) overlay->color;
366 if (!overlay->rgb_clut) { 366 if (!overlay->rgb_clut) {
367 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { 367 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) {
368 *((uint32_t *)&clut[i]) = 368 *((uint32_t *)&clut[i]) =
369 frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb, 369 frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb,
370 clut[i].y, clut[i].cb, clut[i].cr); 370 clut[i].y, clut[i].cb, clut[i].cr);
371 } 371 }
372 overlay->rgb_clut++; 372 overlay->rgb_clut++;
373 } 373 }
374 if (!overlay->clip_rgb_clut) { 374 if (!overlay->clip_rgb_clut) {
375 clut = (clut_t*) overlay->clip_color; 375 clut = (clut_t*) overlay->clip_color;
376 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { 376 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) {
377 *((uint32_t *)&clut[i]) = 377 *((uint32_t *)&clut[i]) =
378 frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb, 378 frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb,
379 clut[i].y, clut[i].cb, clut[i].cr); 379 clut[i].y, clut[i].cb, clut[i].cr);
380 } 380 }
381 overlay->clip_rgb_clut++; 381 overlay->clip_rgb_clut++;
382 } 382 }
383} 383}
384 384
385static void null_overlay_blend ( vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { 385static void null_overlay_blend ( vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) {
386 null_driver_t *this = (null_driver_t *) this_gen; 386 null_driver_t *this = (null_driver_t *) this_gen;
387 opie_frame_t *frame = (opie_frame_t *) frame_gen; 387 opie_frame_t *frame = (opie_frame_t *) frame_gen;
388 388
389 if(!this->m_show_video || frame->sc.output_width == 0 389 if(!this->m_show_video || frame->sc.output_width == 0
390 || frame->sc.output_height== 0) 390 || frame->sc.output_height== 0)
391 return; 391 return;
392 392
393 /* Alpha Blend here */ 393 /* Alpha Blend here */
394 if (overlay->rle) { 394 if (overlay->rle) {
395 if( !overlay->rgb_clut || !overlay->clip_rgb_clut) 395 if( !overlay->rgb_clut || !overlay->clip_rgb_clut)
396 null_overlay_clut_yuv2rgb(this,overlay,frame); 396 null_overlay_clut_yuv2rgb(this,overlay,frame);
397 397
398 switch(this->bpp) { 398 switch(this->bpp) {
399 case 16: 399 case 16:
400 blend_rgb16( (uint8_t *)frame->data, overlay, 400 blend_rgb16( (uint8_t *)frame->data, overlay,
401 frame->sc.output_width, frame->sc.output_height, 401 frame->sc.output_width, frame->sc.output_height,
402 frame->sc.delivered_width, frame->sc.delivered_height); 402 frame->sc.delivered_width, frame->sc.delivered_height);
403 break; 403 break;
404 case 24: 404 case 24:
405 blend_rgb24( (uint8_t *)frame->data, overlay, 405 blend_rgb24( (uint8_t *)frame->data, overlay,
406 frame->sc.output_width, frame->sc.output_height, 406 frame->sc.output_width, frame->sc.output_height,
407 frame->sc.delivered_width, frame->sc.delivered_height); 407 frame->sc.delivered_width, frame->sc.delivered_height);
408 break; 408 break;
409 case 32: 409 case 32:
410 blend_rgb32( (uint8_t *)frame->data, overlay, 410 blend_rgb32( (uint8_t *)frame->data, overlay,
411 frame->sc.output_width, frame->sc.output_height, 411 frame->sc.output_width, frame->sc.output_height,
412 frame->sc.delivered_width, frame->sc.delivered_height); 412 frame->sc.delivered_width, frame->sc.delivered_height);
413 break; 413 break;
414 default: 414 default:
415 /* It should never get here */ 415 /* It should never get here */
416 break; 416 break;
417 } 417 }
418 } 418 }
419} 419}
420 420
421 421
422static int null_get_property( vo_driver_t* self, 422static int null_get_property( vo_driver_t* self,
423 int property ){ 423 int property ){
424 return 0; 424 return 0;
425} 425}
426static int null_set_property( vo_driver_t* self, 426static int null_set_property( vo_driver_t* self,
427 int property, 427 int property,
428 int value ){ 428 int value ){
429 return value; 429 return value;
430} 430}
431static void null_get_property_min_max( vo_driver_t* self, 431static void null_get_property_min_max( vo_driver_t* self,
432 int property, int *min, 432 int property, int *min,
433 int *max ){ 433 int *max ){
434 *max = 0; 434 *max = 0;
435 *min = 0; 435 *min = 0;
436} 436}
437static int null_gui_data_exchange( vo_driver_t* self, 437static int null_gui_data_exchange( vo_driver_t* self,
438 int data_type, 438 int data_type,
439 void *data ){ 439 void *data ){
440 return 0; 440 return 0;
441} 441}
442 442
443static void null_dispose ( vo_driver_t* self ){ 443static void null_dispose ( vo_driver_t* self ){
444 null_driver_t* this = (null_driver_t*)self; 444 null_driver_t* this = (null_driver_t*)self;
445 free ( this ); 445 free ( this );
446} 446}
447static int null_redraw_needed( vo_driver_t* self ){ 447static int null_redraw_needed( vo_driver_t* self ){
448 return 0; 448 return 0;
449} 449}
450 450
451 451
452xine_vo_driver_t* init_video_out_plugin( xine_t *xine, 452xine_vo_driver_t* init_video_out_plugin( xine_t *xine,
453 void* video, display_xine_frame_t frameDisplayFunc, void *userData ){ 453 void* video, display_xine_frame_t frameDisplayFunc, void *userData ){
454 null_driver_t *vo; 454 null_driver_t *vo;
455 vo = (null_driver_t*)malloc( sizeof(null_driver_t ) ); 455 vo = (null_driver_t*)malloc( sizeof(null_driver_t ) );
456 456
457 /* memset? */ 457 /* memset? */
458 memset(vo,0, sizeof(null_driver_t ) ); 458 memset(vo,0, sizeof(null_driver_t ) );
459 459
460 vo_scale_init (&vo->sc, 0, 0, xine->config); 460 vo_scale_init (&vo->sc, 0, 0, xine->config);
461 461
462 vo->sc.gui_pixel_aspect = 1.0; 462 vo->sc.gui_pixel_aspect = 1.0;
463 463
464 vo->m_show_video = 0; // false 464 vo->m_show_video = 0; // false
465 vo->m_video_fullscreen = 0; 465 vo->m_video_fullscreen = 0;
466 vo->m_is_scaling = 0; 466 vo->m_is_scaling = 0;
467 vo->display_ratio = 1.0; 467 vo->display_ratio = 1.0;
468 vo->gui_width = 16; 468 vo->gui_width = 16;
469 vo->gui_height = 8; 469 vo->gui_height = 8;
470 vo->frameDis = NULL; 470 vo->frameDis = NULL;
471 471
472 /* install callback handlers*/ 472 /* install callback handlers*/
473 vo->vo_driver.get_capabilities = null_get_capabilities; 473 vo->vo_driver.get_capabilities = null_get_capabilities;
474 vo->vo_driver.alloc_frame = null_alloc_frame; 474 vo->vo_driver.alloc_frame = null_alloc_frame;
475 vo->vo_driver.update_frame_format = null_update_frame_format; 475 vo->vo_driver.update_frame_format = null_update_frame_format;
476 vo->vo_driver.display_frame = null_display_frame; 476 vo->vo_driver.display_frame = null_display_frame;
477 vo->vo_driver.overlay_blend = null_overlay_blend; 477 vo->vo_driver.overlay_blend = null_overlay_blend;
478 vo->vo_driver.get_property = null_get_property; 478 vo->vo_driver.get_property = null_get_property;
479 vo->vo_driver.set_property = null_set_property; 479 vo->vo_driver.set_property = null_set_property;
480 vo->vo_driver.get_property_min_max = null_get_property_min_max; 480 vo->vo_driver.get_property_min_max = null_get_property_min_max;
481 vo->vo_driver.gui_data_exchange = null_gui_data_exchange; 481 vo->vo_driver.gui_data_exchange = null_gui_data_exchange;
482 vo->vo_driver.dispose = null_dispose; 482 vo->vo_driver.dispose = null_dispose;
483 vo->vo_driver.redraw_needed = null_redraw_needed; 483 vo->vo_driver.redraw_needed = null_redraw_needed;
484 484
485 485
486 /* capabilities */ 486 /* capabilities */
487 vo->m_capabilities = VO_CAP_COPIES_IMAGE | VO_CAP_YUY2 | VO_CAP_YV12; 487 vo->m_capabilities = VO_CAP_COPIES_IMAGE | VO_CAP_YUY2 | VO_CAP_YV12;
488 vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap, 488 vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap,
489 vo->yuv2rgb_cmap); 489 vo->yuv2rgb_cmap);
490 490
491 vo->caller = userData; 491 vo->caller = userData;
492 vo->frameDis = frameDisplayFunc; 492 vo->frameDis = frameDisplayFunc;
493 493
494 /* return ( vo_driver_t*) vo; */ 494 /* return ( vo_driver_t*) vo; */
495 return vo_new_port( xine, ( vo_driver_t* )vo ); 495 return vo_new_port( xine, ( vo_driver_t* )vo );
496} 496}
497 497
498#if 0 498#if 0
499static vo_info_t vo_info_null = { 499static vo_info_t vo_info_null = {
500 5, 500 5,
501 XINE_VISUAL_TYPE_FB 501 XINE_VISUAL_TYPE_FB
502}; 502};
503 503
504vo_info_t *get_video_out_plugin_info(){ 504vo_info_t *get_video_out_plugin_info(){
505 vo_info_null.description = ("xine video output plugin using null device"); 505 vo_info_null.description = ("xine video output plugin using null device");
506 return &vo_info_null; 506 return &vo_info_null;
507} 507}
508 508
509#endif 509#endif
510 510
511/* this is special for this device */ 511/* this is special for this device */
512/** 512/**
513 * We know that we will be controled by the XINE LIB++ 513 * We know that we will be controled by the XINE LIB++
514 */ 514 */
515 515
516/** 516/**
517 * 517 *
518 */ 518 */
519int null_is_showing_video( xine_vo_driver_t* self ){ 519int null_is_showing_video( xine_vo_driver_t* self ){
520 null_driver_t* this = (null_driver_t*)self->driver; 520 null_driver_t* this = (null_driver_t*)self->driver;
521 return this->m_show_video; 521 return this->m_show_video;
522} 522}
523void null_set_show_video( xine_vo_driver_t* self, int show ) { 523void null_set_show_video( xine_vo_driver_t* self, int show ) {
524 ((null_driver_t*)self->driver)->m_show_video = show; 524 ((null_driver_t*)self->driver)->m_show_video = show;
525} 525}
526 526
527int null_is_fullscreen( xine_vo_driver_t* self ){ 527int null_is_fullscreen( xine_vo_driver_t* self ){
528 return ((null_driver_t*)self->driver)->m_video_fullscreen; 528 return ((null_driver_t*)self->driver)->m_video_fullscreen;
529} 529}
530void null_set_fullscreen( xine_vo_driver_t* self, int screen ){ 530void null_set_fullscreen( xine_vo_driver_t* self, int screen ){
531 ((null_driver_t*)self->driver)->m_video_fullscreen = screen; 531 ((null_driver_t*)self->driver)->m_video_fullscreen = screen;
532} 532}
533int null_is_scaling( xine_vo_driver_t* self ){ 533int null_is_scaling( xine_vo_driver_t* self ){
534 return ((null_driver_t*)self->driver)->m_is_scaling; 534 return ((null_driver_t*)self->driver)->m_is_scaling;
535} 535}
536 536
537void null_set_videoGamma( xine_vo_driver_t* self , int value ) { 537void null_set_videoGamma( xine_vo_driver_t* self , int value ) {
538 ((null_driver_t*) self->driver) ->yuv2rgb_gamma = value; 538 ((null_driver_t*) self->driver) ->yuv2rgb_gamma = value;
539 ((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 );
540} 540}
541 541
542void null_set_scaling( xine_vo_driver_t* self, int scale ) { 542void null_set_scaling( xine_vo_driver_t* self, int scale ) {
543 ((null_driver_t*)self->driver)->m_is_scaling = scale; 543 ((null_driver_t*)self->driver)->m_is_scaling = scale;
544} 544}
545 545
546void null_set_gui_width( xine_vo_driver_t* self, int width ) { 546void null_set_gui_width( xine_vo_driver_t* self, int width ) {
547 ((null_driver_t*)self->driver)->gui_width = width; 547 ((null_driver_t*)self->driver)->gui_width = width;
548} 548}
549void null_set_gui_height( xine_vo_driver_t* self, int height ) { 549void null_set_gui_height( xine_vo_driver_t* self, int height ) {
550 ((null_driver_t*)self->driver)->gui_height = height; 550 ((null_driver_t*)self->driver)->gui_height = height;
551} 551}
552 552
553 553
554void 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 ) {
555 null_driver_t* this = (null_driver_t*)self->driver; 555 null_driver_t* this = (null_driver_t*)self->driver;
556 556
557 this->bytes_per_pixel = (depth + 7 ) / 8; 557 this->bytes_per_pixel = (depth + 7 ) / 8;
558 this->bpp = this->bytes_per_pixel * 8; 558 this->bpp = this->bytes_per_pixel * 8;
559 this->depth = depth; 559 this->depth = depth;
560 printf("depth %d %d\n", depth, this->bpp); 560 printf("depth %d %d\n", depth, this->bpp);
561 printf("pixeltype %d\n", rgb ); 561 printf("pixeltype %d\n", rgb );
562 switch ( this->depth ) { 562 switch ( this->depth ) {
563 case 32: 563 case 32:
564 if( rgb == 0 ) 564 if( rgb == 0 )
565 this->yuv2rgb_mode = MODE_32_RGB; 565 this->yuv2rgb_mode = MODE_32_RGB;
566 else 566 else
567 this->yuv2rgb_mode = MODE_32_BGR; 567 this->yuv2rgb_mode = MODE_32_BGR;
568 case 24: 568 case 24:
569 if( this->bpp == 32 ) { 569 if( this->bpp == 32 ) {
570 if( rgb == 0 ) { 570 if( rgb == 0 ) {
571 this->yuv2rgb_mode = MODE_32_RGB; 571 this->yuv2rgb_mode = MODE_32_RGB;
572 } else { 572 } else {
573 this->yuv2rgb_mode = MODE_32_BGR; 573 this->yuv2rgb_mode = MODE_32_BGR;
574 } 574 }
575 }else{ 575 }else{
576 if( rgb == 0 ) 576 if( rgb == 0 )
577 this->yuv2rgb_mode = MODE_24_RGB; 577 this->yuv2rgb_mode = MODE_24_RGB;
578 else 578 else
579 this->yuv2rgb_mode = MODE_24_BGR; 579 this->yuv2rgb_mode = MODE_24_BGR;
580 }; 580 };
581 break; 581 break;
582 case 16: 582 case 16:
583 if( rgb == 0 ) { 583 if( rgb == 0 ) {
584 this->yuv2rgb_mode = MODE_16_RGB; 584 this->yuv2rgb_mode = MODE_16_RGB;
585 } else { 585 } else {
586 this->yuv2rgb_mode = MODE_16_BGR; 586 this->yuv2rgb_mode = MODE_16_BGR;
587 } 587 }
588 break; 588 break;
589 case 15: 589 case 15:
590 if( rgb == 0 ) { 590 if( rgb == 0 ) {
591 this->yuv2rgb_mode = MODE_15_RGB; 591 this->yuv2rgb_mode = MODE_15_RGB;
592 } else { 592 } else {
593 this->yuv2rgb_mode = MODE_15_BGR; 593 this->yuv2rgb_mode = MODE_15_BGR;
594 } 594 }
595 break; 595 break;
596 case 8: 596 case 8:
597 if( rgb == 0 ) { 597 if( rgb == 0 ) {
598 this->yuv2rgb_mode = MODE_8_RGB; 598 this->yuv2rgb_mode = MODE_8_RGB;
599 } else { 599 } else {
600 this->yuv2rgb_mode = MODE_8_BGR; 600 this->yuv2rgb_mode = MODE_8_BGR;
601 } 601 }
602 break; 602 break;
603 }; 603 };
604 //free(this->yuv2rgb_factory ); 604 //free(this->yuv2rgb_factory );
605 // 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,
606 // this->yuv2rgb_cmap); 606 // this->yuv2rgb_cmap);
607}; 607};
608 608
609void 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,
610 void* user_data ) { 610 void* user_data ) {
611 null_driver_t* this = (null_driver_t*) self->driver; 611 null_driver_t* this = (null_driver_t*) self->driver;
612 this->caller = user_data; 612 this->caller = user_data;
613 this->frameDis = t; 613 this->frameDis = t;
614} 614}
615 615
616void null_preload_decoders( xine_stream_t *stream ) 616void null_preload_decoders( xine_stream_t *stream )
617{ 617{
618 static const uint32_t preloadedAudioDecoders[] = { BUF_AUDIO_MPEG, BUF_AUDIO_VORBIS }; 618 static const uint32_t preloadedAudioDecoders[] = { BUF_AUDIO_MPEG, BUF_AUDIO_VORBIS };
619 static const uint8_t preloadedAudioDecoderCount = sizeof( preloadedAudioDecoders ) / sizeof( preloadedAudioDecoders[ 0 ] ); 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 }; 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 ] ); 621 static const uint8_t preloadedVideoDecoderCount = sizeof( preloadedVideoDecoders ) / sizeof( preloadedVideoDecoders[ 0 ] );
622 622
623 uint8_t i; 623 uint8_t i;
624 624
625 for ( i = 0; i < preloadedAudioDecoderCount; ++i ) { 625 for ( i = 0; i < preloadedAudioDecoderCount; ++i ) {
626 audio_decoder_t *decoder = get_audio_decoder( stream, ( preloadedAudioDecoders[ i ] >> 16 ) & 0xff ); 626 audio_decoder_t *decoder = get_audio_decoder( stream, ( preloadedAudioDecoders[ i ] >> 16 ) & 0xff );
627 free_audio_decoder( stream, decoder ); 627/* free_audio_decoder( stream, decoder ); */
628 } 628 }
629 629
630 for ( i = 0; i < preloadedVideoDecoderCount; ++i ) { 630 for ( i = 0; i < preloadedVideoDecoderCount; ++i ) {
631 video_decoder_t *decoder = get_video_decoder( stream, ( preloadedVideoDecoders[ i ] >> 16 ) & 0xff ); 631 video_decoder_t *decoder = get_video_decoder( stream, ( preloadedVideoDecoders[ i ] >> 16 ) & 0xff );
632 free_video_decoder( stream, decoder ); 632/* free_video_decoder( stream, decoder ); */
633 } 633 }
634} 634}
635 635