#include "filter.h"
#include "sound_processor.h"
#include "config.h"
+#include "film.h"
#ifdef DVDOMATIC_WINDOWS
#include "stack.hpp"
#endif
/** @param other A Rect.
* @return The intersection of this with `other'.
*/
-Rect
-Rect::intersection (Rect const & other) const
+dvdomatic::Rect
+dvdomatic::Rect::intersection (Rect const & other) const
{
int const tx = max (x, other.x);
int const ty = max (y, other.y);
return (ext == N_(".tif") || ext == N_(".tiff") || ext == N_(".jpg") || ext == N_(".jpeg") || ext == N_(".png") || ext == N_(".bmp"));
}
-/** @return A pair containing CPU model name and the number of processors */
-pair<string, int>
-cpu_info ()
-{
- pair<string, int> info;
- info.second = 0;
-
-#ifdef DVDOMATIC_POSIX
- ifstream f (N_("/proc/cpuinfo"));
- while (f.good ()) {
- string l;
- getline (f, l);
- if (boost::algorithm::starts_with (l, N_("model name"))) {
- string::size_type const c = l.find (':');
- if (c != string::npos) {
- info.first = l.substr (c + 2);
- }
- } else if (boost::algorithm::starts_with (l, N_("processor"))) {
- ++info.second;
- }
- }
-#endif
-
- return info;
-}
-
string
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 ())
{
}
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
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)