Fix strange behaviour with single-frame fades (#1440).
authorCarl Hetherington <cth@carlh.net>
Sat, 5 Jan 2019 00:50:20 +0000 (00:50 +0000)
committerCarl Hetherington <cth@carlh.net>
Sat, 5 Jan 2019 00:50:20 +0000 (00:50 +0000)
ChangeLog
src/lib/player_video.cc
src/lib/video_content.cc
test/data
test/image_content_fade_test.cc [new file with mode: 0644]
test/wscript

index f2381c006446a2e2d944a2122d9d739451dda644..5bc7bf760375b92a02b440cdc9458c45d3121827 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2019-01-05  Carl Hetherington  <cth@carlh.net>
+
+       * Fix strange behaviour with single-frame fades.
+
 2018-12-29  Carl Hetherington  <cth@carlh.net>
 
        * Updated fr_FR translation from Thierry Journet.
 2018-12-29  Carl Hetherington  <cth@carlh.net>
 
        * Updated fr_FR translation from Thierry Journet.
index 023ab826a8c4e12d7a66b094b6b45ea4afecefce..5c287dc92d3cbdf1bd48f66af90be17af41edd3c 100644 (file)
@@ -243,7 +243,7 @@ bool
 PlayerVideo::same (shared_ptr<const PlayerVideo> other) const
 {
        if (_crop != other->_crop ||
 PlayerVideo::same (shared_ptr<const PlayerVideo> other) const
 {
        if (_crop != other->_crop ||
-           _fade.get_value_or(0) != other->_fade.get_value_or(0) ||
+           _fade != other->_fade ||
            _inter_size != other->_inter_size ||
            _out_size != other->_out_size ||
            _eyes != other->_eyes ||
            _inter_size != other->_inter_size ||
            _out_size != other->_out_size ||
            _eyes != other->_eyes ||
index 932977858e8649abec0364e843c8e4c0da10c1f1..fe35b0df3e800415b097691e59d8bc90e8d315e5 100644 (file)
@@ -354,7 +354,9 @@ VideoContent::scale_and_crop_to_fit_height (shared_ptr<const Film> film)
        set_bottom_crop (0);
 }
 
        set_bottom_crop (0);
 }
 
-/** @param f Frame index within the whole (untrimmed) content */
+/** @param f Frame index within the whole (untrimmed) content.
+ *  @return Fade factor (between 0 and 1) or unset if there is no fade.
+ */
 optional<double>
 VideoContent::fade (shared_ptr<const Film> film, Frame f) const
 {
 optional<double>
 VideoContent::fade (shared_ptr<const Film> film, Frame f) const
 {
index 8e5bb30bd87cc81d55da1653301c9b338a54622a..1f6543913f7ef1497bd0b3f53e796216a05fc81a 160000 (submodule)
--- a/test/data
+++ b/test/data
@@ -1 +1 @@
-Subproject commit 8e5bb30bd87cc81d55da1653301c9b338a54622a
+Subproject commit 1f6543913f7ef1497bd0b3f53e796216a05fc81a
diff --git a/test/image_content_fade_test.cc b/test/image_content_fade_test.cc
new file mode 100644 (file)
index 0000000..a3f0932
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+    Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
+
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    DCP-o-matic is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "test.h"
+#include "lib/film.h"
+#include "lib/content_factory.h"
+#include "lib/content.h"
+#include "lib/video_content.h"
+#include <boost/test/unit_test.hpp>
+
+using std::string;
+using std::list;
+using boost::shared_ptr;
+
+BOOST_AUTO_TEST_CASE (image_content_fade_test)
+{
+       shared_ptr<Film> film = new_test_film2 ("image_content_fade_test");
+       shared_ptr<Content> content = content_factory("test/data/flat_red.png").front();
+       film->examine_and_add_content (content);
+       wait_for_jobs ();
+
+       content->video->set_fade_in (1);
+       film->make_dcp ();
+       wait_for_jobs ();
+
+       check_dcp ("test/data/image_content_fade_test", film->dir(film->dcp_name()));
+}
index 23f31dadcb82dd65864c321f552fac7d96c4c5af..396c713d12639dbf0bc6d7ad0753926a3b9fbfdf 100644 (file)
@@ -76,6 +76,7 @@ def build(bld):
                  file_naming_test.cc
                  film_metadata_test.cc
                  frame_rate_test.cc
                  file_naming_test.cc
                  film_metadata_test.cc
                  frame_rate_test.cc
+                 image_content_fade_test.cc
                  image_filename_sorter_test.cc
                  image_test.cc
                  import_dcp_test.cc
                  image_filename_sorter_test.cc
                  image_test.cc
                  import_dcp_test.cc