changeset 34761:02a03e00341e

Support EIA-608 captions in MOV.
author reimar
date Sat, 07 Apr 2012 20:08:53 +0000
parents ca982f21b1e4
children c1db6548917e
files libmpdemux/demux_lavf.c mpcommon.c sub/sub_cc.c sub/sub_cc.h
diffstat 4 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_lavf.c	Sat Apr 07 19:37:11 2012 +0000
+++ b/libmpdemux/demux_lavf.c	Sat Apr 07 20:08:53 2012 +0000
@@ -439,6 +439,12 @@
                 type = 'd';
             else if(codec->codec_id == CODEC_ID_HDMV_PGS_SUBTITLE)
                 type = 'p';
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 14, 100)
+            else if(codec->codec_id == CODEC_ID_EIA_608)
+                type = 'c';
+#endif
+            else if(codec->codec_tag == MKTAG('c', '6', '0', '8'))
+                type = 'c';
             else
                 break;
             sh_sub = new_sh_sub_sid(demuxer, i, priv->sub_streams, lang ? lang->value : NULL);
--- a/mpcommon.c	Sat Apr 07 19:37:11 2012 +0000
+++ b/mpcommon.c	Sat Apr 07 20:08:53 2012 +0000
@@ -46,6 +46,7 @@
 #include "sub/ass_mp.h"
 #include "sub/vobsub.h"
 #include "sub/av_sub.h"
+#include "sub/sub_cc.h"
 #include "libmpcodecs/dec_teletext.h"
 #include "libavutil/intreadwrite.h"
 #include "m_option.h"
@@ -181,6 +182,7 @@
         if (is_av_sub(type))
             reset_avsub(d_dvdsub->sh);
 #endif
+        subcc_reset();
     }
     // find sub
     if (subdata) {
@@ -240,7 +242,7 @@
             if (vo_vobsub || timestamp >= 0)
                 spudec_assemble(vo_spudec, packet, len, timestamp);
         }
-    } else if (is_text_sub(type) || is_av_sub(type) || type == 'd') {
+    } else if (is_text_sub(type) || is_av_sub(type) || type == 'd' || type == 'c') {
         int orig_type = type;
         double endpts;
         if (type == 'd' && !d_dvdsub->demuxer->teletext) {
@@ -287,6 +289,10 @@
                 }
                 continue;
             }
+            if (type == 'c') {
+                subcc_process_data(packet, len);
+                continue;
+            }
 #ifdef CONFIG_ASS
             if (ass_enabled) {
                 sh_sub_t* sh = d_dvdsub->sh;
--- a/sub/sub_cc.c	Sat Apr 07 19:37:11 2012 +0000
+++ b/sub/sub_cc.c	Sat Apr 07 20:08:53 2012 +0000
@@ -126,6 +126,13 @@
 	initialized=1;
 }
 
+void subcc_reset(void)
+{
+    if (!initialized)
+        return;
+    clear_buffer(&buf1);
+    clear_buffer(&buf2);
+}
 
 static void display_buffer(subtitle *buf)
 {
--- a/sub/sub_cc.h	Sat Apr 07 19:37:11 2012 +0000
+++ b/sub/sub_cc.h	Sat Apr 07 20:08:53 2012 +0000
@@ -24,6 +24,7 @@
 extern int subcc_enabled;
 
 void subcc_init(void);
+void subcc_reset(void);
 void subcc_process_data(const uint8_t *inputdata, unsigned int len);
 void subcc_process_eia708(const uint8_t *data, int len);