changeset 104:afd25d9ebef6

output ECM packet so that former workaround is no longer needed.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Fri, 26 Feb 2010 22:55:44 +0900
parents 387d18563ef8
children 0a9406f92f32
files recpt1/recpt1.c recpt1/tssplitter_lite.c
diffstat 2 files changed, 22 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/recpt1/recpt1.c	Fri Feb 26 19:46:03 2010 +0900
+++ b/recpt1/recpt1.c	Fri Feb 26 22:55:44 2010 +0900
@@ -345,7 +345,7 @@
         }
 
 
-        if(use_b25 && use_splitter) {
+        if(use_splitter) {
             splitbuf.size = 0;
 
             while(buf.size) {
@@ -436,7 +436,7 @@
                     buf = dbuf;
             }
 
-            if(use_b25 && use_splitter) {
+            if(use_splitter) {
                 /* $BJ,N%BP>]0J30$r$U$k$$Mn$H$9(B */
                 code = split_ts(splitter, &buf, &splitbuf);
                 if(code != TSS_SUCCESS) {
@@ -1048,15 +1048,10 @@
     }
     /* initialize splitter */
     if(use_splitter) {
-        if(!use_b25) {
-            fprintf(stderr, "TS splitter does not work without b25 decoder currently.\n");
-        }
-        else {
-            splitter = split_startup(sid_list);
-            if(splitter->sid_list == NULL) {
-                fprintf(stderr, "Cannot start TS splitter\n");
-                return 1;
-            }
+        splitter = split_startup(sid_list);
+        if(splitter->sid_list == NULL) {
+            fprintf(stderr, "Cannot start TS splitter\n");
+            return 1;
         }
     }
 
--- a/recpt1/tssplitter_lite.c	Fri Feb 26 19:46:03 2010 +0900
+++ b/recpt1/tssplitter_lite.c	Fri Feb 26 22:55:44 2010 +0900
@@ -596,6 +596,22 @@
 
 	N = ((buf[15] & 0x0F) << 4) + buf[16] + 16 + 1;
 
+	// ECM
+	int p = 17;
+	while(p < N) {
+		uint32_t ca_pid;
+		uint32_t tag;
+		uint32_t len;
+
+		tag = buf[p];
+		len = buf[p+1];
+		if(tag == 0x09 && len >= 4 && p+len <= N) {
+			ca_pid = ((buf[p+4] << 8) | buf[p+5]) & 0x1fff;
+			sp->pids[ca_pid] = 1;
+		}
+		p += len;
+	}
+
 	// ES PID
 	while (N < Nall + 8 - 4)
 	{