From 46c59ae8695a4b6f62af89afef68895e70985d77 Mon Sep 17 00:00:00 2001 From: Thibaut Mattern Date: Thu, 3 Jan 2008 15:16:07 +0100 Subject: Detect corrupted or broken seek tables for CBR MP3 files. [Bug #3] --HG-- extra : transplant_source : %00%11%94ZZG%2A%A0%2A%3B%DA%CDx%AC%02%A8%E8%C3%DF%A5 --- src/demuxers/demux_mpgaudio.c | 70 ++++++++++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 73e43c199..8e716f095 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -64,6 +64,7 @@ /* Xing header stuff */ #define XING_TAG FOURCC_TAG('X', 'i', 'n', 'g') +#define INFO_TAG FOURCC_TAG('I', 'n', 'f', 'o') #define XING_FRAMES_FLAG 0x0001 #define XING_BYTES_FLAG 0x0002 #define XING_TOC_FLAG 0x0004 @@ -295,16 +296,8 @@ static int parse_frame_header(mpg_audio_frame_t *const frame, const uint8_t *con */ static xing_header_t* parse_xing_header(mpg_audio_frame_t *frame, uint8_t *buf, int bufsize) { - -#ifdef LOG - int i; -#endif uint8_t *ptr = buf; - xing_header_t *xing; - - xing = xine_xmalloc (sizeof (xing_header_t)); - if (!xing) - return NULL; + xing_header_t *xing = NULL; /* offset of the Xing header */ if (frame->lsf_bit) { @@ -319,52 +312,87 @@ static xing_header_t* parse_xing_header(mpg_audio_frame_t *frame, ptr += (9 + 4); } - if (ptr >= (buf + bufsize - 4)) return 0; + if (ptr >= (buf + bufsize - 4)) goto exit_error; lprintf("checking %08X\n", *ptr); + if (_X_BE_32(ptr) == XING_TAG) { + int has_frames_flag = 0; + int has_bytes_flag = 0; + + xing = xine_xmalloc (sizeof (xing_header_t)); + if (!xing) + goto exit_error; + lprintf("Xing header found\n"); ptr += 4; - if (ptr >= (buf + bufsize - 4)) return 0; + if (ptr >= (buf + bufsize - 4)) goto exit_error; xing->flags = _X_BE_32(ptr); ptr += 4; if (xing->flags & XING_FRAMES_FLAG) { - if (ptr >= (buf + bufsize - 4)) return 0; + if (ptr >= (buf + bufsize - 4)) goto exit_error; xing->stream_frames = _X_BE_32(ptr); ptr += 4; lprintf("stream frames: %d\n", xing->stream_frames); + has_frames_flag = 1; } if (xing->flags & XING_BYTES_FLAG) { - if (ptr >= (buf + bufsize - 4)) return 0; + if (ptr >= (buf + bufsize - 4)) goto exit_error; xing->stream_size = _X_BE_32(ptr); ptr += 4; lprintf("stream size: %d\n", xing->stream_size); + has_bytes_flag = 1; + } + + /* check if it's a useful Xing header */ + if (!has_frames_flag || !has_bytes_flag) { + lprintf("Stupid Xing tag, cannot do anything with it !\n"); + goto exit_error; } + if (xing->flags & XING_TOC_FLAG) { + int i; + lprintf("toc found\n"); - if (ptr >= (buf + bufsize - XING_TOC_LENGTH)) return 0; + if (ptr >= (buf + bufsize - XING_TOC_LENGTH)) goto exit_error; memcpy(xing->toc, ptr, XING_TOC_LENGTH); #ifdef LOG for (i = 0; i < XING_TOC_LENGTH; i++) { - lprintf("%d ", xing->toc[i]); + printf("%d ", xing->toc[i]); } - lprintf("\n"); + printf("\n"); #endif + /* check the table validity + * - MUST start with 0 + * - values MUST increase + */ + if (xing->toc[0] != 0) { + lprintf("invalid Xing toc\n"); + goto exit_error; + } + for (i = 1; i < XING_TOC_LENGTH; i++) { + if (xing->toc[i] < xing->toc[i-1]) { + lprintf("invalid Xing toc\n"); + goto exit_error; + } + } ptr += XING_TOC_LENGTH; } xing->vbr_scale = -1; if (xing->flags & XING_VBR_SCALE_FLAG) { - if (ptr >= (buf + bufsize - 4)) return 0; + if (ptr >= (buf + bufsize - 4)) goto exit_error; xing->vbr_scale = _X_BE_32(ptr); lprintf("vbr_scale: %d\n", xing->vbr_scale); } - - return xing; } else { lprintf("Xing header not found\n"); + } + return xing; + +exit_error: + lprintf("Xing header parse error\n"); free(xing); return NULL; } -} /* * Parse a Vbri header @@ -922,7 +950,7 @@ static int demux_mpgaudio_seek (demux_plugin_t *this_gen, if (this->stream_length > 0) { if (this->xing_header && - (this->xing_header->flags & (XING_TOC_FLAG | XING_BYTES_FLAG))) { + (this->xing_header->flags & XING_TOC_FLAG)) { seek_pos += xing_get_seek_point(this->xing_header, start_time, this->stream_length); lprintf("time seek: xing: time=%d, pos=%"PRId64"\n", start_time, seek_pos); } else if (this->vbri_header) { -- cgit v1.2.3 From 9276e56845b6c048cdf1e98574fa8fc80ffe8488 Mon Sep 17 00:00:00 2001 From: Richard van Paasen Date: Fri, 4 Jan 2008 00:00:08 +0100 Subject: Fixed an issue in input_pvr with setting the frequency of the tuner for ivtv versions 0.10.6+ Note: the old code divided the frequency by 62.5. But, the ivtv driver expects a different format. I changed the implementation in input_pvr such that the frequency can be given as provided by cable companies, multiplied by 1000: e.g. 503250 for 503.250 MHz. --- src/input/input_pvr.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c index f07e98133..1b8000072 100644 --- a/src/input/input_pvr.c +++ b/src/input/input_pvr.c @@ -1016,19 +1016,21 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { /* change input */ if (v4l2_data->input != -1 && v4l2_data->input != this->input) { - lprintf("change input to:%d\n", v4l2_data->input); this->input = v4l2_data->input; /* as of ivtv 0.10.6: must close and reopen to set input */ close(this->dev_fd); this->dev_fd = open (this->class->devname, O_RDWR); - if (this->dev_fd == -1) { + if (this->dev_fd < 0) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_pvr: error opening device %s\n", this->class->devname ); } else { - if( ioctl(this->dev_fd, VIDIOC_S_INPUT, &this->input) ) + if( ioctl(this->dev_fd, VIDIOC_S_INPUT, &this->input) == 0 ) { + lprintf("Tuner Input set to:%d\n", v4l2_data->input); + } else { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_pvr: error setting v4l2 input\n"); + } } } @@ -1040,14 +1042,30 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { /* change frequency */ if (v4l2_data->frequency != -1 && v4l2_data->frequency != this->frequency) { - lprintf("changing frequency to:%.2f\n", (float)v4l2_data->frequency * 62.5); + double freq = (double)v4l2_data->frequency / 1000.0; struct v4l2_frequency vf; + struct v4l2_tuner vt; + double fac = 16; + + memset(&vf, 0, sizeof(vf)); + memset(&vt, 0, sizeof(vt)); + this->frequency = v4l2_data->frequency; - vf.frequency = this->frequency; + + if (ioctl(this->dev_fd, VIDIOC_G_TUNER, &vt) == 0) { + fac = (vt.capability & V4L2_TUNER_CAP_LOW) ? 16000 : 16; + } + vf.tuner = 0; - if( ioctl(this->dev_fd, VIDIOC_S_FREQUENCY, &vf) ) + vf.type = vt.type; + vf.frequency = (__u32)(freq * fac); + + if (ioctl(this->dev_fd, VIDIOC_S_FREQUENCY, &vf) == 0) { + lprintf("Tuner Frequency set to %d (%f.3 MHz)\n", vf.frequency, vf.frequency / fac); + } else { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_pvr: error setting v4l2 frequency\n"); + } } pthread_mutex_unlock(&this->dev_lock); -- cgit v1.2.3 From 29de3d76ef4761e34aee107d458bfabe3ce96298 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Fri, 4 Jan 2008 18:12:53 +0000 Subject: Pass $(X_CFLAGS) when compiling syncfb. Noticed by Thomas Koeller . --- src/video_out/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index c40535d9e..d447417c5 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -136,7 +136,7 @@ xineplug_vo_out_opengl_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(MLIB_CFLAGS) xineplug_vo_out_syncfb_la_SOURCES = video_out_syncfb.c xineplug_vo_out_syncfb_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL) -xineplug_vo_out_syncfb_la_CFLAGS = $(VISIBILITY_FLAG) +xineplug_vo_out_syncfb_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) xineplug_vo_out_pgx64_la_SOURCES = video_out_pgx64.c xineplug_vo_out_pgx64_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(SUNDGA_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL) -- cgit v1.2.3 From 051c124db8a2ab27f45530323d9cbd673e277794 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sat, 5 Jan 2008 22:18:27 +0000 Subject: Enable the VMware Screen codec (ffmpeg). --- src/libffmpeg/ff_video_decoder.c | 4 ++++ src/xine-engine/buffer.h | 1 + src/xine-engine/buffer_types.c | 8 ++++++++ 3 files changed, 13 insertions(+) (limited to 'src') diff --git a/src/libffmpeg/ff_video_decoder.c b/src/libffmpeg/ff_video_decoder.c index dc1176e78..dc07abb9f 100644 --- a/src/libffmpeg/ff_video_decoder.c +++ b/src/libffmpeg/ff_video_decoder.c @@ -315,6 +315,7 @@ static const ff_codec_t ff_video_lookup[] = { {BUF_VIDEO_KMVC, CODEC_ID_KMVC, "Karl Morton's Video Codec (ffmpeg)"}, {BUF_VIDEO_FLASHSV, CODEC_ID_FLASHSV, "Flash Screen Video (ffmpeg)"}, {BUF_VIDEO_CAVS, CODEC_ID_CAVS, "Chinese AVS (ffmpeg)"}, + {BUF_VIDEO_VMNC, CODEC_ID_VMNC, "VMware Screen Codec (ffmpeg)"}, {BUF_VIDEO_THEORA_RAW, CODEC_ID_THEORA, "Theora (ffmpeg)"}, }; @@ -1855,6 +1856,9 @@ static uint32_t supported_video_types[] = { #ifdef CONFIG_CAVS_DECODER BUF_VIDEO_CAVS, #endif + #ifdef CONFIG_VMNC_DECODER + BUF_VIDEO_VMNC, + #endif BUF_VIDEO_THEORA_RAW, 0 }; diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h index 35ab1e620..2bcc29510 100644 --- a/src/xine-engine/buffer.h +++ b/src/xine-engine/buffer.h @@ -190,6 +190,7 @@ extern "C" { #define BUF_VIDEO_VP6F 0x02630000 #define BUF_VIDEO_THEORA_RAW 0x02640000 #define BUF_VIDEO_VC1 0x02650000 +#define BUF_VIDEO_VMNC 0x02660000 /* 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 ee50e5391..7242738e1 100644 --- a/src/xine-engine/buffer_types.c +++ b/src/xine-engine/buffer_types.c @@ -771,6 +771,14 @@ static const video_db_t video_db[] = { BUF_VIDEO_KMVC, "Karl Morton's Video Codec" }, +{ + { + ME_FOURCC('V','M','n','c'), + 0 + }, + BUF_VIDEO_VMNC, + "VMware Screen Codec" +}, { { 0 }, 0, "last entry" } }; -- cgit v1.2.3 From ff632b94b6b25c35239ebb49a8e123d11f2fa8f4 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 6 Jan 2008 03:30:02 +0000 Subject: Tell the Real demuxer about lists of http references. Such broken wrong-extension wrong-MIME-type lists exist in the wild... --- src/demuxers/demux_real.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index 85d7dc5a3..9206bfc74 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -806,12 +806,22 @@ static int demux_real_parse_references( demux_real_t *this) { if (!strncmp(buf,"http://",7)) { - for (i = 0; buf[i] && !isspace(buf[i]); ++i) - /**/; - buf[i] = 0; - lprintf("reference [%s] found\n", buf); - - _x_demux_send_mrl_reference (this->stream, 0, buf, NULL, 0, 0); + i = 0; + while (buf[i]) + { + j = i; + while (buf[i] && !isspace(buf[i])) + ++i; /* skip non-space */ + len = buf[i]; + buf[i] = 0; + if (strncmp (buf + j, "http://", 7) || (i - j) < 8) + break; /* stop at the first non-http reference */ + lprintf("reference [%s] found\n", buf + j); + _x_demux_send_mrl_reference (this->stream, 0, buf + j, NULL, 0, 0); + buf[i] = (char) len; + while (buf[i] && isspace(buf[i])) + ++i; /* skip spaces */ + } } else for (i = 0; i < buf_used; ++i) { -- cgit v1.2.3 From 45aa7ebe596abd3263c747c642a2416a7ebbbbba Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Sun, 6 Jan 2008 16:03:20 +0000 Subject: for resolving Korean subtitle bug In draw_subtitle(), if the given encoding is one the CJK charset, colored typefaces functionality is disabled and subtitles are printed with the render_text() method. Otherwise subtitles are drawn by ogm_render_line() function. --- src/libsputext/xine_sputext_decoder.c | 50 ++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libsputext/xine_sputext_decoder.c b/src/libsputext/xine_sputext_decoder.c index 1de1eb099..d45886300 100644 --- a/src/libsputext/xine_sputext_decoder.c +++ b/src/libsputext/xine_sputext_decoder.c @@ -506,11 +506,54 @@ static void read_ssa_tag(sputext_decoder_t *this, const char* text, (*sub_x), (*sub_y), (*max_width), (*alignment)); } +static int is_cjk_encoding(const char *enc) { + char **pstr; + + /* CJK charset strings defined in iconvdata/gconv-modules of glibc */ + static char *cjk_encoding_strings[] = { + "SJIS", + "CP932", + "EUC-KR", + "UHC", + "JOHAB", + "BIG5", + "BIG5HKSCS", + "EUC-JP-MS", + "EUC-JP", + "EUC-CN", + "GBBIG5", + "GBK", + "GBGBK", + "EUC-TW", + "ISO-2022-JP", + "ISO-2022-JP-2", + "ISO-2022-JP-3", + "ISO-2022-KR", + "ISO-2022-CN", + "ISO-2022-CN-EXT", + "GB18030", + "EUC-JISX0213", + "SHIFT_JISX0213", + NULL + }; + + /* return 1 if encoding string is one of the CJK(Chinese,Jananese,Korean) + * character set strings. */ + for (pstr = cjk_encoding_strings; *pstr; pstr++) { + if (strcasecmp(enc, *pstr) == 0) + return 1; + } + + return 0; +} + static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t sub_end ) { int line, y; int font_size; char *font; + char *encoding = (this->buf_encoding)?this->buf_encoding: + this->class->src_encoding; int sub_x, sub_y, max_width; int alignment; int rebuild_all; @@ -719,7 +762,12 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su } } - ogm_render_line(this, x, y + line*this->line_height, this->text[line]); + if( is_cjk_encoding(encoding) ) { + this->renderer->render_text (this->osd, x, y + line * this->line_height, + this->text[line], OSD_TEXT1); + } else { + ogm_render_line(this, x, y + line*this->line_height, this->text[line]); + } } if( font_size != this->font_size ) -- cgit v1.2.3 From 3b8eab0196256be7240878cb718fceb7cd373549 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 6 Jan 2008 15:56:24 +0000 Subject: Constify bits of the OGM subtitle hack. Add a changelog entry. --- src/libsputext/xine_sputext_decoder.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/libsputext/xine_sputext_decoder.c b/src/libsputext/xine_sputext_decoder.c index d45886300..d0cab9cbf 100644 --- a/src/libsputext/xine_sputext_decoder.c +++ b/src/libsputext/xine_sputext_decoder.c @@ -507,10 +507,8 @@ static void read_ssa_tag(sputext_decoder_t *this, const char* text, } static int is_cjk_encoding(const char *enc) { - char **pstr; - /* CJK charset strings defined in iconvdata/gconv-modules of glibc */ - static char *cjk_encoding_strings[] = { + static const char cjk_encoding_strings[][16] = { "SJIS", "CP932", "EUC-KR", @@ -534,15 +532,15 @@ static int is_cjk_encoding(const char *enc) { "GB18030", "EUC-JISX0213", "SHIFT_JISX0213", - NULL }; + int pstr; + /* return 1 if encoding string is one of the CJK(Chinese,Jananese,Korean) * character set strings. */ - for (pstr = cjk_encoding_strings; *pstr; pstr++) { - if (strcasecmp(enc, *pstr) == 0) + for (pstr = 0; pstr < sizeof (cjk_encoding_strings) / sizeof (cjk_encoding_strings[0]); pstr++) + if (strcasecmp (enc, cjk_encoding_strings[pstr]) == 0) return 1; - } return 0; } @@ -552,7 +550,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su int line, y; int font_size; char *font; - char *encoding = (this->buf_encoding)?this->buf_encoding: + const char *encoding = (this->buf_encoding)?this->buf_encoding: this->class->src_encoding; int sub_x, sub_y, max_width; int alignment; -- cgit v1.2.3