Skip to content

Instantly share code, notes, and snippets.

@codeman38
Created April 3, 2013 02:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeman38/5298096 to your computer and use it in GitHub Desktop.
Save codeman38/5298096 to your computer and use it in GitHub Desktop.
Adds option to ZVBI ntsc-cc.c to output null frames in raw closed caption dump. This allows timing of captions to be correctly preserved.
diff --git a/contrib/ntsc-cc.c b/contrib/ntsc-cc.c
index 066ef07..9a06ef5 100644
--- a/contrib/ntsc-cc.c
+++ b/contrib/ntsc-cc.c
@@ -124,6 +124,7 @@ char usesen=0;
char debugwin=0;
char test=0;
char usewebtv=1;
+char rawnull=0;
char rawline=-1;
@@ -706,7 +707,7 @@ static int print_raw(int data)
// this is just null data with two parity bits
// 100000010000000 = 0x8080
- if (data == 0x8080)
+ if (data == 0x8080 && !rawnull)
return -1;
b1 = data & 0x7f;
@@ -1244,6 +1245,7 @@ Options:\n\
-l | --channel number Select caption channel 1 ... 4 [no filter]\n\
-p | --plain-ascii Print plain ASCII, else insert VT.100 color,\n\
italic and underline control codes\n\
+-n | --rawnull Include null frames in raw output\n\
-r | --raw line-number Dump raw VBI data\n\
-s | --sentences Decode caption by sentences\n\
-v | --verbose Increase verbosity\n\
@@ -1260,7 +1262,7 @@ Options:\n\
}
static const char
-short_options [] = "?1:2:3:4:5:6:7:8:bcd:f:hkl:pr:stvwxC:RSX:";
+short_options [] = "?1:2:3:4:5:6:7:8:bcd:f:hkl:npr:stvwxC:RSX:";
#ifdef HAVE_GETOPT_LONG
static const struct option
@@ -1281,6 +1283,7 @@ long_options [] = {
{ "help", no_argument, NULL, 'h' },
{ "keyword", required_argument, NULL, 'k' },
{ "channel", required_argument, NULL, 'l' },
+ { "rawnull", no_argument, NULL, 'n' },
{ "plain-ascii", no_argument, NULL, 'p' },
{ "raw", required_argument, NULL, 'r' },
{ "sentences", no_argument, NULL, 's' },
@@ -1433,6 +1436,10 @@ int main(int argc,char **argv)
keyword[keywords++]=optarg;
break;
+ case 'n':
+ rawnull=1;
+ break;
+
case 'p':
plain=1;
xds_info_prefix = "% ";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment