Mercurial > pt1.oyama
changeset 98:3fd15032fd3a
tweak user interface for sid:
- rename --split option as --sid
- show all available service IDs along with specified SIDs.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Wed, 10 Feb 2010 15:02:25 +0900 |
parents | 4d201756c593 |
children | 3a3f15b063e1 |
files | recpt1/recpt1.c recpt1/tssplitter_lite.c recpt1/tssplitter_lite.h |
diffstat | 3 files changed, 29 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/recpt1/recpt1.c Wed Feb 10 14:55:03 2010 +0900 +++ b/recpt1/recpt1.c Wed Feb 10 15:02:25 2010 +0900 @@ -485,9 +485,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] [--split 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 rectime destfile\n", cmd); #else - fprintf(stderr, "Usage: \n%s [--strip] [--EMM]] [--udp [--addr hostname --port portnumber]] [--device devicefile] [--lnb voltage] [--split 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] channel rectime destfile\n", cmd); #endif fprintf(stderr, "\n"); fprintf(stderr, "Remarks:\n"); @@ -510,7 +510,7 @@ fprintf(stderr, " --port portnumber: Port number to connect\n"); fprintf(stderr, "--device devicefile: Specify devicefile to use\n"); fprintf(stderr, "--lnb voltage: Specify LNB voltage (0, 11, 15)\n"); - fprintf(stderr, "--split SID1,SID2...,SIDN: Specify SID number in CSV format(100,101,102,...)\n"); + fprintf(stderr, "--sid SID1,SID2,...: Specify SID number in CSV format (101,102,...)\n"); fprintf(stderr, "--help: Show this help\n"); fprintf(stderr, "--version: Show version\n"); fprintf(stderr, "--list: Show channel list\n"); @@ -896,7 +896,7 @@ { "help", 0, NULL, 'h'}, { "version", 0, NULL, 'v'}, { "list", 0, NULL, 'l'}, - { "split", 1, NULL, 'i'}, + { "sid", 1, NULL, 'i'}, {0, 0, NULL, 0} /* terminate */ }; @@ -913,7 +913,7 @@ char *voltage[] = {"0V", "11V", "15V"}; char *sid_list = NULL; - while((result = getopt_long(argc, argv, "br:smn:ua:p:d:hvl", + while((result = getopt_long(argc, argv, "br:smn:ua:p:d:hvli:", long_options, &option_index)) != -1) { switch(result) { case 'b':
--- a/recpt1/tssplitter_lite.c Wed Feb 10 14:55:03 2010 +0900 +++ b/recpt1/tssplitter_lite.c Wed Feb 10 15:02:25 2010 +0900 @@ -113,10 +113,12 @@ { i++; } +#if 0 for(i=0; sid_list[i] != NULL; i++) { printf("sid_list[%d]=[%s].\n",i, sid_list[i]); } +#endif return sid_list; } @@ -325,16 +327,18 @@ unsigned char* pids, // [out] 出力対象 PID 情報 char** sid_list, // [in] 出力対象サービス ID のリスト unsigned char* pmt_pids, // [out] サービス ID に対応する PMT の PID - int* pmt_drop) // [out] 落とすPMTの数 + int* pmt_drop +) // [out] 落とすPMTの数 { int pos[MAX_PID]; int service_id; - int i; + int i, j=0, k; int size = 0; int pid; int result = TSS_SUCCESS; char **p; int sid_found; + int avail_sids[MAX_SERVICES]; if (NULL == *pat) { @@ -350,6 +354,7 @@ { sid_found = 0; service_id = (buf[i] << 8) + buf[i + 1]; + avail_sids[j] = service_id; p = sid_list; while(*p != NULL) { @@ -388,7 +393,21 @@ pos[pid] = i; *(pmt_drop) = *(pmt_drop)+1; } + j++; } + fprintf(stderr, "Available sid = "); + for(k=0; k<j; k++) + fprintf(stderr, "%d ", avail_sids[k]); + fprintf(stderr, "\n"); + + fprintf(stderr, "Chosen sid = "); + p = sid_list; + while(*p != NULL) { + fprintf(stderr, "%s ", *p); + p++; + } + fprintf(stderr, "\n"); + // PAT 再構築 result = RecreatePat(buf, pat, pids, pos); }
--- a/recpt1/tssplitter_lite.h Wed Feb 10 14:55:03 2010 +0900 +++ b/recpt1/tssplitter_lite.h Wed Feb 10 15:02:25 2010 +0900 @@ -21,7 +21,7 @@ #include <io.h> #include <windows.h> #include <crtdbg.h> - + #pragma warning(disable: 4996) #else #define __STDC_FORMAT_MACROS @@ -32,6 +32,7 @@ #define LENGTH_PACKET (188) #define MAX_PID (8192) +#define MAX_SERVICES (50) #define LENGTH_CRC_DATA (176) #define false (0) #define true (1) @@ -39,7 +40,7 @@ #define TSS_SUCCESS (0) #define TSS_ERROR (-1) #define TSS_NULL (-2) -#define LENGTH_PAT_HEADER (12) +#define LENGTH_PAT_HEADER (12) #define C_CHAR_COMMA ',' /**