gnutv: move channel_name to flag to allow piped output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I need to capture ATSC QAM closed captioning to file, and at the same time the mpeg-ts stream to a different file. I've been looking for an app that will let me do this.

A simple cat works:

cat /dev/dvb/adapter0/dvr0 | tee $FIL.mpg | zvbi-atsc-cc --atsc -m -C $FIL.txt -T KCBS

But there is naturally no tuner or timer in cat, so closing the processes at the end of the recording is a hassle; there may be other issues cat doesn't handle optimally. I looked around and found gnutv in the dvb-apps project.

gnutv is actively maintained, tunes ATSC QAM-256, handles individual channels well, and has a timer -- but it has a small, show-stopper problem.

gnutv mandates that the channel name be placed at the end of the user input. There is a great -out stdout option, but you can't use it to pipe, since the channel name has to be placed afterwards.

I suggest we move the channel name into a flag, like the other user values, so that we can pipe the output like this:

gnutv -adapter 0 -channel_list ~/.azap/channels.conf -timeout 10 -channel_name KCBS \
 -out stdout | tee $FIL.mpg | zvbi-atsc-cc --atsc -T -9 $FIL.txt -n KCBS

With a simple patch against the today's mercurial tree, as below, this works great. For clarity, I renamed channels to channels_list; I'll be happy to remove that change if it breaks too many scripts. I don't know how to make the change to channel_name so that it's backwardly compatible, but maybe we don't need to.

Cheers,
Dave


--- gnutv.c    2010-11-27 10:56:57.000000000 -0800
+++ gnutv-new.c    2010-11-27 11:34:41.000000000 -0800
@@ -54,7 +54,8 @@
         " -frontend <id>    frontend to use (default 0)\n"
         " -demux <id>        demux to use (default 0)\n"
         " -caslotnum <id>    ca slot number to use (default 0)\n"
-        " -channels <filename>    channels.conf file.\n"
+        " -channel_list <filename>    channels.conf file.\n"
+        " -channel_name <name>     Name of the channel to tune to.\n"
         " -secfile <filename>    Optional sec.conf file.\n"
         " -secid <secid>    ID of the SEC configuration to use, one of:\n"
" * UNIVERSAL (default) - Europe, 10800 to 11800 MHz and 11600 to 12700 Mhz,\n"
@@ -82,8 +83,7 @@
         " -timeout <secs>    Number of seconds to output channel for\n"
" (0=>exit immediately after successful tuning, default is to output forever)\n"
         " -cammenu        Show the CAM menu\n"
- " -nomoveca Do not attempt to move CA descriptors from stream to programme level\n"
-        " <channel name>\n";
+ " -nomoveca Do not attempt to move CA descriptors from stream to programme level\n";
     fprintf(stderr, "%s\n", _usage);

     exit(1);
@@ -154,11 +154,16 @@
             if (sscanf(argv[argpos+1], "%i", &caslot_num) != 1)
                 usage();
             argpos+=2;
-        } else if (!strcmp(argv[argpos], "-channels")) {
+        } else if (!strcmp(argv[argpos], "-channel_list")) {
             if ((argc - argpos) < 2)
                 usage();
             chanfile = argv[argpos+1];
             argpos+=2;
+        } else if (!strcmp(argv[argpos], "-channel_name")) {
+            if ((argc - argpos) < 2)
+                usage();
+            channel_name = argv[argpos+1];
+            argpos+=2;
         } else if (!strcmp(argv[argpos], "-secfile")) {
             if ((argc - argpos) < 2)
                 usage();
@@ -235,11 +240,6 @@
         } else if (!strcmp(argv[argpos], "-cammenu")) {
             cammenu = 1;
             argpos++;
-        } else {
-            if ((argc - argpos) != 1)
-                usage();
-            channel_name = argv[argpos];
-            argpos++;
         }
     }


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux