X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg_content.cc;h=f3a4c4c4fc7893441267ea6d916f2fcadec98059;hb=5a5324ed3a381a86dfe0a6e3932c1d58fdcd596f;hp=0f66180d0a6cd80da8f7d4ff16e99e247d8b3f27;hpb=31150ddd0fafac4426d11a758be9d77699b7377c;p=dcpomatic.git diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 0f66180d0..f3a4c4c4f 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -42,6 +42,7 @@ extern "C" { } #include #include +#include #include #include "i18n.h" @@ -56,6 +57,7 @@ using std::pair; using std::make_pair; using std::max; using boost::shared_ptr; +using boost::make_shared; using boost::dynamic_pointer_cast; using boost::optional; @@ -73,12 +75,12 @@ FFmpegContent::FFmpegContent (shared_ptr film, cxml::ConstNodePtr no : Content (film, node) { video = VideoContent::from_xml (this, node, version); - audio = AudioContent::from_xml (this, node); + audio = AudioContent::from_xml (this, node, version); subtitle = SubtitleContent::from_xml (this, node, version); list c = node->node_children ("SubtitleStream"); for (list::const_iterator i = c.begin(); i != c.end(); ++i) { - _subtitle_streams.push_back (shared_ptr (new FFmpegSubtitleStream (*i, version))); + _subtitle_streams.push_back (make_shared (*i, version)); if ((*i)->optional_number_child ("Selected")) { _subtitle_stream = _subtitle_streams.back (); } @@ -86,7 +88,7 @@ FFmpegContent::FFmpegContent (shared_ptr film, cxml::ConstNodePtr no c = node->node_children ("AudioStream"); for (list::const_iterator i = c.begin(); i != c.end(); ++i) { - shared_ptr as (new FFmpegAudioStream (*i, version)); + shared_ptr as = make_shared (*i, version); audio->add_stream (as); if (version < 11 && !(*i)->optional_node_child ("Selected")) { /* This is an old file and this stream is not selected, so un-map it */ @@ -210,7 +212,7 @@ FFmpegContent::examine (shared_ptr job) Content::examine (job); - shared_ptr examiner (new FFmpegExaminer (shared_from_this (), job)); + shared_ptr examiner = make_shared (shared_from_this (), job); if (examiner->has_video ()) { video.reset (new VideoContent (this)); @@ -218,6 +220,8 @@ FFmpegContent::examine (shared_ptr job) set_default_colour_conversion (); } + boost::filesystem::path first_path = path (0); + { boost::mutex::scoped_lock lm (_mutex); @@ -239,7 +243,7 @@ FFmpegContent::examine (shared_ptr job) AudioStreamPtr as = audio->streams().front(); AudioMapping m = as->mapping (); - film()->make_audio_mapping_default (m); + film()->make_audio_mapping_default (m, first_path); as->set_mapping (m); }