changeset 35044:99ac85950277

Support decoding teletext in the format that WTV uses.
author reimar
date Sat, 01 Sep 2012 14:53:05 +0000
parents 35fe96aedad5
children fe1602874f0a
files libmpcodecs/dec_teletext.c libmpcodecs/dec_teletext.h mpcommon.c
diffstat 3 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/dec_teletext.c	Sat Sep 01 14:47:50 2012 +0000
+++ b/libmpcodecs/dec_teletext.c	Sat Sep 01 14:53:05 2012 +0000
@@ -1867,6 +1867,9 @@
     case TV_VBI_CONTROL_DECODE_PAGE:
         vbi_decode(priv,*(unsigned char**)arg);
         return VBI_CONTROL_TRUE;
+    case TV_VBI_CONTROL_DECODE_LINE:
+        vbi_decode_line(priv, arg);
+        return VBI_CONTROL_TRUE;
     case TV_VBI_CONTROL_DECODE_DVB:
         vbi_decode_dvb(priv, arg);
         return VBI_CONTROL_TRUE;
--- a/libmpcodecs/dec_teletext.h	Sat Sep 01 14:47:50 2012 +0000
+++ b/libmpcodecs/dec_teletext.h	Sat Sep 01 14:53:05 2012 +0000
@@ -70,6 +70,7 @@
 #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 TV_VBI_CONTROL_DECODE_LINE     0x559   ///< decode a single teletext line (format used by WTV)
 
 #define VBI_TFORMAT_TEXT    0               ///< text mode
 #define VBI_TFORMAT_BW      1               ///< black&white mode
--- a/mpcommon.c	Sat Sep 01 14:47:50 2012 +0000
+++ b/mpcommon.c	Sat Sep 01 14:53:05 2012 +0000
@@ -276,6 +276,15 @@
             if (type == 'd') {
                 if (d_dvdsub->demuxer->teletext) {
                     uint8_t *p = packet;
+                    if (len == 3124) { // wtv subtitle-only format
+                        while (len >= 42) {
+                            teletext_control(d_dvdsub->demuxer->teletext,
+                                TV_VBI_CONTROL_DECODE_LINE, p);
+                            p   += 42;
+                            len -= 42;
+                        }
+                        return;
+                    }
                     p++;
                     len--;
                     while (len >= 46) {