Add some tests; fix failure to make DCP when there is a bit of audio right at the...
[dcpomatic.git] / src / lib / video_content.cc
index 1b2dc34e79997adbb2be1c428890acbab8797045..92219b4c7cf9be404289d09f1be614f10f75144c 100644 (file)
@@ -32,7 +32,6 @@
 #include "log.h"
 #include <dcp/raw_convert.h>
 #include <libcxml/cxml.h>
-#include <dcp/colour_matrix.h>
 #include <libxml++/libxml++.h>
 #include <iomanip>
 #include <iostream>
@@ -242,10 +241,14 @@ VideoContent::take_from_examiner (shared_ptr<VideoExaminer> d)
                _sample_aspect_ratio = ar;
                _yuv = yuv;
 
-               /* Guess correct scale from size and sample aspect ratio */
-               _scale = VideoContentScale (
-                       Ratio::nearest_from_ratio (double (_size.width) * ar.get_value_or (1) / _size.height)
-                       );
+               if (Config::instance()->default_scale_to ()) {
+                       _scale = VideoContentScale (Config::instance()->default_scale_to ());
+               } else {
+                       /* Guess correct scale from size and sample aspect ratio */
+                       _scale = VideoContentScale (
+                               Ratio::nearest_from_ratio (double (_size.width) * ar.get_value_or (1) / _size.height)
+                               );
+               }
        }
 
        LOG_GENERAL ("Video length obtained from header as %1 frames", _length);
@@ -431,7 +434,7 @@ VideoContent::processing_description () const
        if (scaled != container_size) {
                d += String::compose (
                        _("\nPadded with black to fit container %1 (%2x%3)"),
-                       film->container()->nickname (),
+                       film->container()->container_nickname (),
                        container_size.width, container_size.height
                        );
 
@@ -535,3 +538,9 @@ VideoContent::use_template (shared_ptr<const VideoContent> c)
        _fade_in = c->_fade_in;
        _fade_out = c->_fade_out;
 }
+
+void
+VideoContent::modify_position (DCPTime& pos) const
+{
+       pos = pos.ceil (_parent->film()->video_frame_rate());
+}