summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-12-19 14:27:11 +0100
committerCarl Hetherington <cth@carlh.net>2025-12-19 14:27:11 +0100
commit127ba4071318ed2bee545bf983792ece369b5111 (patch)
tree4077b00c773972a7401e2864b198597f33db5491
parentd36d580b7e38cfc2f3189c178ca6553aea921b28 (diff)
White space: dcpomatic_disk.cc, upmixer_a_test.cc, vf_test.cc
-rw-r--r--src/tools/dcpomatic_disk.cc210
-rw-r--r--test/upmixer_a_test.cc58
-rw-r--r--test/vf_test.cc252
3 files changed, 260 insertions, 260 deletions
diff --git a/src/tools/dcpomatic_disk.cc b/src/tools/dcpomatic_disk.cc
index b8d451c23..6c8d1a0f6 100644
--- a/src/tools/dcpomatic_disk.cc
+++ b/src/tools/dcpomatic_disk.cc
@@ -80,8 +80,8 @@ enum {
class DirDialogWrapper : public wxDirDialog
{
public:
- DirDialogWrapper (wxWindow* parent)
- : wxDirDialog (parent, _("Choose a DCP folder"), {}, wxDD_DIR_MUST_EXIST)
+ DirDialogWrapper(wxWindow* parent)
+ : wxDirDialog(parent, _("Choose a DCP folder"), {}, wxDD_DIR_MUST_EXIST)
{
}
@@ -90,14 +90,14 @@ public:
{
auto const dcp = boost::filesystem::path(wx_to_std(GetPath()));
if (!dcp::filesystem::exists(dcp / "ASSETMAP") && !dcp::filesystem::exists(dcp / "ASSETMAP.xml")) {
- error_dialog (nullptr, _("No ASSETMAP or ASSETMAP.xml found in this folder. Please choose a DCP folder."));
+ error_dialog(nullptr, _("No ASSETMAP or ASSETMAP.xml found in this folder. Please choose a DCP folder."));
return {};
}
return { dcp };
}
- void set (boost::filesystem::path)
+ void set(boost::filesystem::path)
{
/* Not used */
}
@@ -107,33 +107,33 @@ public:
class DOMFrame : public wxFrame
{
public:
- explicit DOMFrame (wxString const & title)
- : wxFrame (nullptr, wxID_ANY, title)
- , _nanomsg (true)
- , _sizer (new wxBoxSizer(wxVERTICAL))
+ explicit DOMFrame(wxString const & title)
+ : wxFrame(nullptr, wxID_ANY, title)
+ , _nanomsg(true)
+ , _sizer(new wxBoxSizer(wxVERTICAL))
{
#ifdef DCPOMATIC_OSX
auto bar = new wxMenuBar;
auto tools = new wxMenu;
tools->Append(ID_tools_uninstall, _("Uninstall..."));
bar->Append(tools, _("Tools"));
- SetMenuBar (bar);
- Bind (wxEVT_MENU, boost::bind(&DOMFrame::uninstall, this), ID_tools_uninstall);
+ SetMenuBar(bar);
+ Bind(wxEVT_MENU, boost::bind(&DOMFrame::uninstall, this), ID_tools_uninstall);
#endif
/* Use a panel as the only child of the Frame so that we avoid
the dark-grey background on Windows.
*/
- auto overall_panel = new wxPanel (this);
- auto s = new wxBoxSizer (wxHORIZONTAL);
- s->Add (overall_panel, 1, wxEXPAND);
- SetSizer (s);
+ auto overall_panel = new wxPanel(this);
+ auto s = new wxBoxSizer(wxHORIZONTAL);
+ s->Add(overall_panel, 1, wxEXPAND);
+ SetSizer(s);
- auto grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ auto grid = new wxGridBagSizer(DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
int r = 0;
add_label_to_sizer(grid, overall_panel, _("DCPs"), true, wxGBPosition(r, 0));
- auto dcp_sizer = new wxBoxSizer (wxHORIZONTAL);
+ auto dcp_sizer = new wxBoxSizer(wxHORIZONTAL);
auto dcps = new EditableList<boost::filesystem::path, DirDialogWrapper>(
overall_panel,
{ EditableListColumn(_("DCP"), 300, true) },
@@ -148,39 +148,39 @@ public:
grid->Add(dcp_sizer, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND);
++r;
- add_label_to_sizer (grid, overall_panel, _("Drive"), true, wxGBPosition(r, 0));
- auto drive_sizer = new wxBoxSizer (wxHORIZONTAL);
- _drive = new wxChoice (overall_panel, wxID_ANY);
+ add_label_to_sizer(grid, overall_panel, _("Drive"), true, wxGBPosition(r, 0));
+ auto drive_sizer = new wxBoxSizer(wxHORIZONTAL);
+ _drive = new wxChoice(overall_panel, wxID_ANY);
drive_sizer->Add(_drive, 1, wxTOP, 2);
- _drive_refresh = new wxButton (overall_panel, wxID_ANY, _("Refresh"));
+ _drive_refresh = new wxButton(overall_panel, wxID_ANY, _("Refresh"));
drive_sizer->Add(_drive_refresh, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
- grid->Add (drive_sizer, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND);
+ grid->Add(drive_sizer, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND);
++r;
- _jobs = new JobManagerView (overall_panel, false);
- grid->Add (_jobs, wxGBPosition(r, 0), wxGBSpan(6, 2), wxEXPAND);
+ _jobs = new JobManagerView(overall_panel, false);
+ grid->Add(_jobs, wxGBPosition(r, 0), wxGBSpan(6, 2), wxEXPAND);
r += 6;
_copy = new wxButton(overall_panel, wxID_ANY, _("Copy DCPs"));
- grid->Add (_copy, wxGBPosition(r, 0), wxGBSpan(1, 2), wxEXPAND);
+ grid->Add(_copy, wxGBPosition(r, 0), wxGBSpan(1, 2), wxEXPAND);
++r;
- grid->AddGrowableCol (1);
+ grid->AddGrowableCol(1);
- _copy->Bind (wxEVT_BUTTON, boost::bind(&DOMFrame::copy, this));
- _drive->Bind (wxEVT_CHOICE, boost::bind(&DOMFrame::setup_sensitivity, this));
- _drive_refresh->Bind (wxEVT_BUTTON, boost::bind(&DOMFrame::drive_refresh, this));
+ _copy->Bind(wxEVT_BUTTON, boost::bind(&DOMFrame::copy, this));
+ _drive->Bind(wxEVT_CHOICE, boost::bind(&DOMFrame::setup_sensitivity, this));
+ _drive_refresh->Bind(wxEVT_BUTTON, boost::bind(&DOMFrame::drive_refresh, this));
- _sizer->Add (grid, 1, wxALL | wxEXPAND, DCPOMATIC_DIALOG_BORDER);
- overall_panel->SetSizer (_sizer);
- Fit ();
+ _sizer->Add(grid, 1, wxALL | wxEXPAND, DCPOMATIC_DIALOG_BORDER);
+ overall_panel->SetSizer(_sizer);
+ Fit();
SetSize(768, GetSize().GetHeight() + 96);
/* XXX: this is a hack, but I expect we'll need logs and I'm not sure if there's
* a better place to put them.
*/
dcpomatic_log = make_shared<FileLog>(State::write_path("disk.log"));
- dcpomatic_log->set_types (dcpomatic_log->types() | LogEntry::TYPE_DISK);
+ dcpomatic_log->set_types(dcpomatic_log->types() | LogEntry::TYPE_DISK);
LOG_DISK("dcpomatic_disk {} started", dcpomatic_git_commit);
{
@@ -195,15 +195,15 @@ public:
}
}
- Bind (wxEVT_SIZE, boost::bind(&DOMFrame::sized, this, _1));
- Bind (wxEVT_CLOSE_WINDOW, boost::bind(&DOMFrame::close, this, _1));
+ Bind(wxEVT_SIZE, boost::bind(&DOMFrame::sized, this, _1));
+ Bind(wxEVT_CLOSE_WINDOW, boost::bind(&DOMFrame::close, this, _1));
JobManager::instance()->ActiveJobsChanged.connect(boost::bind(&DOMFrame::setup_sensitivity, this));
#ifdef DCPOMATIC_WINDOWS
/* We must use ::shell here, it seems, to avoid error code 740 (related to privilege escalation) */
LOG_DISK("Starting writer process {}", disk_writer_path().string());
- _writer = new boost::process::child (disk_writer_path(), boost::process::shell, boost::process::windows::hide);
+ _writer = new boost::process::child(disk_writer_path(), boost::process::shell, boost::process::windows::hide);
#endif
#ifdef DCPOMATIC_LINUX
@@ -212,7 +212,7 @@ public:
} else {
LOG_DISK("Starting writer process {}", disk_writer_path().string());
#ifdef DCPOMATIC_BOOST_PROCESS_V1
- _writer = new boost::process::child (disk_writer_path());
+ _writer = new boost::process::child(disk_writer_path());
#else
_writer = new boost::process::v2::process(_context, disk_writer_path(), {});
#endif
@@ -221,20 +221,20 @@ public:
#ifdef DCPOMATIC_OSX
LOG_DISK("Sending notification to writer daemon");
- notify_post ("com.dcpomatic.disk.writer.start");
+ notify_post("com.dcpomatic.disk.writer.start");
#endif
}
- ~DOMFrame ()
+ ~DOMFrame()
{
_nanomsg.send(DISK_WRITER_QUIT "\n", 2000);
/* This seems really horrible but it's suggested by the examples on nanomsg.org, so...
* Without this the quit is not received (at least sometimes) causing #2018.
*/
- dcpomatic_sleep_seconds (1);
+ dcpomatic_sleep_seconds(1);
}
- void set_dcp_paths (vector<boost::filesystem::path> dcps)
+ void set_dcp_paths(vector<boost::filesystem::path> dcps)
{
_dcp_paths = dcps;
setup_sensitivity();
@@ -246,10 +246,10 @@ private:
return _dcp_paths;
}
- void sized (wxSizeEvent& ev)
+ void sized(wxSizeEvent& ev)
{
- _sizer->Layout ();
- ev.Skip ();
+ _sizer->Layout();
+ ev.Skip();
}
@@ -261,7 +261,7 @@ private:
#endif
- bool should_close ()
+ bool should_close()
{
if (!JobManager::instance()->work_to_do()) {
return true;
@@ -278,28 +278,28 @@ private:
}
- void close (wxCloseEvent& ev)
+ void close(wxCloseEvent& ev)
{
if (!should_close()) {
- ev.Veto ();
+ ev.Veto();
return;
}
- ev.Skip ();
- JobManager::drop ();
+ ev.Skip();
+ JobManager::drop();
}
- void copy ()
+ void copy()
{
/* Check that the selected drive still exists and update its properties if so */
- drive_refresh ();
+ drive_refresh();
if (_drive->GetSelection() == wxNOT_FOUND) {
- error_dialog (this, _("The disk you selected is no longer available. Please choose another."));
+ error_dialog(this, _("The disk you selected is no longer available. Please choose another."));
return;
}
- DCPOMATIC_ASSERT (_drive->GetSelection() != wxNOT_FOUND);
- DCPOMATIC_ASSERT (!_dcp_paths.empty());
+ DCPOMATIC_ASSERT(_drive->GetSelection() != wxNOT_FOUND);
+ DCPOMATIC_ASSERT(!_dcp_paths.empty());
auto ping = [this](int attempt) {
if (_nanomsg.send(DISK_WRITER_PING "\n", 1000)) {
@@ -314,7 +314,7 @@ private:
} else {
LOG_DISK("Could not send ping to writer (attempt {})", attempt);
}
- dcpomatic_sleep_seconds (1);
+ dcpomatic_sleep_seconds(1);
return false;
};
@@ -344,8 +344,8 @@ private:
dialog.ShowModal();
return;
#else
- LOG_DISK ("Failed to ping writer");
- throw CommunicationFailedError ();
+ LOG_DISK("Failed to ping writer");
+ throw CommunicationFailedError();
#endif
}
@@ -360,11 +360,11 @@ private:
LOG_DISK("Sending unmount request to disk writer for {}", drive.as_xml());
if (!_nanomsg.send(DISK_WRITER_UNMOUNT "\n", 2000)) {
LOG_DISK("Failed to send unmount request.");
- throw CommunicationFailedError ();
+ throw CommunicationFailedError();
}
if (!_nanomsg.send(drive.as_xml(), 2000)) {
LOG_DISK("Failed to send drive for unmount request.");
- throw CommunicationFailedError ();
+ throw CommunicationFailedError();
}
/* The reply may have to wait for the user to authenticate, so let's wait a while */
auto const reply = DiskWriterBackEndResponse::read_from_nanomsg(_nanomsg, 30000);
@@ -394,20 +394,20 @@ private:
}
JobManager::instance()->add(make_shared<CopyToDriveJob>(_dcp_paths, _drives[_drive->GetSelection()], _nanomsg));
- setup_sensitivity ();
+ setup_sensitivity();
}
- void drive_refresh ()
+ void drive_refresh()
{
- int const sel = _drive->GetSelection ();
+ int const sel = _drive->GetSelection();
wxString current;
if (sel != wxNOT_FOUND) {
- current = _drive->GetString (sel);
+ current = _drive->GetString(sel);
}
- _drive->Clear ();
+ _drive->Clear();
int re_select = wxNOT_FOUND;
int j = 0;
- _drives = Drive::get ();
+ _drives = Drive::get();
for (auto i: _drives) {
auto const s = std_to_wx(i.description());
if (s == current) {
@@ -416,13 +416,13 @@ private:
_drive->Append(s);
++j;
}
- _drive->SetSelection (re_select);
- setup_sensitivity ();
+ _drive->SetSelection(re_select);
+ setup_sensitivity();
}
- void setup_sensitivity ()
+ void setup_sensitivity()
{
- _copy->Enable (!_dcp_paths.empty() && _drive->GetSelection() != wxNOT_FOUND && !JobManager::instance()->work_to_do());
+ _copy->Enable(!_dcp_paths.empty() && _drive->GetSelection() != wxNOT_FOUND && !JobManager::instance()->work_to_do());
}
wxChoice* _drive;
@@ -447,22 +447,22 @@ private:
static const wxCmdLineEntryDesc command_line_description[] = {
{ wxCMD_LINE_OPTION, "d", "dcp", "DCP to write", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
{ wxCMD_LINE_SWITCH, "s", "sure", "skip alpha test warnings", wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
- { wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType (0), 0 }
+ { wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType(0), 0 }
};
class App : public wxApp
{
public:
- App ()
- : _frame (nullptr)
+ App()
+ : _frame(nullptr)
{}
- bool OnInit () override
+ bool OnInit() override
{
try {
- Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
- Config::Warning.connect (boost::bind (&App::config_warning, this, _1));
+ Config::FailedToLoad.connect(boost::bind(&App::config_failed_to_load, this));
+ Config::Warning.connect(boost::bind(&App::config_warning, this, _1));
SetAppName(variant::wx::dcpomatic_disk_writer());
@@ -471,15 +471,15 @@ public:
}
#ifdef DCPOMATIC_LINUX
- unsetenv ("UBUNTU_MENUPROXY");
+ unsetenv("UBUNTU_MENUPROXY");
#endif
#ifdef DCPOMATIC_OSX
- dcpomatic_sleep_seconds (1);
- make_foreground_application ();
+ dcpomatic_sleep_seconds(1);
+ make_foreground_application();
#endif
- dcpomatic_setup_path_encoding ();
+ dcpomatic_setup_path_encoding();
/* Enable i18n; this will create a Config object
to look for a force-configured language. This Config
@@ -492,24 +492,24 @@ public:
/* Set things up, including filters etc.
which will now be internationalised correctly.
*/
- dcpomatic_setup ();
+ dcpomatic_setup();
/* Force the configuration to be re-loaded correctly next
time it is needed.
*/
- Config::drop ();
+ Config::drop();
_frame = new DOMFrame(variant::wx::dcpomatic_disk_writer());
- SetTopWindow (_frame);
+ SetTopWindow(_frame);
- _frame->Show ();
+ _frame->Show();
if (_dcp_to_write) {
_frame->set_dcp_paths({*_dcp_to_write});
}
- signal_manager = new wxSignalManager (this);
- Bind (wxEVT_IDLE, boost::bind (&App::idle, this, _1));
+ signal_manager = new wxSignalManager(this);
+ Bind(wxEVT_IDLE, boost::bind(&App::idle, this, _1));
}
catch (exception& e)
{
@@ -520,46 +520,46 @@ public:
return true;
}
- void OnInitCmdLine (wxCmdLineParser& parser) override
+ void OnInitCmdLine(wxCmdLineParser& parser) override
{
- parser.SetDesc (command_line_description);
+ parser.SetDesc(command_line_description);
parser.SetSwitchChars(char_to_wx("-"));
}
- bool OnCmdLineParsed (wxCmdLineParser& parser) override
+ bool OnCmdLineParsed(wxCmdLineParser& parser) override
{
wxString dcp;
if (parser.Found(char_to_wx("dcp"), &dcp)) {
- _dcp_to_write = wx_to_std (dcp);
+ _dcp_to_write = wx_to_std(dcp);
}
return true;
}
- void config_failed_to_load ()
+ void config_failed_to_load()
{
- message_dialog (_frame, _("The existing configuration failed to load. Default values will be used instead. These may take a short time to create."));
+ message_dialog(_frame, _("The existing configuration failed to load. Default values will be used instead. These may take a short time to create."));
}
- void config_warning (string m)
+ void config_warning(string m)
{
- message_dialog (_frame, std_to_wx(m));
+ message_dialog(_frame, std_to_wx(m));
}
- void idle (wxIdleEvent& ev)
+ void idle(wxIdleEvent& ev)
{
- signal_manager->ui_idle ();
- ev.Skip ();
+ signal_manager->ui_idle();
+ ev.Skip();
}
- void report_exception ()
+ void report_exception()
{
try {
throw;
} catch (FileError& e) {
- error_dialog (
+ error_dialog(
0,
- wxString::Format (
+ wxString::Format(
_("An exception occurred: %s (%s)\n\n%s"),
std_to_wx(e.what()),
std_to_wx(e.file().string().c_str()),
@@ -567,9 +567,9 @@ public:
)
);
} catch (exception& e) {
- error_dialog (
+ error_dialog(
0,
- wxString::Format (
+ wxString::Format(
_("An exception occurred: %s.\n\n%s"),
std_to_wx(e.what()),
dcpomatic::wx::report_problem()
@@ -580,20 +580,20 @@ public:
}
}
- bool OnExceptionInMainLoop () override
+ bool OnExceptionInMainLoop() override
{
- report_exception ();
+ report_exception();
/* This will terminate the program */
return false;
}
- void OnUnhandledException () override
+ void OnUnhandledException() override
{
- report_exception ();
+ report_exception();
}
DOMFrame* _frame;
boost::optional<boost::filesystem::path> _dcp_to_write;
};
-IMPLEMENT_APP (App)
+IMPLEMENT_APP(App)
diff --git a/test/upmixer_a_test.cc b/test/upmixer_a_test.cc
index 4ab40563a..b24666d9d 100644
--- a/test/upmixer_a_test.cc
+++ b/test/upmixer_a_test.cc
@@ -54,50 +54,50 @@ static SNDFILE* Rs;
static void
-write (shared_ptr<AudioBuffers> b, DCPTime)
+write(shared_ptr<AudioBuffers> b, DCPTime)
{
- sf_write_float (L, b->data(0), b->frames());
- sf_write_float (R, b->data(1), b->frames());
- sf_write_float (C, b->data(2), b->frames());
- sf_write_float (Lfe, b->data(3), b->frames());
- sf_write_float (Ls, b->data(4), b->frames());
- sf_write_float (Rs, b->data(5), b->frames());
+ sf_write_float(L, b->data(0), b->frames());
+ sf_write_float(R, b->data(1), b->frames());
+ sf_write_float(C, b->data(2), b->frames());
+ sf_write_float(Lfe, b->data(3), b->frames());
+ sf_write_float(Ls, b->data(4), b->frames());
+ sf_write_float(Rs, b->data(5), b->frames());
}
-BOOST_AUTO_TEST_CASE (upmixer_a_test)
+BOOST_AUTO_TEST_CASE(upmixer_a_test)
{
auto content = make_shared<FFmpegContent>("test/data/white.wav");
auto film = new_test_film("upmixer_a_test", { content });
- film->set_audio_processor (AudioProcessor::from_id("stereo-5.1-upmix-a"));
+ film->set_audio_processor(AudioProcessor::from_id("stereo-5.1-upmix-a"));
SF_INFO info;
info.samplerate = 48000;
info.channels = 1;
info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
- L = sf_open ("build/test/upmixer_a_test/L.wav", SFM_WRITE, &info);
- R = sf_open ("build/test/upmixer_a_test/R.wav", SFM_WRITE, &info);
- C = sf_open ("build/test/upmixer_a_test/C.wav", SFM_WRITE, &info);
- Lfe = sf_open ("build/test/upmixer_a_test/Lfe.wav", SFM_WRITE, &info);
- Ls = sf_open ("build/test/upmixer_a_test/Ls.wav", SFM_WRITE, &info);
- Rs = sf_open ("build/test/upmixer_a_test/Rs.wav", SFM_WRITE, &info);
+ L = sf_open("build/test/upmixer_a_test/L.wav", SFM_WRITE, &info);
+ R = sf_open("build/test/upmixer_a_test/R.wav", SFM_WRITE, &info);
+ C = sf_open("build/test/upmixer_a_test/C.wav", SFM_WRITE, &info);
+ Lfe = sf_open("build/test/upmixer_a_test/Lfe.wav", SFM_WRITE, &info);
+ Ls = sf_open("build/test/upmixer_a_test/Ls.wav", SFM_WRITE, &info);
+ Rs = sf_open("build/test/upmixer_a_test/Rs.wav", SFM_WRITE, &info);
auto player = make_shared<Player>(film, Image::Alignment::COMPACT, false);
- player->Audio.connect (bind (&write, _1, _2));
+ player->Audio.connect(bind(&write, _1, _2));
while (!player->pass()) {}
- sf_close (L);
- sf_close (R);
- sf_close (C);
- sf_close (Lfe);
- sf_close (Ls);
- sf_close (Rs);
-
- check_wav_file ("test/data/upmixer_a_test/L.wav", "build/test/upmixer_a_test/L.wav");
- check_wav_file ("test/data/upmixer_a_test/R.wav", "build/test/upmixer_a_test/R.wav");
- check_wav_file ("test/data/upmixer_a_test/C.wav", "build/test/upmixer_a_test/C.wav");
- check_wav_file ("test/data/upmixer_a_test/Lfe.wav", "build/test/upmixer_a_test/Lfe.wav");
- check_wav_file ("test/data/upmixer_a_test/Ls.wav", "build/test/upmixer_a_test/Ls.wav");
- check_wav_file ("test/data/upmixer_a_test/Rs.wav", "build/test/upmixer_a_test/Rs.wav");
+ sf_close(L);
+ sf_close(R);
+ sf_close(C);
+ sf_close(Lfe);
+ sf_close(Ls);
+ sf_close(Rs);
+
+ check_wav_file("test/data/upmixer_a_test/L.wav", "build/test/upmixer_a_test/L.wav");
+ check_wav_file("test/data/upmixer_a_test/R.wav", "build/test/upmixer_a_test/R.wav");
+ check_wav_file("test/data/upmixer_a_test/C.wav", "build/test/upmixer_a_test/C.wav");
+ check_wav_file("test/data/upmixer_a_test/Lfe.wav", "build/test/upmixer_a_test/Lfe.wav");
+ check_wav_file("test/data/upmixer_a_test/Ls.wav", "build/test/upmixer_a_test/Ls.wav");
+ check_wav_file("test/data/upmixer_a_test/Rs.wav", "build/test/upmixer_a_test/Rs.wav");
}
diff --git a/test/vf_test.cc b/test/vf_test.cc
index b362e59b8..9c7ff65be 100644
--- a/test/vf_test.cc
+++ b/test/vf_test.cc
@@ -64,65 +64,65 @@ using namespace dcpomatic;
/** Test the logic which decides whether a DCP can be referenced or not */
-BOOST_AUTO_TEST_CASE (vf_test1)
+BOOST_AUTO_TEST_CASE(vf_test1)
{
auto dcp = make_shared<DCPContent>("test/data/reels_test2");
auto film = new_test_film("vf_test1", { dcp });
/* Multi-reel DCP can't be referenced if we are using a single reel for the project */
- film->set_reel_type (ReelType::SINGLE);
+ film->set_reel_type(ReelType::SINGLE);
film->set_audio_channels(16);
string why_not;
- BOOST_CHECK (!dcp->can_reference_video(film, why_not));
- BOOST_CHECK (!dcp->can_reference_audio(film, why_not));
- BOOST_CHECK (!dcp->can_reference_text(film, TextType::OPEN_SUBTITLE, why_not));
- BOOST_CHECK (!dcp->can_reference_text(film, TextType::CLOSED_CAPTION, why_not));
+ BOOST_CHECK(!dcp->can_reference_video(film, why_not));
+ BOOST_CHECK(!dcp->can_reference_audio(film, why_not));
+ BOOST_CHECK(!dcp->can_reference_text(film, TextType::OPEN_SUBTITLE, why_not));
+ BOOST_CHECK(!dcp->can_reference_text(film, TextType::CLOSED_CAPTION, why_not));
/* Multi-reel DCP can be referenced if we are using by-video-content */
- film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
- BOOST_CHECK (dcp->can_reference_video(film, why_not));
- BOOST_CHECK (dcp->can_reference_audio(film, why_not));
+ film->set_reel_type(ReelType::BY_VIDEO_CONTENT);
+ BOOST_CHECK(dcp->can_reference_video(film, why_not));
+ BOOST_CHECK(dcp->can_reference_audio(film, why_not));
/* (but reels_test2 has no texts to reference) */
- BOOST_CHECK (!dcp->can_reference_text(film, TextType::OPEN_SUBTITLE, why_not));
- BOOST_CHECK (!dcp->can_reference_text(film, TextType::CLOSED_CAPTION, why_not));
+ BOOST_CHECK(!dcp->can_reference_text(film, TextType::OPEN_SUBTITLE, why_not));
+ BOOST_CHECK(!dcp->can_reference_text(film, TextType::CLOSED_CAPTION, why_not));
auto other = make_shared<FFmpegContent>("test/data/test.mp4");
film->examine_and_add_content({other});
- BOOST_REQUIRE (!wait_for_jobs());
- BOOST_CHECK (!other->audio);
+ BOOST_REQUIRE(!wait_for_jobs());
+ BOOST_CHECK(!other->audio);
/* Not possible if there is overlap; we only check video here as that's all test.mp4 has */
- other->set_position (film, DCPTime());
- BOOST_CHECK (!dcp->can_reference_video(film, why_not));
+ other->set_position(film, DCPTime());
+ BOOST_CHECK(!dcp->can_reference_video(film, why_not));
/* This should not be considered an overlap */
- other->set_position (film, dcp->end(film));
- BOOST_CHECK (dcp->can_reference_video(film, why_not));
- BOOST_CHECK (dcp->can_reference_audio(film, why_not));
+ other->set_position(film, dcp->end(film));
+ BOOST_CHECK(dcp->can_reference_video(film, why_not));
+ BOOST_CHECK(dcp->can_reference_audio(film, why_not));
/* (reels_test2 has no texts to reference) */
- BOOST_CHECK (!dcp->can_reference_text(film, TextType::OPEN_SUBTITLE, why_not));
- BOOST_CHECK (!dcp->can_reference_text(film, TextType::CLOSED_CAPTION, why_not));
+ BOOST_CHECK(!dcp->can_reference_text(film, TextType::OPEN_SUBTITLE, why_not));
+ BOOST_CHECK(!dcp->can_reference_text(film, TextType::CLOSED_CAPTION, why_not));
}
/** Make a OV with video and audio and a VF referencing the OV and adding subs */
-BOOST_AUTO_TEST_CASE (vf_test2)
+BOOST_AUTO_TEST_CASE(vf_test2)
{
/* Make the OV */
auto video = content_factory("test/data/flat_red.png")[0];
auto audio = content_factory("test/data/white.wav")[0];
auto ov = new_test_film("vf_test2_ov", { video, audio });
- video->video->set_length (24 * 5);
- make_and_verify_dcp (ov);
+ video->video->set_length(24 * 5);
+ make_and_verify_dcp(ov);
/* Make the VF */
auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
auto sub = content_factory("test/data/subrip4.srt")[0];
auto vf = new_test_film("vf_test2_vf", { dcp, sub });
- vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
- dcp->set_reference_video (true);
- dcp->set_reference_audio (true);
- make_and_verify_dcp (
+ vf->set_reel_type(ReelType::BY_VIDEO_CONTENT);
+ dcp->set_reference_video(true);
+ dcp->set_reference_audio(true);
+ make_and_verify_dcp(
vf,
{
dcp::VerificationNote::Code::EXTERNAL_ASSET,
@@ -133,27 +133,27 @@ BOOST_AUTO_TEST_CASE (vf_test2)
false
);
- dcp::DCP ov_c (ov->dir(ov->dcp_name()));
- ov_c.read ();
- BOOST_REQUIRE_EQUAL (ov_c.cpls().size(), 1U);
- BOOST_REQUIRE_EQUAL (ov_c.cpls()[0]->reels().size(), 1U);
- BOOST_REQUIRE (ov_c.cpls()[0]->reels()[0]->main_picture());
+ dcp::DCP ov_c(ov->dir(ov->dcp_name()));
+ ov_c.read();
+ BOOST_REQUIRE_EQUAL(ov_c.cpls().size(), 1U);
+ BOOST_REQUIRE_EQUAL(ov_c.cpls()[0]->reels().size(), 1U);
+ BOOST_REQUIRE(ov_c.cpls()[0]->reels()[0]->main_picture());
string const pic_id = ov_c.cpls()[0]->reels()[0]->main_picture()->id();
- BOOST_REQUIRE (ov_c.cpls()[0]->reels()[0]->main_sound());
+ BOOST_REQUIRE(ov_c.cpls()[0]->reels()[0]->main_sound());
string const sound_id = ov_c.cpls()[0]->reels()[0]->main_sound()->id();
- BOOST_REQUIRE (!ov_c.cpls()[0]->reels()[0]->main_subtitle());
+ BOOST_REQUIRE(!ov_c.cpls()[0]->reels()[0]->main_subtitle());
BOOST_REQUIRE(!ov_c.pkls().empty());
BOOST_CHECK(!static_cast<bool>(ov_c.pkls()[0]->group_id()));
- dcp::DCP vf_c (vf->dir(vf->dcp_name()));
- vf_c.read ();
- BOOST_REQUIRE_EQUAL (vf_c.cpls().size(), 1U);
- BOOST_REQUIRE_EQUAL (vf_c.cpls()[0]->reels().size(), 1U);
- BOOST_REQUIRE (vf_c.cpls()[0]->reels()[0]->main_picture());
- BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_picture()->id(), pic_id);
- BOOST_REQUIRE (vf_c.cpls()[0]->reels()[0]->main_sound());
- BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_sound()->id(), sound_id);
- BOOST_REQUIRE (vf_c.cpls()[0]->reels()[0]->main_subtitle());
+ dcp::DCP vf_c(vf->dir(vf->dcp_name()));
+ vf_c.read();
+ BOOST_REQUIRE_EQUAL(vf_c.cpls().size(), 1U);
+ BOOST_REQUIRE_EQUAL(vf_c.cpls()[0]->reels().size(), 1U);
+ BOOST_REQUIRE(vf_c.cpls()[0]->reels()[0]->main_picture());
+ BOOST_CHECK_EQUAL(vf_c.cpls()[0]->reels()[0]->main_picture()->id(), pic_id);
+ BOOST_REQUIRE(vf_c.cpls()[0]->reels()[0]->main_sound());
+ BOOST_CHECK_EQUAL(vf_c.cpls()[0]->reels()[0]->main_sound()->id(), sound_id);
+ BOOST_REQUIRE(vf_c.cpls()[0]->reels()[0]->main_subtitle());
BOOST_REQUIRE(!vf_c.pkls().empty());
BOOST_CHECK(static_cast<bool>(vf_c.pkls()[0]->group_id()));
}
@@ -162,148 +162,148 @@ BOOST_AUTO_TEST_CASE (vf_test2)
/** Test creation of a VF using a trimmed OV; the output should have entry point /
* duration altered to effect the trimming.
*/
-BOOST_AUTO_TEST_CASE (vf_test3)
+BOOST_AUTO_TEST_CASE(vf_test3)
{
/* Make the OV */
auto video = content_factory("test/data/flat_red.png")[0];
auto audio = content_factory("test/data/white.wav")[0];
auto ov = new_test_film("vf_test3_ov", { video, audio });
- video->video->set_length (24 * 5);
- make_and_verify_dcp (ov);
+ video->video->set_length(24 * 5);
+ make_and_verify_dcp(ov);
/* Make the VF */
auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
auto vf = new_test_film("vf_test3_vf", { dcp });
- vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
- dcp->set_trim_start(vf, ContentTime::from_seconds (1));
- dcp->set_trim_end (ContentTime::from_seconds (1));
- dcp->set_reference_video (true);
- dcp->set_reference_audio (true);
+ vf->set_reel_type(ReelType::BY_VIDEO_CONTENT);
+ dcp->set_trim_start(vf, ContentTime::from_seconds(1));
+ dcp->set_trim_end(ContentTime::from_seconds(1));
+ dcp->set_reference_video(true);
+ dcp->set_reference_audio(true);
make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
- dcp::DCP vf_c (vf->dir(vf->dcp_name()));
- vf_c.read ();
- BOOST_REQUIRE_EQUAL (vf_c.cpls().size(), 1U);
- BOOST_REQUIRE_EQUAL (vf_c.cpls()[0]->reels().size(), 1U);
- BOOST_REQUIRE (vf_c.cpls()[0]->reels()[0]->main_picture());
- BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_picture()->entry_point().get_value_or(0), 24);
- BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_picture()->actual_duration(), 72);
- BOOST_REQUIRE (vf_c.cpls()[0]->reels()[0]->main_sound());
- BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_sound()->entry_point().get_value_or(0), 24);
- BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_sound()->actual_duration(), 72);
+ dcp::DCP vf_c(vf->dir(vf->dcp_name()));
+ vf_c.read();
+ BOOST_REQUIRE_EQUAL(vf_c.cpls().size(), 1U);
+ BOOST_REQUIRE_EQUAL(vf_c.cpls()[0]->reels().size(), 1U);
+ BOOST_REQUIRE(vf_c.cpls()[0]->reels()[0]->main_picture());
+ BOOST_CHECK_EQUAL(vf_c.cpls()[0]->reels()[0]->main_picture()->entry_point().get_value_or(0), 24);
+ BOOST_CHECK_EQUAL(vf_c.cpls()[0]->reels()[0]->main_picture()->actual_duration(), 72);
+ BOOST_REQUIRE(vf_c.cpls()[0]->reels()[0]->main_sound());
+ BOOST_CHECK_EQUAL(vf_c.cpls()[0]->reels()[0]->main_sound()->entry_point().get_value_or(0), 24);
+ BOOST_CHECK_EQUAL(vf_c.cpls()[0]->reels()[0]->main_sound()->actual_duration(), 72);
}
/** Make a OV with video and audio and a VF referencing the OV and adding some more video */
-BOOST_AUTO_TEST_CASE (vf_test4)
+BOOST_AUTO_TEST_CASE(vf_test4)
{
/* Make the OV */
auto video = content_factory("test/data/flat_red.png")[0];
auto audio = content_factory("test/data/white.wav")[0];
auto ov = new_test_film("vf_test4_ov", { video, audio });
- video->video->set_length (24 * 5);
- make_and_verify_dcp (ov);
+ video->video->set_length(24 * 5);
+ make_and_verify_dcp(ov);
/* Make the VF */
auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
auto vf = new_test_film("vf_test4_vf", { dcp });
- vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
- vf->set_sequence (false);
+ vf->set_reel_type(ReelType::BY_VIDEO_CONTENT);
+ vf->set_sequence(false);
dcp->set_position(vf, DCPTime::from_seconds(10));
- dcp->set_reference_video (true);
- dcp->set_reference_audio (true);
+ dcp->set_reference_video(true);
+ dcp->set_reference_audio(true);
auto more_video = content_factory("test/data/flat_red.png")[0];
vf->examine_and_add_content({more_video});
- BOOST_REQUIRE (!wait_for_jobs());
- more_video->set_position (vf, DCPTime());
+ BOOST_REQUIRE(!wait_for_jobs());
+ more_video->set_position(vf, DCPTime());
make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
- dcp::DCP ov_c (ov->dir(ov->dcp_name()));
- ov_c.read ();
- BOOST_REQUIRE_EQUAL (ov_c.cpls().size(), 1U);
- BOOST_REQUIRE_EQUAL (ov_c.cpls()[0]->reels().size(), 1U);
- BOOST_REQUIRE (ov_c.cpls()[0]->reels()[0]->main_picture());
+ dcp::DCP ov_c(ov->dir(ov->dcp_name()));
+ ov_c.read();
+ BOOST_REQUIRE_EQUAL(ov_c.cpls().size(), 1U);
+ BOOST_REQUIRE_EQUAL(ov_c.cpls()[0]->reels().size(), 1U);
+ BOOST_REQUIRE(ov_c.cpls()[0]->reels()[0]->main_picture());
string const pic_id = ov_c.cpls()[0]->reels()[0]->main_picture()->id();
- BOOST_REQUIRE (ov_c.cpls()[0]->reels()[0]->main_sound());
+ BOOST_REQUIRE(ov_c.cpls()[0]->reels()[0]->main_sound());
string const sound_id = ov_c.cpls()[0]->reels()[0]->main_sound()->id();
- BOOST_REQUIRE (!ov_c.cpls()[0]->reels()[0]->main_subtitle());
-
- dcp::DCP vf_c (vf->dir (vf->dcp_name ()));
- vf_c.read ();
- BOOST_REQUIRE_EQUAL (vf_c.cpls().size(), 1U);
- BOOST_REQUIRE_EQUAL (vf_c.cpls()[0]->reels().size(), 2U);
- BOOST_REQUIRE (vf_c.cpls()[0]->reels().back()->main_picture());
- BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels().back()->main_picture()->id(), pic_id);
- BOOST_REQUIRE (vf_c.cpls()[0]->reels().back()->main_sound());
- BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels().back()->main_sound()->id(), sound_id);
+ BOOST_REQUIRE(!ov_c.cpls()[0]->reels()[0]->main_subtitle());
+
+ dcp::DCP vf_c(vf->dir(vf->dcp_name()));
+ vf_c.read();
+ BOOST_REQUIRE_EQUAL(vf_c.cpls().size(), 1U);
+ BOOST_REQUIRE_EQUAL(vf_c.cpls()[0]->reels().size(), 2U);
+ BOOST_REQUIRE(vf_c.cpls()[0]->reels().back()->main_picture());
+ BOOST_CHECK_EQUAL(vf_c.cpls()[0]->reels().back()->main_picture()->id(), pic_id);
+ BOOST_REQUIRE(vf_c.cpls()[0]->reels().back()->main_sound());
+ BOOST_CHECK_EQUAL(vf_c.cpls()[0]->reels().back()->main_sound()->id(), sound_id);
}
/** Test bug #1495 */
-BOOST_AUTO_TEST_CASE (vf_test5)
+BOOST_AUTO_TEST_CASE(vf_test5)
{
/* Make the OV */
auto ov = new_test_film("vf_test5_ov");
- ov->set_reel_type (ReelType::BY_VIDEO_CONTENT);
+ ov->set_reel_type(ReelType::BY_VIDEO_CONTENT);
for (int i = 0; i < 3; ++i) {
auto video = content_factory("test/data/flat_red.png")[0];
ov->examine_and_add_content({video});
- BOOST_REQUIRE (!wait_for_jobs());
- video->video->set_length (24 * 10);
+ BOOST_REQUIRE(!wait_for_jobs());
+ video->video->set_length(24 * 10);
}
- BOOST_REQUIRE (!wait_for_jobs());
- make_and_verify_dcp (ov);
+ BOOST_REQUIRE(!wait_for_jobs());
+ make_and_verify_dcp(ov);
/* Make the VF */
auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
auto vf = new_test_film("vf_test5_vf", { dcp });
- vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
- vf->set_sequence (false);
- dcp->set_reference_video (true);
- dcp->set_reference_audio (true);
- dcp->set_trim_end (ContentTime::from_seconds(15));
+ vf->set_reel_type(ReelType::BY_VIDEO_CONTENT);
+ vf->set_sequence(false);
+ dcp->set_reference_video(true);
+ dcp->set_reference_audio(true);
+ dcp->set_trim_end(ContentTime::from_seconds(15));
make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
/* Check that the selected reel assets are right */
auto a = get_referenced_reel_assets(vf, vf->playlist());
- BOOST_REQUIRE_EQUAL (a.size(), 4U);
+ BOOST_REQUIRE_EQUAL(a.size(), 4U);
auto i = a.begin();
- BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(0), DCPTime(960000)));
+ BOOST_CHECK(i->period == DCPTimePeriod(DCPTime(0), DCPTime(960000)));
++i;
- BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(0), DCPTime(960000)));
+ BOOST_CHECK(i->period == DCPTimePeriod(DCPTime(0), DCPTime(960000)));
++i;
- BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(960000), DCPTime(1440000)));
+ BOOST_CHECK(i->period == DCPTimePeriod(DCPTime(960000), DCPTime(1440000)));
++i;
- BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(960000), DCPTime(1440000)));
+ BOOST_CHECK(i->period == DCPTimePeriod(DCPTime(960000), DCPTime(1440000)));
++i;
}
/** Test bug #1528 */
-BOOST_AUTO_TEST_CASE (vf_test6)
+BOOST_AUTO_TEST_CASE(vf_test6)
{
/* Make the OV */
auto video = content_factory("test/data/flat_red.png")[0];
auto ov = new_test_film("vf_test6_ov", { video });
- ov->set_reel_type (ReelType::BY_VIDEO_CONTENT);
- video->video->set_length (24 * 10);
- make_and_verify_dcp (ov);
+ ov->set_reel_type(ReelType::BY_VIDEO_CONTENT);
+ video->video->set_length(24 * 10);
+ make_and_verify_dcp(ov);
/* Make the VF */
auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
auto vf = new_test_film("vf_test6_vf", { dcp });
- vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
- vf->set_sequence (false);
- dcp->set_reference_video (true);
- dcp->set_reference_audio (true);
+ vf->set_reel_type(ReelType::BY_VIDEO_CONTENT);
+ vf->set_sequence(false);
+ dcp->set_reference_video(true);
+ dcp->set_reference_audio(true);
auto sub = content_factory("test/data/15s.srt")[0];
vf->examine_and_add_content({sub});
- BOOST_REQUIRE (!wait_for_jobs());
+ BOOST_REQUIRE(!wait_for_jobs());
- make_and_verify_dcp (
+ make_and_verify_dcp(
vf,
{
dcp::VerificationNote::Code::EXTERNAL_ASSET,
@@ -316,34 +316,34 @@ BOOST_AUTO_TEST_CASE (vf_test6)
/** Test bug #1643 (the second part; referring fails if there are gaps) */
-BOOST_AUTO_TEST_CASE (vf_test7)
+BOOST_AUTO_TEST_CASE(vf_test7)
{
/* First OV */
auto ov1 = new_test_film("vf_test7_ov1", {content_factory("test/data/flat_red.png")[0]});
- ov1->set_video_frame_rate (24);
- make_and_verify_dcp (ov1);
+ ov1->set_video_frame_rate(24);
+ make_and_verify_dcp(ov1);
/* Second OV */
auto ov2 = new_test_film("vf_test7_ov2", {content_factory("test/data/flat_red.png")[0]});
- ov2->set_video_frame_rate (24);
- make_and_verify_dcp (ov2);
+ ov2->set_video_frame_rate(24);
+ make_and_verify_dcp(ov2);
/* VF */
auto ov1_dcp = make_shared<DCPContent>(ov1->dir(ov1->dcp_name()));
auto ov2_dcp = make_shared<DCPContent>(ov2->dir(ov2->dcp_name()));
auto vf = new_test_film("vf_test7_vf", {ov1_dcp, ov2_dcp});
- vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
- ov1_dcp->set_reference_video (true);
- ov2_dcp->set_reference_video (true);
- ov1_dcp->set_position (vf, DCPTime::from_seconds(1));
- ov2_dcp->set_position (vf, DCPTime::from_seconds(20));
- vf->write_metadata ();
- make_and_verify_dcp (vf);
+ vf->set_reel_type(ReelType::BY_VIDEO_CONTENT);
+ ov1_dcp->set_reference_video(true);
+ ov2_dcp->set_reference_video(true);
+ ov1_dcp->set_position(vf, DCPTime::from_seconds(1));
+ ov2_dcp->set_position(vf, DCPTime::from_seconds(20));
+ vf->write_metadata();
+ make_and_verify_dcp(vf);
}
/** Test bug #2116 */
-BOOST_AUTO_TEST_CASE (test_vf_with_trimmed_multi_reel_dcp)
+BOOST_AUTO_TEST_CASE(test_vf_with_trimmed_multi_reel_dcp)
{
/* Make an OV with 3 reels */
std::vector<std::shared_ptr<Content>> ov_content;
@@ -354,7 +354,7 @@ BOOST_AUTO_TEST_CASE (test_vf_with_trimmed_multi_reel_dcp)
}
auto ov = new_test_film("test_vf_with_trimmed_multi_reel_dcp_ov", ov_content);
ov->set_reel_type(ReelType::BY_VIDEO_CONTENT);
- make_and_verify_dcp (ov);
+ make_and_verify_dcp(ov);
/* Make a VF with a specific arrangement */
auto vf_image = content_factory("test/data/flat_red.png")[0];