summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_ts.c34
-rw-r--r--src/video_dec/libvdpau/vdpau_mpeg12.c3
-rw-r--r--src/video_out/video_out_vdpau.c90
3 files changed, 92 insertions, 35 deletions
diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c
index 6f5053a37..79c802cc5 100644
--- a/src/demuxers/demux_ts.c
+++ b/src/demuxers/demux_ts.c
@@ -1,3 +1,4 @@
+
/*
* Copyright (C) 2000-2003 the xine project
*
@@ -233,6 +234,8 @@
STREAM_VIDEO_MPEG = 0x80,
STREAM_AUDIO_AC3 = 0x81,
STREAM_SPU_BITMAP_HDMV = 0x90,
+
+ STREAM_VIDEO_VC1 = 0xea, /* VC-1 Video */
} streamType;
#define WRAP_THRESHOLD 270000
@@ -272,7 +275,7 @@ typedef struct {
} demux_ts_media;
/* DVBSUB */
-#define MAX_SPU_LANGS 16
+#define MAX_SPU_LANGS 32
typedef struct {
spu_dvb_descriptor_t desc;
@@ -281,7 +284,7 @@ typedef struct {
} demux_ts_spu_lang;
/* Audio Channels */
-#define MAX_AUDIO_TRACKS 16
+#define MAX_AUDIO_TRACKS 32
typedef struct {
int pid;
@@ -652,13 +655,12 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt,
this->last_pmt_crc = 0;
this->videoPid = INVALID_PID;
this->spu_pid = INVALID_PID;
- }
- this->pmt_pid[program_count] = pmt_pid;
- if (this->pmt[program_count] != NULL) {
- free(this->pmt[program_count]);
- this->pmt[program_count] = NULL;
- this->pmt_write_ptr[program_count] = NULL;
+ if (this->pmt[program_count] != NULL) {
+ free(this->pmt[program_count]);
+ this->pmt[program_count] = NULL;
+ this->pmt_write_ptr[program_count] = NULL;
+ }
}
#ifdef TS_PAT_LOG
if (this->program_number[program_count] != INVALID_PROGRAM)
@@ -746,6 +748,13 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
p += header_len + 9;
packet_len -= header_len + 3;
+ if (m->descriptor_tag == STREAM_VIDEO_VC1) {
+ m->content = p;
+ m->size = packet_len;
+ m->type = BUF_VIDEO_VC1;
+ return 1;
+ }
+
if (m->descriptor_tag == STREAM_SPU_BITMAP_HDMV) {
long payload_len = ((buf[4] << 8) | buf[5]) - header_len - 3;
@@ -1316,6 +1325,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
case ISO_13818_VIDEO:
case ISO_14496_PART2_VIDEO:
case ISO_14496_PART10_VIDEO:
+ case STREAM_VIDEO_VC1:
if (this->videoPid == INVALID_PID) {
#ifdef TS_PMT_LOG
printf ("demux_ts: PMT video pid 0x%.4x type %2.2x\n", pid, stream[0]);
@@ -1446,6 +1456,14 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
if (this->hdmv > 0) {
if (pid >= 0x1200 && pid < 0x1300) {
/* HDMV Presentation Graphics / SPU */
+
+ if (this->spu_langs_count >= MAX_SPU_LANGS) {
+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
+ "demux_ts: too many SPU tracks! ignoring pid 0x%.4x\n",
+ pid);
+ break;
+ }
+
demux_ts_spu_lang *lang = &this->spu_langs[this->spu_langs_count];
memset(lang->desc.lang, 0, sizeof(lang->desc.lang));
diff --git a/src/video_dec/libvdpau/vdpau_mpeg12.c b/src/video_dec/libvdpau/vdpau_mpeg12.c
index d12557ced..09399ac3b 100644
--- a/src/video_dec/libvdpau/vdpau_mpeg12.c
+++ b/src/video_dec/libvdpau/vdpau_mpeg12.c
@@ -794,7 +794,8 @@ static void vdpau_mpeg12_decode_data (video_decoder_t *this_gen, buf_element_t *
if ( !buf->size )
return;
- seq->cur_pts = buf->pts;
+ if ( buf->pts )
+ seq->cur_pts = buf->pts;
int size = seq->bufpos+buf->size;
if ( seq->bufsize < size ) {
diff --git a/src/video_out/video_out_vdpau.c b/src/video_out/video_out_vdpau.c
index d458b3a0f..4a8758bdb 100644
--- a/src/video_out/video_out_vdpau.c
+++ b/src/video_out/video_out_vdpau.c
@@ -352,6 +352,7 @@ typedef struct {
int enable_inverse_telecine;
int honor_progressive;
int skip_chroma;
+ int studio_levels;
int vdp_runtime_nr;
int reinit_needed;
@@ -1350,15 +1351,58 @@ static void vdpau_update_csc( vdpau_driver_t *this_gen )
float contrast = this_gen->contrast/100.0;
float brightness = this_gen->brightness/100.0;
- printf( "vo_vdpau: vdpau_update_csc: hue=%f, saturation=%f, contrast=%f, brightness=%f, color_standard=%d\n", hue, saturation, contrast, brightness, this_gen->color_standard );
+ printf( "vo_vdpau: vdpau_update_csc: hue=%f, saturation=%f, contrast=%f, brightness=%f, color_standard=%d studio_levels=%d\n", hue, saturation, contrast, brightness, this_gen->color_standard, this_gen->studio_levels );
+ VdpStatus st;
VdpCSCMatrix matrix;
VdpProcamp procamp = { VDP_PROCAMP_VERSION, brightness, contrast, saturation, hue };
- VdpStatus st = vdp_generate_csc_matrix( &procamp, this_gen->color_standard, &matrix );
- if ( st != VDP_STATUS_OK ) {
- printf( "vo_vdpau: error, can't generate csc matrix !!\n" );
- return;
+ if ( this_gen->studio_levels ) {
+ int i;
+ float Kr, Kg, Kb;
+ float uvcos = procamp.saturation * cos(procamp.hue);
+ float uvsin = procamp.saturation * sin(procamp.hue);
+ int rgbmin = 16;
+ int rgbr = 235 - 16;
+ switch ( this_gen->color_standard ) {
+ case VDP_COLOR_STANDARD_SMPTE_240M:
+ Kr = 0.2122;
+ Kg = 0.7013;
+ Kb = 0.0865;
+ break;
+ case VDP_COLOR_STANDARD_ITUR_BT_709:
+ Kr = 0.2125;
+ Kg = 0.7154;
+ Kb = 0.0721;
+ break;
+ case VDP_COLOR_STANDARD_ITUR_BT_601:
+ default:
+ Kr = 0.299;
+ Kg = 0.587;
+ Kb = 0.114;
+ break;
+ }
+ float uv_coeffs[3][2] = {{ 0.000, (rgbr / 112.0) * (1 - Kr) },
+ {-(rgbr / 112.0) * (1 - Kb) * Kb / Kg, -(rgbr / 112.0) * (1 - Kr) * Kr / Kg },
+ { (rgbr / 112.0) * (1 - Kb), 0.000 }};
+ for (i = 0; i < 3; ++i) {
+ matrix[i][3] = procamp.brightness;
+ matrix[i][0] = rgbr * procamp.contrast / 219;
+ matrix[i][3] += (-16 / 255.0) * matrix[i][0];
+ matrix[i][1] = uv_coeffs[i][0] * uvcos + uv_coeffs[i][1] * uvsin;
+ matrix[i][3] += (-128 / 255.0) * matrix[i][1];
+ matrix[i][2] = uv_coeffs[i][0] * uvsin + uv_coeffs[i][1] * uvcos;
+ matrix[i][3] += (-128 / 255.0) * matrix[i][2];
+ matrix[i][3] += rgbmin / 255.0;
+ matrix[i][3] += 0.5 - procamp.contrast / 2.0;
+ }
+ }
+ else {
+ st = vdp_generate_csc_matrix( &procamp, this_gen->color_standard, &matrix );
+ if ( st != VDP_STATUS_OK ) {
+ printf( "vo_vdpau: error, can't generate csc matrix !!\n" );
+ return;
+ }
}
VdpVideoMixerAttribute attributes [] = { VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX };
void* attribute_values[] = { &matrix };
@@ -1394,6 +1438,15 @@ static void vdpau_set_skip_chroma( void *this_gen, xine_cfg_entry_t *entry )
+static void vdpau_set_studio_levels( void *this_gen, xine_cfg_entry_t *entry )
+{
+ vdpau_driver_t *this = (vdpau_driver_t *) this_gen;
+ this->studio_levels = entry->num_value;
+ vdpau_update_csc( this );
+}
+
+
+
static void vdpau_shift_queue( vo_driver_t *this_gen )
{
vdpau_driver_t *this = (vdpau_driver_t *) this_gen;
@@ -2536,6 +2589,11 @@ static vo_driver_t *vdpau_open_plugin (video_driver_class_t *class_gen, const vo
10, vdpau_set_skip_chroma, this );
}
+ this->studio_levels = config->register_bool( config, "video.output.vdpau_studio_levels", 0,
+ _("vdpau: disable studio level"),
+ _("Setting to true enables studio levels (16-219) instead of PC levels (0-255) in RGB colors.\n\n"),
+ 10, vdpau_set_studio_levels, this );
+
/* number of video frames from config - register it with the default value. */
int frame_num = config->register_num (config, "engine.buffers.video_num_frames", 15, /* default */
_("default number of video frames"),
@@ -2598,26 +2656,6 @@ static vo_driver_t *vdpau_open_plugin (video_driver_class_t *class_gen, const vo
* class functions
*/
-static char* vdpau_get_identifier (video_driver_class_t *this_gen)
-{
-}
-
-
-
-static char* vdpau_get_description (video_driver_class_t *this_gen)
-{
-}
-
-
-
-static void vdpau_dispose_class (video_driver_class_t *this_gen)
-{
- vdpau_class_t *this = (vdpau_class_t *) this_gen;
- free (this);
-}
-
-
-
static void *vdpau_init_class (xine_t *xine, void *visual_gen)
{
vdpau_class_t *this = (vdpau_class_t *) calloc(1, sizeof(vdpau_class_t));
@@ -2647,4 +2685,4 @@ const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
{ PLUGIN_VIDEO_OUT, 22, "vdpau", XINE_VERSION_CODE, &vo_info_vdpau, vdpau_init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
-}; \ No newline at end of file
+};