summaryrefslogtreecommitdiff
path: root/src/lib/audio_content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-05-09 19:58:37 +0100
committerCarl Hetherington <cth@carlh.net>2016-05-18 11:50:29 +0100
commit19f94521139aac13ef8fb4eaa55855b2ada307b4 (patch)
tree6e4b457c1fa46c674433fb1a5d2a9cd0f07c5a11 /src/lib/audio_content.cc
parent0a2d40420813403a96352c6dc895d23fcd9994c0 (diff)
Move video frame rate ('prepared-for') into Content.
Diffstat (limited to 'src/lib/audio_content.cc')
-rw-r--r--src/lib/audio_content.cc45
1 files changed, 8 insertions, 37 deletions
diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc
index a903cfb9a..a0c9950a6 100644
--- a/src/lib/audio_content.cc
+++ b/src/lib/audio_content.cc
@@ -47,7 +47,6 @@ using boost::optional;
int const AudioContentProperty::STREAMS = 200;
int const AudioContentProperty::GAIN = 201;
int const AudioContentProperty::DELAY = 202;
-int const AudioContentProperty::VIDEO_FRAME_RATE = 203;
AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film)
: ContentPart (parent, film)
@@ -62,7 +61,12 @@ AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film, cxml::
{
_gain = node->number_child<double> ("AudioGain");
_delay = node->number_child<int> ("AudioDelay");
- _video_frame_rate = node->optional_number_child<double> ("AudioVideoFrameRate");
+
+ /* Backwards compatibility */
+ optional<double> r = node->optional_number_child<double> ("AudioVideoFrameRate");
+ if (r) {
+ _parent->set_video_frame_rate (r.get ());
+ }
}
AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film, vector<shared_ptr<Content> > c)
@@ -79,16 +83,10 @@ AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film, vector
if (c[i]->audio->delay() != ref->delay()) {
throw JoinError (_("Content to be joined must have the same audio delay."));
}
-
- if (c[i]->audio->video_frame_rate() != ref->video_frame_rate()) {
- throw JoinError (_("Content to be joined must have the same video frame rate."));
- }
}
_gain = ref->gain ();
_delay = ref->delay ();
- /* Preserve the optional<> part of this */
- _video_frame_rate = ref->_video_frame_rate;
_streams = ref->streams ();
}
@@ -98,9 +96,6 @@ AudioContent::as_xml (xmlpp::Node* node) const
boost::mutex::scoped_lock lm (_mutex);
node->add_child("AudioGain")->add_child_text (raw_convert<string> (_gain));
node->add_child("AudioDelay")->add_child_text (raw_convert<string> (_delay));
- if (_video_frame_rate) {
- node->add_child("AudioVideoFrameRate")->add_child_text (raw_convert<string> (_video_frame_rate.get()));
- }
}
void
@@ -184,7 +179,7 @@ AudioContent::resampled_frame_rate () const
shared_ptr<const Film> film = _film.lock ();
DCPOMATIC_ASSERT (film);
- FrameRateChange frc (video_frame_rate(), film->video_frame_rate());
+ FrameRateChange frc (_parent->active_video_frame_rate(), film->video_frame_rate());
/* Compensate if the DCP is being run at a different frame rate
to the source; that is, if the video is run such that it will
@@ -295,7 +290,7 @@ AudioContent::add_properties (list<UserProperty>& p) const
shared_ptr<const Film> film = _film.lock ();
DCPOMATIC_ASSERT (film);
- FrameRateChange const frc (video_frame_rate(), film->video_frame_rate());
+ FrameRateChange const frc (_parent->active_video_frame_rate(), film->video_frame_rate());
ContentTime const c (_parent->full_length(), frc);
p.push_back (
@@ -327,30 +322,6 @@ AudioContent::add_properties (list<UserProperty>& p) const
}
void
-AudioContent::set_video_frame_rate (double r)
-{
- maybe_set (_video_frame_rate, r, AudioContentProperty::VIDEO_FRAME_RATE);
-}
-
-double
-AudioContent::video_frame_rate () const
-{
- {
- boost::mutex::scoped_lock lm (_mutex);
- if (_video_frame_rate) {
- return _video_frame_rate.get ();
- }
- }
-
- /* No frame rate specified, so assume this content has been
- prepared for any concurrent video content.
- */
- shared_ptr<const Film> film = _film.lock ();
- DCPOMATIC_ASSERT (film);
- return film->active_frame_rate_change(_parent->position()).source;
-}
-
-void
AudioContent::set_streams (vector<AudioStreamPtr> streams)
{
{