From 17db1541ed0d981b41a62a4fef080cb188990d5c Mon Sep 17 00:00:00 2001 From: Christophe Thommeret Date: Sat, 8 Dec 2007 01:33:23 +0000 Subject: spudvb osd update fix - Allow visible region updates. - Resize OSD at drawing time. --HG-- extra : transplant_source : %17%ECZ%D0j%2C%BC%06%7CO%3A%F0%C7u%A3%86%DE%8Bb%D3 --- src/libspudvb/xine_spudvb_decoder.c | 86 +++++++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/libspudvb/xine_spudvb_decoder.c b/src/libspudvb/xine_spudvb_decoder.c index 0f4716564..602723fcb 100644 --- a/src/libspudvb/xine_spudvb_decoder.c +++ b/src/libspudvb/xine_spudvb_decoder.c @@ -48,6 +48,7 @@ typedef struct { typedef struct { int width, height; + int empty; int depth; int CLUT_id; int objects_start; @@ -106,11 +107,40 @@ typedef struct dvb_spu_decoder_s { } dvb_spu_decoder_t; +static void update_osd(dvb_spu_decoder_t *this, int region_id) +{ + dvbsub_func_t *dvbsub = this->dvbsub; + region_t *reg = &dvbsub->regions[region_id]; + + if ( !reg->img ) { + if ( reg->osd ) { + pthread_mutex_lock( &this->dvbsub_osd_mutex ); + this->stream->osd_renderer->free_object( reg->osd ); + reg->osd = NULL; + pthread_mutex_unlock( &this->dvbsub_osd_mutex ); + } + return; + } + + if ( reg->osd ) { + if ( reg->width!=reg->osd->width || reg->height!=reg->osd->height ) { + pthread_mutex_lock( &this->dvbsub_osd_mutex ); + this->stream->osd_renderer->free_object( reg->osd ); + reg->osd = NULL; + pthread_mutex_unlock( &this->dvbsub_osd_mutex ); + } + } + + if ( !reg->osd ) + reg->osd = this->stream->osd_renderer->new_object( this->stream->osd_renderer, reg->width, reg->height ); +} + static void update_region (dvb_spu_decoder_t * this, int region_id, int region_width, int region_height, int fill, int fill_color) { dvbsub_func_t *dvbsub = this->dvbsub; region_t *reg = &dvbsub->regions[region_id]; + page_t *page = &dvbsub->page; /* reject invalid sizes and set some limits ! */ if ( region_width<=0 || region_height<=0 || region_width>720 || region_height>576 ) { @@ -118,19 +148,13 @@ static void update_region (dvb_spu_decoder_t * this, int region_id, int region_w free( reg->img ); reg->img = NULL; } - if ( reg->osd ) { - pthread_mutex_lock( &this->dvbsub_osd_mutex ); - this->stream->osd_renderer->free_object( reg->osd ); - reg->osd = NULL; - pthread_mutex_unlock( &this->dvbsub_osd_mutex ); - } #ifdef LOG printf("SPUDVB: rejected region %d = %dx%d\n", region_id, region_width, region_height ); #endif return; } - if ( reg->width!=region_width || reg->height!=region_height ) { + if ( reg->width*reg->heightimg ); reg->img = NULL; } - if ( reg->osd ) { - pthread_mutex_lock( &this->dvbsub_osd_mutex ); - this->stream->osd_renderer->free_object( reg->osd ); - reg->osd = NULL; - pthread_mutex_unlock( &this->dvbsub_osd_mutex ); - } } if ( !reg->img ) { @@ -151,15 +169,20 @@ static void update_region (dvb_spu_decoder_t * this, int region_id, int region_w lprintf( "can't allocate mem for region %d\n", region_id ); return; } + fill_color = 15; + fill = 1; } - if ( !reg->osd ) - reg->osd = this->stream->osd_renderer->new_object( this->stream->osd_renderer, region_width, region_height ); - if ( fill!=1 ) - fill_color = 15; - memset( reg->img, fill_color, region_width*region_height ); + if ( fill ) { + memset( reg->img, fill_color, region_width*region_height ); + reg->empty = 1; +#ifdef LOG + printf("SPUDVB : FILL REGION %d\n", region_id); +#endif + } reg->width = region_width; reg->height = region_height; + page->regions[region_id].is_visible = 1; } @@ -170,8 +193,10 @@ static void do_plot (dvb_spu_decoder_t * this, int r, int x, int y, unsigned cha i = (y * dvbsub->regions[r].width) + x; /* do some clipping */ - if ( i<(dvbsub->regions[r].width*dvbsub->regions[r].height) ) + if ( i<(dvbsub->regions[r].width*dvbsub->regions[r].height) ) { dvbsub->regions[r].img[i] = pixel; + dvbsub->regions[r].empty = 0; + } } static void plot (dvb_spu_decoder_t * this, int r, int run_length, unsigned char pixel) @@ -416,15 +441,14 @@ static void process_page_composition_segment (dvb_spu_decoder_t * this) dvbsub->page.page_version_number = (dvbsub->buf[dvbsub->i] & 0xf0) >> 4; dvbsub->page.page_state = (dvbsub->buf[dvbsub->i] & 0x0c) >> 2; dvbsub->i++; - if ((dvbsub->page.page_state != 2) && (dvbsub->page.page_state != 1)) { - return; + if (dvbsub->page.page_state==2) { + for (r=0; rpage.regions[r].is_visible = 0; } - else { + else if ( dvbsub->page.page_state!=0 && dvbsub->page.page_state!=1 ) { + return; } - for (r = 0; r < MAX_REGIONS; r++) { - dvbsub->page.regions[r].is_visible = 0; - } while (dvbsub->i < j) { region_id = dvbsub->buf[dvbsub->i++]; dvbsub->i++; /* reserved */ @@ -435,10 +459,7 @@ static void process_page_composition_segment (dvb_spu_decoder_t * this) dvbsub->page.regions[region_id].x = region_x; dvbsub->page.regions[region_id].y = region_y; - dvbsub->page.regions[region_id].is_visible = 1; - } - } @@ -655,7 +676,10 @@ static void draw_subtitles (dvb_spu_decoder_t * this) for (r = 0; r < MAX_REGIONS; r++) { if (this->dvbsub->regions[r].img) { - if (this->dvbsub->page.regions[r].is_visible && this->dvbsub->regions[r].osd) { + if (this->dvbsub->page.regions[r].is_visible && !this->dvbsub->regions[r].empty) { + update_osd( this, r ); + if ( !this->dvbsub->regions[r].osd ) + continue; /* clear osd */ this->stream->osd_renderer->clear( this->dvbsub->regions[r].osd ); if (this->dvbsub->regions[r].width>dest_width) { @@ -678,7 +702,7 @@ static void draw_subtitles (dvb_spu_decoder_t * this) printf("SPUDVB: this->vpts=%llu\n",this->vpts); #endif for ( r=0; rdvbsub->page.regions[r].is_visible && this->dvbsub->regions[r].osd ) { + if ( this->dvbsub->page.regions[r].is_visible && this->dvbsub->regions[r].osd && !this->dvbsub->regions[r].empty ) { this->stream->osd_renderer->set_position( this->dvbsub->regions[r].osd, this->dvbsub->page.regions[r].x, this->dvbsub->page.regions[r].y ); this->stream->osd_renderer->show( this->dvbsub->regions[r].osd, this->vpts ); #ifdef LOG @@ -693,8 +717,6 @@ static void draw_subtitles (dvb_spu_decoder_t * this) #endif } } - /* reset page */ - this->dvbsub->page.regions[r].is_visible = 0; } this->dvbsub_hide_timeout.tv_nsec = 0; this->dvbsub_hide_timeout.tv_sec = time(NULL) + this->dvbsub->page.page_time_out; -- cgit v1.2.3 From be63e939873fc1865c763e598e2407f23ce67246 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 9 Dec 2007 05:12:03 +0000 Subject: Enable the WMV VC1 (ffmpeg) codec. --HG-- extra : transplant_source : %15%CD%0B%2C%F2g%03%B9%25%D4%B2%8BQ%1F%EB%BB%8F%28%9B%C8 --- src/libffmpeg/ff_video_decoder.c | 4 ++++ src/xine-engine/buffer.h | 1 + src/xine-engine/buffer_types.c | 10 ++++++++++ 3 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/libffmpeg/ff_video_decoder.c b/src/libffmpeg/ff_video_decoder.c index 1e32ad3a6..cceb96bf0 100644 --- a/src/libffmpeg/ff_video_decoder.c +++ b/src/libffmpeg/ff_video_decoder.c @@ -245,6 +245,7 @@ static const ff_codec_t ff_video_lookup[] = { {BUF_VIDEO_WMV7, CODEC_ID_WMV1, "MS Windows Media Video 7 (ffmpeg)"}, {BUF_VIDEO_WMV8, CODEC_ID_WMV2, "MS Windows Media Video 8 (ffmpeg)"}, {BUF_VIDEO_WMV9, CODEC_ID_WMV3, "MS Windows Media Video 9 (ffmpeg)"}, + {BUF_VIDEO_VC1, CODEC_ID_VC1, "MS Windows Media Video VC-1 (ffmpeg)"}, {BUF_VIDEO_MPEG4, CODEC_ID_MPEG4, "ISO MPEG-4 (ffmpeg)"}, {BUF_VIDEO_XVID, CODEC_ID_MPEG4, "ISO MPEG-4 (XviD, ffmpeg)"}, {BUF_VIDEO_DIVX5, CODEC_ID_MPEG4, "ISO MPEG-4 (DivX5, ffmpeg)"}, @@ -1597,6 +1598,9 @@ static uint32_t supported_video_types[] = { #ifdef CONFIG_WMV3_DECODER BUF_VIDEO_WMV9, #endif + #ifdef CONFIG_VC1_DECODER + BUF_VIDEO_VC1, + #endif #ifdef CONFIG_MPEG4_DECODER BUF_VIDEO_MPEG4, #endif diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h index b08960e7d..35ab1e620 100644 --- a/src/xine-engine/buffer.h +++ b/src/xine-engine/buffer.h @@ -189,6 +189,7 @@ extern "C" { #define BUF_VIDEO_CAVS 0x02620000 #define BUF_VIDEO_VP6F 0x02630000 #define BUF_VIDEO_THEORA_RAW 0x02640000 +#define BUF_VIDEO_VC1 0x02650000 /* audio buffer types: (please keep in sync with buffer_types.c) */ diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c index 129d8d194..ee50e5391 100644 --- a/src/xine-engine/buffer_types.c +++ b/src/xine-engine/buffer_types.c @@ -316,6 +316,16 @@ static const video_db_t video_db[] = { BUF_VIDEO_WMV9, "Windows Media Video 9" }, +{ + { + ME_FOURCC('W','V','C','1'), + ME_FOURCC('W','M','V','A'), + ME_FOURCC('v','c','-','1'), + 0 + }, + BUF_VIDEO_VC1, + "Windows Media Video VC-1" +}, { { ME_FOURCC('c','r','a','m'), -- cgit v1.2.3