summaryrefslogtreecommitdiff
path: root/src/lib/sndfile_content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-05-27 20:55:51 +0100
committerCarl Hetherington <cth@carlh.net>2015-06-02 13:38:21 +0100
commit0a93237cb5e4642d3b698ff9b7d0cfae5401478c (patch)
treeb0d5255ae2b90d1c9ef489e78239c2f081ea0a9e /src/lib/sndfile_content.cc
parent608c146eb09fac2a8fc60e1a72591f6bb8364e1f (diff)
Handle multiple audio streams in a single piece of content
in a similar way to the V1 patch.
Diffstat (limited to 'src/lib/sndfile_content.cc')
-rw-r--r--src/lib/sndfile_content.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc
index 0eb7efb2f..cfee7bd38 100644
--- a/src/lib/sndfile_content.cc
+++ b/src/lib/sndfile_content.cc
@@ -17,14 +17,16 @@
*/
-#include <libcxml/cxml.h>
#include "sndfile_content.h"
#include "sndfile_decoder.h"
+#include "sndfile_examiner.h"
#include "film.h"
#include "compose.hpp"
#include "job.h"
#include "util.h"
#include "safe_stringstream.h"
+#include "raw_convert.h"
+#include <libcxml/cxml.h>
#include "i18n.h"
@@ -42,8 +44,9 @@ SndfileContent::SndfileContent (shared_ptr<const Film> f, boost::filesystem::pat
SndfileContent::SndfileContent (shared_ptr<const Film> f, cxml::ConstNodePtr node, int version)
: Content (f, node)
, SingleStreamAudioContent (f, node, version)
+ , _audio_length (node->number_child<int64_t> ("AudioLength"))
{
-
+
}
void
@@ -52,6 +55,7 @@ SndfileContent::as_xml (xmlpp::Node* node) const
node->add_child("Type")->add_child_text ("Sndfile");
Content::as_xml (node);
SingleStreamAudioContent::as_xml (node);
+ node->add_child("AudioLength")->add_child_text (raw_convert<string> (audio_length ()));
}
@@ -84,16 +88,25 @@ SndfileContent::examine (shared_ptr<Job> job)
{
job->set_progress_unknown ();
Content::examine (job);
- shared_ptr<AudioExaminer> dec (new SndfileDecoder (shared_from_this()));
+ shared_ptr<AudioExaminer> dec (new SndfileExaminer (shared_from_this ()));
take_from_audio_examiner (dec);
}
+void
+SndfileContent::take_from_audio_examiner (shared_ptr<AudioExaminer> examiner)
+{
+ SingleStreamAudioContent::take_from_audio_examiner (examiner);
+
+ boost::mutex::scoped_lock lm (_mutex);
+ _audio_length = examiner->audio_length ();
+}
+
DCPTime
SndfileContent::full_length () const
{
shared_ptr<const Film> film = _film.lock ();
DCPOMATIC_ASSERT (film);
FrameRateChange const frc = film->active_frame_rate_change (position ());
- return DCPTime::from_frames (audio_length() / frc.speed_up, audio_frame_rate ());
+ return DCPTime::from_frames (audio_length() / frc.speed_up, audio_stream()->frame_rate ());
}