Mercurial > libavformat.hg
changeset 5441:eada8bccc620 libavformat
Add avg_frame_rate.
author | michael |
---|---|
date | Sun, 13 Dec 2009 15:52:11 +0000 |
parents | 02e58aea657b |
children | 65a5773a23a5 |
files | avformat.h utils.c |
diffstat | 2 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/avformat.h Sun Dec 13 15:28:00 2009 +0000 +++ b/avformat.h Sun Dec 13 15:52:11 2009 +0000 @@ -466,6 +466,11 @@ * used internally, NOT PART OF PUBLIC API, dont read or write from outside of libav* */ struct AVPacketList *last_in_packet_buffer; + + /** + * Average framerate + */ + AVRational avg_frame_rate; } AVStream; #define AV_PROGRAM_RUNNING 1
--- a/utils.c Sun Dec 13 15:28:00 2009 +0000 +++ b/utils.c Sun Dec 13 15:52:11 2009 +0000 @@ -2223,6 +2223,10 @@ } for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; + if(codec_info_nb_frames[i]>2) + av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, + (codec_info_nb_frames[i]-2)*(int64_t)st->time_base.den, + codec_info_duration[i] *(int64_t)st->time_base.num, 60000); if (st->codec->codec_type == CODEC_TYPE_VIDEO) { if(st->codec->codec_id == CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_coded_sample) st->codec->codec_tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt); @@ -2900,6 +2904,8 @@ display_aspect_ratio.num, display_aspect_ratio.den); } if(st->codec->codec_type == CODEC_TYPE_VIDEO){ + if(st->avg_frame_rate.den && st->avg_frame_rate.num) + print_fps(av_q2d(st->avg_frame_rate), "fps"); if(st->r_frame_rate.den && st->r_frame_rate.num) print_fps(av_q2d(st->r_frame_rate), "tbr"); if(st->time_base.den && st->time_base.num)