summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c
index f28fba3..90f62f2 100644
--- a/noncore/multimedia/opieplayer2/nullvideo.c
+++ b/noncore/multimedia/opieplayer2/nullvideo.c
@@ -23,563 +23,563 @@
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 vo_img->copy_called = 1; 119 vo_img->proc_called = 1;
120 120
121 if (!frame->output->m_show_video) { 121 if (!frame->output->m_show_video) {
122 /* printf("nullvideo: no video\n"); */ 122 /* printf("nullvideo: no video\n"); */
123 return; 123 return;
124 } 124 }
125 125
126 if (frame->format == XINE_IMGFMT_YV12) { 126 if (frame->format == XINE_IMGFMT_YV12) {
127 frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, 127 frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst,
128 src[0], src[1], src[2]); 128 src[0], src[1], src[2]);
129 } else { 129 } else {
130 130
131 frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, 131 frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst,
132 src[0]); 132 src[0]);
133 } 133 }
134 134
135 frame->rgb_dst += frame->stripe_inc; 135 frame->rgb_dst += frame->stripe_inc;
136} 136}
137 137
138static void null_frame_field (vo_frame_t *vo_img, int which_field) { 138static void null_frame_field (vo_frame_t *vo_img, int which_field) {
139 139
140 opie_frame_t *frame = (opie_frame_t *) vo_img ; 140 opie_frame_t *frame = (opie_frame_t *) vo_img ;
141 141
142 switch (which_field) { 142 switch (which_field) {
143 case VO_TOP_FIELD: 143 case VO_TOP_FIELD:
144 frame->rgb_dst = (uint8_t *)frame->data; 144 frame->rgb_dst = (uint8_t *)frame->data;
145 frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; 145 frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line;
146 break; 146 break;
147 case VO_BOTTOM_FIELD: 147 case VO_BOTTOM_FIELD:
148 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; 148 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ;
149 frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; 149 frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line;
150 break; 150 break;
151 case VO_BOTH_FIELDS: 151 case VO_BOTH_FIELDS:
152 frame->rgb_dst = (uint8_t *)frame->data; 152 frame->rgb_dst = (uint8_t *)frame->data;
153 break; 153 break;
154 } 154 }
155} 155}
156 156
157 157
158/* take care of the frame*/ 158/* take care of the frame*/
159static void null_frame_dispose( vo_frame_t* vo_img){ 159static void null_frame_dispose( vo_frame_t* vo_img){
160 opie_frame_t* frame = (opie_frame_t*)vo_img; 160 opie_frame_t* frame = (opie_frame_t*)vo_img;
161 161
162 if (frame->data) 162 if (frame->data)
163 free( frame->data ); 163 free( frame->data );
164 free (frame); 164 free (frame);
165} 165}
166 166
167/* end take care of frames*/ 167/* end take care of frames*/
168 168
169static vo_frame_t* null_alloc_frame( vo_driver_t* self ){ 169static vo_frame_t* null_alloc_frame( vo_driver_t* self ){
170 170
171 null_driver_t* this = (null_driver_t*)self; 171 null_driver_t* this = (null_driver_t*)self;
172 opie_frame_t* frame; 172 opie_frame_t* frame;
173 173
174#ifdef LOG 174#ifdef LOG
175 fprintf (stderr, "nullvideo: alloc_frame\n"); 175 fprintf (stderr, "nullvideo: alloc_frame\n");
176#endif 176#endif
177 177
178 frame = (opie_frame_t*)malloc ( sizeof(opie_frame_t) ); 178 frame = (opie_frame_t*)malloc ( sizeof(opie_frame_t) );
179 179
180 memset( frame, 0, sizeof( opie_frame_t) ); 180 memset( frame, 0, sizeof( opie_frame_t) );
181 memcpy (&frame->sc, &this->sc, sizeof(vo_scale_t)); 181 memcpy (&frame->sc, &this->sc, sizeof(vo_scale_t));
182 182
183 pthread_mutex_init (&frame->frame.mutex, NULL); 183 pthread_mutex_init (&frame->frame.mutex, NULL);
184 184
185 frame->output = this; 185 frame->output = this;
186 186
187 /* initialize the frame*/ 187 /* initialize the frame*/
188 frame->frame.driver = self; 188 frame->frame.driver = self;
189 frame->frame.copy = null_frame_copy; 189 frame->frame.proc_slice = null_frame_copy;
190 frame->frame.field = null_frame_field; 190 frame->frame.field = null_frame_field;
191 frame->frame.dispose = null_frame_dispose; 191 frame->frame.dispose = null_frame_dispose;
192 192
193 /* 193 /*
194 * colorspace converter for this frame 194 * colorspace converter for this frame
195 */ 195 */
196 frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory); 196 frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory);
197 197
198 return (vo_frame_t*) frame; 198 return (vo_frame_t*) frame;
199} 199}
200 200
201static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img, 201static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img,
202 uint32_t width, uint32_t height, 202 uint32_t width, uint32_t height,
203 int ratio_code, int format, int flags ){ 203 double ratio_code, int format, int flags ){
204 null_driver_t* this = (null_driver_t*) self; 204 null_driver_t* this = (null_driver_t*) self;
205 opie_frame_t* frame = (opie_frame_t*)img; 205 opie_frame_t* frame = (opie_frame_t*)img;
206 /* not needed now */ 206 /* not needed now */
207 207
208#ifdef LOG 208#ifdef LOG
209 fprintf (stderr, "nullvideo: update_frame_format\n"); 209 fprintf (stderr, "nullvideo: update_frame_format\n");
210#endif 210#endif
211 211
212 flags &= VO_BOTH_FIELDS; 212 flags &= VO_BOTH_FIELDS;
213 213
214 /* find out if we need to adapt this frame */ 214 /* find out if we need to adapt this frame */
215 215
216 if ((width != frame->sc.delivered_width) 216 if ((width != frame->sc.delivered_width)
217 || (height != frame->sc.delivered_height) 217 || (height != frame->sc.delivered_height)
218 || (ratio_code != frame->sc.delivered_ratio_code) 218 || (ratio_code != frame->sc.delivered_ratio)
219 || (flags != frame->flags) 219 || (flags != frame->flags)
220 || (format != frame->format) 220 || (format != frame->format)
221 || (this->sc.user_ratio != frame->sc.user_ratio) 221 || (this->sc.user_ratio != frame->sc.user_ratio)
222 || (this->gui_width != frame->sc.gui_width) 222 || (this->gui_width != frame->sc.gui_width)
223 || (this->gui_height != frame->sc.gui_height)) { 223 || (this->gui_height != frame->sc.gui_height)) {
224 224
225 frame->sc.delivered_width = width; 225 frame->sc.delivered_width = width;
226 frame->sc.delivered_height = height; 226 frame->sc.delivered_height = height;
227 frame->sc.delivered_ratio_code = ratio_code; 227 frame->sc.delivered_ratio = ratio_code;
228 frame->flags = flags; 228 frame->flags = flags;
229 frame->format = format; 229 frame->format = format;
230 frame->sc.user_ratio = this->sc.user_ratio; 230 frame->sc.user_ratio = this->sc.user_ratio;
231 frame->sc.gui_width = this->gui_width; 231 frame->sc.gui_width = this->gui_width;
232 frame->sc.gui_height = this->gui_height; 232 frame->sc.gui_height = this->gui_height;
233 frame->sc.gui_pixel_aspect = 1.0; 233 frame->sc.gui_pixel_aspect = 1.0;
234 234
235 vo_scale_compute_ideal_size ( &frame->sc ); 235 vo_scale_compute_ideal_size ( &frame->sc );
236 vo_scale_compute_output_size( &frame->sc ); 236 vo_scale_compute_output_size( &frame->sc );
237 237
238#ifdef LOG 238#ifdef LOG
239 fprintf (stderr, "nullvideo: gui %dx%d delivered %dx%d output %dx%d\n", 239 fprintf (stderr, "nullvideo: gui %dx%d delivered %dx%d output %dx%d\n",
240 frame->sc.gui_width, frame->sc.gui_height, 240 frame->sc.gui_width, frame->sc.gui_height,
241 frame->sc.delivered_width, frame->sc.delivered_height, 241 frame->sc.delivered_width, frame->sc.delivered_height,
242 frame->sc.output_width, frame->sc.output_height); 242 frame->sc.output_width, frame->sc.output_height);
243#endif 243#endif
244 244
245 /* 245 /*
246 * (re-) allocate 246 * (re-) allocate
247 */ 247 */
248 if( frame->data ) { 248 if( frame->data ) {
249 if( frame->chunk[0] ){ 249 if( frame->chunk[0] ){
250 free( frame->chunk[0] ); 250 free( frame->chunk[0] );
251 frame->chunk[0] = NULL; 251 frame->chunk[0] = NULL;
252 } 252 }
253 if( frame->chunk[1] ){ 253 if( frame->chunk[1] ){
254 free ( frame->chunk[1] ); 254 free ( frame->chunk[1] );
255 frame->chunk[1] = NULL; 255 frame->chunk[1] = NULL;
256 } 256 }
257 if( frame->chunk[2] ){ 257 if( frame->chunk[2] ){
258 free ( frame->chunk[2] ); 258 free ( frame->chunk[2] );
259 frame->chunk[2] = NULL; 259 frame->chunk[2] = NULL;
260 } 260 }
261 free ( frame->data ); 261 free ( frame->data );
262 } 262 }
263 263
264 frame->data = xine_xmalloc (frame->sc.output_width 264 frame->data = xine_xmalloc (frame->sc.output_width
265 * frame->sc.output_height 265 * frame->sc.output_height
266 * this->bytes_per_pixel ); 266 * this->bytes_per_pixel );
267 267
268 if( format == XINE_IMGFMT_YV12 ) { 268 if( format == XINE_IMGFMT_YV12 ) {
269 frame->frame.pitches[0] = 8*((width + 7) / 8); 269 frame->frame.pitches[0] = 8*((width + 7) / 8);
270 frame->frame.pitches[1] = 8*((width + 15) / 16); 270 frame->frame.pitches[1] = 8*((width + 15) / 16);
271 frame->frame.pitches[2] = 8*((width + 15) / 16); 271 frame->frame.pitches[2] = 8*((width + 15) / 16);
272 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,(void **)&frame->chunk[0]); 272 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,(void **)&frame->chunk[0]);
273 frame->frame.base[1] = xine_xmalloc_aligned (16, frame->frame.pitches[1] * ((height+ 1)/2), (void **)&frame->chunk[1]); 273 frame->frame.base[1] = xine_xmalloc_aligned (16, frame->frame.pitches[1] * ((height+ 1)/2), (void **)&frame->chunk[1]);
274 frame->frame.base[2] = xine_xmalloc_aligned (16, frame->frame.pitches[2] * ((height+ 1)/2), (void **)&frame->chunk[2]); 274 frame->frame.base[2] = xine_xmalloc_aligned (16, frame->frame.pitches[2] * ((height+ 1)/2), (void **)&frame->chunk[2]);
275 275
276 }else{ 276 }else{
277 frame->frame.pitches[0] = 8*((width + 3) / 4); 277 frame->frame.pitches[0] = 8*((width + 3) / 4);
278 278
279 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height, 279 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,
280 (void **)&frame->chunk[0]); 280 (void **)&frame->chunk[0]);
281 frame->chunk[1] = NULL; 281 frame->chunk[1] = NULL;
282 frame->chunk[2] = NULL; 282 frame->chunk[2] = NULL;
283 } 283 }
284 284
285 frame->stripe_height = 16 * frame->sc.output_height / frame->sc.delivered_height; 285 frame->stripe_height = 16 * frame->sc.output_height / frame->sc.delivered_height;
286 frame->bytes_per_line = frame->sc.output_width * this->bytes_per_pixel; 286 frame->bytes_per_line = frame->sc.output_width * this->bytes_per_pixel;
287 287
288 /* 288 /*
289 * set up colorspace converter 289 * set up colorspace converter
290 */ 290 */
291 291
292 switch (flags) { 292 switch (flags) {
293 case VO_TOP_FIELD: 293 case VO_TOP_FIELD:
294 case VO_BOTTOM_FIELD: 294 case VO_BOTTOM_FIELD:
295 frame->yuv2rgb->configure (frame->yuv2rgb, 295 frame->yuv2rgb->configure (frame->yuv2rgb,
296 frame->sc.delivered_width, 296 frame->sc.delivered_width,
297 16, 297 16,
298 2*frame->frame.pitches[0], 298 2*frame->frame.pitches[0],
299 2*frame->frame.pitches[1], 299 2*frame->frame.pitches[1],
300 frame->sc.output_width, 300 frame->sc.output_width,
301 frame->stripe_height, 301 frame->stripe_height,
302 frame->bytes_per_line*2); 302 frame->bytes_per_line*2);
303 frame->yuv_stride = frame->bytes_per_line*2; 303 frame->yuv_stride = frame->bytes_per_line*2;
304 break; 304 break;
305 case VO_BOTH_FIELDS: 305 case VO_BOTH_FIELDS:
306 frame->yuv2rgb->configure (frame->yuv2rgb, 306 frame->yuv2rgb->configure (frame->yuv2rgb,
307 frame->sc.delivered_width, 307 frame->sc.delivered_width,
308 16, 308 16,
309 frame->frame.pitches[0], 309 frame->frame.pitches[0],
310 frame->frame.pitches[1], 310 frame->frame.pitches[1],
311 frame->sc.output_width, 311 frame->sc.output_width,
312 frame->stripe_height, 312 frame->stripe_height,
313 frame->bytes_per_line); 313 frame->bytes_per_line);
314 frame->yuv_stride = frame->bytes_per_line; 314 frame->yuv_stride = frame->bytes_per_line;
315 break; 315 break;
316 } 316 }
317#ifdef LOG 317#ifdef LOG
318 fprintf (stderr, "nullvideo: colorspace converter configured.\n"); 318 fprintf (stderr, "nullvideo: colorspace converter configured.\n");
319#endif 319#endif
320 } 320 }
321 321
322 /* 322 /*
323 * reset dest pointers 323 * reset dest pointers
324 */ 324 */
325 325
326 if (frame->data) { 326 if (frame->data) {
327 switch (flags) { 327 switch (flags) {
328 case VO_TOP_FIELD: 328 case VO_TOP_FIELD:
329 frame->rgb_dst = (uint8_t *)frame->data; 329 frame->rgb_dst = (uint8_t *)frame->data;
330 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; 330 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line;
331 break; 331 break;
332 case VO_BOTTOM_FIELD: 332 case VO_BOTTOM_FIELD:
333 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; 333 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ;
334 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; 334 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line;
335 break; 335 break;
336 case VO_BOTH_FIELDS: 336 case VO_BOTH_FIELDS:
337 frame->rgb_dst = (uint8_t *)frame->data; 337 frame->rgb_dst = (uint8_t *)frame->data;
338 frame->stripe_inc = frame->stripe_height * frame->bytes_per_line; 338 frame->stripe_inc = frame->stripe_height * frame->bytes_per_line;
339 break; 339 break;
340 } 340 }
341 } 341 }
342} 342}
343 343
344static void null_display_frame( vo_driver_t* self, vo_frame_t *frame_gen ){ 344static void null_display_frame( vo_driver_t* self, vo_frame_t *frame_gen ){
345 null_driver_t* this = (null_driver_t*) self; 345 null_driver_t* this = (null_driver_t*) self;
346 opie_frame_t* frame = (opie_frame_t*)frame_gen; 346 opie_frame_t* frame = (opie_frame_t*)frame_gen;
347 display_xine_frame_t display = this->frameDis; 347 display_xine_frame_t display = this->frameDis;
348 348
349 if (!this->m_show_video) 349 if (!this->m_show_video)
350 return; 350 return;
351 351
352 if( display != NULL ) { 352 if( display != NULL ) {
353 (*display)(this->caller, frame->data, 353 (*display)(this->caller, frame->data,
354 frame->sc.output_width, frame->sc.output_height, 354 frame->sc.output_width, frame->sc.output_height,
355 frame->bytes_per_line ); 355 frame->bytes_per_line );
356 } 356 }
357 357
358 frame->frame.displayed (&frame->frame); 358 frame->frame.free(&frame->frame);
359} 359}
360 360
361 361
362/* blending related */ 362/* blending related */
363static void null_overlay_clut_yuv2rgb (null_driver_t *this, 363static void null_overlay_clut_yuv2rgb (null_driver_t *this,
364 vo_overlay_t *overlay, 364 vo_overlay_t *overlay,
365 opie_frame_t *frame) { 365 opie_frame_t *frame) {
366 int i; 366 int i;
367 clut_t* clut = (clut_t*) overlay->color; 367 clut_t* clut = (clut_t*) overlay->color;
368 if (!overlay->rgb_clut) { 368 if (!overlay->rgb_clut) {
369 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { 369 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) {
370 *((uint32_t *)&clut[i]) = 370 *((uint32_t *)&clut[i]) =
371 frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb, 371 frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb,
372 clut[i].y, clut[i].cb, clut[i].cr); 372 clut[i].y, clut[i].cb, clut[i].cr);
373 } 373 }
374 overlay->rgb_clut++; 374 overlay->rgb_clut++;
375 } 375 }
376 if (!overlay->clip_rgb_clut) { 376 if (!overlay->clip_rgb_clut) {
377 clut = (clut_t*) overlay->clip_color; 377 clut = (clut_t*) overlay->clip_color;
378 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { 378 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) {
379 *((uint32_t *)&clut[i]) = 379 *((uint32_t *)&clut[i]) =
380 frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb, 380 frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb,
381 clut[i].y, clut[i].cb, clut[i].cr); 381 clut[i].y, clut[i].cb, clut[i].cr);
382 } 382 }
383 overlay->clip_rgb_clut++; 383 overlay->clip_rgb_clut++;
384 } 384 }
385} 385}
386 386
387static void null_overlay_blend ( vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { 387static void null_overlay_blend ( vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) {
388 null_driver_t *this = (null_driver_t *) this_gen; 388 null_driver_t *this = (null_driver_t *) this_gen;
389 opie_frame_t *frame = (opie_frame_t *) frame_gen; 389 opie_frame_t *frame = (opie_frame_t *) frame_gen;
390 390
391 if(!this->m_show_video || frame->sc.output_width == 0 391 if(!this->m_show_video || frame->sc.output_width == 0
392 || frame->sc.output_height== 0) 392 || frame->sc.output_height== 0)
393 return; 393 return;
394 394
395 /* Alpha Blend here */ 395 /* Alpha Blend here */
396 if (overlay->rle) { 396 if (overlay->rle) {
397 if( !overlay->rgb_clut || !overlay->clip_rgb_clut) 397 if( !overlay->rgb_clut || !overlay->clip_rgb_clut)
398 null_overlay_clut_yuv2rgb(this,overlay,frame); 398 null_overlay_clut_yuv2rgb(this,overlay,frame);
399 399
400 switch(this->bpp) { 400 switch(this->bpp) {
401 case 16: 401 case 16:
402 blend_rgb16( (uint8_t *)frame->data, overlay, 402 blend_rgb16( (uint8_t *)frame->data, overlay,
403 frame->sc.output_width, frame->sc.output_height, 403 frame->sc.output_width, frame->sc.output_height,
404 frame->sc.delivered_width, frame->sc.delivered_height); 404 frame->sc.delivered_width, frame->sc.delivered_height);
405 break; 405 break;
406 case 24: 406 case 24:
407 blend_rgb24( (uint8_t *)frame->data, overlay, 407 blend_rgb24( (uint8_t *)frame->data, overlay,
408 frame->sc.output_width, frame->sc.output_height, 408 frame->sc.output_width, frame->sc.output_height,
409 frame->sc.delivered_width, frame->sc.delivered_height); 409 frame->sc.delivered_width, frame->sc.delivered_height);
410 break; 410 break;
411 case 32: 411 case 32:
412 blend_rgb32( (uint8_t *)frame->data, overlay, 412 blend_rgb32( (uint8_t *)frame->data, overlay,
413 frame->sc.output_width, frame->sc.output_height, 413 frame->sc.output_width, frame->sc.output_height,
414 frame->sc.delivered_width, frame->sc.delivered_height); 414 frame->sc.delivered_width, frame->sc.delivered_height);
415 break; 415 break;
416 default: 416 default:
417 /* It should never get here */ 417 /* It should never get here */
418 break; 418 break;
419 } 419 }
420 } 420 }
421} 421}
422 422
423 423
424static int null_get_property( vo_driver_t* self, 424static int null_get_property( vo_driver_t* self,
425 int property ){ 425 int property ){
426 return 0; 426 return 0;
427} 427}
428static int null_set_property( vo_driver_t* self, 428static int null_set_property( vo_driver_t* self,
429 int property, 429 int property,
430 int value ){ 430 int value ){
431 return value; 431 return value;
432} 432}
433static void null_get_property_min_max( vo_driver_t* self, 433static void null_get_property_min_max( vo_driver_t* self,
434 int property, int *min, 434 int property, int *min,
435 int *max ){ 435 int *max ){
436 *max = 0; 436 *max = 0;
437 *min = 0; 437 *min = 0;
438} 438}
439static int null_gui_data_exchange( vo_driver_t* self, 439static int null_gui_data_exchange( vo_driver_t* self,
440 int data_type, 440 int data_type,
441 void *data ){ 441 void *data ){
442 return 0; 442 return 0;
443} 443}
444 444
445static void null_dispose ( vo_driver_t* self ){ 445static void null_dispose ( vo_driver_t* self ){
446 null_driver_t* this = (null_driver_t*)self; 446 null_driver_t* this = (null_driver_t*)self;
447 free ( this ); 447 free ( this );
448} 448}
449static int null_redraw_needed( vo_driver_t* self ){ 449static int null_redraw_needed( vo_driver_t* self ){
450 return 0; 450 return 0;
451} 451}
452 452
453 453
454xine_vo_driver_t* init_video_out_plugin( xine_t *xine, 454xine_vo_driver_t* init_video_out_plugin( xine_t *xine,
455 void* video, display_xine_frame_t frameDisplayFunc, void *userData ){ 455 void* video, display_xine_frame_t frameDisplayFunc, void *userData ){
456 null_driver_t *vo; 456 null_driver_t *vo;
457 vo = (null_driver_t*)malloc( sizeof(null_driver_t ) ); 457 vo = (null_driver_t*)malloc( sizeof(null_driver_t ) );
458 458
459 /* memset? */ 459 /* memset? */
460 memset(vo,0, sizeof(null_driver_t ) ); 460 memset(vo,0, sizeof(null_driver_t ) );
461 461
462 vo_scale_init (&vo->sc, 0, 0, xine->config); 462 vo_scale_init (&vo->sc, 0, 0, xine->config);
463 463
464 vo->sc.gui_pixel_aspect = 1.0; 464 vo->sc.gui_pixel_aspect = 1.0;
465 465
466 vo->m_show_video = 0; // false 466 vo->m_show_video = 0; // false
467 vo->m_video_fullscreen = 0; 467 vo->m_video_fullscreen = 0;
468 vo->m_is_scaling = 0; 468 vo->m_is_scaling = 0;
469 vo->display_ratio = 1.0; 469 vo->display_ratio = 1.0;
470 vo->gui_width = 16; 470 vo->gui_width = 16;
471 vo->gui_height = 8; 471 vo->gui_height = 8;
472 vo->frameDis = NULL; 472 vo->frameDis = NULL;
473 473
474 /* install callback handlers*/ 474 /* install callback handlers*/
475 vo->vo_driver.get_capabilities = null_get_capabilities; 475 vo->vo_driver.get_capabilities = null_get_capabilities;
476 vo->vo_driver.alloc_frame = null_alloc_frame; 476 vo->vo_driver.alloc_frame = null_alloc_frame;
477 vo->vo_driver.update_frame_format = null_update_frame_format; 477 vo->vo_driver.update_frame_format = null_update_frame_format;
478 vo->vo_driver.display_frame = null_display_frame; 478 vo->vo_driver.display_frame = null_display_frame;
479 vo->vo_driver.overlay_blend = null_overlay_blend; 479 vo->vo_driver.overlay_blend = null_overlay_blend;
480 vo->vo_driver.get_property = null_get_property; 480 vo->vo_driver.get_property = null_get_property;
481 vo->vo_driver.set_property = null_set_property; 481 vo->vo_driver.set_property = null_set_property;
482 vo->vo_driver.get_property_min_max = null_get_property_min_max; 482 vo->vo_driver.get_property_min_max = null_get_property_min_max;
483 vo->vo_driver.gui_data_exchange = null_gui_data_exchange; 483 vo->vo_driver.gui_data_exchange = null_gui_data_exchange;
484 vo->vo_driver.dispose = null_dispose; 484 vo->vo_driver.dispose = null_dispose;
485 vo->vo_driver.redraw_needed = null_redraw_needed; 485 vo->vo_driver.redraw_needed = null_redraw_needed;
486 486
487 487
488 /* capabilities */ 488 /* capabilities */
489 vo->m_capabilities = VO_CAP_COPIES_IMAGE | VO_CAP_YUY2 | VO_CAP_YV12; 489 vo->m_capabilities = /* VO_CAP_COPIES_IMAGE | */ VO_CAP_YUY2 | VO_CAP_YV12;
490 vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap, 490 vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap,
491 vo->yuv2rgb_cmap); 491 vo->yuv2rgb_cmap);
492 492
493 vo->caller = userData; 493 vo->caller = userData;
494 vo->frameDis = frameDisplayFunc; 494 vo->frameDis = frameDisplayFunc;
495 495
496 /* return ( vo_driver_t*) vo; */ 496 /* return ( vo_driver_t*) vo; */
497 return vo_new_port( xine, ( vo_driver_t* )vo, 0 ); 497 return vo_new_port( xine, ( vo_driver_t* )vo, 0 );
498} 498}
499 499
500#if 0 500#if 0
501static vo_info_t vo_info_null = { 501static vo_info_t vo_info_null = {
502 5, 502 5,
503 XINE_VISUAL_TYPE_FB 503 XINE_VISUAL_TYPE_FB
504}; 504};
505 505
506vo_info_t *get_video_out_plugin_info(){ 506vo_info_t *get_video_out_plugin_info(){
507 vo_info_null.description = ("xine video output plugin using null device"); 507 vo_info_null.description = ("xine video output plugin using null device");
508 return &vo_info_null; 508 return &vo_info_null;
509} 509}
510 510
511#endif 511#endif
512 512
513/* this is special for this device */ 513/* this is special for this device */
514/** 514/**
515 * We know that we will be controled by the XINE LIB++ 515 * We know that we will be controled by the XINE LIB++
516 */ 516 */
517 517
518/** 518/**
519 * 519 *
520 */ 520 */
521int null_is_showing_video( xine_vo_driver_t* self ){ 521int null_is_showing_video( xine_vo_driver_t* self ){
522 null_driver_t* this = (null_driver_t*)self->driver; 522 null_driver_t* this = (null_driver_t*)self->driver;
523 return this->m_show_video; 523 return this->m_show_video;
524} 524}
525void null_set_show_video( xine_vo_driver_t* self, int show ) { 525void null_set_show_video( xine_vo_driver_t* self, int show ) {
526 ((null_driver_t*)self->driver)->m_show_video = show; 526 ((null_driver_t*)self->driver)->m_show_video = show;
527} 527}
528 528
529int null_is_fullscreen( xine_vo_driver_t* self ){ 529int null_is_fullscreen( xine_vo_driver_t* self ){
530 return ((null_driver_t*)self->driver)->m_video_fullscreen; 530 return ((null_driver_t*)self->driver)->m_video_fullscreen;
531} 531}
532void null_set_fullscreen( xine_vo_driver_t* self, int screen ){ 532void null_set_fullscreen( xine_vo_driver_t* self, int screen ){
533 ((null_driver_t*)self->driver)->m_video_fullscreen = screen; 533 ((null_driver_t*)self->driver)->m_video_fullscreen = screen;
534} 534}
535int null_is_scaling( xine_vo_driver_t* self ){ 535int null_is_scaling( xine_vo_driver_t* self ){
536 return ((null_driver_t*)self->driver)->m_is_scaling; 536 return ((null_driver_t*)self->driver)->m_is_scaling;
537} 537}
538 538
539void null_set_videoGamma( xine_vo_driver_t* self , int value ) { 539void null_set_videoGamma( xine_vo_driver_t* self , int value ) {
540 ((null_driver_t*) self->driver) ->yuv2rgb_gamma = value; 540 ((null_driver_t*) self->driver) ->yuv2rgb_gamma = value;
541 ((null_driver_t*) self->driver) ->yuv2rgb_factory->set_gamma( ((null_driver_t*) self->driver) ->yuv2rgb_factory, value ); 541 ((null_driver_t*) self->driver) ->yuv2rgb_factory->set_gamma( ((null_driver_t*) self->driver) ->yuv2rgb_factory, value );
542} 542}
543 543
544void null_set_scaling( xine_vo_driver_t* self, int scale ) { 544void null_set_scaling( xine_vo_driver_t* self, int scale ) {
545 ((null_driver_t*)self->driver)->m_is_scaling = scale; 545 ((null_driver_t*)self->driver)->m_is_scaling = scale;
546} 546}
547 547
548void null_set_gui_width( xine_vo_driver_t* self, int width ) { 548void null_set_gui_width( xine_vo_driver_t* self, int width ) {
549 ((null_driver_t*)self->driver)->gui_width = width; 549 ((null_driver_t*)self->driver)->gui_width = width;
550} 550}
551void null_set_gui_height( xine_vo_driver_t* self, int height ) { 551void null_set_gui_height( xine_vo_driver_t* self, int height ) {
552 ((null_driver_t*)self->driver)->gui_height = height; 552 ((null_driver_t*)self->driver)->gui_height = height;
553} 553}
554 554
555 555
556void null_set_mode( xine_vo_driver_t* self, int depth, int rgb ) { 556void null_set_mode( xine_vo_driver_t* self, int depth, int rgb ) {
557 null_driver_t* this = (null_driver_t*)self->driver; 557 null_driver_t* this = (null_driver_t*)self->driver;
558 558
559 this->bytes_per_pixel = (depth + 7 ) / 8; 559 this->bytes_per_pixel = (depth + 7 ) / 8;
560 this->bpp = this->bytes_per_pixel * 8; 560 this->bpp = this->bytes_per_pixel * 8;
561 this->depth = depth; 561 this->depth = depth;
562 printf("depth %d %d\n", depth, this->bpp); 562 printf("depth %d %d\n", depth, this->bpp);
563 printf("pixeltype %d\n", rgb ); 563 printf("pixeltype %d\n", rgb );
564 switch ( this->depth ) { 564 switch ( this->depth ) {
565 case 32: 565 case 32:
566 if( rgb == 0 ) 566 if( rgb == 0 )
567 this->yuv2rgb_mode = MODE_32_RGB; 567 this->yuv2rgb_mode = MODE_32_RGB;
568 else 568 else
569 this->yuv2rgb_mode = MODE_32_BGR; 569 this->yuv2rgb_mode = MODE_32_BGR;
570 case 24: 570 case 24:
571 if( this->bpp == 32 ) { 571 if( this->bpp == 32 ) {
572 if( rgb == 0 ) { 572 if( rgb == 0 ) {
573 this->yuv2rgb_mode = MODE_32_RGB; 573 this->yuv2rgb_mode = MODE_32_RGB;
574 } else { 574 } else {
575 this->yuv2rgb_mode = MODE_32_BGR; 575 this->yuv2rgb_mode = MODE_32_BGR;
576 } 576 }
577 }else{ 577 }else{
578 if( rgb == 0 ) 578 if( rgb == 0 )
579 this->yuv2rgb_mode = MODE_24_RGB; 579 this->yuv2rgb_mode = MODE_24_RGB;
580 else 580 else
581 this->yuv2rgb_mode = MODE_24_BGR; 581 this->yuv2rgb_mode = MODE_24_BGR;
582 }; 582 };
583 break; 583 break;
584 case 16: 584 case 16:
585 if( rgb == 0 ) { 585 if( rgb == 0 ) {