summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-12-16 14:53:22 +0000
committerCarl Hetherington <cth@carlh.net>2012-12-16 14:53:22 +0000
commitaa230169f8b59b7cb2da9a3bbb8ce5f7600285c0 (patch)
tree5cde52f6c50b9a56597e0f6ebad1f8e4aa5e1c8d /src/lib/ffmpeg_decoder.cc
parent7fd2aff3af82d3e573934d046be26b72a67a93e6 (diff)
parent3ce37f08e98b9c3a238fb1c9a6184fb7fd4e5667 (diff)
Merge speed-up branch.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
-rw-r--r--src/lib/ffmpeg_decoder.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index 24ee89b21..136843190 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -164,14 +164,7 @@ FFmpegDecoder::setup_video ()
throw DecodeError ("could not find video decoder");
}
- /* I think this prevents problems with green hash on decodes and
- "changing frame properties on the fly is not supported by all filters"
- messages with some content. Although I'm not sure; needs checking.
- */
- AVDictionary* opts = 0;
- av_dict_set (&opts, "threads", "1", 0);
-
- if (avcodec_open2 (_video_codec_context, _video_codec, &opts) < 0) {
+ if (avcodec_open2 (_video_codec_context, _video_codec, 0) < 0) {
throw DecodeError ("could not open video decoder");
}
}
@@ -616,7 +609,6 @@ FFmpegAudioStream::to_string () const
return String::compose ("ffmpeg %1 %2 %3 %4", _id, _sample_rate, _channel_layout, _name);
}
-
void
FFmpegDecoder::out_with_sync ()
{
@@ -680,3 +672,10 @@ FFmpegDecoder::film_changed (Film::Property p)
}
}
+/** @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();
+}
+