From 8b64f6e74403379fa6e9a858e1d2f1ab178e5be4 Mon Sep 17 00:00:00 2001 From: Torsten Jager Date: Tue, 14 Feb 2012 22:03:27 +0200 Subject: Fixed asx demuxer --- src/demuxers/demux_asf.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index d2f0a89de..4689abeee 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.c @@ -1043,6 +1043,10 @@ static int asf_parse_packet_payload_header(demux_asf_t *this, uint32_t p_hdr_siz #ifdef LOG timestamp = get_le32(this); p_hdr_size += 4; duration = get_le16(this); p_hdr_size += 2; +#else + /* skip the above bytes */ + this->input->seek (this->input, 6, SEEK_CUR); + p_hdr_size += 6; #endif lprintf ("timestamp=%"PRId64", duration=%"PRId64"\n", timestamp, duration); -- cgit v1.2.3 From dafe573e4d5a6de588634e1476707dce5acaad36 Mon Sep 17 00:00:00 2001 From: Torsten Jager Date: Tue, 14 Feb 2012 22:06:31 +0200 Subject: Fix video driver crash when accessing unsupported properties --- src/video_out/video_out_syncfb.c | 8 ++++++++ src/video_out/video_out_vidix.c | 8 ++++++++ src/video_out/video_out_xcbxv.c | 9 +++++++++ src/video_out/video_out_xv.c | 9 +++++++++ src/video_out/video_out_xvmc.c | 8 ++++++++ src/video_out/video_out_xxmc.c | 8 ++++++++ 6 files changed, 50 insertions(+) (limited to 'src') diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c index 68a04c33d..4df568c76 100644 --- a/src/video_out/video_out_syncfb.c +++ b/src/video_out/video_out_syncfb.c @@ -663,6 +663,8 @@ static int syncfb_get_property(vo_driver_t* this_gen, int property) { syncfb_driver_t* this = (syncfb_driver_t *) this_gen; + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) return 0; + switch (property) { case VO_PROP_WINDOW_WIDTH: this->props[property].value = this->sc.gui_width; @@ -691,6 +693,8 @@ static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) { syncfb_driver_t* this = (syncfb_driver_t *) this_gen; + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) return 0; + switch (property) { case VO_PROP_INTERLACED: this->props[property].value = value; @@ -801,6 +805,10 @@ static void syncfb_get_property_min_max(vo_driver_t *this_gen, { syncfb_driver_t* this = (syncfb_driver_t *) this_gen; + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) { + *min = *max = 0; + return; + } *min = this->props[property].min; *max = this->props[property].max; } diff --git a/src/video_out/video_out_vidix.c b/src/video_out/video_out_vidix.c index 0a7f6a8f6..19e9d0520 100644 --- a/src/video_out/video_out_vidix.c +++ b/src/video_out/video_out_vidix.c @@ -697,6 +697,8 @@ static int vidix_get_property (vo_driver_t *this_gen, int property) { vidix_driver_t *this = (vidix_driver_t *) this_gen; + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) return 0; + switch (property) { case VO_PROP_WINDOW_WIDTH: this->props[property].value = this->sc.gui_width; @@ -731,6 +733,8 @@ static int vidix_set_property (vo_driver_t *this_gen, vidix_driver_t *this = (vidix_driver_t *) this_gen; int err; + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) return 0; + if ((value >= this->props[property].min) && (value <= this->props[property].max)) { @@ -853,6 +857,10 @@ static void vidix_get_property_min_max (vo_driver_t *this_gen, vidix_driver_t *this = (vidix_driver_t *) this_gen; + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) { + *min = *max = 0; + return; + } *min = this->props[property].min; *max = this->props[property].max; } diff --git a/src/video_out/video_out_xcbxv.c b/src/video_out/video_out_xcbxv.c index 1f580bd69..a627c802b 100644 --- a/src/video_out/video_out_xcbxv.c +++ b/src/video_out/video_out_xcbxv.c @@ -770,6 +770,8 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { static int xv_get_property (vo_driver_t *this_gen, int property) { xv_driver_t *this = (xv_driver_t *) this_gen; + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) return (0); + switch (property) { case VO_PROP_WINDOW_WIDTH: this->props[property].value = this->sc.gui_width; @@ -810,6 +812,8 @@ static int xv_set_property (vo_driver_t *this_gen, int property, int value) { xv_driver_t *this = (xv_driver_t *) this_gen; + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) return 0; + if (this->props[property].atom != XCB_NONE) { xcb_xv_get_port_attribute_cookie_t get_attribute_cookie; xcb_xv_get_port_attribute_reply_t *get_attribute_reply; @@ -899,6 +903,11 @@ static void xv_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max) { xv_driver_t *this = (xv_driver_t *) this_gen; + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) { + *min = *max = 0; + return; + } + *min = this->props[property].min; *max = this->props[property].max; } diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index af1752158..0fd8ca89a 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -875,6 +875,8 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { static int xv_get_property (vo_driver_t *this_gen, int property) { xv_driver_t *this = (xv_driver_t *) this_gen; + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) return (0); + switch (property) { case VO_PROP_WINDOW_WIDTH: this->props[property].value = this->sc.gui_width; @@ -916,6 +918,8 @@ static int xv_set_property (vo_driver_t *this_gen, int property, int value) { xv_driver_t *this = (xv_driver_t *) this_gen; + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) return 0; + if (this->props[property].atom != None) { /* value is out of bound */ @@ -1000,6 +1004,11 @@ static void xv_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max) { xv_driver_t *this = (xv_driver_t *) this_gen; + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) { + *min = *max = 0; + return; + } + *min = this->props[property].min; *max = this->props[property].max; } diff --git a/src/video_out/video_out_xvmc.c b/src/video_out/video_out_xvmc.c index aeb50271a..5644307ef 100644 --- a/src/video_out/video_out_xvmc.c +++ b/src/video_out/video_out_xvmc.c @@ -1009,6 +1009,8 @@ static int xvmc_get_property (vo_driver_t *this_gen, int property) { lprintf ("xvmc_get_property\n"); + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) return 0; + switch (property) { case VO_PROP_WINDOW_WIDTH: this->props[property].value = this->sc.gui_width; @@ -1051,6 +1053,8 @@ static int xvmc_set_property (vo_driver_t *this_gen, lprintf ("xvmc_set_property %d value %d\n",property,value); + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) return 0; + if (this->props[property].atom != None) { /* value is out of bound */ if((value < this->props[property].min) || (value > this->props[property].max)) @@ -1129,6 +1133,10 @@ static void xvmc_get_property_min_max (vo_driver_t *this_gen, lprintf ("xvmc_get_property_min_max\n"); + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) { + *min = *max = 0; + return; + } *min = this->props[property].min; *max = this->props[property].max; } diff --git a/src/video_out/video_out_xxmc.c b/src/video_out/video_out_xxmc.c index f8caec755..929e4462c 100644 --- a/src/video_out/video_out_xxmc.c +++ b/src/video_out/video_out_xxmc.c @@ -1754,6 +1754,8 @@ static void xxmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) static int xxmc_get_property (vo_driver_t *this_gen, int property) { xxmc_driver_t *this = (xxmc_driver_t *) this_gen; + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) return 0; + switch (property) { case VO_PROP_WINDOW_WIDTH: this->props[property].value = this->sc.gui_width; @@ -1804,6 +1806,8 @@ static int xxmc_set_property (vo_driver_t *this_gen, int property, int value) { xxmc_driver_t *this = (xxmc_driver_t *) this_gen; + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) return 0; + if (this->props[property].atom != None) { /* value is out of bound */ @@ -1892,6 +1896,10 @@ static void xxmc_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max) { xxmc_driver_t *this = (xxmc_driver_t *) this_gen; + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) { + *min = *max = 0; + return; + } *min = this->props[property].min; *max = this->props[property].max; } -- cgit v1.2.3 From 8104053a5d71f7ca8c673469d81fc961542e7560 Mon Sep 17 00:00:00 2001 From: Torsten Jager Date: Tue, 14 Feb 2012 22:17:08 +0200 Subject: Improved RGB->YUV conversion (use mpeg range instead of full range) Video out plugins expect mpeg range yuv data (y=16..235, uv=16..239). RGB sources (still images and audio visualisation effects) need to be converted first. --- src/xine-utils/color.c | 3 ++- src/xine-utils/xineutils.h | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/xine-utils/color.c b/src/xine-utils/color.c index 3c2388c27..8b37134b7 100644 --- a/src/xine-utils/color.c +++ b/src/xine-utils/color.c @@ -76,7 +76,8 @@ * next 9 defines. */ -#if 1 +/* convert full range rgb to mpeg range yuv */ +#if 0 #define Y_R (SCALEFACTOR * 0.29900) #define Y_G (SCALEFACTOR * 0.58700) diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index 5b16e6e3c..662f39467 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -288,18 +288,20 @@ extern void (*yuy2_to_yv12) unsigned char *v_dst, int v_dst_pitch, int width, int height) XINE_PROTECTED; -#define SCALEFACTOR 65536 +/* convert full range rgb to mpeg range yuv */ +#define SCALESHIFT 16 +#define SCALEFACTOR (1<> SCALESHIFT) + 16) #define COMPUTE_U(r, g, b) \ (unsigned char) \ - ((u_r_table[r] + u_g_table[g] + u_b_table[b]) / SCALEFACTOR + CENTERSAMPLE) + (((u_r_table[r] + u_g_table[g] + u_b_table[b]) >> SCALESHIFT) + CENTERSAMPLE) #define COMPUTE_V(r, g, b) \ (unsigned char) \ - ((v_r_table[r] + v_g_table[g] + v_b_table[b]) / SCALEFACTOR + CENTERSAMPLE) + (((v_r_table[r] + v_g_table[g] + v_b_table[b]) >> SCALESHIFT) + CENTERSAMPLE) #define UNPACK_BGR15(packed_pixel, r, g, b) \ b = (packed_pixel & 0x7C00) >> 7; \ -- cgit v1.2.3