summaryrefslogtreecommitdiff
path: root/noncore/multimedia
Unidiff
Diffstat (limited to 'noncore/multimedia') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c183
1 files changed, 94 insertions, 89 deletions
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c
index 90f62f2..378bbd4 100644
--- a/noncore/multimedia/opieplayer2/nullvideo.c
+++ b/noncore/multimedia/opieplayer2/nullvideo.c
@@ -105,9 +105,9 @@ struct opie_frame_s {
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;
@@ -116,22 +116,22 @@ static uint32_t null_get_capabilities( vo_driver_t *self ){
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->proc_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
@@ -157,5 +157,5 @@ static void null_frame_field (vo_frame_t *vo_img, int which_field) {
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
@@ -167,22 +167,22 @@ static void null_frame_dispose( vo_frame_t* vo_img){
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;
@@ -190,16 +190,17 @@ static vo_frame_t* null_alloc_frame( vo_driver_t* self ){
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 double ratio_code, int format, int flags ){ 203 double ratio_code, int format,
204 int flags ){
204 null_driver_t* this = (null_driver_t*) self; 205 null_driver_t* this = (null_driver_t*) self;
205 opie_frame_t* frame = (opie_frame_t*)img; 206 opie_frame_t* frame = (opie_frame_t*)img;
@@ -236,5 +237,5 @@ static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img,
236 vo_scale_compute_output_size( &frame->sc ); 237 vo_scale_compute_output_size( &frame->sc );
237 238
238#ifdef LOG 239#ifdef LOG
239 fprintf (stderr, "nullvideo: gui %dx%d delivered %dx%d output %dx%d\n", 240 fprintf (stderr, "nullvideo: gui %dx%d delivered %dx%d output %dx%d\n",
240 frame->sc.gui_width, frame->sc.gui_height, 241 frame->sc.gui_width, frame->sc.gui_height,
@@ -244,25 +245,25 @@ static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img,
244 245
245 /* 246 /*
246 * (re-) allocate 247 * (re-) allocate
247 */ 248 */
248 if( frame->data ) { 249 if( frame->data ) {
249 if( frame->chunk[0] ){ 250 if( frame->chunk[0] ){
250 free( frame->chunk[0] ); 251 free( frame->chunk[0] );
251 frame->chunk[0] = NULL; 252 frame->chunk[0] = NULL;
252 } 253 }
253 if( frame->chunk[1] ){ 254 if( frame->chunk[1] ){
254 free ( frame->chunk[1] ); 255 free ( frame->chunk[1] );
255 frame->chunk[1] = NULL; 256 frame->chunk[1] = NULL;
256 } 257 }
257 if( frame->chunk[2] ){ 258 if( frame->chunk[2] ){
258 free ( frame->chunk[2] ); 259 free ( frame->chunk[2] );
259 frame->chunk[2] = NULL; 260 frame->chunk[2] = NULL;
260 } 261 }
261 free ( frame->data ); 262 free ( frame->data );
262 } 263 }
263 264
264 frame->data = xine_xmalloc (frame->sc.output_width 265 frame->data = xine_xmalloc (frame->sc.output_width
265 * frame->sc.output_height 266 * frame->sc.output_height
266 * this->bytes_per_pixel ); 267 * this->bytes_per_pixel );
267 268
268 if( format == XINE_IMGFMT_YV12 ) { 269 if( format == XINE_IMGFMT_YV12 ) {
@@ -276,7 +277,7 @@ static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img,
276 }else{ 277 }else{
277 frame->frame.pitches[0] = 8*((width + 3) / 4); 278 frame->frame.pitches[0] = 8*((width + 3) / 4);
278 279
279 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height, 280 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,
280 (void **)&frame->chunk[0]); 281 (void **)&frame->chunk[0]);
281 frame->chunk[1] = NULL; 282 frame->chunk[1] = NULL;
282 frame->chunk[2] = NULL; 283 frame->chunk[2] = NULL;
@@ -285,6 +286,6 @@ static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img,
285 frame->stripe_height = 16 * frame->sc.output_height / frame->sc.delivered_height; 286 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; 287 frame->bytes_per_line = frame->sc.output_width * this->bytes_per_pixel;
287 288
288 /* 289 /*
289 * set up colorspace converter 290 * set up colorspace converter
290 */ 291 */
@@ -294,22 +295,22 @@ static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img,
294 case VO_BOTTOM_FIELD: 295 case VO_BOTTOM_FIELD:
295 frame->yuv2rgb->configure (frame->yuv2rgb, 296 frame->yuv2rgb->configure (frame->yuv2rgb,
296 frame->sc.delivered_width, 297 frame->sc.delivered_width,
297 16, 298 16,
298 2*frame->frame.pitches[0], 299 2*frame->frame.pitches[0],
299 2*frame->frame.pitches[1], 300 2*frame->frame.pitches[1],
300 frame->sc.output_width, 301 frame->sc.output_width,
301 frame->stripe_height, 302 frame->stripe_height,
302 frame->bytes_per_line*2); 303 frame->bytes_per_line*2);
303 frame->yuv_stride = frame->bytes_per_line*2; 304 frame->yuv_stride = frame->bytes_per_line*2;
304 break; 305 break;
305 case VO_BOTH_FIELDS: 306 case VO_BOTH_FIELDS:
306 frame->yuv2rgb->configure (frame->yuv2rgb, 307 frame->yuv2rgb->configure (frame->yuv2rgb,
307 frame->sc.delivered_width, 308 frame->sc.delivered_width,
308 16, 309 16,
309 frame->frame.pitches[0], 310 frame->frame.pitches[0],
310 frame->frame.pitches[1], 311 frame->frame.pitches[1],
311 frame->sc.output_width, 312 frame->sc.output_width,
312 frame->stripe_height, 313 frame->stripe_height,
313 frame->bytes_per_line); 314 frame->bytes_per_line);
314 frame->yuv_stride = frame->bytes_per_line; 315 frame->yuv_stride = frame->bytes_per_line;
315 break; 316 break;
@@ -339,21 +340,21 @@ static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img,
339 break; 340 break;
340 } 341 }
341 } 342 }
342} 343}
343 344
344static void null_display_frame( vo_driver_t* self, vo_frame_t *frame_gen ){ 345static void null_display_frame( vo_driver_t* self, vo_frame_t *frame_gen ){
345 null_driver_t* this = (null_driver_t*) self; 346 null_driver_t* this = (null_driver_t*) self;
346 opie_frame_t* frame = (opie_frame_t*)frame_gen; 347 opie_frame_t* frame = (opie_frame_t*)frame_gen;
347 display_xine_frame_t display = this->frameDis; 348 display_xine_frame_t display = this->frameDis;
348 349
349 if (!this->m_show_video) 350 if (!this->m_show_video)
350 return; 351 return;
351 352
352 if( display != NULL ) { 353 if( display != NULL ) {
353 (*display)(this->caller, frame->data, 354 (*display)(this->caller, frame->data,
354 frame->sc.output_width, frame->sc.output_height, 355 frame->sc.output_width, frame->sc.output_height,
355 frame->bytes_per_line ); 356 frame->bytes_per_line );
356 } 357 }
357 358
358 frame->frame.free(&frame->frame); 359 frame->frame.free(&frame->frame);
359} 360}
@@ -361,7 +362,7 @@ static void null_display_frame( vo_driver_t* self, vo_frame_t *frame_gen ){
361 362
362/* blending related */ 363/* blending related */
363static void null_overlay_clut_yuv2rgb (null_driver_t *this, 364static void null_overlay_clut_yuv2rgb (null_driver_t *this,
364 vo_overlay_t *overlay, 365 vo_overlay_t *overlay,
365 opie_frame_t *frame) { 366 opie_frame_t *frame) {
366 int i; 367 int i;
367 clut_t* clut = (clut_t*) overlay->color; 368 clut_t* clut = (clut_t*) overlay->color;
@@ -369,6 +370,7 @@ static void null_overlay_clut_yuv2rgb (null_driver_t *this,
369 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { 370 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) {
370 *((uint32_t *)&clut[i]) = 371 *((uint32_t *)&clut[i]) =
371 frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb, 372 frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb,
372 clut[i].y, clut[i].cb, clut[i].cr); 373 clut[i].y, clut[i].cb,
374 clut[i].cr);
373 } 375 }
374 overlay->rgb_clut++; 376 overlay->rgb_clut++;
@@ -379,5 +381,5 @@ static void null_overlay_clut_yuv2rgb (null_driver_t *this,
379 *((uint32_t *)&clut[i]) = 381 *((uint32_t *)&clut[i]) =
380 frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb, 382 frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb,
381 clut[i].y, clut[i].cb, clut[i].cr); 383 clut[i].y, clut[i].cb, clut[i].cr);
382 } 384 }
383 overlay->clip_rgb_clut++; 385 overlay->clip_rgb_clut++;
@@ -385,9 +387,10 @@ static void null_overlay_clut_yuv2rgb (null_driver_t *this,
385} 387}
386 388
387static void null_overlay_blend ( vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { 389static void null_overlay_blend ( vo_driver_t *this_gen, vo_frame_t *frame_gen,
390 vo_overlay_t *overlay) {
388 null_driver_t *this = (null_driver_t *) this_gen; 391 null_driver_t *this = (null_driver_t *) this_gen;
389 opie_frame_t *frame = (opie_frame_t *) frame_gen; 392 opie_frame_t *frame = (opie_frame_t *) frame_gen;
390 393
391 if(!this->m_show_video || frame->sc.output_width == 0 394 if(!this->m_show_video || frame->sc.output_width == 0
392 || frame->sc.output_height== 0) 395 || frame->sc.output_height== 0)
393 return; 396 return;
@@ -397,5 +400,5 @@ static void null_overlay_blend ( vo_driver_t *this_gen, vo_frame_t *frame_gen, v
397 if( !overlay->rgb_clut || !overlay->clip_rgb_clut) 400 if( !overlay->rgb_clut || !overlay->clip_rgb_clut)
398 null_overlay_clut_yuv2rgb(this,overlay,frame); 401 null_overlay_clut_yuv2rgb(this,overlay,frame);
399 402
400 switch(this->bpp) { 403 switch(this->bpp) {
401 case 16: 404 case 16:
@@ -417,5 +420,5 @@ static void null_overlay_blend ( vo_driver_t *this_gen, vo_frame_t *frame_gen, v
417 /* It should never get here */ 420 /* It should never get here */
418 break; 421 break;
419 } 422 }
420 } 423 }
421} 424}
@@ -423,21 +426,21 @@ static void null_overlay_blend ( vo_driver_t *this_gen, vo_frame_t *frame_gen, v
423 426
424static int null_get_property( vo_driver_t* self, 427static int null_get_property( vo_driver_t* self,
425 int property ){ 428 int property ){
426 return 0; 429 return 0;
427} 430}
428static int null_set_property( vo_driver_t* self, 431static int null_set_property( vo_driver_t* self,
429 int property, 432 int property,
430 int value ){ 433 int value ){
431 return value; 434 return value;
432} 435}
433static void null_get_property_min_max( vo_driver_t* self, 436static void null_get_property_min_max( vo_driver_t* self,
434 int property, int *min, 437 int property, int *min,
435 int *max ){ 438 int *max ){
436 *max = 0; 439 *max = 0;
437 *min = 0; 440 *min = 0;
438} 441}
439static int null_gui_data_exchange( vo_driver_t* self, 442static int null_gui_data_exchange( vo_driver_t* self,
440 int data_type, 443 int data_type,
441 void *data ){ 444 void *data ){
442 return 0; 445 return 0;
443} 446}
@@ -450,8 +453,10 @@ static int null_redraw_needed( vo_driver_t* self ){
450 return 0; 453 return 0;
451} 454}
452 455
453 456
454xine_vo_driver_t* init_video_out_plugin( xine_t *xine, 457xine_vo_driver_t* init_video_out_plugin( xine_t *xine,
455 void* video, display_xine_frame_t frameDisplayFunc, void *userData ){ 458 void* video,
459 display_xine_frame_t frameDisplayFunc,
460 void *userData ){
456 null_driver_t *vo; 461 null_driver_t *vo;
457 vo = (null_driver_t*)malloc( sizeof(null_driver_t ) ); 462 vo = (null_driver_t*)malloc( sizeof(null_driver_t ) );
@@ -488,6 +493,6 @@ xine_vo_driver_t* init_video_out_plugin( xine_t *xine,
488 /* capabilities */ 493 /* capabilities */
489 vo->m_capabilities = /* VO_CAP_COPIES_IMAGE | */ VO_CAP_YUY2 | VO_CAP_YV12; 494 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, 495 vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap,
491 vo->yuv2rgb_cmap); 496 vo->yuv2rgb_cmap);
492 497
493 vo->caller = userData; 498 vo->caller = userData;
@@ -545,5 +550,5 @@ void null_set_scaling( xine_vo_driver_t* self, int scale ) {
545 ((null_driver_t*)self->driver)->m_is_scaling = scale; 550 ((null_driver_t*)self->driver)->m_is_scaling = scale;
546} 551}
547 552
548void null_set_gui_width( xine_vo_driver_t* self, int width ) { 553void null_set_gui_width( xine_vo_driver_t* self, int width ) {
549 ((null_driver_t*)self->driver)->gui_width = width; 554 ((null_driver_t*)self->driver)->gui_width = width;
@@ -556,5 +561,5 @@ void null_set_gui_height( xine_vo_driver_t* self, int height ) {
556void null_set_mode( xine_vo_driver_t* self, int depth, int rgb ) { 561void null_set_mode( xine_vo_driver_t* self, int depth, int rgb ) {
557 null_driver_t* this = (null_driver_t*)self->driver; 562 null_driver_t* this = (null_driver_t*)self->driver;
558 563
559 this->bytes_per_pixel = (depth + 7 ) / 8; 564 this->bytes_per_pixel = (depth + 7 ) / 8;
560 this->bpp = this->bytes_per_pixel * 8; 565 this->bpp = this->bytes_per_pixel * 8;
@@ -566,11 +571,11 @@ void null_set_mode( xine_vo_driver_t* self, int depth, int rgb ) {
566 if( rgb == 0 ) 571 if( rgb == 0 )
567 this->yuv2rgb_mode = MODE_32_RGB; 572 this->yuv2rgb_mode = MODE_32_RGB;
568 else 573 else
569 this->yuv2rgb_mode = MODE_32_BGR; 574 this->yuv2rgb_mode = MODE_32_BGR;
570 case 24: 575 case 24:
571 if( this->bpp == 32 ) { 576 if( this->bpp == 32 ) {
572 if( rgb == 0 ) { 577 if( rgb == 0 ) {
573 this->yuv2rgb_mode = MODE_32_RGB; 578 this->yuv2rgb_mode = MODE_32_RGB;
574 } else { 579 } else {
575 this->yuv2rgb_mode = MODE_32_BGR; 580 this->yuv2rgb_mode = MODE_32_BGR;
576 } 581 }