comparison recpt1/recpt1.c @ 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 aeba1988234f
children afd25d9ebef6
comparison
equal deleted inserted replaced
102:6e661e828b43 103:387d18563ef8
334 buf = sbuf; /* default */ 334 buf = sbuf; /* default */
335 335
336 if(use_b25) { 336 if(use_b25) {
337 code = b25_decode(dec, &sbuf, &dbuf); 337 code = b25_decode(dec, &sbuf, &dbuf);
338 if(code < 0) { 338 if(code < 0) {
339 fprintf(stderr, "b25_decode failed. fall back to encrypted recording.\n"); 339 fprintf(stderr, "b25_decode failed (code=%d). fall back to encrypted recording.\n", code);
340 use_b25 = FALSE; /* local flag */ 340 use_b25 = FALSE;
341 use_splitter = FALSE; /* should not split when decode failed */
341 } 342 }
342 else 343 else
343 buf = dbuf; 344 buf = dbuf;
344 } 345 }
345 346
346 347
347 if(use_splitter) { 348 if(use_b25 && use_splitter) {
348 splitbuf.size = 0; 349 splitbuf.size = 0;
349 350
350 while(buf.size) { 351 while(buf.size) {
351 /* $BJ,N%BP>](BPID$B$NCj=P(B */ 352 /* $BJ,N%BP>](BPID$B$NCj=P(B */
352 if(split_select_finish != TSS_SUCCESS) { 353 if(split_select_finish != TSS_SUCCESS) {
433 fprintf(stderr, "b25_finish failed\n"); 434 fprintf(stderr, "b25_finish failed\n");
434 else 435 else
435 buf = dbuf; 436 buf = dbuf;
436 } 437 }
437 438
438 if(use_splitter) { 439 if(use_b25 && use_splitter) {
439 /* $BJ,N%BP>]0J30$r$U$k$$Mn$H$9(B */ 440 /* $BJ,N%BP>]0J30$r$U$k$$Mn$H$9(B */
440 code = split_ts(splitter, &buf, &splitbuf); 441 code = split_ts(splitter, &buf, &splitbuf);
441 if(code != TSS_SUCCESS) { 442 if(code != TSS_SUCCESS) {
442 break; 443 break;
443 } 444 }
1039 if(use_b25) { 1040 if(use_b25) {
1040 dec = b25_startup(&dopt); 1041 dec = b25_startup(&dopt);
1041 if(!dec) { 1042 if(!dec) {
1042 fprintf(stderr, "Cannot start b25 decoder\n"); 1043 fprintf(stderr, "Cannot start b25 decoder\n");
1043 fprintf(stderr, "Fall back to encrypted recording\n"); 1044 fprintf(stderr, "Fall back to encrypted recording\n");
1044 use_b25 = 0; 1045 use_b25 = FALSE;
1046 use_splitter = FALSE; /* should not split when decode failed */
1045 } 1047 }
1046 } 1048 }
1047 /* initialize splitter */ 1049 /* initialize splitter */
1048 if(use_splitter) 1050 if(use_splitter) {
1049 { 1051 if(!use_b25) {
1050 splitter = split_startup(sid_list); 1052 fprintf(stderr, "TS splitter does not work without b25 decoder currently.\n");
1051 if ( splitter->sid_list == NULL ) 1053 }
1052 { 1054 else {
1053 fprintf(stderr, "Cannot start TS splitter\n"); 1055 splitter = split_startup(sid_list);
1054 return 1; 1056 if(splitter->sid_list == NULL) {
1057 fprintf(stderr, "Cannot start TS splitter\n");
1058 return 1;
1059 }
1055 } 1060 }
1056 } 1061 }
1057 1062
1058 /* initialize udp connection */ 1063 /* initialize udp connection */
1059 if(use_udp) { 1064 if(use_udp) {