From e9d0d7bf9871b7e7fa8d154535cf0bbc7e7bd466 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 10 Dec 2012 22:20:39 +0000 Subject: Try to allow users to specify that the film's header should be trusted wrt length when building thumbnails, thus speeding up examine-content by a factor of 2-ish. --- src/lib/ffmpeg_decoder.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/lib/ffmpeg_decoder.cc') diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index ef9c05fa6..fd522a5ac 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -629,3 +629,9 @@ FFmpegAudioStream::to_string () const return String::compose ("ffmpeg %1 %2 %3 %4", _id, _sample_rate, _channel_layout, _name); } +/** @return Length (in video frames) according to our content's header */ +SourceFrame +FFmpegDecoder::length () const +{ + return (double(_format_context->duration) / AV_TIME_BASE) * frames_per_second(); +} -- cgit v1.2.3