diff src/tssplitter_lite.c @ 181:863ac6807ee3

Changed to stdout stderr from the log output.
author Naoya OYAMA <naoya.oyama@gmail.com>
date Mon, 24 Feb 2014 23:51:52 +0900
parents 4f3640bf350d
children 27e5f99f8991
line wrap: on
line diff
--- a/src/tssplitter_lite.c	Wed Dec 18 23:23:32 2013 +0900
+++ b/src/tssplitter_lite.c	Mon Feb 24 23:51:52 2014 +0900
@@ -194,7 +194,7 @@
 #if 0
 	for(i=0; sid_list[i] != NULL; i++)
 	{
-		printf("sid_list[%d]=[%s].\n",i, sid_list[i]);
+		printf(stderr, "sid_list[%d]=[%s].\n",i, sid_list[i]);
 	}
 #endif
 	return sid_list;
@@ -494,15 +494,15 @@
 							program->stc = pcr_h * 300 + pcr_l; /* PCR受信時にSTCを補正*/
 							if ( program->pcr1 == 0 ) {
 								program->pcr1 = program->stc;
-								printf("pcr1 pid[%d] sid[%d] packet_nb[%d] sid_nb[%d] i[%d]\n",
+								fprintf(stderr, "pcr1 pid[%d] sid[%d] packet_nb[%d] sid_nb[%d] i[%d]\n",
 										pid, sid, packet_nb, sp->pcr[pcr_index].sid_nb, i);
 							} else if ( program->pcr2 == 0 ) {
-//								printf("pcr2 pid[%d] sid[%d] packet_nb[%d], p_packet_nb[%d] sid_nb[%d] i[%d]\n",
+//								fprintf(stderr, "pcr2 pid[%d] sid[%d] packet_nb[%d], p_packet_nb[%d] sid_nb[%d] i[%d]\n",
 //										pid, sid, packet_nb, program->pcr_packet_nb, sp->pcr[pcr_index].sid_nb, i);
 								program->pcr2 = program->stc;
 								program->pcr_incr = (program->pcr2 -program->pcr1)
 									/(packet_nb -program->pcr_packet_nb);
-								printf("pcr2 pid[%d] sid[%d] pcr_incr[%llu]\n",
+								fprintf(stderr, "pcr2 pid[%d] sid[%d] pcr_incr[%llu]\n",
 										pid, sid, program->pcr_incr);
 							} else {
 								/* PCR処理済み */
@@ -521,7 +521,7 @@
 									+(sp->time_cue -sp->time_tot)*27e6
 									+(packet_nb -sp->tot_packet_nb)*program->pcr_incr
 									-(27e6*49/100);
-								printf("STC[%llu] CUE[%llu] SID[%d]\n",
+								fprintf(stderr, "STC[%llu] CUE[%llu] SID[%d]\n",
 										program->stc, program->cue, sid);
 							}
 							program->pcr_packet_nb = packet_nb;
@@ -548,7 +548,7 @@
 // NHK Gを ALL とすると SID 1024 しか出ない...orz..
 				if ( !(packet_nb % 1000) ) {
 					program = &(sp->program[sid]);
-					printf("STC[%llu] SID[%d]\n", program->stc, sid);
+					fprintf("STC[%llu] SID[%d]\n", program->stc, sid);
 				}
 #endif
 				/* TS処理 */
@@ -964,7 +964,7 @@
 			sp->cat_pids[cat_pid] = 1;
 			sp->pid_sid_table[cat_pid] = sid; /* CATも複数ServiceIDで重複がある */
 #ifdef PmtDebug
-			printf("	CAT PacketID[%d][0x%04x]\n", cat_pid, cat_pid);
+			fprintf(stderr, "	CAT PacketID[%d][0x%04x]\n", cat_pid, cat_pid);
 #endif
 		}
 		p += len;
@@ -1012,7 +1012,7 @@
 				sp->program[sid].video_nb += 1;
 				av_flag = TSS_STREAM_TYPE_VIDEO;
 #ifdef PmtDebug
-				printf("	VIDEO PacketID[%d][0x%04x] StreamType[0x%02x]\n", epid, epid, buf[N]);
+				fprintf(stderr, "	VIDEO PacketID[%d][0x%04x] StreamType[0x%02x]\n", epid, epid, buf[N]);
 #endif
 			} else if ( (buf[N] == 0x04) || (buf[N] == 0x0f) ) {
 				/* 13818-3 Audio or 13818-7 Audio with ADTS transport syntax */
@@ -1020,11 +1020,11 @@
 				sp->program[sid].audio_nb += 1;
 				av_flag = TSS_STREAM_TYPE_AUDIO;
 #ifdef PmtDebug
-				printf("	AUDIO PacketID[%d][0x%04x] StreamType[0x%02x]\n", epid, epid, buf[N]);
+				fprintf(stderr, "	AUDIO PacketID[%d][0x%04x] StreamType[0x%02x]\n", epid, epid, buf[N]);
 #endif
 			} else {
 #ifdef PmtDebug
-				printf("	OTHER PacketID[%d][0x%04x] StreamType[0x%02x]\n", epid, epid, buf[N]);
+				fprintf (stderr, "	OTHER PacketID[%d][0x%04x] StreamType[0x%02x]\n", epid, epid, buf[N]);
 #endif
 				; /* A/V どちらでもないものはとりあえずスルー */
 			}
@@ -1494,7 +1494,7 @@
 		es_rate = AV_RB24(p);
 		es_rate = (es_rate >>1) & 0x3fffff;
 		es_rate = es_rate * 50;
-		printf("pid[%d] es_rate[%d]Byte/Sec.\n", pid, es_rate);
+		fprintf(stderr, "pid[%d] es_rate[%d]Byte/Sec.\n", pid, es_rate);
 		p += 3;
 		len_pesh_supposed += 3;
 	}
