Mercurial > pt1.oyama
diff recpt1/recpt1.c @ 122:4009737ea899
add es output arg:
add start_time arg:
author | Naoya OYAMA <naoya.oyama@gmail.com> |
---|---|
date | Wed, 05 May 2010 20:43:43 +0900 |
parents | e915d31c5bd9 |
children |
line wrap: on
line diff
--- a/recpt1/recpt1.c Thu Apr 29 02:02:42 2010 +0900 +++ b/recpt1/recpt1.c Wed May 05 20:43:43 2010 +0900 @@ -1,4 +1,5 @@ /* -*- tab-width: 4; indent-tabs-mode: nil -*- */ +/* vim: set ts=4 sts=4 sw=4 expandtab number : */ #include <stdio.h> #include <fcntl.h> #include <sys/types.h> @@ -336,8 +337,8 @@ if(use_b25) { code = b25_decode(dec, &sbuf, &dbuf); if(code < 0) { - fprintf(stderr, "b25_decode failed. fall back to encrypted recording.\n"); - use_b25 = FALSE; /* local flag */ + fprintf(stderr, "b25_decode failed (code=%d). fall back to encrypted recording.\n", code); + use_b25 = FALSE; } else buf = dbuf; @@ -361,6 +362,12 @@ /* $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; } } @@ -480,9 +487,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 [--es filename_suffix] 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] [--es filename_suffix] [--start_time YYYYMMDDHHMISS] channel rectime destfile\n", cmd); #else - 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); + fprintf(stderr, "Usage: \n%s [--strip] [--EMM]] [--udp [--addr hostname --port portnumber]] [--device devicefile] [--lnb voltage] [--sid SID1,SID2] [--es filename_suffix] [--start_time YYYYMMDDHHMISS] channel rectime destfile\n", cmd); #endif fprintf(stderr, "\n"); fprintf(stderr, "Remarks:\n"); @@ -507,6 +514,7 @@ 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, " --start_time YYYYMMDDHHMISS: Specify record start datetime\n"); fprintf(stderr, "--help: Show this help\n"); fprintf(stderr, "--version: Show version\n"); fprintf(stderr, "--list: Show channel list\n"); @@ -896,6 +904,7 @@ { "SID", 1, NULL, 'i'}, { "es", 1, NULL, 'e'}, { "ES", 1, NULL, 'e'}, + { "start_time", 1, NULL, 'y'}, {0, 0, NULL, 0} /* terminate */ }; @@ -912,6 +921,7 @@ char *voltage[] = {"0V", "11V", "15V"}; char *sid_list = NULL; char *es_name_prefix = NULL; + char *start_time = NULL; while((result = getopt_long(argc, argv, "br:smn:ua:p:d:hvli:", long_options, &option_index)) != -1) { @@ -992,6 +1002,9 @@ case 'e': es_name_prefix = optarg; break; + case 'y': + start_time = optarg; + break; } } @@ -1049,15 +1062,13 @@ if(!dec) { fprintf(stderr, "Cannot start b25 decoder\n"); fprintf(stderr, "Fall back to encrypted recording\n"); - use_b25 = 0; + use_b25 = FALSE; } } /* initialize splitter */ - if(use_splitter) - { - splitter = split_startup(sid_list, es_name_prefix); - if ( splitter->sid_list == NULL ) - { + if(use_splitter) { + splitter = split_startup(sid_list, es_name_prefix, start_time); + if(splitter->sid_list == NULL) { fprintf(stderr, "Cannot start TS splitter\n"); return 1; }