summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-11-10 11:31:47 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-11-10 11:31:47 +0000
commit9a8a73e547dd662bce82cfe52fde37dd7409f1d2 (patch)
treeb6dd51d6090a0a23b7f8675ad94645980eae8b24
parent1135e23dfc98a161a4da78519fa200f2c982a064 (diff)
downloadmpv-9a8a73e547dd662bce82cfe52fde37dd7409f1d2.tar.bz2
mpv-9a8a73e547dd662bce82cfe52fde37dd7409f1d2.tar.xz
Add support for DVB teletext.
Patch by Francesco Lavra [francescolavra interfree it] with modifications by me. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29875 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--DOCS/man/en/mplayer.13
-rw-r--r--libmpcodecs/dec_teletext.c26
-rw-r--r--libmpcodecs/dec_teletext.h1
-rw-r--r--mpcommon.c24
4 files changed, 52 insertions, 2 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index bf3db2fd53..151e4d74a5 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -431,7 +431,8 @@ Confirm choice.
.RS
.
(The following keys are only valid if teletext support is enabled during
-compilation: They are used for controlling TV teletext.)
+compilation: They are used for controlling TV teletext, whose data may come
+from either an analog TV source or an MPEG Transport Stream.)
.RE
.PP
.PD 0
diff --git a/libmpcodecs/dec_teletext.c b/libmpcodecs/dec_teletext.c
index d063860fd6..5be9812086 100644
--- a/libmpcodecs/dec_teletext.c
+++ b/libmpcodecs/dec_teletext.c
@@ -1537,6 +1537,29 @@ static void vbi_decode(priv_vbi_t* priv,unsigned char*buf){
}
+/**
+ * \brief decodes a vbi line from a DVB teletext stream
+ * \param priv private data structure
+ * \param buf buffer with DVB teletext data
+ *
+ * No locking is done since this is only called from a single-threaded context
+ */
+static void vbi_decode_dvb(priv_vbi_t *priv, const uint8_t buf[44]){
+ int i;
+ uint8_t data[42];
+
+ mp_msg(MSGT_TELETEXT,MSGL_DBG3, "vbi: vbi_decode_dvb\n");
+
+ /* Reverse bit order, skipping the first two bytes (field parity, line
+ offset and framing code). */
+ for (i = 0; i < sizeof(data); i++)
+ data[i] = av_reverse[buf[2 + i]];
+
+ vbi_decode_line(priv, data);
+ if (priv->cache_reset)
+ priv->cache_reset--;
+}
+
/*
---------------------------------------------------------------------------------
Public routines
@@ -1846,6 +1869,9 @@ int teletext_control(void* p, int cmd, void *arg)
case TV_VBI_CONTROL_DECODE_PAGE:
vbi_decode(priv,*(unsigned char**)arg);
return VBI_CONTROL_TRUE;
+ case TV_VBI_CONTROL_DECODE_DVB:
+ vbi_decode_dvb(priv, arg);
+ return VBI_CONTROL_TRUE;
case TV_VBI_CONTROL_GET_VBIPAGE:
if(!priv->on)
return VBI_CONTROL_FALSE;
diff --git a/libmpcodecs/dec_teletext.h b/libmpcodecs/dec_teletext.h
index 50d72e9edc..9cbeae813d 100644
--- a/libmpcodecs/dec_teletext.h
+++ b/libmpcodecs/dec_teletext.h
@@ -69,6 +69,7 @@ int teletext_control(void* p, int cmd, void *arg);
#define TV_VBI_CONTROL_STOP 0x555 ///< vbi stop
#define TV_VBI_CONTROL_DECODE_PAGE 0x556 ///< decode vbi page
#define TV_VBI_CONTROL_GET_NETWORKNAME 0x557 ///< get current network name
+#define TV_VBI_CONTROL_DECODE_DVB 0x558 ///< decode DVB teletext
#define VBI_TFORMAT_TEXT 0 ///< text mode
#define VBI_TFORMAT_BW 1 ///< black&white mode
diff --git a/mpcommon.c b/mpcommon.c
index 5e2f85a606..ba5e20db89 100644
--- a/mpcommon.c
+++ b/mpcommon.c
@@ -141,9 +141,15 @@ void update_subtitles(sh_video_t *sh_video, double refpts, demux_stream_t *d_dvd
if (spudec_changed(vo_spudec))
vo_osd_changed(OSDTYPE_SPU);
- } else if (dvdsub_id >= 0 && (type == 't' || type == 'm' || type == 'a')) {
+ } else if (dvdsub_id >= 0 && (type == 't' || type == 'm' || type == 'a' || type == 'd')) {
double curpts = refpts + sub_delay;
double endpts;
+ if (type == 'd' && !d_dvdsub->demuxer->teletext) {
+ tt_stream_props tsp = {0};
+ void *ptr = &tsp;
+ if (teletext_control(NULL, TV_VBI_CONTROL_START, &ptr) == VBI_CONTROL_TRUE)
+ d_dvdsub->demuxer->teletext = ptr;
+ }
if (d_dvdsub->non_interleaved)
ds_get_next_pts(d_dvdsub);
while (d_dvdsub->first) {
@@ -157,6 +163,22 @@ void update_subtitles(sh_video_t *sh_video, double refpts, demux_stream_t *d_dvd
len = FFMIN(len - 2, AV_RB16(packet));
packet += 2;
}
+ if (type == 'd') {
+ if (d_dvdsub->demuxer->teletext) {
+ uint8_t *p = packet;
+ p++;
+ len--;
+ while (len >= 46) {
+ int sublen = p[1];
+ if (p[0] == 2 || p[0] == 3)
+ teletext_control(d_dvdsub->demuxer->teletext,
+ TV_VBI_CONTROL_DECODE_DVB, p + 2);
+ p += sublen + 2;
+ len -= sublen + 2;
+ }
+ }
+ continue;
+ }
#ifdef CONFIG_ASS
if (ass_enabled) {
sh_sub_t* sh = d_dvdsub->sh;