diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-06-28 09:47:55 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-06-28 09:47:55 +0100 |
| commit | 318d819afd66b76e3ea7ce728452c2fb668c0b80 (patch) | |
| tree | f053fd342a84555b98d78eca79b93cf254c028d9 /src/lib/ffmpeg_decoder.cc | |
| parent | 409db67a7e665c562b4c46035e6394263a93a7f6 (diff) | |
| parent | 1c86e1eaa1115015e7b2c4129a3b4be024939db2 (diff) | |
Merge branch 'master' of ssh://carlh.dnsalias.org/home/carl/git/dvdomatic
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index cad247e5a..c2143b949 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -61,6 +61,8 @@ using boost::optional; using boost::dynamic_pointer_cast; using libdcp::Size; +boost::mutex FFmpegDecoder::_mutex; + FFmpegDecoder::FFmpegDecoder (shared_ptr<Film> f, DecodeOptions o) : Decoder (f, o) , VideoDecoder (f, o) @@ -83,6 +85,8 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr<Film> f, DecodeOptions o) FFmpegDecoder::~FFmpegDecoder () { + boost::mutex::scoped_lock lm (_mutex); + if (_audio_codec_context) { avcodec_close (_audio_codec_context); } @@ -157,6 +161,8 @@ FFmpegDecoder::setup_general () void FFmpegDecoder::setup_video () { + boost::mutex::scoped_lock lm (_mutex); + _video_codec_context = _format_context->streams[_video_stream]->codec; _video_codec = avcodec_find_decoder (_video_codec_context->codec_id); @@ -172,6 +178,8 @@ FFmpegDecoder::setup_video () void FFmpegDecoder::setup_audio () { + boost::mutex::scoped_lock lm (_mutex); + if (!_audio_stream) { return; } @@ -194,6 +202,8 @@ FFmpegDecoder::setup_audio () void FFmpegDecoder::setup_subtitle () { + boost::mutex::scoped_lock lm (_mutex); + if (!_subtitle_stream || _subtitle_stream->id() >= int (_format_context->nb_streams)) { return; } |
