summaryrefslogtreecommitdiff
path: root/src/lib/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-07-04 22:29:47 +0100
committerCarl Hetherington <cth@carlh.net>2013-07-04 22:29:47 +0100
commitaabf54736d7401437af7f066c51fee91be64e809 (patch)
tree5e3b5f6993a157fcbe75a6f37a12a603e1d9fb25 /src/lib/util.cc
parent6d7b419d42aa8a5df91836dee3c4b3b7a8849bf8 (diff)
Pad silence for things that already have at least some audio.
Diffstat (limited to 'src/lib/util.cc')
-rw-r--r--src/lib/util.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 4cf57368a..83980f828 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -61,6 +61,7 @@ extern "C" {
#include "filter.h"
#include "sound_processor.h"
#include "config.h"
+#include "film.h"
#ifdef DVDOMATIC_WINDOWS
#include "stack.hpp"
#endif
@@ -962,8 +963,9 @@ audio_channel_name (int c)
return channels[c];
}
-AudioMapping::AudioMapping (int c)
- : _source_channels (c)
+AudioMapping::AudioMapping (shared_ptr<const Film> f)
+ : _source_channels (f->audio_stream() ? f->audio_stream()->channels() : 0)
+ , _minimum_channels (f->minimum_audio_channels ())
{
}
@@ -1001,8 +1003,11 @@ AudioMapping::dcp_to_source (libdcp::Channel c) const
return static_cast<int> (c);
}
+/** @return minimum number of DCP channels that we can allow in this
+ DCP, given the nature of the source.
+*/
int
-AudioMapping::dcp_channels () const
+AudioMapping::minimum_dcp_channels () const
{
if (_source_channels == 1) {
/* The source is mono, so to put the mono channel into
@@ -1014,6 +1019,15 @@ AudioMapping::dcp_channels () const
return _source_channels;
}
+/** @return number of channels that there should be in the DCP, including
+ * any silent padded ones.
+ */
+int
+AudioMapping::dcp_channels () const
+{
+ return max (_source_channels, _minimum_channels);
+}
+
FrameRateConversion::FrameRateConversion (float source, int dcp)
: skip (false)
, repeat (false)