X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fsndfile_content.cc;h=c7879202f471c6ac5a2f2f978215b35cffc39300;hb=8bef34f672815c3c9b4236d06fdee8dfd0bffbc2;hp=549af09b10cd116857d9748f29102dca90f39b93;hpb=7370f2b159a539d4a7721a50d0f3dc56ba14c678;p=dcpomatic.git diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc index 549af09b1..c7879202f 100644 --- a/src/lib/sndfile_content.cc +++ b/src/lib/sndfile_content.cc @@ -20,8 +20,10 @@ #include #include "sndfile_content.h" #include "sndfile_decoder.h" +#include "film.h" #include "compose.hpp" #include "job.h" +#include "util.h" #include "i18n.h" @@ -41,7 +43,7 @@ SndfileContent::SndfileContent (shared_ptr f, boost::filesystem::pat } -SndfileContent::SndfileContent (shared_ptr f, shared_ptr node) +SndfileContent::SndfileContent (shared_ptr f, shared_ptr node, int) : Content (f, node) , AudioContent (f, node) , _audio_mapping (node->node_child ("AudioMapping")) @@ -54,7 +56,16 @@ SndfileContent::SndfileContent (shared_ptr f, shared_ptr job) signal_changed (AudioContentProperty::AUDIO_LENGTH); signal_changed (AudioContentProperty::AUDIO_FRAME_RATE); - /* XXX: do this in signal_changed...? */ - _audio_mapping = AudioMapping (_audio_channels); - _audio_mapping.make_default (); + { + boost::mutex::scoped_lock lm (_mutex); + /* XXX: do this in signal_changed...? */ + _audio_mapping = AudioMapping (_audio_channels); + _audio_mapping.make_default (); + } + signal_changed (AudioContentProperty::AUDIO_MAPPING); } @@ -119,14 +134,15 @@ SndfileContent::as_xml (xmlpp::Node* node) const node->add_child("Type")->add_child_text ("Sndfile"); Content::as_xml (node); AudioContent::as_xml (node); - node->add_child("AudioChannels")->add_child_text (lexical_cast (_audio_channels)); - node->add_child("AudioLength")->add_child_text (lexical_cast (_audio_length)); - node->add_child("AudioFrameRate")->add_child_text (lexical_cast (_audio_frame_rate)); + + node->add_child("AudioChannels")->add_child_text (lexical_cast (audio_channels ())); + node->add_child("AudioLength")->add_child_text (lexical_cast (audio_length ())); + node->add_child("AudioFrameRate")->add_child_text (lexical_cast (content_audio_frame_rate ())); _audio_mapping.as_xml (node->add_child("AudioMapping")); } Time -SndfileContent::length () const +SndfileContent::full_length () const { shared_ptr film = _film.lock (); assert (film); @@ -140,7 +156,7 @@ SndfileContent::output_audio_frame_rate () const shared_ptr film = _film.lock (); assert (film); - return film->dcp_audio_frame_rate (); + return film->audio_frame_rate (); } void