From 045dd4b9287551443e655b313417fd776f52aab0 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 29 Apr 2011 17:27:01 +0200 Subject: Replace some commented-out debug printf() / av_log() messages with av_dlog(). --- libavformat/mpeg.c | 7 +++---- libavformat/mpegenc.c | 11 +++-------- libavformat/mpegts.c | 6 ++---- libavformat/oggdec.c | 16 ++++------------ libavformat/rmdec.c | 16 +++++++--------- libavformat/utils.c | 16 +++++++--------- 6 files changed, 26 insertions(+), 46 deletions(-) (limited to 'libavformat') diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 68b685cc29..0b663ab512 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -569,10 +569,9 @@ static int mpegps_read_packet(AVFormatContext *s, pkt->dts = dts; pkt->pos = dummy_pos; pkt->stream_index = st->index; -#if 0 - av_log(s, AV_LOG_DEBUG, "%d: pts=%0.3f dts=%0.3f size=%d\n", - pkt->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0, pkt->size); -#endif + av_dlog(s, AV_LOG_DEBUG, "%d: pts=%0.3f dts=%0.3f size=%d\n", + pkt->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0, + pkt->size); return 0; } diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 0e0164511a..28ca1cbd5b 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -662,10 +662,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, id = stream->id; -#if 0 - printf("packet ID=%2x PTS=%0.3f\n", - id, pts / 90000.0); -#endif + av_dlog(ctx, "packet ID=%2x PTS=%0.3f\n", id, pts / 90000.0); buf_ptr = buffer; @@ -1078,10 +1075,8 @@ retry: best_dts= pkt_desc->dts; } -#if 0 - av_log(ctx, AV_LOG_DEBUG, "bumping scr, scr:%f, dts:%f\n", - scr/90000.0, best_dts/90000.0); -#endif + av_dlog(ctx, AV_LOG_DEBUG, "bumping scr, scr:%f, dts:%f\n", + scr / 90000.0, best_dts / 90000.0); if(best_dts == INT64_MAX) return 0; diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index d7f2c0c957..2ff6e55c57 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1538,10 +1538,8 @@ static int mpegts_read_header(AVFormatContext *s, s->bit_rate = (TS_PACKET_SIZE * 8) * 27e6 / ts->pcr_incr; st->codec->bit_rate = s->bit_rate; st->start_time = ts->cur_pcr; -#if 0 - av_log(ts->stream, AV_LOG_DEBUG, "start=%0.3f pcr=%0.3f incr=%d\n", - st->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr); -#endif + av_dlog(ts->stream, AV_LOG_DEBUG, "start=%0.3f pcr=%0.3f incr=%d\n", + st->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr); } avio_seek(pb, pos, SEEK_SET); diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 8d96320b3f..07969c816f 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -316,9 +316,7 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpo int complete = 0; int segp = 0, psize = 0; -#if 0 - av_log (s, AV_LOG_DEBUG, "ogg_packet: curidx=%i\n", ogg->curidx); -#endif + av_dlog(s, AV_LOG_DEBUG, "ogg_packet: curidx=%i\n", ogg->curidx); do{ idx = ogg->curidx; @@ -330,11 +328,9 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpo os = ogg->streams + idx; -#if 0 - av_log (s, AV_LOG_DEBUG, + av_dlog(s, AV_LOG_DEBUG, "ogg_packet: idx=%d pstart=%d psize=%d segp=%d nsegs=%d\n", idx, os->pstart, os->psize, os->segp, os->nsegs); -#endif if (!os->codec){ if (os->header < 0){ @@ -366,11 +362,9 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpo } }while (!complete); -#if 0 - av_log (s, AV_LOG_DEBUG, + av_dlog(s, AV_LOG_DEBUG, "ogg_packet: idx %i, frame size %i, start %i\n", idx, os->psize, os->pstart); -#endif if (os->granule == -1) av_log(s, AV_LOG_WARNING, "Page at %"PRId64" is missing granule\n", os->page_pos); @@ -451,9 +445,7 @@ ogg_get_headers (AVFormatContext * s) return -1; }while (!ogg->headers); -#if 0 - av_log (s, AV_LOG_DEBUG, "found headers\n"); -#endif + av_dlog(s, AV_LOG_DEBUG, "found headers\n"); return 0; } diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index bcf55fddfa..843706dec3 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -414,15 +414,13 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) tag = avio_rl32(pb); tag_size = avio_rb32(pb); avio_rb16(pb); -#if 0 - printf("tag=%c%c%c%c (%08x) size=%d\n", - (tag) & 0xff, - (tag >> 8) & 0xff, - (tag >> 16) & 0xff, - (tag >> 24) & 0xff, - tag, - tag_size); -#endif + av_dlog(s, "tag=%c%c%c%c (%08x) size=%d\n", + (tag ) & 0xff, + (tag >> 8) & 0xff, + (tag >> 16) & 0xff, + (tag >> 24) & 0xff, + tag, + tag_size); if (tag_size < 10 && tag != MKTAG('D', 'A', 'T', 'A')) return -1; switch(tag) { diff --git a/libavformat/utils.c b/libavformat/utils.c index 88e9a49e87..6d6c8308ca 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1974,22 +1974,20 @@ static void av_estimate_timings(AVFormatContext *ic, int64_t old_offset) } av_update_stream_timings(ic); -#if 0 { int i; AVStream *st; for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; - printf("%d: start_time: %0.3f duration: %0.3f\n", - i, (double)st->start_time / AV_TIME_BASE, - (double)st->duration / AV_TIME_BASE); + av_dlog(ic, "%d: start_time: %0.3f duration: %0.3f\n", i, + (double) st->start_time / AV_TIME_BASE, + (double) st->duration / AV_TIME_BASE); } - printf("stream: start_time: %0.3f duration: %0.3f bitrate=%d kb/s\n", - (double)ic->start_time / AV_TIME_BASE, - (double)ic->duration / AV_TIME_BASE, - ic->bit_rate / 1000); + av_dlog(ic, "stream: start_time: %0.3f duration: %0.3f bitrate=%d kb/s\n", + (double) ic->start_time / AV_TIME_BASE, + (double) ic->duration / AV_TIME_BASE, + ic->bit_rate / 1000); } -#endif } static int has_codec_parameters(AVCodecContext *enc) -- cgit v1.2.3 From 2e15305b7088c9dfe1c8d29c248a9b49bcf0b0a3 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 29 Apr 2011 19:05:40 +0200 Subject: Remove some disabled printf debug cruft. --- ffmpeg.c | 1 - libavcodec/asv1.c | 11 ----------- libavcodec/dct-test.c | 19 ------------------- libavcodec/dsputil.c | 7 ------- libavcodec/h263dec.c | 8 -------- libavcodec/h264.c | 10 ---------- libavcodec/huffyuv.c | 5 ----- libavcodec/motion_est_template.c | 35 ----------------------------------- libavcodec/mpeg12enc.c | 4 ---- libavcodec/mpegaudioenc.c | 15 --------------- libavcodec/msmpeg4.c | 15 --------------- libavcodec/ratecontrol.c | 8 -------- libavcodec/rv10.c | 17 ----------------- libavcodec/svq1dec.c | 13 ------------- libavcodec/wmadec.c | 9 --------- libavcodec/wmv2dec.c | 14 -------------- libavformat/ffmdec.c | 3 --- libavformat/mpegts.c | 3 --- 18 files changed, 197 deletions(-) (limited to 'libavformat') diff --git a/ffmpeg.c b/ffmpeg.c index d3a85dde89..050fa98f1f 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -3212,7 +3212,6 @@ static void opt_input_file(const char *filename) case AVMEDIA_TYPE_AUDIO: input_codecs[nb_input_codecs-1] = avcodec_find_decoder_by_name(audio_codec_name); set_context_opts(dec, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM, input_codecs[nb_input_codecs-1]); - //fprintf(stderr, "\nInput Audio channels: %d", dec->channels); channel_layout = dec->channel_layout; audio_channels = dec->channels; audio_sample_rate = dec->sample_rate; diff --git a/libavcodec/asv1.c b/libavcodec/asv1.c index cb07771718..8171945e40 100644 --- a/libavcodec/asv1.c +++ b/libavcodec/asv1.c @@ -450,17 +450,6 @@ static int decode_frame(AVCodecContext *avctx, idct_put(a, mb_x, mb_y); } } -#if 0 -int i; -printf("%d %d\n", 8*buf_size, get_bits_count(&a->gb)); -for(i=get_bits_count(&a->gb); i<8*buf_size; i++){ - printf("%d", get_bits1(&a->gb)); -} - -for(i=0; iavctx->extradata_size; i++){ - printf("%c\n", ((uint8_t*)s->avctx->extradata)[i]); -} -#endif *picture= *(AVFrame*)&a->picture; *data_size = sizeof(AVPicture); diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c index c3c376e79f..d0fe34e1d7 100644 --- a/libavcodec/dct-test.c +++ b/libavcodec/dct-test.c @@ -493,25 +493,6 @@ static void idct248_error(const char *name, if (v > err_max) err_max = v; } -#if 0 - printf("ref=\n"); - for(i=0;i<8;i++) { - int j; - for(j=0;j<8;j++) { - printf(" %3d", img_dest1[i*8+j]); - } - printf("\n"); - } - - printf("out=\n"); - for(i=0;i<8;i++) { - int j; - for(j=0;j<8;j++) { - printf(" %3d", img_dest[i*8+j]); - } - printf("\n"); - } -#endif } printf("%s %s: err_inf=%d\n", 1 ? "IDCT248" : "DCT248", diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index dbfc8ce162..32472b1a74 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -3327,13 +3327,6 @@ static int hadamard8_diff8x8_c(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t +BUTTERFLYA(temp[8*2+i], temp[8*6+i]) +BUTTERFLYA(temp[8*3+i], temp[8*7+i]); } -#if 0 -static int maxi=0; -if(sum>maxi){ - maxi=sum; - printf("MAX:%d\n", maxi); -} -#endif return sum; } diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index afc7c9035a..934c952449 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -552,14 +552,6 @@ retry: s->workaround_bugs, s->lavc_build, s->xvid_build, s->divx_version, s->divx_build, s->divx_packed ? "p" : ""); -#if 0 // dump bits per frame / qp / complexity -{ - static FILE *f=NULL; - if(!f) f=fopen("rate_qp_cplx.txt", "w"); - fprintf(f, "%d %d %f\n", buf_size, s->qscale, buf_size*(double)s->qscale); -} -#endif - #if HAVE_MMX if (s->codec_id == CODEC_ID_MPEG4 && s->xvid_build>=0 && avctx->idct_algo == FF_IDCT_AUTO && (av_get_cpu_flags() & AV_CPU_FLAG_MMX)) { avctx->idct_algo= FF_IDCT_XVIDMMX; diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 264afe5b4e..a59f121108 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -152,10 +152,6 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_l h->nal_unit_type= src[0]&0x1F; src++; length--; -#if 0 - for(i=0; iis_avc ? 0 : buf_size; h->max_contexts = avctx->thread_count; -#if 0 - int i; - for(i=0; i<50; i++){ - av_log(NULL, AV_LOG_ERROR,"%02X ", buf[i]); - } -#endif if(!(s->flags2 & CODEC_FLAG2_CHUNKS)){ h->current_slice = 0; if (!s->first_field) diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 183ce0ea74..bdfbf88ed0 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -352,11 +352,6 @@ static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length){ if(generate_bits_table(s->bits[i], s->len[i])<0){ return -1; } -#if 0 -for(j=0; j<256; j++){ -printf("%6X, %2d, %3d\n", s->bits[i][j], s->len[i][j], j); -} -#endif free_vlc(&s->vlc[i]); init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0); } diff --git a/libavcodec/motion_est_template.c b/libavcodec/motion_est_template.c index 09ec9f79c4..45e87a0bec 100644 --- a/libavcodec/motion_est_template.c +++ b/libavcodec/motion_est_template.c @@ -632,25 +632,6 @@ static int funny_diamond_search(MpegEncContext * s, int *best, int dmin, if(x!=best[0] || y!=best[1]) dia_size=0; -#if 0 -{ -int dx, dy, i; -static int stats[8*8]; -dx= FFABS(x-best[0]); -dy= FFABS(y-best[1]); -if(dy>dx){ - dx^=dy; dy^=dx; dx^=dy; -} -stats[dy*8 + dx] ++; -if(256*256*256*64 % (stats[0]+1)==0){ - for(i=0; i<64; i++){ - if((i&7)==0) printf("\n"); - printf("%8d ", stats[i]); - } - printf("\n"); -} -} -#endif } return dmin; } @@ -983,22 +964,6 @@ static int var_diamond_search(MpegEncContext * s, int *best, int dmin, if(x!=best[0] || y!=best[1]) dia_size=0; -#if 0 -{ -int dx, dy, i; -static int stats[8*8]; -dx= FFABS(x-best[0]); -dy= FFABS(y-best[1]); -stats[dy*8 + dx] ++; -if(256*256*256*64 % (stats[0]+1)==0){ - for(i=0; i<64; i++){ - if((i&7)==0) printf("\n"); - printf("%6d ", stats[i]); - } - printf("\n"); -} -} -#endif } return dmin; } diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 5e9b2ba3b1..c7f2f76410 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -888,10 +888,6 @@ static void mpeg1_encode_block(MpegEncContext *s, j = s->intra_scantable.permutated[i]; level = block[j]; next_coef: -#if 0 - if (level != 0) - av_dlog(s->avctx, "level[%d]=%d\n", i, level); -#endif /* encode using VLC */ if (level != 0) { run = i - last_non_zero - 1; diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c index 9659757ff8..65fac2ad29 100644 --- a/libavcodec/mpegaudioenc.c +++ b/libavcodec/mpegaudioenc.c @@ -585,13 +585,6 @@ static void compute_bit_allocation(MpegAudioContext *s, } *padding = max_frame_size - current_frame_size; assert(*padding >= 0); - -#if 0 - for(i=0;isblimit;i++) { - printf("%d ", bit_alloc[i]); - } - printf("\n"); -#endif } /* @@ -713,15 +706,7 @@ static void encode_frame(MpegAudioContext *s, /* group the 3 values to save bits */ put_bits(p, -bits, q[0] + steps * (q[1] + steps * q[2])); -#if 0 - printf("%d: gr1 %d\n", - i, q[0] + steps * (q[1] + steps * q[2])); -#endif } else { -#if 0 - printf("%d: gr3 %d %d %d\n", - i, q[0], q[1], q[2]); -#endif put_bits(p, bits, q[0]); put_bits(p, bits, q[1]); put_bits(p, bits, q[2]); diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index 85713b5d40..053e1005d2 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -617,10 +617,6 @@ void msmpeg4_encode_mb(MpegEncContext * s, } coded_cbp |= val << (5 - i); } -#if 0 - if (coded_cbp) - printf("cbp=%x %x\n", cbp, coded_cbp); -#endif if(s->msmpeg4_version<=2){ if (s->pict_type == FF_I_TYPE) { @@ -1383,17 +1379,6 @@ int msmpeg4_decode_picture_header(MpegEncContext * s) { int code; -#if 0 -{ -int i; -for(i=0; igb.size_in_bits; i++) - av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb)); -// get_bits1(&s->gb); -av_log(s->avctx, AV_LOG_DEBUG, "END\n"); -return -1; -} -#endif - if(s->msmpeg4_version==1){ int start_code = get_bits_long(&s->gb, 32); if(start_code!=0x00000100){ diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index 380e3548a7..e22d62e864 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -806,14 +806,6 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) rcc->last_mc_mb_var_sum= pic->mc_mb_var_sum; rcc->last_mb_var_sum= pic->mb_var_sum; } -#if 0 -{ - static int mvsum=0, texsum=0; - mvsum += s->mv_bits; - texsum += s->i_tex_bits + s->p_tex_bits; - printf("%d %d//\n\n", mvsum, texsum); -} -#endif return q; } diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 5df162b14c..4af1fd0574 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -293,23 +293,6 @@ static int rv20_decode_picture_header(MpegEncContext *s) { int seq, mb_pos, i; -#if 0 - GetBitContext gb= s->gb; - for(i=0; i<64; i++){ - av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&gb)); - if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " "); - } - av_log(s->avctx, AV_LOG_DEBUG, "\n"); -#endif -#if 0 - av_log(s->avctx, AV_LOG_DEBUG, "%3dx%03d/%02Xx%02X ", s->width, s->height, s->width/4, s->height/4); - for(i=0; iavctx->extradata_size; i++){ - av_log(s->avctx, AV_LOG_DEBUG, "%02X ", ((uint8_t*)s->avctx->extradata)[i]); - if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " "); - } - av_log(s->avctx, AV_LOG_DEBUG, "\n"); -#endif - if(s->avctx->sub_id == 0x30202002 || s->avctx->sub_id == 0x30203002){ if (get_bits(&s->gb, 3)){ av_log(s->avctx, AV_LOG_ERROR, "unknown triplet set\n"); diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c index 444785aa88..256a29867f 100644 --- a/libavcodec/svq1dec.c +++ b/libavcodec/svq1dec.c @@ -378,13 +378,6 @@ static int svq1_motion_inter_block (MpegEncContext *s, GetBitContext *bitbuf, if(x + (mv.x >> 1)<0) mv.x= 0; -#if 0 - int w= (s->width+15)&~15; - int h= (s->height+15)&~15; - if(x + (mv.x >> 1)<0 || y + (mv.y >> 1)<0 || x + (mv.x >> 1) + 16 > w || y + (mv.y >> 1) + 16> h) - av_log(s->avctx, AV_LOG_INFO, "%d %d %d %d\n", x, y, x + (mv.x >> 1), y + (mv.y >> 1)); -#endif - src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1))*pitch]; dst = current; @@ -461,12 +454,6 @@ static int svq1_motion_inter_4v_block (MpegEncContext *s, GetBitContext *bitbuf, if(x + (mvx >> 1)<0) mvx= 0; -#if 0 - int w= (s->width+15)&~15; - int h= (s->height+15)&~15; - if(x + (mvx >> 1)<0 || y + (mvy >> 1)<0 || x + (mvx >> 1) + 8 > w || y + (mvy >> 1) + 8> h) - av_log(s->avctx, AV_LOG_INFO, "%d %d %d %d\n", x, y, x + (mvx >> 1), y + (mvy >> 1)); -#endif src = &previous[(x + (mvx >> 1)) + (y + (mvy >> 1))*pitch]; dst = current; diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index f6ed26cb59..479b34c3e0 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -178,15 +178,6 @@ static void wma_lsp_to_curve_init(WMACodecContext *s, int frame_len) s->lsp_pow_m_table2[i] = b - a; b = a; } -#if 0 - for(i=1;i<20;i++) { - float v, r1, r2; - v = 5.0 / i; - r1 = pow_m1_4(s, v); - r2 = pow(v,-0.25); - printf("%f^-0.25=%f e=%f\n", v, r1, r2 - r1); - } -#endif } /** diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c index 578cce9200..10fdde7093 100644 --- a/libavcodec/wmv2dec.c +++ b/libavcodec/wmv2dec.c @@ -116,16 +116,6 @@ int ff_wmv2_decode_picture_header(MpegEncContext * s) Wmv2Context * const w= (Wmv2Context*)s; int code; -#if 0 -{ -int i; -for(i=0; igb.size*8; i++) - printf("%d", get_bits1(&s->gb)); -// get_bits1(&s->gb); -printf("END\n"); -return -1; -} -#endif if(s->picture_number==0) decode_ext_header(w); @@ -316,10 +306,6 @@ static inline int wmv2_decode_inter_block(Wmv2Context *w, DCTELEM *block, int n, if(w->per_block_abt) w->abt_type= decode012(&s->gb); -#if 0 - if(w->per_block_abt) - printf("B%d", w->abt_type); -#endif w->abt_type_table[n]= w->abt_type; if(w->abt_type){ diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 6cd2b51392..8a6226a104 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -417,9 +417,6 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt) if (ffm->header[1] & FLAG_DTS) if (ffm_read_data(s, ffm->header+16, 4, 1) != 4) return -1; -#if 0 - av_hexdump_log(s, AV_LOG_DEBUG, ffm->header, FRAME_HEADER_SIZE); -#endif ffm->read_state = READ_DATA; /* fall thru */ case READ_DATA: diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 2ff6e55c57..3130eb9ff5 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -662,9 +662,6 @@ static int mpegts_push_data(MpegTSFilter *filter, if (pes->data_index == PES_START_SIZE) { /* we got all the PES or section header. We can now decide */ -#if 0 - av_hex_dump_log(pes->stream, AV_LOG_DEBUG, pes->header, pes->data_index); -#endif if (pes->header[0] == 0x00 && pes->header[1] == 0x00 && pes->header[2] == 0x01) { /* it must be an mpeg2 PES stream */ -- cgit v1.2.3 From 7c152a458d3fb0a2fb1aef1f05bfee90fe70697e Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Thu, 28 Apr 2011 20:47:40 +0200 Subject: lavf: inspect more frames for fps when container time base is coarse As per issue2629, most 23.976fps matroska H.264 files are incorrectly detected as 24fps, as the matroska timestamps usually have only millisecond precision. Fix that by doubling the amount of timestamps inspected for frame rate for streams that have coarse time base. This also fixes 29.970 detection in matroska. Signed-off-by: Michael Niedermayer (cherry picked from commit 78431098f9e306ebe27e7698d0ae539e3df2afe9) Tested with mplayer based on this report http://thread.gmane.org/gmane.comp.video.mplayer.user/66043/focus=66063 Signed-off-by: Reinhard Tartler --- libavformat/utils.c | 10 +- tests/ref/fate/cscd | 414 ++++++++++++++++++++++++++-------------------------- 2 files changed, 216 insertions(+), 208 deletions(-) (limited to 'libavformat') diff --git a/libavformat/utils.c b/libavformat/utils.c index 6d6c8308ca..79e70f943e 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2217,12 +2217,20 @@ int av_find_stream_info(AVFormatContext *ic) /* check if one codec still needs to be handled */ for(i=0;inb_streams;i++) { + int fps_analyze_framecount = 20; + st = ic->streams[i]; if (!has_codec_parameters(st->codec)) break; + /* if the timebase is coarse (like the usual millisecond precision + of mkv), we need to analyze more frames to reliably arrive at + the correct fps */ + if (av_q2d(st->time_base) > 0.0005) + fps_analyze_framecount *= 2; /* variable fps and no guess at the real fps */ if( tb_unreliable(st->codec) && !(st->r_frame_rate.num && st->avg_frame_rate.num) - && st->info->duration_count<20 && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) + && st->info->duration_count < fps_analyze_framecount + && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) break; if(st->parser && st->parser->parser->split && !st->codec->extradata) break; diff --git a/tests/ref/fate/cscd b/tests/ref/fate/cscd index 75a7725c18..8b89e80a10 100644 --- a/tests/ref/fate/cscd +++ b/tests/ref/fate/cscd @@ -1,208 +1,208 @@ 0, 0, 270000, 0xf90015d8 -0, 2880, 270000, 0xf90015d8 -0, 5760, 270000, 0xf90015d8 -0, 8640, 270000, 0xf90015d8 -0, 11520, 270000, 0xf90015d8 -0, 14400, 270000, 0xf90015d8 -0, 17280, 270000, 0xf90015d8 -0, 20160, 270000, 0xf90015d8 -0, 23040, 270000, 0xf90015d8 -0, 25920, 270000, 0xf90015d8 -0, 28800, 270000, 0xf90015d8 -0, 31680, 270000, 0xf90015d8 -0, 34560, 270000, 0xf90015d8 -0, 37440, 270000, 0xf90015d8 -0, 40320, 270000, 0xf90015d8 -0, 43200, 270000, 0xf90015d8 -0, 46080, 270000, 0xf90015d8 -0, 48960, 270000, 0xf90015d8 -0, 51840, 270000, 0xf90015d8 -0, 54720, 270000, 0xf90015d8 -0, 57600, 270000, 0xf90015d8 -0, 60480, 270000, 0xf90015d8 -0, 63360, 270000, 0xf90015d8 -0, 66240, 270000, 0xf90015d8 -0, 69120, 270000, 0xf90015d8 -0, 72000, 270000, 0xf90015d8 -0, 74880, 270000, 0xf90015d8 -0, 77760, 270000, 0xf90015d8 -0, 80640, 270000, 0xf90015d8 -0, 83520, 270000, 0xf90015d8 -0, 86400, 270000, 0xf90015d8 -0, 89280, 270000, 0xf90015d8 -0, 92160, 270000, 0xf90015d8 -0, 95040, 270000, 0xf90015d8 -0, 97920, 270000, 0xf90015d8 -0, 100800, 270000, 0xf90015d8 -0, 103680, 270000, 0xf90015d8 -0, 106560, 270000, 0xf90015d8 -0, 109440, 270000, 0xf90015d8 -0, 112320, 270000, 0x1f9c15d8 -0, 115200, 270000, 0x436f15d8 -0, 118080, 270000, 0xe90115d8 -0, 120960, 270000, 0xe90115d8 -0, 123840, 270000, 0x8ea215d8 -0, 126720, 270000, 0x424015d8 -0, 129600, 270000, 0x0ce315d8 -0, 132480, 270000, 0x14bc15d8 -0, 135360, 270000, 0x2a9215d8 -0, 138240, 270000, 0x233f15d8 -0, 141120, 270000, 0x764b15d8 -0, 144000, 270000, 0xf76115d8 -0, 146880, 270000, 0xbbe015d8 -0, 149760, 270000, 0x95af15d8 -0, 152640, 270000, 0x324815d8 -0, 155520, 270000, 0x311915d8 -0, 158400, 270000, 0x090ef191 -0, 161280, 270000, 0xd88974dc -0, 164160, 270000, 0xfa7f58df -0, 167040, 270000, 0x78f849c3 -0, 169920, 270000, 0xae174892 -0, 172800, 270000, 0x9d4e2332 -0, 175680, 270000, 0x874b09b4 -0, 178560, 270000, 0x4069fed6 -0, 181440, 270000, 0x4069fed6 -0, 184320, 270000, 0x4069fed6 -0, 187200, 270000, 0x4069fed6 -0, 190080, 270000, 0x4069fed6 -0, 192960, 270000, 0x4069fed6 -0, 195840, 270000, 0x4069fed6 -0, 198720, 270000, 0x4069fed6 -0, 201600, 270000, 0x4069fed6 -0, 204480, 270000, 0x4069fed6 -0, 207360, 270000, 0x4069fed6 -0, 210240, 270000, 0x773db046 -0, 213120, 270000, 0x773db046 -0, 216000, 270000, 0x773db046 -0, 218880, 270000, 0x773db046 -0, 221760, 270000, 0x773db046 -0, 224640, 270000, 0x773db046 -0, 227520, 270000, 0x773db046 -0, 230400, 270000, 0x773db046 -0, 233280, 270000, 0x773db046 -0, 236160, 270000, 0x773db046 -0, 239040, 270000, 0x773db046 -0, 241920, 270000, 0x773db046 -0, 244800, 270000, 0x773db046 -0, 247680, 270000, 0x773db046 -0, 250560, 270000, 0x773db046 -0, 253440, 270000, 0x773db046 -0, 256320, 270000, 0x773db046 -0, 259200, 270000, 0x17b9aec9 -0, 262080, 270000, 0x622fad4c -0, 264960, 270000, 0xdaea3aef -0, 267840, 270000, 0x61bb10e3 -0, 270720, 270000, 0xfc37ee0c -0, 273600, 270000, 0x50dbd01e -0, 276480, 270000, 0xcd66c27c -0, 279360, 270000, 0xd13f1e4f -0, 282240, 270000, 0xa4a2dbf5 -0, 285120, 270000, 0xf302c9ab -0, 288000, 270000, 0x4479f7fe -0, 290880, 270000, 0x1afe92c8 -0, 293760, 270000, 0x3007f4c3 -0, 296640, 270000, 0x5834c096 -0, 299520, 270000, 0x40109126 -0, 302400, 270000, 0x0a7b8882 -0, 305280, 270000, 0x15b8635d -0, 308160, 270000, 0xeaa5598e -0, 311040, 270000, 0x0b7b5489 -0, 313920, 270000, 0x0b7b5489 -0, 316800, 270000, 0x0b7b5489 -0, 319680, 270000, 0x0b7b5489 -0, 322560, 270000, 0x8f0e6eaa -0, 325440, 270000, 0xc46fc0f2 -0, 328320, 270000, 0xadd7e605 -0, 331200, 270000, 0x9d23a056 -0, 334080, 270000, 0x365afa63 -0, 336960, 270000, 0x6ac3bda2 -0, 339840, 270000, 0x14f5daf2 -0, 342720, 270000, 0x4b3afb6a -0, 345600, 270000, 0x1a3302e3 -0, 348480, 270000, 0x1a3302e3 -0, 351360, 270000, 0x1a3302e3 -0, 354240, 270000, 0x1a3302e3 -0, 357120, 270000, 0xc15526e2 -0, 360000, 270000, 0x3dd73006 -0, 362880, 270000, 0x60abb5bc -0, 365760, 270000, 0xb960c27c -0, 368640, 270000, 0x8fa4c01c -0, 371520, 270000, 0x8fa4c01c -0, 374400, 270000, 0x8fa4c01c -0, 377280, 270000, 0xb20dcc38 -0, 380160, 270000, 0x03c6ad3c -0, 383040, 270000, 0xe550b194 -0, 385920, 270000, 0xe550b194 -0, 388800, 270000, 0xe550b194 -0, 391680, 270000, 0xe550b194 -0, 394560, 270000, 0xe550b194 -0, 397440, 270000, 0xe550b194 -0, 400320, 270000, 0xe550b194 -0, 403200, 270000, 0xe550b194 -0, 406080, 270000, 0xe550b194 -0, 408960, 270000, 0xe550b194 -0, 411840, 270000, 0xe550b194 -0, 414720, 270000, 0xe550b194 -0, 417600, 270000, 0xe550b194 -0, 420480, 270000, 0xe550b194 -0, 423360, 270000, 0x4550a014 -0, 426240, 270000, 0xaf639da8 -0, 429120, 270000, 0xe4229da8 -0, 432000, 270000, 0x315d9da8 -0, 434880, 270000, 0x7e899da8 -0, 437760, 270000, 0x99b9a8a0 -0, 440640, 270000, 0x4588ac2a -0, 443520, 270000, 0x1e79ae6e -0, 446400, 270000, 0xa003cb14 -0, 449280, 270000, 0x03ef1bb8 -0, 452160, 270000, 0x3b3f30fc -0, 455040, 270000, 0x4dad3525 -0, 457920, 270000, 0x5b600c12 -0, 460800, 270000, 0x75a1fab3 -0, 463680, 270000, 0xc9f7d9ad -0, 466560, 270000, 0x9eaec58d -0, 469440, 270000, 0xb91bc3e8 -0, 472320, 270000, 0x77bdbbfb -0, 475200, 270000, 0x77bdbbfb -0, 478080, 270000, 0x77bdbbfb -0, 480960, 270000, 0x77bdbbfb -0, 483840, 270000, 0x77bdbbfb -0, 486720, 270000, 0x77bdbbfb -0, 489600, 270000, 0x3d54eac2 -0, 492480, 270000, 0x3d54eac2 -0, 495360, 270000, 0x3d54eac2 -0, 498240, 270000, 0x3d54eac2 -0, 501120, 270000, 0x3d54eac2 -0, 504000, 270000, 0x3d54eac2 -0, 506880, 270000, 0x3d54eac2 -0, 509760, 270000, 0x3d54eac2 -0, 512640, 270000, 0x3d54eac2 -0, 515520, 270000, 0x3d54eac2 -0, 518400, 270000, 0x3d54eac2 -0, 521280, 270000, 0x3d54eac2 -0, 524160, 270000, 0x3d54eac2 -0, 527040, 270000, 0x3d54eac2 -0, 529920, 270000, 0x3d54eac2 -0, 532800, 270000, 0x3d54eac2 -0, 535680, 270000, 0x3d54eac2 -0, 538560, 270000, 0x3d54eac2 -0, 541440, 270000, 0x3d54eac2 -0, 544320, 270000, 0x5f3609ba -0, 547200, 270000, 0x80921b0c -0, 550080, 270000, 0x80921b0c -0, 552960, 270000, 0x80921b0c -0, 555840, 270000, 0x80921b0c -0, 558720, 270000, 0x80921b0c -0, 561600, 270000, 0x80921b0c -0, 564480, 270000, 0x80921b0c -0, 567360, 270000, 0x80921b0c -0, 570240, 270000, 0x80921b0c -0, 573120, 270000, 0x80921b0c -0, 576000, 270000, 0x80921b0c -0, 578880, 270000, 0x80921b0c -0, 581760, 270000, 0x80921b0c -0, 584640, 270000, 0x80921b0c -0, 587520, 270000, 0x80921b0c -0, 590400, 270000, 0x80921b0c -0, 593280, 270000, 0xf0e626a8 -0, 596160, 270000, 0xf0e626a8 +0, 2865, 270000, 0xf90015d8 +0, 5729, 270000, 0xf90015d8 +0, 8594, 270000, 0xf90015d8 +0, 11459, 270000, 0xf90015d8 +0, 14324, 270000, 0xf90015d8 +0, 17188, 270000, 0xf90015d8 +0, 20053, 270000, 0xf90015d8 +0, 22918, 270000, 0xf90015d8 +0, 25782, 270000, 0xf90015d8 +0, 28647, 270000, 0xf90015d8 +0, 31512, 270000, 0xf90015d8 +0, 34377, 270000, 0xf90015d8 +0, 37241, 270000, 0xf90015d8 +0, 40106, 270000, 0xf90015d8 +0, 42971, 270000, 0xf90015d8 +0, 45836, 270000, 0xf90015d8 +0, 48700, 270000, 0xf90015d8 +0, 51565, 270000, 0xf90015d8 +0, 54430, 270000, 0xf90015d8 +0, 57294, 270000, 0xf90015d8 +0, 60159, 270000, 0xf90015d8 +0, 63024, 270000, 0xf90015d8 +0, 65889, 270000, 0xf90015d8 +0, 68753, 270000, 0xf90015d8 +0, 71618, 270000, 0xf90015d8 +0, 74483, 270000, 0xf90015d8 +0, 77347, 270000, 0xf90015d8 +0, 80212, 270000, 0xf90015d8 +0, 83077, 270000, 0xf90015d8 +0, 85942, 270000, 0xf90015d8 +0, 88806, 270000, 0xf90015d8 +0, 91671, 270000, 0xf90015d8 +0, 94536, 270000, 0xf90015d8 +0, 97401, 270000, 0xf90015d8 +0, 100265, 270000, 0xf90015d8 +0, 103130, 270000, 0xf90015d8 +0, 105995, 270000, 0xf90015d8 +0, 108859, 270000, 0xf90015d8 +0, 111724, 270000, 0x1f9c15d8 +0, 114589, 270000, 0x436f15d8 +0, 117454, 270000, 0xe90115d8 +0, 120318, 270000, 0xe90115d8 +0, 123183, 270000, 0x8ea215d8 +0, 126048, 270000, 0x424015d8 +0, 128912, 270000, 0x0ce315d8 +0, 131777, 270000, 0x14bc15d8 +0, 134642, 270000, 0x2a9215d8 +0, 137507, 270000, 0x233f15d8 +0, 140371, 270000, 0x764b15d8 +0, 143236, 270000, 0xf76115d8 +0, 146101, 270000, 0xbbe015d8 +0, 148966, 270000, 0x95af15d8 +0, 151830, 270000, 0x324815d8 +0, 154695, 270000, 0x311915d8 +0, 157560, 270000, 0x090ef191 +0, 160424, 270000, 0xd88974dc +0, 163289, 270000, 0xfa7f58df +0, 166154, 270000, 0x78f849c3 +0, 169019, 270000, 0xae174892 +0, 171883, 270000, 0x9d4e2332 +0, 174748, 270000, 0x874b09b4 +0, 177613, 270000, 0x4069fed6 +0, 180477, 270000, 0x4069fed6 +0, 183342, 270000, 0x4069fed6 +0, 186207, 270000, 0x4069fed6 +0, 189072, 270000, 0x4069fed6 +0, 191936, 270000, 0x4069fed6 +0, 194801, 270000, 0x4069fed6 +0, 197666, 270000, 0x4069fed6 +0, 200531, 270000, 0x4069fed6 +0, 203395, 270000, 0x4069fed6 +0, 206260, 270000, 0x4069fed6 +0, 209125, 270000, 0x773db046 +0, 211989, 270000, 0x773db046 +0, 214854, 270000, 0x773db046 +0, 217719, 270000, 0x773db046 +0, 220584, 270000, 0x773db046 +0, 223448, 270000, 0x773db046 +0, 226313, 270000, 0x773db046 +0, 229178, 270000, 0x773db046 +0, 232042, 270000, 0x773db046 +0, 234907, 270000, 0x773db046 +0, 237772, 270000, 0x773db046 +0, 240637, 270000, 0x773db046 +0, 243501, 270000, 0x773db046 +0, 246366, 270000, 0x773db046 +0, 249231, 270000, 0x773db046 +0, 252095, 270000, 0x773db046 +0, 254960, 270000, 0x773db046 +0, 257825, 270000, 0x17b9aec9 +0, 260690, 270000, 0x622fad4c +0, 263554, 270000, 0xdaea3aef +0, 266419, 270000, 0x61bb10e3 +0, 269284, 270000, 0xfc37ee0c +0, 272149, 270000, 0x50dbd01e +0, 275013, 270000, 0xcd66c27c +0, 277878, 270000, 0xd13f1e4f +0, 280743, 270000, 0xa4a2dbf5 +0, 283607, 270000, 0xf302c9ab +0, 286472, 270000, 0x4479f7fe +0, 289337, 270000, 0x1afe92c8 +0, 292202, 270000, 0x3007f4c3 +0, 295066, 270000, 0x5834c096 +0, 297931, 270000, 0x40109126 +0, 300796, 270000, 0x0a7b8882 +0, 303660, 270000, 0x15b8635d +0, 306525, 270000, 0xeaa5598e +0, 309390, 270000, 0x0b7b5489 +0, 312255, 270000, 0x0b7b5489 +0, 315119, 270000, 0x0b7b5489 +0, 317984, 270000, 0x0b7b5489 +0, 320849, 270000, 0x8f0e6eaa +0, 323714, 270000, 0xc46fc0f2 +0, 326578, 270000, 0xadd7e605 +0, 329443, 270000, 0x9d23a056 +0, 332308, 270000, 0x365afa63 +0, 335172, 270000, 0x6ac3bda2 +0, 338037, 270000, 0x14f5daf2 +0, 340902, 270000, 0x4b3afb6a +0, 343767, 270000, 0x1a3302e3 +0, 346631, 270000, 0x1a3302e3 +0, 349496, 270000, 0x1a3302e3 +0, 352361, 270000, 0x1a3302e3 +0, 355225, 270000, 0xc15526e2 +0, 358090, 270000, 0x3dd73006 +0, 360955, 270000, 0x60abb5bc +0, 363820, 270000, 0xb960c27c +0, 366684, 270000, 0x8fa4c01c +0, 369549, 270000, 0x8fa4c01c +0, 372414, 270000, 0x8fa4c01c +0, 375279, 270000, 0xb20dcc38 +0, 378143, 270000, 0x03c6ad3c +0, 381008, 270000, 0xe550b194 +0, 383873, 270000, 0xe550b194 +0, 386737, 270000, 0xe550b194 +0, 389602, 270000, 0xe550b194 +0, 392467, 270000, 0xe550b194 +0, 395332, 270000, 0xe550b194 +0, 398196, 270000, 0xe550b194 +0, 401061, 270000, 0xe550b194 +0, 403926, 270000, 0xe550b194 +0, 406790, 270000, 0xe550b194 +0, 409655, 270000, 0xe550b194 +0, 412520, 270000, 0xe550b194 +0, 415385, 270000, 0xe550b194 +0, 418249, 270000, 0xe550b194 +0, 421114, 270000, 0x4550a014 +0, 423979, 270000, 0xaf639da8 +0, 426844, 270000, 0xe4229da8 +0, 429708, 270000, 0x315d9da8 +0, 432573, 270000, 0x7e899da8 +0, 435438, 270000, 0x99b9a8a0 +0, 438302, 270000, 0x4588ac2a +0, 441167, 270000, 0x1e79ae6e +0, 444032, 270000, 0xa003cb14 +0, 446897, 270000, 0x03ef1bb8 +0, 449761, 270000, 0x3b3f30fc +0, 452626, 270000, 0x4dad3525 +0, 455491, 270000, 0x5b600c12 +0, 458355, 270000, 0x75a1fab3 +0, 461220, 270000, 0xc9f7d9ad +0, 464085, 270000, 0x9eaec58d +0, 466950, 270000, 0xb91bc3e8 +0, 469814, 270000, 0x77bdbbfb +0, 472679, 270000, 0x77bdbbfb +0, 475544, 270000, 0x77bdbbfb +0, 478408, 270000, 0x77bdbbfb +0, 481273, 270000, 0x77bdbbfb +0, 484138, 270000, 0x77bdbbfb +0, 487003, 270000, 0x3d54eac2 +0, 489867, 270000, 0x3d54eac2 +0, 492732, 270000, 0x3d54eac2 +0, 495597, 270000, 0x3d54eac2 +0, 498462, 270000, 0x3d54eac2 +0, 501326, 270000, 0x3d54eac2 +0, 504191, 270000, 0x3d54eac2 +0, 507056, 270000, 0x3d54eac2 +0, 509920, 270000, 0x3d54eac2 +0, 512785, 270000, 0x3d54eac2 +0, 515650, 270000, 0x3d54eac2 +0, 518515, 270000, 0x3d54eac2 +0, 521379, 270000, 0x3d54eac2 +0, 524244, 270000, 0x3d54eac2 +0, 527109, 270000, 0x3d54eac2 +0, 529973, 270000, 0x3d54eac2 +0, 532838, 270000, 0x3d54eac2 +0, 535703, 270000, 0x3d54eac2 +0, 538568, 270000, 0x3d54eac2 +0, 541432, 270000, 0x5f3609ba +0, 544297, 270000, 0x80921b0c +0, 547162, 270000, 0x80921b0c +0, 550027, 270000, 0x80921b0c +0, 552891, 270000, 0x80921b0c +0, 555756, 270000, 0x80921b0c +0, 558621, 270000, 0x80921b0c +0, 561485, 270000, 0x80921b0c +0, 564350, 270000, 0x80921b0c +0, 567215, 270000, 0x80921b0c +0, 570080, 270000, 0x80921b0c +0, 572944, 270000, 0x80921b0c +0, 575809, 270000, 0x80921b0c +0, 578674, 270000, 0x80921b0c +0, 581538, 270000, 0x80921b0c +0, 584403, 270000, 0x80921b0c +0, 587268, 270000, 0x80921b0c +0, 590133, 270000, 0xf0e626a8 +0, 592997, 270000, 0xf0e626a8 -- cgit v1.2.3