Mercurial > libavformat.hg
comparison utils.c @ 5441:eada8bccc620 libavformat
Add avg_frame_rate.
| author | michael |
|---|---|
| date | Sun, 13 Dec 2009 15:52:11 +0000 |
| parents | 88c31193e06b |
| children | 075674a33641 |
comparison
equal
deleted
inserted
replaced
| 5440:02e58aea657b | 5441:eada8bccc620 |
|---|---|
| 2221 if(st->codec->codec) | 2221 if(st->codec->codec) |
| 2222 avcodec_close(st->codec); | 2222 avcodec_close(st->codec); |
| 2223 } | 2223 } |
| 2224 for(i=0;i<ic->nb_streams;i++) { | 2224 for(i=0;i<ic->nb_streams;i++) { |
| 2225 st = ic->streams[i]; | 2225 st = ic->streams[i]; |
| 2226 if(codec_info_nb_frames[i]>2) | |
| 2227 av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, | |
| 2228 (codec_info_nb_frames[i]-2)*(int64_t)st->time_base.den, | |
| 2229 codec_info_duration[i] *(int64_t)st->time_base.num, 60000); | |
| 2226 if (st->codec->codec_type == CODEC_TYPE_VIDEO) { | 2230 if (st->codec->codec_type == CODEC_TYPE_VIDEO) { |
| 2227 if(st->codec->codec_id == CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_coded_sample) | 2231 if(st->codec->codec_id == CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_coded_sample) |
| 2228 st->codec->codec_tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt); | 2232 st->codec->codec_tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt); |
| 2229 | 2233 |
| 2230 // the check for tb_unreliable() is not completely correct, since this is not about handling | 2234 // the check for tb_unreliable() is not completely correct, since this is not about handling |
| 2898 av_log(NULL, AV_LOG_INFO, ", PAR %d:%d DAR %d:%d", | 2902 av_log(NULL, AV_LOG_INFO, ", PAR %d:%d DAR %d:%d", |
| 2899 st->sample_aspect_ratio.num, st->sample_aspect_ratio.den, | 2903 st->sample_aspect_ratio.num, st->sample_aspect_ratio.den, |
| 2900 display_aspect_ratio.num, display_aspect_ratio.den); | 2904 display_aspect_ratio.num, display_aspect_ratio.den); |
| 2901 } | 2905 } |
| 2902 if(st->codec->codec_type == CODEC_TYPE_VIDEO){ | 2906 if(st->codec->codec_type == CODEC_TYPE_VIDEO){ |
| 2907 if(st->avg_frame_rate.den && st->avg_frame_rate.num) | |
| 2908 print_fps(av_q2d(st->avg_frame_rate), "fps"); | |
| 2903 if(st->r_frame_rate.den && st->r_frame_rate.num) | 2909 if(st->r_frame_rate.den && st->r_frame_rate.num) |
| 2904 print_fps(av_q2d(st->r_frame_rate), "tbr"); | 2910 print_fps(av_q2d(st->r_frame_rate), "tbr"); |
| 2905 if(st->time_base.den && st->time_base.num) | 2911 if(st->time_base.den && st->time_base.num) |
| 2906 print_fps(1/av_q2d(st->time_base), "tbn"); | 2912 print_fps(1/av_q2d(st->time_base), "tbn"); |
| 2907 if(st->codec->time_base.den && st->codec->time_base.num) | 2913 if(st->codec->time_base.den && st->codec->time_base.num) |
