2 Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #include "verify_dcp_dialog.h"
23 #include "lib/verify_dcp_job.h"
24 #include "lib/warnings.h"
25 #include <dcp/verify.h>
26 DCPOMATIC_DISABLE_WARNINGS
27 #include <wx/richtext/richtextctrl.h>
28 DCPOMATIC_ENABLE_WARNINGS
29 #include <boost/foreach.hpp>
32 using boost::shared_ptr;
34 VerifyDCPDialog::VerifyDCPDialog (wxWindow* parent, shared_ptr<VerifyDCPJob> job)
35 : wxDialog (parent, wxID_ANY, _("DCP verification"))
37 wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
38 _text = new wxRichTextCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (400, 300), wxRE_READONLY);
39 sizer->Add (_text, 1, wxEXPAND | wxALL, 6);
41 wxStdDialogButtonSizer* buttons = CreateStdDialogButtonSizer (0);
42 sizer->Add (CreateSeparatedSizer(buttons), wxSizerFlags().Expand().DoubleBorder());
43 buttons->SetAffirmativeButton (new wxButton (this, wxID_OK));
48 sizer->SetSizeHints (this);
50 _text->GetCaret()->Hide ();
52 if (job->finished_ok() && job->notes().empty()) {
53 _text->BeginStandardBullet (N_("standard/circle"), 1, 50);
54 _text->WriteText (_("DCP validates OK."));
55 _text->EndStandardBullet ();
59 /* We might have an error that did not come from dcp::verify; report it if so */
60 if (job->finished_in_error() && job->error_summary() != "") {
61 _text->BeginSymbolBullet (N_("!"), 1, 50);
62 _text->WriteText(std_to_wx(job->error_summary()));
66 BOOST_FOREACH (dcp::VerificationNote i, job->notes()) {
68 case dcp::VerificationNote::VERIFY_WARNING:
69 _text->BeginStandardBullet (N_("standard/diamond"), 1, 50);
71 case dcp::VerificationNote::VERIFY_ERROR:
72 _text->BeginSymbolBullet (N_("!"), 1, 50);
78 case dcp::VerificationNote::GENERAL_READ:
79 text = std_to_wx(*i.note());
81 case dcp::VerificationNote::CPL_HASH_INCORRECT:
82 text = _("The hash of the CPL in the PKL does not agree with the CPL file. This probably means that the CPL file is corrupt.");
84 case dcp::VerificationNote::INVALID_PICTURE_FRAME_RATE:
85 text = _("The picture in a reel has an invalid frame rate");
87 case dcp::VerificationNote::PICTURE_HASH_INCORRECT:
88 text = wxString::Format(
89 _("The hash of the picture asset %s does not agree with the PKL file. This probably means that the asset file is corrupt."),
90 std_to_wx(i.file()->filename().string())
93 case dcp::VerificationNote::PKL_CPL_PICTURE_HASHES_DISAGREE:
94 text = _("The PKL and CPL hashes disagree for a picture asset.");
96 case dcp::VerificationNote::SOUND_HASH_INCORRECT:
97 text = wxString::Format(
98 _("The hash of the sound asset %s does not agree with the PKL file. This probably means that the asset file is corrupt."),
99 std_to_wx(i.file()->filename().string())
102 case dcp::VerificationNote::PKL_CPL_SOUND_HASHES_DISAGREE:
103 text = _("The PKL and CPL hashes disagree for a sound asset.");
105 case dcp::VerificationNote::EMPTY_ASSET_PATH:
106 text = _("An asset has an empty path in the ASSETMAP.");
108 case dcp::VerificationNote::MISSING_ASSET:
109 text = _("An asset is missing.");
111 case dcp::VerificationNote::MISMATCHED_STANDARD:
112 text = _("Parts of the DCP are written according to the Interop standard and parts according to SMPTE.");
114 case dcp::VerificationNote::XML_VALIDATION_ERROR:
116 text = wxString::Format(
117 _("The XML in %s is malformed on line %" PRIu64 "."),
118 std_to_wx(i.file()->filename().string()),
122 text = wxString::Format(
123 _("The XML in %s is malformed."),
124 std_to_wx(i.file()->filename().string())
128 case dcp::VerificationNote::MISSING_ASSETMAP:
129 text = _("No ASSETMAP or ASSETMAP.xml file was found.");
131 case dcp::VerificationNote::INTRINSIC_DURATION_TOO_SMALL:
132 text = _("An asset has an instrinsic duration of less than 1 second, which is invalid.");
134 case dcp::VerificationNote::DURATION_TOO_SMALL:
135 text = _("An asset has a duration of less than 1 second, which is invalid.");
137 case dcp::VerificationNote::PICTURE_FRAME_TOO_LARGE:
138 text = _("At least one frame of the video data is over the limit of 250Mbit/s.");
140 case dcp::VerificationNote::PICTURE_FRAME_NEARLY_TOO_LARGE:
141 text = _("At least one frame of the video data is close to the limit of 250MBit/s.");
143 case dcp::VerificationNote::EXTERNAL_ASSET:
144 text = _("This DCP refers to at least one asset in another DCP, so it is a \"version file\" (VF)");
148 _text->WriteText (text);
152 case dcp::VerificationNote::VERIFY_WARNING:
153 _text->EndStandardBullet ();
155 case dcp::VerificationNote::VERIFY_ERROR:
156 _text->EndSymbolBullet ();