diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-11-20 16:45:26 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-11-20 16:45:26 +0000 |
| commit | 28387574433feaa828b8f2fce8ac55c1ac4b3b4e (patch) | |
| tree | 073af9290187fd6b9effe1070695d866a20c712d /src/lib | |
| parent | d801f4f01fba5c922829c2068c07364c58ae879e (diff) | |
Only do long probes of FFmpeg content with the examiner, not the decoder.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/ffmpeg.cc | 19 | ||||
| -rw-r--r-- | src/lib/ffmpeg.h | 4 | ||||
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 2 | ||||
| -rw-r--r-- | src/lib/ffmpeg_examiner.cc | 2 |
4 files changed, 15 insertions, 12 deletions
diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index e9c41ea18..dbafba0f0 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -37,13 +37,14 @@ using boost::lexical_cast; boost::mutex FFmpeg::_mutex; -FFmpeg::FFmpeg (boost::shared_ptr<const FFmpegContent> c) +/** @param long_probe true to do a long probe of the file looking for streams */ +FFmpeg::FFmpeg (boost::shared_ptr<const FFmpegContent> c, bool long_probe) : _ffmpeg_content (c) , _format_context (0) , _frame (0) , _video_stream (-1) { - setup_general (); + setup_general (long_probe); setup_video (); setup_audio (); } @@ -65,16 +66,18 @@ FFmpeg::~FFmpeg () } void -FFmpeg::setup_general () +FFmpeg::setup_general (bool long_probe) { av_register_all (); AVDictionary* options = 0; - /* These durations are in microseconds, and represent how far into the content file - we will look for streams. - */ - av_dict_set (&options, "analyzeduration", lexical_cast<string> (5 * 60 * 1e6).c_str(), 0); - av_dict_set (&options, "probesize", lexical_cast<string> (5 * 60 * 1e6).c_str(), 0); + if (long_probe) { + /* These durations are in microseconds, and represent how far into the content file + we will look for streams. + */ + av_dict_set (&options, "analyzeduration", lexical_cast<string> (5 * 60 * 1e6).c_str(), 0); + av_dict_set (&options, "probesize", lexical_cast<string> (5 * 60 * 1e6).c_str(), 0); + } if (avformat_open_input (&_format_context, _ffmpeg_content->path().string().c_str(), 0, &options) < 0) { throw OpenFileError (_ffmpeg_content->path().string ()); diff --git a/src/lib/ffmpeg.h b/src/lib/ffmpeg.h index 4d1a45da3..d5f4db291 100644 --- a/src/lib/ffmpeg.h +++ b/src/lib/ffmpeg.h @@ -41,7 +41,7 @@ class FFmpegContent; class FFmpeg { public: - FFmpeg (boost::shared_ptr<const FFmpegContent>); + FFmpeg (boost::shared_ptr<const FFmpegContent>, bool); virtual ~FFmpeg (); boost::shared_ptr<const FFmpegContent> ffmpeg_content () const { @@ -67,7 +67,7 @@ protected: static boost::mutex _mutex; private: - void setup_general (); + void setup_general (bool); void setup_video (); void setup_audio (); }; diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 19b99df90..be3247537 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -63,7 +63,7 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr<const Film> f, shared_ptr<const FFmpegC , VideoDecoder (f, c) , AudioDecoder (f, c) , SubtitleDecoder (f) - , FFmpeg (c) + , FFmpeg (c, false) , _subtitle_codec_context (0) , _subtitle_codec (0) , _decode_video (video) diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index 215c5e758..4d10aabbb 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -32,7 +32,7 @@ using boost::shared_ptr; using boost::optional; FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c) - : FFmpeg (c) + : FFmpeg (c, true) { /* Find audio and subtitle streams */ |
