diff recpt1/tssplitter_lite.c @ 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 52f8e081763d
children 3a3f15b063e1
line wrap: on
line diff
--- 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);
 	}