summaryrefslogtreecommitdiff
path: root/src/lib/sndfile_content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-05-23 17:18:49 +0100
committerCarl Hetherington <cth@carlh.net>2013-05-23 17:18:49 +0100
commit64a2f1bb6a7b972607fa363631ef7a47444e8217 (patch)
tree020c028a93f113e372e70f485857ce04dea5db3d /src/lib/sndfile_content.cc
parent8c6fe8e1e8c8f6d5932606f2a5b6e1b87681ae38 (diff)
Various bits and pieces.
Diffstat (limited to 'src/lib/sndfile_content.cc')
-rw-r--r--src/lib/sndfile_content.cc38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc
index 758ae942d..0f895c95e 100644
--- a/src/lib/sndfile_content.cc
+++ b/src/lib/sndfile_content.cc
@@ -33,9 +33,9 @@ using std::cout;
using boost::shared_ptr;
using boost::lexical_cast;
-SndfileContent::SndfileContent (boost::filesystem::path f)
- : Content (f)
- , AudioContent (f)
+SndfileContent::SndfileContent (shared_ptr<const Film> f, boost::filesystem::path p)
+ : Content (f, p)
+ , AudioContent (f, p)
, _audio_channels (0)
, _audio_length (0)
, _audio_frame_rate (0)
@@ -43,9 +43,9 @@ SndfileContent::SndfileContent (boost::filesystem::path f)
}
-SndfileContent::SndfileContent (shared_ptr<const cxml::Node> node)
- : Content (node)
- , AudioContent (node)
+SndfileContent::SndfileContent (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node)
+ : Content (f, node)
+ , AudioContent (f, node)
{
_audio_channels = node->number_child<int> ("AudioChannels");
_audio_length = node->number_child<ContentAudioFrame> ("AudioLength");
@@ -93,10 +93,13 @@ SndfileContent::clone () const
}
void
-SndfileContent::examine (shared_ptr<Film> film, shared_ptr<Job> job)
+SndfileContent::examine (shared_ptr<Job> job)
{
job->set_progress_unknown ();
- Content::examine (film, job);
+ Content::examine (job);
+
+ shared_ptr<const Film> film = _film.lock ();
+ assert (film);
SndfileDecoder dec (film, shared_from_this());
@@ -122,15 +125,20 @@ SndfileContent::as_xml (xmlpp::Node* node) const
node->add_child("AudioFrameRate")->add_child_text (lexical_cast<string> (_audio_frame_rate));
}
-int
-SndfileContent::output_audio_frame_rate (shared_ptr<const Film>) const
+Time
+SndfileContent::length () const
{
- /* Resample to a DCI-approved sample rate */
- return dcp_audio_frame_rate (content_audio_frame_rate ());
+ shared_ptr<const Film> film = _film.lock ();
+ assert (film);
+
+ return film->audio_frames_to_time (audio_length ());
}
-Time
-SndfileContent::length (shared_ptr<const Film> film) const
+int
+SndfileContent::output_audio_frame_rate () const
{
- return film->audio_frames_to_time (audio_length ());
+ shared_ptr<const Film> film = _film.lock ();
+ assert (film);
+
+ return film->dcp_audio_frame_rate ();
}