1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
/*
Copyright (C) 2020-2021 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/>.
*/
/** @file test/test_no_use_video.cc
* @brief Test some cases where the video parts of inputs are ignored, to
* check that the right DCPs are made.
* @ingroup completedcp
*/
#include "lib/audio_content.h"
#include "lib/content.h"
#include "lib/content_factory.h"
#include "lib/film.h"
#include "lib/dcp_content.h"
#include "lib/video_content.h"
#include "test.h"
#include <dcp/cpl.h>
#include <dcp/dcp.h>
#include <dcp/reel.h>
#include <dcp/reel_sound_asset.h>
#include <dcp/reel_picture_asset.h>
#include <boost/test/unit_test.hpp>
using std::dynamic_pointer_cast;
using std::make_shared;
/** Overlay two video-only bits of content, don't use the video on one and
* make sure the other one is in the DCP.
*/
BOOST_AUTO_TEST_CASE (no_use_video_test1)
{
auto film = new_test_film("no_use_video_test1");
auto A = content_factory("test/data/flat_red.png")[0];
auto B = content_factory("test/data/flat_green.png")[0];
film->examine_and_add_content (A);
film->examine_and_add_content (B);
BOOST_REQUIRE (!wait_for_jobs());
A->set_position (film, dcpomatic::DCPTime());
B->set_position (film, dcpomatic::DCPTime());
A->video->set_use (false);
film->set_audio_channels(16);
make_and_verify_dcp (film);
check_dcp ("test/data/no_use_video_test1", film);
}
/** Overlay two muxed sources and disable the video on one */
BOOST_AUTO_TEST_CASE (no_use_video_test2)
{
Cleanup cl;
auto A = content_factory(TestPaths::private_data() / "dolby_aurora.vob")[0];
auto B = content_factory(TestPaths::private_data() / "big_buck_bunny_trailer_480p.mov")[0];
auto film = new_test_film("no_use_video_test2", { A, B }, &cl);
film->set_video_bit_rate(VideoEncoding::JPEG2000, 100000000);
A->set_position (film, dcpomatic::DCPTime());
B->set_position (film, dcpomatic::DCPTime());
A->video->set_use (false);
film->set_audio_channels(16);
make_and_verify_dcp (film);
check_dcp (TestPaths::private_data() / "no_use_video_test2", film);
cl.run();
}
/** Make two DCPs and make a VF with the audio from one and the video from another */
BOOST_AUTO_TEST_CASE (no_use_video_test3)
{
auto ov_a = new_test_film("no_use_video_test3_ov_a");
auto ov_a_pic = content_factory("test/data/flat_red.png")[0];
BOOST_REQUIRE (ov_a_pic);
auto ov_a_snd = content_factory("test/data/sine_16_48_220_10.wav")[0];
BOOST_REQUIRE (ov_a_snd);
ov_a->examine_and_add_content (ov_a_pic);
ov_a->examine_and_add_content (ov_a_snd);
BOOST_REQUIRE (!wait_for_jobs());
make_and_verify_dcp (ov_a);
auto ov_b = new_test_film("no_use_video_test3_ov_b");
auto ov_b_pic = content_factory("test/data/flat_green.png")[0];
BOOST_REQUIRE (ov_b_pic);
auto ov_b_snd = content_factory("test/data/sine_16_48_880_10.wav")[0];
BOOST_REQUIRE (ov_b_snd);
ov_b->examine_and_add_content (ov_b_pic);
ov_b->examine_and_add_content (ov_b_snd);
BOOST_REQUIRE (!wait_for_jobs());
make_and_verify_dcp (ov_b);
auto vf = new_test_film("no_use_video_test3_vf");
auto A = make_shared<DCPContent>(ov_a->dir(ov_a->dcp_name()));
auto B = make_shared<DCPContent>(ov_b->dir(ov_b->dcp_name()));
vf->examine_and_add_content (A);
vf->examine_and_add_content (B);
BOOST_REQUIRE (!wait_for_jobs());
A->set_position (vf, dcpomatic::DCPTime());
A->video->set_use (false);
B->set_position (vf, dcpomatic::DCPTime());
AudioMapping mapping (16, 16);
mapping.make_zero ();
B->audio->set_mapping(mapping);
A->set_reference_audio (true);
B->set_reference_video (true);
make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
dcp::DCP ov_a_check (ov_a->dir(ov_a->dcp_name()));
ov_a_check.read ();
BOOST_REQUIRE_EQUAL (ov_a_check.cpls().size(), 1U);
BOOST_REQUIRE_EQUAL (ov_a_check.cpls().front()->reels().size(), 1U);
auto ov_a_reel (ov_a_check.cpls().front()->reels().front());
dcp::DCP ov_b_check (ov_b->dir(ov_b->dcp_name()));
ov_b_check.read ();
BOOST_REQUIRE_EQUAL (ov_b_check.cpls().size(), 1U);
BOOST_REQUIRE_EQUAL (ov_b_check.cpls().front()->reels().size(), 1U);
auto ov_b_reel (ov_b_check.cpls().front()->reels().front());
dcp::DCP vf_check (vf->dir(vf->dcp_name()));
vf_check.read ();
BOOST_REQUIRE_EQUAL (vf_check.cpls().size(), 1U);
BOOST_REQUIRE_EQUAL (vf_check.cpls().front()->reels().size(), 1U);
auto vf_reel (vf_check.cpls().front()->reels().front());
BOOST_CHECK_EQUAL (vf_reel->main_picture()->asset_ref().id(), ov_b_reel->main_picture()->asset_ref().id());
BOOST_CHECK_EQUAL (vf_reel->main_sound()->asset_ref().id(), ov_a_reel->main_sound()->asset_ref().id());
}
|