@@ -1599,7 +1599,7 @@
 					esbuf->started = 1;
 					esbuf->Program->video_start = 1;
 					esbuf->Program->video_pts = esbuf->pts;
-					printf("video stream. pid[%d] v_pts[%llu].\n", pid, esbuf->pts);
+					fprintf(stderr, "video stream. pid[%d] v_pts[%llu].\n", pid, esbuf->pts);
 				} else {
 					/* GOP先頭を含まないものはクリア */
 					esbuf_clear(esbuf, pesbuf->pts, pesbuf->dts);
@@ -1641,7 +1641,7 @@
 						esbuf_clear(esbuf, pesbuf->pts, pesbuf->dts);
 					}
 				} else if ( esbuf->Program->video_start ) { /* video 蓄積が開始されている?*/
-					printf("audio stream. pid[%d] a_pts[%llu] v_pts[%llu] size[%d].\n", pid, esbuf->pts, esbuf->Program->video_pts, esbuf->size);
+					fprintf(stderr, "audio stream. pid[%d] a_pts[%llu] v_pts[%llu] size[%d].\n", pid, esbuf->pts, esbuf->Program->video_pts, esbuf->size);
 					audio_lipsync_offset = 0;
 					audio_pts = esbuf->pts;
 					adts_freq = AnalyzeAdifHeader(esbuf);
@@ -1657,11 +1657,11 @@
 							esbuf_clear(esbuf, pesbuf->pts, pesbuf->dts);
 							break;
 						}
-						printf("audio stream drop. pid[%d] pts[%llu].\n", pid, audio_pts);
+						fprintf(stderr, "audio stream drop. pid[%d] pts[%llu].\n", pid, audio_pts);
 						audio_pts += adts_frame_time; /* AACの1フレーム分、時間を進める */
 					}
 					if ( (esbuf->Program->video_pts <= audio_pts +adts_frame_time/2) ) {
-						printf("lipsync start. v_pts[%llu] a_pts[%llu].\n", esbuf->Program->video_pts, audio_pts);
+						fprintf(stderr, "lipsync start. v_pts[%llu] a_pts[%llu].\n", esbuf->Program->video_pts, audio_pts);
 						memmove(esbuf->buffer +audio_lipsync_offset,
 								esbuf->buffer,
 								esbuf->size -audio_lipsync_offset);
@@ -1796,7 +1796,6 @@
 	MJD = (*(p) & 0xff) <<8;
 	p++;
 	MJD |= *(p) & 0xff;
-	printf("MJD[%x].\n", MJD);
 
 	/* ARIB STD-B10 第2部 付録C の公式より MJD to YYYYMMDD */
 	tm.tm_year = (int)floor((MJD - 15078.2)/365.25);
@@ -1820,7 +1819,6 @@
 
 	*t = mktime(&tm);
 	time(&t2);
-//	printf("time[%d] TOT[%d].\n", t2, *t);
 
 	return TRUE;
 }
@@ -1875,10 +1873,6 @@
 	for(; i < esbuf->size - sizeof(adts_start_code); i++) {
 		startcode = AV_RB16(esbuf->buffer+i);
 		if( startcode == adts_start_code ) { /* 該当位置から12bit連続1が立っているか? */
-#if 0
-			printf("adts start code found.i[%d]. 0[%02x] 1[%02x] 2[%02x] 3[%02x] 4[%02x] 5[%02x] 6[%02x]\n",
-					i, *(esbuf->buffer+i+0), *(esbuf->buffer+i+1), *(esbuf->buffer+i+2), *(esbuf->buffer+i+3), *(esbuf->buffer+i+4), *(esbuf->buffer+i+5), *(esbuf->buffer+i+6) );
-#endif
 			return (i-offset);
 		}
 	}