diff mpcommon.c @ 29833:b06429c8c104

Add support for DVB teletext. Patch by Francesco Lavra [francescolavra interfree it] with modifications by me.
author reimar
date Tue, 10 Nov 2009 11:31:47 +0000
parents e255f9571156
children 7119354805e7
line wrap: on
line diff
--- a/mpcommon.c	Tue Nov 10 11:26:03 2009 +0000
+++ b/mpcommon.c	Tue Nov 10 11:31:47 2009 +0000
@@ -141,9 +141,15 @@
 
         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 @@
                 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;