changeset 35028:dd77d5a292df

Support closed-caption format as used in wtv format. Needs an FFmpeg fix so it marks them as CC instead of teletext.
author reimar
date Mon, 27 Aug 2012 19:51:33 +0000
parents 6395c172f9c0
children 7abba31768ec
files sub/sub_cc.c
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sub/sub_cc.c	Mon Aug 27 16:20:40 2012 +0000
+++ b/sub/sub_cc.c	Mon Aug 27 19:51:33 2012 +0000
@@ -54,6 +54,7 @@
 static unsigned int cursor_pos=0;
 
 static int initialized=0;
+static int wtv_format;
 
 #define CC_ROLLON 1
 #define CC_ROLLUP 2
@@ -124,10 +125,12 @@
 	channel = -1;
 
 	initialized=1;
+	wtv_format = 0;
 }
 
 void subcc_reset(void)
 {
+    wtv_format = 0;
     if (!initialized)
         return;
     clear_buffer(&buf1);
@@ -385,6 +388,15 @@
 		mov_subcc_decode(inputdata, len);
 		return;
 	}
+	if (len & 1) wtv_format = 0;
+	if (len == 2) {
+		// EIA-608 compatibility part.
+		// Full EIA-708 parts have length >= 4 (multiple of 2).
+		cc_decode_EIA608(inputdata[0] | (inputdata[1] << 8));
+		wtv_format = 1;
+	}
+	if (wtv_format)
+		return;
 	subcc_decode(inputdata, len);
 }