summaryrefslogtreecommitdiff
path: root/src/lib/sndfile_content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-04-13 18:39:56 +0100
committerCarl Hetherington <cth@carlh.net>2016-05-18 11:50:29 +0100
commit6dd3777a0074f6f97c7f7286621006a1c14376e8 (patch)
treef151d71e7d5616e87d1b1d087e4a3034d676dee7 /src/lib/sndfile_content.cc
parentc5dab5fdc0edde080e408a6d24fa059e27106ef5 (diff)
Copy SingleStreamAudioContent into DCPContent and SndfileContent.
Diffstat (limited to 'src/lib/sndfile_content.cc')
-rw-r--r--src/lib/sndfile_content.cc34
1 files changed, 26 insertions, 8 deletions
diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc
index f9eb62a2b..d8435613d 100644
--- a/src/lib/sndfile_content.cc
+++ b/src/lib/sndfile_content.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,19 +34,21 @@
using std::string;
using std::cout;
+using std::vector;
using boost::shared_ptr;
SndfileContent::SndfileContent (shared_ptr<const Film> film, boost::filesystem::path p)
: Content (film, p)
- , SingleStreamAudioContent (film, p)
+ , AudioContent (film, p)
{
}
SndfileContent::SndfileContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
: Content (film, node)
- , SingleStreamAudioContent (film, node, version)
+ , AudioContent (film, node)
, _audio_length (node->number_child<Frame> ("AudioLength"))
+ , _audio_stream (new AudioStream (node->number_child<int> ("AudioFrameRate"), AudioMapping (node->node_child ("AudioMapping"), version)))
{
}
@@ -56,7 +58,9 @@ SndfileContent::as_xml (xmlpp::Node* node) const
{
node->add_child("Type")->add_child_text ("Sndfile");
Content::as_xml (node);
- SingleStreamAudioContent::as_xml (node);
+ AudioContent::as_xml (node);
+ node->add_child("AudioFrameRate")->add_child_text (raw_convert<string> (audio_stream()->frame_rate ()));
+ audio_stream()->mapping().as_xml (node->add_child("AudioMapping"));
node->add_child("AudioLength")->add_child_text (raw_convert<string> (audio_length ()));
}
@@ -97,10 +101,16 @@ SndfileContent::examine (shared_ptr<Job> job)
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 ();
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ _audio_stream.reset (new AudioStream (examiner->audio_frame_rate(), examiner->audio_channels ()));
+ AudioMapping m = _audio_stream->mapping ();
+ film()->make_audio_mapping_default (m);
+ _audio_stream->set_mapping (m);
+ _audio_length = examiner->audio_length ();
+ }
+
+ signal_changed (AudioContentProperty::AUDIO_STREAMS);
}
DCPTime
@@ -109,3 +119,11 @@ SndfileContent::full_length () const
FrameRateChange const frc (audio_video_frame_rate(), film()->video_frame_rate());
return DCPTime::from_frames (audio_length() / frc.speed_up, audio_stream()->frame_rate ());
}
+
+vector<AudioStreamPtr>
+SndfileContent::audio_streams () const
+{
+ vector<AudioStreamPtr> s;
+ s.push_back (_audio_stream);
+ return s;
+}