-rw-r--r-- | noncore/multimedia/opieplayer2/nullvideo.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c index 3cf3664..f28fba3 100644 --- a/noncore/multimedia/opieplayer2/nullvideo.c +++ b/noncore/multimedia/opieplayer2/nullvideo.c | |||
@@ -1,97 +1,97 @@ | |||
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 */ |
57 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, | 57 | typedef 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 | ||
60 | typedef struct null_driver_s null_driver_t; | 60 | typedef struct null_driver_s null_driver_t; |
61 | 61 | ||
62 | struct null_driver_s { | 62 | struct 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 | ||
89 | typedef struct opie_frame_s opie_frame_t; | 89 | typedef struct opie_frame_s opie_frame_t; |
90 | struct opie_frame_s { | 90 | struct 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 | ||
@@ -401,193 +401,193 @@ static void null_overlay_blend ( vo_driver_t *this_gen, vo_frame_t *frame_gen, v | |||
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 | ||
424 | static int null_get_property( vo_driver_t* self, | 424 | static int null_get_property( vo_driver_t* self, |
425 | int property ){ | 425 | int property ){ |
426 | return 0; | 426 | return 0; |
427 | } | 427 | } |
428 | static int null_set_property( vo_driver_t* self, | 428 | static 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 | } |
433 | static void null_get_property_min_max( vo_driver_t* self, | 433 | static 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 | } |
439 | static int null_gui_data_exchange( vo_driver_t* self, | 439 | static 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 | ||
445 | static void null_dispose ( vo_driver_t* self ){ | 445 | static 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 | } |
449 | static int null_redraw_needed( vo_driver_t* self ){ | 449 | static int null_redraw_needed( vo_driver_t* self ){ |
450 | return 0; | 450 | return 0; |
451 | } | 451 | } |
452 | 452 | ||
453 | 453 | ||
454 | xine_vo_driver_t* init_video_out_plugin( xine_t *xine, | 454 | xine_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, 1 ); | 497 | return vo_new_port( xine, ( vo_driver_t* )vo, 0 ); |
498 | } | 498 | } |
499 | 499 | ||
500 | #if 0 | 500 | #if 0 |
501 | static vo_info_t vo_info_null = { | 501 | static vo_info_t vo_info_null = { |
502 | 5, | 502 | 5, |
503 | XINE_VISUAL_TYPE_FB | 503 | XINE_VISUAL_TYPE_FB |
504 | }; | 504 | }; |
505 | 505 | ||
506 | vo_info_t *get_video_out_plugin_info(){ | 506 | vo_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 | */ |
521 | int null_is_showing_video( xine_vo_driver_t* self ){ | 521 | int 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 | } |
525 | void null_set_show_video( xine_vo_driver_t* self, int show ) { | 525 | void 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 | ||
529 | int null_is_fullscreen( xine_vo_driver_t* self ){ | 529 | int 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 | } |
532 | void null_set_fullscreen( xine_vo_driver_t* self, int screen ){ | 532 | void 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 | } |
535 | int null_is_scaling( xine_vo_driver_t* self ){ | 535 | int 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 | ||
539 | void null_set_videoGamma( xine_vo_driver_t* self , int value ) { | 539 | void 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 | ||
544 | void null_set_scaling( xine_vo_driver_t* self, int scale ) { | 544 | void 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 | ||
548 | void null_set_gui_width( xine_vo_driver_t* self, int width ) { | 548 | void 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 | } |
551 | void null_set_gui_height( xine_vo_driver_t* self, int height ) { | 551 | void 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 | ||
556 | void null_set_mode( xine_vo_driver_t* self, int depth, int rgb ) { | 556 | void 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 ) { |
586 | this->yuv2rgb_mode = MODE_16_RGB; | 586 | this->yuv2rgb_mode = MODE_16_RGB; |
587 | } else { | 587 | } else { |
588 | this->yuv2rgb_mode = MODE_16_BGR; | 588 | this->yuv2rgb_mode = MODE_16_BGR; |
589 | } | 589 | } |
590 | break; | 590 | break; |
591 | case 15: | 591 | case 15: |
592 | if( rgb == 0 ) { | 592 | if( rgb == 0 ) { |
593 | this->yuv2rgb_mode = MODE_15_RGB; | 593 | this->yuv2rgb_mode = MODE_15_RGB; |