changeset 167:b21f1e823ec3

Import NIT fix patch.(http://microgroove.jp/shaolin/2010/09/a_tiny_patch_for_recpt1tssplitter_litec.html)
author Naoya OYAMA <naoya.oyama@gmail.com>
date Sat, 06 Oct 2012 21:57:42 +0900
parents 726fe10d9e4a
children 061ef2cd98f0
files src/tssplitter_lite.c
diffstat 1 files changed, 21 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/tssplitter_lite.c	Tue Oct 02 21:57:40 2012 +0900
+++ b/src/tssplitter_lite.c	Sat Oct 06 21:57:42 2012 +0900
@@ -606,16 +606,23 @@
 		size = buf[7];
 
 		/* prescan SID/PMT */
-		for(i = 17, j = 0; i < (size + 8) - 4; i = i + 4, j++) {
-			avail_sids[j] = (buf[i] << 8) + buf[i+1];
-			sp->avail_pmts[j] = GetPid(&buf[i+2]);
+		for(i = 13, j = 0; i < (size + 8) - 4; i = i + 4) {
+			pid = GetPid(&buf[i+2]);
+			if(pid == 0x0010)
+				continue;
+			avail_sids[j] = (buf[i] << 8) + buf[i+2];
+			sp->avail_pmts[j] = pid;
+			j++;
 		}
 		sp->num_pmts = j;
 
 		// 対象チャンネル判定
 		/* size + 8 = パケット全長 */
 		/* 最終 4 バイトはCRCなので飛ばす */
-		for(i = 17; i < (size + 8) - 4; i = i + 4) {
+		for(i = 13; i < (size + 8) - 4; i = i + 4) {
+			pid = GetPid(&buf[i+2]);
+			if(pid==0x0010)
+				continue;
 
 			service_id = (buf[i] << 8) + buf[i+1];
 			p = sid_list;
@@ -746,7 +753,7 @@
 		/* print PMTs */
 		fprintf(stderr, "Available PMT = ");
 		for(k=0; k < sp->num_pmts; k++)
-			fprintf(stderr, "%d ", sp->avail_pmts[k]);
+			fprintf(stderr, "0x%x ", sp->avail_pmts[k]);
 		fprintf(stderr, "\n");
 #endif
 
@@ -755,7 +762,7 @@
 #if 0
 		int tc;
 		for(tc=0; tc<188; tc++)
-			fprintf(stderr, "%02x ", *(pat+tc));
+			fprintf(stderr, "%02x ", *(sp->pat+tc));
 #endif
 	}
 
@@ -769,10 +776,9 @@
  */
 static int RecreatePat(splitter *sp, unsigned char *buf, int *pos)
 #if 0
+	splitter *sp						// [in/out]	splitter	
 	unsigned char* buf,					// [in]		読み込んだバッファ
-	unsigned char** pat,				// [out]	PAT 情報(再構築後)
-	unsigned char* pids,				// [out]	出力対象 PID 情報
-	int *pos)							// [in]		取得対象 PMT のバッファ中の位置
+	int *pos							// [in]		取得対象 PMT のバッファ中の位置
 #endif
 {
 	unsigned char y[LENGTH_CRC_DATA];
@@ -785,10 +791,15 @@
 	// CRC 計算のためのデータ
 	{
 		// チャンネルによって変わらない部分
-		for (i = 0; i < LENGTH_PAT_HEADER; i++)
+		for (i = 0; i < LENGTH_PAT_HEADER - 4; i++)
 		{
 			y[i] = buf[i + 5];
 		}
+		// NIT
+		y[LENGTH_PAT_HEADER-4] = 0x00;
+		y[LENGTH_PAT_HEADER-3] = 0x00;
+		y[LENGTH_PAT_HEADER-2] = 0xe0;
+		y[LENGTH_PAT_HEADER-1] = 0x10;
 		// チャンネルによって変わる部分
 		for (i = 0; i < MAX_PID; i++)
 		{