changeset 103:387d18563ef8

temporary workaround: disable splitter if decoder is disabled.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Fri, 26 Feb 2010 19:46:03 +0900
parents 6e661e828b43
children afd25d9ebef6
files recpt1/recpt1.c
diffstat 1 files changed, 17 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/recpt1/recpt1.c	Wed Feb 24 22:44:06 2010 +0900
+++ b/recpt1/recpt1.c	Fri Feb 26 19:46:03 2010 +0900
@@ -336,15 +336,16 @@
         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;
+                use_splitter = FALSE; /* should not split when decode failed */
             }
             else
                 buf = dbuf;
         }
 
 
-        if(use_splitter) {
+        if(use_b25 && use_splitter) {
             splitbuf.size = 0;
 
             while(buf.size) {
@@ -435,7 +436,7 @@
                     buf = dbuf;
             }
 
-            if(use_splitter) {
+            if(use_b25 && use_splitter) {
                 /* $BJ,N%BP>]0J30$r$U$k$$Mn$H$9(B */
                 code = split_ts(splitter, &buf, &splitbuf);
                 if(code != TSS_SUCCESS) {
@@ -1041,17 +1042,21 @@
         if(!dec) {
             fprintf(stderr, "Cannot start b25 decoder\n");
             fprintf(stderr, "Fall back to encrypted recording\n");
-            use_b25 = 0;
+            use_b25 = FALSE;
+            use_splitter = FALSE; /* should not split when decode failed */
         }
     }
     /* initialize splitter */
-    if(use_splitter)
-    {
-        splitter = split_startup(sid_list);
-        if ( splitter->sid_list == NULL )
-        {
-            fprintf(stderr, "Cannot start TS splitter\n");
-            return 1;
+    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;
+            }
         }
     }