summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2007-12-09 05:26:57 +0000
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2007-12-09 05:26:57 +0000
commit839f1c05e75c6f0ea8a96a7994c27445f2db4e2e (patch)
tree57f7b0fe9f1726b7ae44b3d6789e604665ed1ef1 /src
parent18425f7e1c44a3d9280cbc6f9220032c4077dd25 (diff)
parentbe63e939873fc1865c763e598e2407f23ce67246 (diff)
downloadxine-lib-839f1c05e75c6f0ea8a96a7994c27445f2db4e2e.tar.gz
xine-lib-839f1c05e75c6f0ea8a96a7994c27445f2db4e2e.tar.bz2
Merge from 1.1.
Diffstat (limited to 'src')
-rw-r--r--src/libffmpeg/ff_video_decoder.c4
-rw-r--r--src/libspudvb/xine_spudvb_decoder.c86
-rw-r--r--src/xine-engine/buffer.h1
-rw-r--r--src/xine-engine/buffer_types.c10
4 files changed, 69 insertions, 32 deletions
diff --git a/src/libffmpeg/ff_video_decoder.c b/src/libffmpeg/ff_video_decoder.c
index 0f63df738..df0973030 100644
--- a/src/libffmpeg/ff_video_decoder.c
+++ b/src/libffmpeg/ff_video_decoder.c
@@ -243,6 +243,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)"},
@@ -1595,6 +1596,9 @@ static uint32_t supported_video_types[] = {
#if defined(HAVE_FFMPEG) || CONFIG_WMV3_DECODER
BUF_VIDEO_WMV9,
#endif
+#if defined(HAVE_FFMPEG) || CONFIG_VC1_DECODER
+ BUF_VIDEO_VC1,
+#endif
#if defined(HAVE_FFMPEG) || CONFIG_MPEG4_DECODER
BUF_VIDEO_MPEG4,
#endif
diff --git a/src/libspudvb/xine_spudvb_decoder.c b/src/libspudvb/xine_spudvb_decoder.c
index 0f300138a..af9000a0b 100644
--- a/src/libspudvb/xine_spudvb_decoder.c
+++ b/src/libspudvb/xine_spudvb_decoder.c
@@ -49,6 +49,7 @@ typedef struct {
typedef struct {
int width, height;
+ int empty;
int depth;
int CLUT_id;
int objects_start;
@@ -107,11 +108,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 ) {
@@ -119,19 +149,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->height<region_width*region_height ) {
#ifdef LOG
printf("SPUDVB: update size of region %d = %dx%d\n", region_id, region_width, region_height);
#endif
@@ -139,12 +163,6 @@ 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 );
- }
}
if ( !reg->img ) {
@@ -152,15 +170,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;
}
@@ -171,8 +194,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)
@@ -429,15 +454,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; r<MAX_REGIONS; r++)
+ dvbsub->page.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 */
@@ -448,10 +472,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;
-
}
-
}
@@ -668,7 +689,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) {
@@ -691,7 +715,7 @@ static void draw_subtitles (dvb_spu_decoder_t * this)
printf("SPUDVB: this->vpts=%llu\n",this->vpts);
#endif
for ( r=0; r<MAX_REGIONS; r++ ) {
- 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].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
@@ -706,8 +730,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;
diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h
index 20579f12d..ce209c9da 100644
--- a/src/xine-engine/buffer.h
+++ b/src/xine-engine/buffer.h
@@ -196,6 +196,7 @@ extern "C" {
#define BUF_VIDEO_CAVS 0x02620000
#define BUF_VIDEO_VP6F 0x02630000
#define BUF_VIDEO_THEORA_RAW 0x02640000
+#define BUF_VIDEO_VC1 0x02650000
/*@}*/
/**
diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c
index 827394374..eece2df90 100644
--- a/src/xine-engine/buffer_types.c
+++ b/src/xine-engine/buffer_types.c
@@ -318,6 +318,16 @@ static const video_db_t video_db[] = {
},
{
{
+ 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'),
ME_FOURCC('C','R','A','M'),
ME_FOURCC('M','S','V','C'),