diff sub/sub_cc.c @ 35029:7abba31768ec

Add new -subcc values. This makes it possible to specify that we should try to extract a EIA-608 compatibility stream instead of assuming the whole stream is EIA-608.
author reimar
date Mon, 27 Aug 2012 19:57:33 +0000
parents dd77d5a292df
children d206960484fe
line wrap: on
line diff
--- a/sub/sub_cc.c	Mon Aug 27 19:51:33 2012 +0000
+++ b/sub/sub_cc.c	Mon Aug 27 19:57:33 2012 +0000
@@ -320,11 +320,20 @@
     data2 = current[2];
     current += 3; curbytes += 3;
 
+    // 0xfe/0xff are both used on plain EIA-608 CC and
+    // for extended EIA-708 (where 0xfc/0xfd is used for
+    // compatibility layer).
+    // Allow using channel bit 2 to select between which
+    // ones to look in.
     switch (cc_code) {
+    case 0xfc:
+    case 0xfd:
     case 0xfe:
     case 0xff:
+      if ((cc_code & 2) == (selected_channel() & 4) >> 1)
+          break;
       odd_offset ^= 1;
-      if (odd_offset != selected_channel() >> 1)
+      if (odd_offset != (selected_channel() & 2) >> 1)
           break;
       /* expect EIA-608 CC1/CC2 encoding */
       // FIXME check parity!
@@ -333,6 +342,7 @@
       cc_decode_EIA608(data1 | (data2 << 8));
       break;
 
+    case 0xfa:
     case 0x00:
       /* This seems to be just padding */
       break;