diff recpt1/recpt1.c @ 121:e915d31c5bd9

add --es option
author Naoya OYAMA <naoya.oyama@gmail.com>
date Thu, 29 Apr 2010 02:02:42 +0900
parents d89f0da0a7e4
children 4009737ea899
line wrap: on
line diff
--- a/recpt1/recpt1.c	Sun Apr 25 18:26:32 2010 +0900
+++ b/recpt1/recpt1.c	Thu Apr 29 02:02:42 2010 +0900
@@ -336,8 +336,8 @@
         if(use_b25) {
             code = b25_decode(dec, &sbuf, &dbuf);
             if(code < 0) {
-                fprintf(stderr, "b25_decode failed (code=%d). fall back to encrypted recording.\n", code);
-                use_b25 = FALSE;
+                fprintf(stderr, "b25_decode failed. fall back to encrypted recording.\n");
+                use_b25 = FALSE; /* local flag */
             }
             else
                 buf = dbuf;
@@ -361,12 +361,6 @@
                         /* $BJ,N%BP>](BPID$B$,40A4$KCj=P$G$-$k$^$G=PNO$7$J$$(B
                          * 1$BICDxEYM>M5$r8+$k$H$$$$$+$b(B
                          */
-                        time_t cur_time;
-                        time(&cur_time);
-                        if(cur_time - data->start_time > 4) {
-                            use_splitter = FALSE;
-                            goto fin;
-                        }
                         break;
                     }
                 }
@@ -486,9 +480,9 @@
 show_usage(char *cmd)
 {
 #ifdef HAVE_LIBARIB25
-    fprintf(stderr, "Usage: \n%s [--b25 [--round N] [--strip] [--EMM]] [--udp [--addr hostname --port portnumber]] [--device devicefile] [--lnb voltage] [--sid SID1,SID2] channel rectime destfile\n", cmd);
+    fprintf(stderr, "Usage: \n%s [--b25 [--round N] [--strip] [--EMM]] [--udp [--addr hostname --port portnumber]] [--device devicefile] [--lnb voltage] [--sid SID1,SID2] channel [--es filename_suffix] rectime destfile\n", cmd);
 #else
-    fprintf(stderr, "Usage: \n%s [--strip] [--EMM]] [--udp [--addr hostname --port portnumber]] [--device devicefile] [--lnb voltage] [--sid SID1,SID2] channel rectime destfile\n", cmd);
+    fprintf(stderr, "Usage: \n%s [--strip] [--EMM]] [--udp [--addr hostname --port portnumber]] [--device devicefile] [--lnb voltage] [--sid SID1,SID2] [--es filename_suffix] channel rectime destfile\n", cmd);
 #endif
     fprintf(stderr, "\n");
     fprintf(stderr, "Remarks:\n");
@@ -512,6 +506,7 @@
     fprintf(stderr, "--device devicefile: Specify devicefile to use\n");
     fprintf(stderr, "--lnb voltage:       Specify LNB voltage (0, 11, 15)\n");
     fprintf(stderr, "--sid SID1,SID2,...: Specify SID number in CSV format (101,102,...)\n");
+    fprintf(stderr, "  --es filename:     Specify ES out filename prefix\n");
     fprintf(stderr, "--help:              Show this help\n");
     fprintf(stderr, "--version:           Show version\n");
     fprintf(stderr, "--list:              Show channel list\n");
@@ -898,6 +893,9 @@
         { "version",   0, NULL, 'v'},
         { "list",      0, NULL, 'l'},
         { "sid",       1, NULL, 'i'},
+        { "SID",       1, NULL, 'i'},
+        { "es",       1, NULL, 'e'},
+        { "ES",       1, NULL, 'e'},
         {0, 0, NULL, 0} /* terminate */
     };
 
@@ -913,6 +911,7 @@
     int val;
     char *voltage[] = {"0V", "11V", "15V"};
     char *sid_list = NULL;
+    char *es_name_prefix = NULL;
 
     while((result = getopt_long(argc, argv, "br:smn:ua:p:d:hvli:",
                                 long_options, &option_index)) != -1) {
@@ -990,6 +989,9 @@
             use_splitter = TRUE;
             sid_list = optarg;
             break;
+        case 'e':
+            es_name_prefix = optarg;
+            break;
         }
     }
 
@@ -1047,13 +1049,15 @@
         if(!dec) {
             fprintf(stderr, "Cannot start b25 decoder\n");
             fprintf(stderr, "Fall back to encrypted recording\n");
-            use_b25 = FALSE;
+            use_b25 = 0;
         }
     }
     /* initialize splitter */
-    if(use_splitter) {
-        splitter = split_startup(sid_list);
-        if(splitter->sid_list == NULL) {
+    if(use_splitter)
+    {
+        splitter = split_startup(sid_list, es_name_prefix);
+        if ( splitter->sid_list == NULL )
+        {
             fprintf(stderr, "Cannot start TS splitter\n");
             return 1;
         }