summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/combined/ffmpeg/ff_video_decoder.c4
-rw-r--r--src/demuxers/demux_mpgaudio.c70
-rw-r--r--src/demuxers/demux_real.c22
-rw-r--r--src/input/input_pvr.c30
-rw-r--r--src/spu_dec/sputext_decoder.c48
-rw-r--r--src/video_out/Makefile.am1
-rw-r--r--src/xine-engine/buffer_types.c8
7 files changed, 149 insertions, 34 deletions
diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c
index b99046547..b7a5338fc 100644
--- a/src/combined/ffmpeg/ff_video_decoder.c
+++ b/src/combined/ffmpeg/ff_video_decoder.c
@@ -313,6 +313,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)"},
};
@@ -1841,6 +1842,9 @@ static const uint32_t supported_video_types[] = {
#if defined(HAVE_FFMPEG) || CONFIG_CAVS_DECODER
BUF_VIDEO_CAVS,
#endif
+#if defined(HAVE_FFMPEG) || CONFIG_VMNC_DECODER
+ BUF_VIDEO_VMNC,
+#endif
BUF_VIDEO_THEORA_RAW,
0
};
diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c
index 27ee7f56b..549005bef 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
@@ -919,7 +947,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) {
diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c
index 21308bd45..8f6ce0611 100644
--- a/src/demuxers/demux_real.c
+++ b/src/demuxers/demux_real.c
@@ -800,12 +800,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)
{
diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c
index 50ba4720e..740d51665 100644
--- a/src/input/input_pvr.c
+++ b/src/input/input_pvr.c
@@ -1008,19 +1008,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");
+ }
}
}
@@ -1032,14 +1034,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);
diff --git a/src/spu_dec/sputext_decoder.c b/src/spu_dec/sputext_decoder.c
index 093fca1e7..0cc0ee21b 100644
--- a/src/spu_dec/sputext_decoder.c
+++ b/src/spu_dec/sputext_decoder.c
@@ -507,11 +507,52 @@ 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) {
+ /* CJK charset strings defined in iconvdata/gconv-modules of glibc */
+ static const char cjk_encoding_strings[][16] = {
+ "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",
+ };
+
+ int pstr;
+
+ /* return 1 if encoding string is one of the CJK(Chinese,Jananese,Korean)
+ * character set strings. */
+ 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;
+}
+
static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t sub_end ) {
int line, y;
int font_size;
char *font;
+ const char *encoding = (this->buf_encoding)?this->buf_encoding:
+ this->class->src_encoding;
int sub_x, sub_y, max_width;
int alignment;
int rebuild_all;
@@ -720,7 +761,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 )
diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am
index 9fd8b2d91..b7e24d088 100644
--- a/src/video_out/Makefile.am
+++ b/src/video_out/Makefile.am
@@ -142,6 +142,7 @@ xineplug_vo_out_opengl_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(MLIB_CFLAGS) -fno-
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 = $(AM_CFLAGS) $(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)
diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c
index 08ff194fa..c7b6ae860 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" }
};