summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-10-10 13:04:59 +0100
committerCarl Hetherington <cth@carlh.net>2012-10-10 13:04:59 +0100
commitd382f34db155ddaf4bb61538c18b87c7564e00b2 (patch)
tree8c63943ad046240f9a307c640d022af750b07bb7 /src/lib/ffmpeg_decoder.cc
parentb5828ccf20a0e0c4365854ac19a05d5a4783e254 (diff)
parent1bbd5367ddddfac18ceaa4d010cfc39f1daaa3a3 (diff)
Merge branch 'master' into subs
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
-rw-r--r--src/lib/ffmpeg_decoder.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index 7bc579ba6..ca35c6e81 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -208,10 +208,8 @@ FFmpegDecoder::do_pass ()
int frame_finished;
- if (_opt->decode_video) {
- while (avcodec_decode_video2 (_video_codec_context, _frame, &frame_finished, &_packet) >= 0 && frame_finished) {
- process_video (_frame);
- }
+ while (avcodec_decode_video2 (_video_codec_context, _frame, &frame_finished, &_packet) >= 0 && frame_finished) {
+ process_video (_frame);
}
if (_audio_stream >= 0 && _opt->decode_audio) {
@@ -228,7 +226,7 @@ FFmpegDecoder::do_pass ()
return true;
}
- if (_packet.stream_index == _video_stream && _opt->decode_video) {
+ if (_packet.stream_index == _video_stream) {
int frame_finished;
if (avcodec_decode_video2 (_video_codec_context, _frame, &frame_finished, &_packet) >= 0 && frame_finished) {
@@ -275,7 +273,13 @@ FFmpegDecoder::length_in_frames () const
float
FFmpegDecoder::frames_per_second () const
{
- return av_q2d (_format_context->streams[_video_stream]->avg_frame_rate);
+ AVStream* s = _format_context->streams[_video_stream];
+
+ if (s->avg_frame_rate.num && s->avg_frame_rate.den) {
+ return av_q2d (s->avg_frame_rate);
+ }
+
+ return av_q2d (s->r_frame_rate);
}
int