Fix message for high bitrate frames during verify.
[dcpomatic.git] / src / wx / verify_dcp_dialog.cc
1 /*
2     Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
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.
10
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.
15
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/>.
18
19 */
20
21
22 #include "verify_dcp_dialog.h"
23 #include "wx_util.h"
24 #include "lib/verify_dcp_job.h"
25 #include <dcp/raw_convert.h>
26 #include <dcp/verify.h>
27 #include <dcp/warnings.h>
28 LIBDCP_DISABLE_WARNINGS
29 #include <wx/richtext/richtextctrl.h>
30 #include <wx/notebook.h>
31 LIBDCP_ENABLE_WARNINGS
32 #include <boost/algorithm/string.hpp>
33
34
35 using std::list;
36 using std::map;
37 using std::shared_ptr;
38 using std::string;
39 using std::vector;
40
41
42 VerifyDCPDialog::VerifyDCPDialog (wxWindow* parent, shared_ptr<VerifyDCPJob> job)
43         : wxDialog (parent, wxID_ANY, _("DCP verification"), wxDefaultPosition, {600, 400})
44 {
45         auto sizer = new wxBoxSizer (wxVERTICAL);
46         auto notebook = new wxNotebook (this, wxID_ANY);
47         sizer->Add (notebook, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
48
49         map<dcp::VerificationNote::Type, wxRichTextCtrl*> pages;
50         pages[dcp::VerificationNote::Type::ERROR] = new wxRichTextCtrl (notebook, wxID_ANY, wxEmptyString, wxDefaultPosition, {400, 300}, wxRE_READONLY);
51         notebook->AddPage (pages[dcp::VerificationNote::Type::ERROR], _("Errors"));
52         pages[dcp::VerificationNote::Type::BV21_ERROR] = new wxRichTextCtrl (notebook, wxID_ANY, wxEmptyString, wxDefaultPosition, {400, 300}, wxRE_READONLY);
53         notebook->AddPage (pages[dcp::VerificationNote::Type::BV21_ERROR], _("SMPTE Bv2.1 errors"));
54         pages[dcp::VerificationNote::Type::WARNING] = new wxRichTextCtrl (notebook, wxID_ANY, wxEmptyString, wxDefaultPosition, {400, 300}, wxRE_READONLY);
55         notebook->AddPage (pages[dcp::VerificationNote::Type::WARNING], _("Warnings"));
56
57         auto summary = new wxStaticText (this, wxID_ANY, wxT(""));
58         sizer->Add (summary, 0, wxALL, DCPOMATIC_DIALOG_BORDER);
59
60         auto buttons = CreateStdDialogButtonSizer (0);
61         sizer->Add (CreateSeparatedSizer(buttons), wxSizerFlags().Expand().DoubleBorder());
62         buttons->SetAffirmativeButton (new wxButton (this, wxID_OK));
63         buttons->Realize ();
64
65         SetSizer (sizer);
66         sizer->Layout ();
67         sizer->SetSizeHints (this);
68
69         for (auto const& i: pages) {
70                 i.second->GetCaret()->Hide();
71         }
72
73         if (job->finished_ok() && job->notes().empty()) {
74                 summary->SetLabel (_("DCP validates OK."));
75                 return;
76         }
77
78         map<dcp::VerificationNote::Type, int> counts;
79         counts[dcp::VerificationNote::Type::WARNING] = 0;
80         counts[dcp::VerificationNote::Type::BV21_ERROR] = 0;
81         counts[dcp::VerificationNote::Type::ERROR] = 0;
82
83         auto add_bullet = [&pages](dcp::VerificationNote::Type type, wxString message) {
84                 pages[type]->BeginStandardBullet(N_("standard/diamond"), 1, 50);
85                 pages[type]->WriteText (message);
86                 pages[type]->Newline ();
87                 pages[type]->EndStandardBullet ();
88         };
89
90         auto add = [&counts, &add_bullet](dcp::VerificationNote note, wxString message) {
91                 if (note.reference_hash()) {
92                         message.Replace("%reference_hash", std_to_wx(note.reference_hash().get()));
93                 }
94                 if (note.calculated_hash()) {
95                         message.Replace("%calculated_hash", std_to_wx(note.calculated_hash().get()));
96                 }
97                 if (note.frame()) {
98                         message.Replace("%frame", std_to_wx(dcp::raw_convert<string>(note.frame().get())));
99                         message.Replace(
100                                 "%timecode",
101                                 std_to_wx(
102                                         dcp::Time(note.frame().get(), note.frame_rate().get(), note.frame_rate().get()).as_string(dcp::Standard::SMPTE)
103                                         ));
104                 }
105                 if (note.note()) {
106                         message.Replace("%n", std_to_wx(note.note().get()));
107                 }
108                 if (note.file()) {
109                         message.Replace("%f", std_to_wx(note.file()->filename().string()));
110                 }
111                 if (note.line()) {
112                         message.Replace("%l", std_to_wx(dcp::raw_convert<string>(note.line().get())));
113                 }
114                 if (note.component()) {
115                         message.Replace("%component", std_to_wx(dcp::raw_convert<string>(note.component().get())));
116                 }
117                 if (note.size()) {
118                         message.Replace("%size", std_to_wx(dcp::raw_convert<string>(note.size().get())));
119                 }
120                 if (note.id()) {
121                         message.Replace("%id", std_to_wx(note.id().get()));
122                 }
123                 if (note.other_id()) {
124                         message.Replace("%other_id", std_to_wx(note.other_id().get()));
125                 }
126                 add_bullet (note.type(), message);
127                 counts[note.type()]++;
128         };
129
130         if (job->finished_in_error() && job->error_summary() != "") {
131                 /* We have an error that did not come from dcp::verify */
132                 add_bullet (dcp::VerificationNote::Type::ERROR, std_to_wx(job->error_summary()));
133         }
134
135         for (auto i: job->notes()) {
136                 switch (i.code()) {
137                 case dcp::VerificationNote::Code::FAILED_READ:
138                         add (i, std_to_wx(*i.note()));
139                         break;
140                 case dcp::VerificationNote::Code::MISMATCHED_CPL_HASHES:
141                         add(i, _("The hash (%reference_hash) of the CPL %n in the PKL does not agree with the CPL file (%calculated_hash).  This probably means that the CPL file is corrupt."));
142                         break;
143                 case dcp::VerificationNote::Code::INVALID_PICTURE_FRAME_RATE:
144                         add(i, _("The picture in a reel has a frame rate of %n, which is not valid."));
145                         break;
146                 case dcp::VerificationNote::Code::INCORRECT_PICTURE_HASH:
147                         add(i, _("The hash (%calculated_hash) of the picture asset %f does not agree with the PKL file (%reference_hash).  This probably means that the asset file is corrupt."));
148                         break;
149                 case dcp::VerificationNote::Code::MISMATCHED_PICTURE_HASHES:
150                         add(i, _("The PKL and CPL hashes disagree for picture asset %f."));
151                         break;
152                 case dcp::VerificationNote::Code::INCORRECT_SOUND_HASH:
153                         add(i, _("The hash (%calculated_hash) of the sound asset %f does not agree with the PKL file (%reference_hash).  This probably means that the asset file is corrupt."));
154                         break;
155                 case dcp::VerificationNote::Code::MISMATCHED_SOUND_HASHES:
156                         add(i, _("The PKL and CPL hashes disagree for sound asset %f."));
157                         break;
158                 case dcp::VerificationNote::Code::EMPTY_ASSET_PATH:
159                         add(i, _("An asset has an empty path in the ASSETMAP."));
160                         break;
161                 case dcp::VerificationNote::Code::MISSING_ASSET:
162                         add(i, _("The asset %f is missing."));
163                         break;
164                 case dcp::VerificationNote::Code::MISMATCHED_STANDARD:
165                         add(i, _("Parts of the DCP are written according to the Interop standard and parts according to SMPTE."));
166                         break;
167                 case dcp::VerificationNote::Code::INVALID_XML:
168                         if (i.line()) {
169                                 add(i, _("The XML in %f is malformed on line %l (%n)."));
170                         } else {
171                                 add(i, _("The XML in %f is malformed (%n)."));
172                         }
173                         break;
174                 case dcp::VerificationNote::Code::MISSING_ASSETMAP:
175                         add(i, _("No ASSETMAP or ASSETMAP.xml file was found."));
176                         break;
177                 case dcp::VerificationNote::Code::INVALID_INTRINSIC_DURATION:
178                         add(i, _("The asset %n has an intrinsic duration of less than 1 second, which is invalid."));
179                         break;
180                 case dcp::VerificationNote::Code::INVALID_DURATION:
181                         add(i, _("The asset %n has a duration of less than 1 second, which is invalid."));
182                         break;
183                 case dcp::VerificationNote::Code::INVALID_PICTURE_FRAME_SIZE_IN_BYTES:
184                         add(i, _("At least one frame of the video asset %f is over the limit of 250Mbit/s."));
185                         break;
186                 case dcp::VerificationNote::Code::NEARLY_INVALID_PICTURE_FRAME_SIZE_IN_BYTES:
187                         add(i, _("Frame %frame (timecode %timecode) in asset %f has an instantaneous bit rate that is close to the limit of 250Mbit/s."));
188                         break;
189                 case dcp::VerificationNote::Code::EXTERNAL_ASSET:
190                         add(i, _("This DCP refers to at the asset %n in another DCP (and perhaps others), so it is a \"version file\" (VF)"));
191                         break;
192                 case dcp::VerificationNote::Code::THREED_ASSET_MARKED_AS_TWOD:
193                         add(i, _("The asset %f is 3D but its MXF is marked as 2D."));
194                         break;
195                 case dcp::VerificationNote::Code::INVALID_STANDARD:
196                         add(i, _("This DCP uses the Interop standard, but it should be made with SMPTE."));
197                         break;
198                 case dcp::VerificationNote::Code::INVALID_LANGUAGE:
199                         add(i, _("The invalid language tag %n is used."));
200                         break;
201                 case dcp::VerificationNote::Code::INVALID_PICTURE_SIZE_IN_PIXELS:
202                         add(i, _("The video asset %f uses the invalid image size %n."));
203                         break;
204                 case dcp::VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_2K:
205                         add(i, _("The video asset %f uses the invalid frame rate %n."));
206                         break;
207                 case dcp::VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_4K:
208                         add(i, _("The video asset %f uses the frame rate %n which is invalid for 4K video."));
209                         break;
210                 case dcp::VerificationNote::Code::INVALID_PICTURE_ASSET_RESOLUTION_FOR_3D:
211                         add(i, _("The video asset %f uses the frame rate %n which is invalid for 3D video."));
212                         break;
213                 case dcp::VerificationNote::Code::INVALID_CLOSED_CAPTION_XML_SIZE_IN_BYTES:
214                         add(i, _("The XML in the closed caption asset %f takes up %n bytes which is over the 256KB limit."));
215                         break;
216                 case dcp::VerificationNote::Code::INVALID_TIMED_TEXT_SIZE_IN_BYTES:
217                         add(i, _("The timed text asset %f takes up %n bytes which is over the 115MB limit."));
218                         break;
219                 case dcp::VerificationNote::Code::INVALID_TIMED_TEXT_FONT_SIZE_IN_BYTES:
220                         add(i, _("The fonts in the timed text asset %f take up %n bytes which is over the 10MB limit."));
221                         break;
222                 case dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE:
223                         add(i, _("The subtitle asset %f contains no <Language> tag."));
224                         break;
225                 case dcp::VerificationNote::Code::MISMATCHED_SUBTITLE_LANGUAGES:
226                         add(i, _("Not all subtitle assets specify the same <Language> tag."));
227                         break;
228                 case dcp::VerificationNote::Code::MISSING_SUBTITLE_START_TIME:
229                         add(i, _("The subtitle asset %f contains no <StartTime> tag."));
230                         break;
231                 case dcp::VerificationNote::Code::INVALID_SUBTITLE_START_TIME:
232                         add(i, _("The subtitle asset %f has a <StartTime> which is not zero."));
233                         break;
234                 case dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME:
235                         add(i, _("The first subtitle or closed caption happens before 4s into the first reel."));
236                         break;
237                 case dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION:
238                         add(i, _("At least one subtitle lasts less than 15 frames."));
239                         break;
240                 case dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING:
241                         add(i, _("At least one pair of subtitles is separated by less than 2 frames."));
242                         break;
243                 case dcp::VerificationNote::Code::INVALID_SUBTITLE_LINE_COUNT:
244                         add(i, _("There are more than 3 subtitle lines in at least one place."));
245                         break;
246                 case dcp::VerificationNote::Code::NEARLY_INVALID_SUBTITLE_LINE_LENGTH:
247                         add(i, _("There are more than 52 characters in at least one subtitle line."));
248                         break;
249                 case dcp::VerificationNote::Code::INVALID_SUBTITLE_LINE_LENGTH:
250                         add(i, _("There are more than 79 characters in at least one subtitle line."));
251                         break;
252                 case dcp::VerificationNote::Code::INVALID_CLOSED_CAPTION_LINE_COUNT:
253                         add(i, _("There are more than 3 closed caption lines in at least one place."));
254                         break;
255                 case dcp::VerificationNote::Code::INVALID_CLOSED_CAPTION_LINE_LENGTH:
256                         add(i, _("There are more than 32 characters in at least one closed caption line."));
257                         break;
258                 case dcp::VerificationNote::Code::INVALID_SOUND_FRAME_RATE:
259                         add(i, _("The sound asset %f has an invalid frame rate of %n."));
260                         break;
261                 case dcp::VerificationNote::Code::MISSING_CPL_ANNOTATION_TEXT:
262                         add(i, _("The CPL %n has no <AnnotationText> tag."));
263                         break;
264                 case dcp::VerificationNote::Code::MISMATCHED_CPL_ANNOTATION_TEXT:
265                         add(i, _("The CPL %n has an <AnnotationText> which is not the same as its <ContentTitleText>."));
266                         break;
267                 case dcp::VerificationNote::Code::MISMATCHED_ASSET_DURATION:
268                         add(i, _("At least one asset in a reel does not have the same duration as the others."));
269                         break;
270                 case dcp::VerificationNote::Code::MISSING_MAIN_SUBTITLE_FROM_SOME_REELS:
271                         add(i, _("The DCP has subtitles but at least one reel has no subtitle asset."));
272                         break;
273                 case dcp::VerificationNote::Code::MISMATCHED_CLOSED_CAPTION_ASSET_COUNTS:
274                         add(i, _("The DCP has closed captions but not every reel has the same number of closed caption assets."));
275                         break;
276                 case dcp::VerificationNote::Code::MISSING_SUBTITLE_ENTRY_POINT:
277                         add(i, _("The subtitle asset %n has no <EntryPoint> tag."));
278                         break;
279                 case dcp::VerificationNote::Code::INCORRECT_SUBTITLE_ENTRY_POINT:
280                         add(i, _("Subtitle asset %n has a non-zero <EntryPoint>."));
281                         break;
282                 case dcp::VerificationNote::Code::MISSING_CLOSED_CAPTION_ENTRY_POINT:
283                         add(i, _("The closed caption asset %n has no <EntryPoint> tag."));
284                         break;
285                 case dcp::VerificationNote::Code::INCORRECT_CLOSED_CAPTION_ENTRY_POINT:
286                         add(i, _("Closed caption asset %n has a non-zero <EntryPoint>."));
287                         break;
288                 case dcp::VerificationNote::Code::MISSING_HASH:
289                         add(i, _("The asset %n has no <Hash> in the CPL."));
290                         break;
291                 case dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE:
292                         add(i, _("The DCP is a feature but has no FFEC (first frame of end credits) marker."));
293                         break;
294                 case dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE:
295                         add(i, _("The DCP is a feature but has no FFMC (first frame of moving credits) marker."));
296                         break;
297                 case dcp::VerificationNote::Code::MISSING_FFOC:
298                         add(i, _("The DCP has no FFOC (first frame of content) marker."));
299                         break;
300                 case dcp::VerificationNote::Code::MISSING_LFOC:
301                         add(i, _("The DCP has no LFOC (last frame of content) marker."));
302                         break;
303                 case dcp::VerificationNote::Code::INCORRECT_FFOC:
304                         add(i, _("The DCP has a FFOC of %n instead of 1."));
305                         break;
306                 case dcp::VerificationNote::Code::INCORRECT_LFOC:
307                         add(i, _("The DCP has a LFOC of %n instead of the reel duration minus one."));
308                         break;
309                 case dcp::VerificationNote::Code::MISSING_CPL_METADATA:
310                         add(i, _("The CPL %n has no CPL metadata tag."));
311                         break;
312                 case dcp::VerificationNote::Code::MISSING_CPL_METADATA_VERSION_NUMBER:
313                         add(i, _("The CPL %n has no CPL metadata version number tag."));
314                         break;
315                 case dcp::VerificationNote::Code::MISSING_EXTENSION_METADATA:
316                         add(i, _("The CPL %n has no CPL extension metadata tag."));
317                         break;
318                 case dcp::VerificationNote::Code::INVALID_EXTENSION_METADATA:
319                         add(i, _("The CPL %f has an invalid CPL extension metadata tag (%n)"));
320                         break;
321                 case dcp::VerificationNote::Code::UNSIGNED_CPL_WITH_ENCRYPTED_CONTENT:
322                         add(i, _("The CPL %n has encrypted content but is not signed."));
323                         break;
324                 case dcp::VerificationNote::Code::UNSIGNED_PKL_WITH_ENCRYPTED_CONTENT:
325                         add(i, _("The PKL %n has encrypted content but is not signed."));
326                         break;
327                 case dcp::VerificationNote::Code::MISMATCHED_PKL_ANNOTATION_TEXT_WITH_CPL:
328                         add(i, _("The PKL %n has an <AnnotationText> which does not match its CPL's <ContentTitleText>."));
329                         break;
330                 case dcp::VerificationNote::Code::PARTIALLY_ENCRYPTED:
331                         add(i, _("The DCP has encrypted content, but not all its assets are encrypted."));
332                         break;
333                 case dcp::VerificationNote::Code::INVALID_JPEG2000_CODESTREAM:
334                         add(i, _("A picture frame has an invalid JPEG2000 codestream (%n)"));
335                         break;
336                 case dcp::VerificationNote::Code::INVALID_JPEG2000_GUARD_BITS_FOR_2K:
337                         add(i, _("A 2K JPEG2000 frame has %n guard bits instead of 1."));
338                         break;
339                 case dcp::VerificationNote::Code::INVALID_JPEG2000_GUARD_BITS_FOR_4K:
340                         add(i, _("A 4K JPEG2000 frame has %n guard bits instead of 2."));
341                         break;
342                 case dcp::VerificationNote::Code::INVALID_JPEG2000_TILE_SIZE:
343                         add(i, _("A JPEG2000 tile size does not match the image size."));
344                         break;
345                 case dcp::VerificationNote::Code::INVALID_JPEG2000_CODE_BLOCK_WIDTH:
346                         add(i, _("A JPEG2000 frame has a code-block width of %n instead of 32."));
347                         break;
348                 case dcp::VerificationNote::Code::INVALID_JPEG2000_CODE_BLOCK_HEIGHT:
349                         add(i, _("A JPEG2000 frame has a code-block height of %n instead of 32."));
350                         break;
351                 case dcp::VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER_COUNT_FOR_2K:
352                         add(i, _("A 2K JPEG2000 frame has %n POC marker(s) instead of 0."));
353                         break;
354                 case dcp::VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER_COUNT_FOR_4K:
355                         add(i, _("A 4K JPEG2000 frame has %n POC marker(s) instead of 1."));
356                         break;
357                 case dcp::VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER:
358                         add(i, _("A JPEG2000 frame contains an invalid POC marker (%n)."));
359                         break;
360                 case dcp::VerificationNote::Code::INVALID_JPEG2000_POC_MARKER_LOCATION:
361                         add(i, _("A JPEG2000 frame contains POC marker in an invalid location."));
362                         break;
363                 case dcp::VerificationNote::Code::INVALID_JPEG2000_TILE_PARTS_FOR_2K:
364                         add(i, _("A 2K JPEG2000 frame contains %n tile parts instead of 3."));
365                         break;
366                 case dcp::VerificationNote::Code::INVALID_JPEG2000_TILE_PARTS_FOR_4K:
367                         add(i, _("A 4K JPEG2000 frame contains %n tile parts instead of 6."));
368                         break;
369                 case dcp::VerificationNote::Code::MISSING_JPEG200_TLM_MARKER:
370                         add(i, _("A JPEG2000 frame has no TLM marker."));
371                         break;
372                 case dcp::VerificationNote::Code::SUBTITLE_OVERLAPS_REEL_BOUNDARY:
373                         add(i, _("A subtitle lasts longer than the reel it is in."));
374                         break;
375                 case dcp::VerificationNote::Code::MISMATCHED_TIMED_TEXT_RESOURCE_ID:
376                         add(i, _("The Resource ID in a timed text MXF did not match the ID of the contained XML."));
377                         break;
378                 case dcp::VerificationNote::Code::INCORRECT_TIMED_TEXT_ASSET_ID:
379                         add(i, _("The Asset ID in a timed text MXF is the same as the Resource ID or that of the contained XML."));
380                         break;
381                 case dcp::VerificationNote::Code::MISMATCHED_TIMED_TEXT_DURATION:
382                 {
383                         vector<string> parts;
384                         boost::split (parts, i.note().get(), boost::is_any_of(" "));
385                         add(i, wxString::Format(_("The reel duration (%s) of some timed text is not the same as the ContainerDuration (%s) of its MXF."), std_to_wx(parts[0]), std_to_wx(parts[1])));
386                         break;
387                 }
388                 case dcp::VerificationNote::Code::MISSED_CHECK_OF_ENCRYPTED:
389                         add(i, _("Part of the DCP could not be checked because no KDM was available."));
390                         break;
391                 case dcp::VerificationNote::Code::EMPTY_TEXT:
392                         add(i, _("At least one <Text> node in a subtitle or closed caption is empty."));
393                         break;
394                 case dcp::VerificationNote::Code::MISMATCHED_CLOSED_CAPTION_VALIGN:
395                         add(i, _("Some closed <Text> or <Image> nodes have different vertical alignments within a <Subtitle>."));
396                         break;
397                 case dcp::VerificationNote::Code::INCORRECT_CLOSED_CAPTION_ORDERING:
398                         add(i, _("Some closed captions are not listed in the order of their vertical position."));
399                         break;
400                 case dcp::VerificationNote::Code::UNEXPECTED_ENTRY_POINT:
401                         add(i, _("There is a <EntryPoint> tag inside a <MainMarkers>."));
402                         break;
403                 case dcp::VerificationNote::Code::UNEXPECTED_DURATION:
404                         add(i, _("There is a <Duration> tag inside a <MainMarkers>."));
405                         break;
406                 case dcp::VerificationNote::Code::INVALID_CONTENT_KIND:
407                         add(i, _("An invalid <ContentKind> %n has been used."));
408                         break;
409                 case dcp::VerificationNote::Code::INVALID_MAIN_PICTURE_ACTIVE_AREA:
410                         add(i, _("The <MainPictureActiveArea> is either not a multiple of 2, or is bigger than an asset."));
411                         break;
412                 case dcp::VerificationNote::Code::DUPLICATE_ASSET_ID_IN_PKL:
413                         add(i, _("The PKL %n has more than one asset with the same ID."));
414                         break;
415                 case dcp::VerificationNote::Code::DUPLICATE_ASSET_ID_IN_ASSETMAP:
416                         add(i, _("The ASSETMAP %n has more than one asset with the same ID."));
417                         break;
418                 case dcp::VerificationNote::Code::MISSING_SUBTITLE:
419                         add(i, _("The subtitle asset %n contains no subtitles."));
420                         break;
421                 case dcp::VerificationNote::Code::INVALID_SUBTITLE_ISSUE_DATE:
422                         add(i, _("<IssueDate> has an invalid value %n"));
423                         break;
424                 case dcp::VerificationNote::Code::MISMATCHED_SOUND_CHANNEL_COUNTS:
425                         add(i, _("Sound assets do not all have the same channel count."));
426                         break;
427                 case dcp::VerificationNote::Code::INVALID_MAIN_SOUND_CONFIGURATION:
428                         add(i, _("<MainSoundConfiguration> describes incorrect number of channels (%n)"));
429                         break;
430                 case dcp::VerificationNote::Code::MISSING_FONT:
431                         add(i, _("The font file for font ID \"%n\" was not found, or was not referred to in the ASSETMAP."));
432                         break;
433                 case dcp::VerificationNote::Code::INVALID_JPEG2000_TILE_PART_SIZE:
434                         add(i, _("Frame %frame has an image component that is too large (component %component is %size bytes in size)."));
435                         break;
436                 case dcp::VerificationNote::Code::INCORRECT_SUBTITLE_NAMESPACE_COUNT:
437                         add(i, _("The XML in the subtitle asset %n has more than one namespace declaration."));
438                         break;
439                 case dcp::VerificationNote::Code::MISSING_LOAD_FONT_FOR_FONT:
440                         add(i, _("A subtitle or closed caption refers to a font with ID %id that does not have a corresponding <LoadFont> node."));
441                         break;
442                 case dcp::VerificationNote::Code::MISSING_LOAD_FONT:
443                         add(i, _("The SMPTE subtitle asset %id has <Text> nodes but no <LoadFont> node"));
444                         break;
445                 case dcp::VerificationNote::Code::MISMATCHED_ASSET_MAP_ID:
446                         add(i, _("The asset with ID %id in the asset map actually has an id of %other_id"));
447                         break;
448                 case dcp::VerificationNote::Code::EMPTY_CONTENT_VERSION_LABEL_TEXT:
449                         add(i, _("The <LabelText> in a <ContentVersion> in CPL %id is empty"));
450                         break;
451                 }
452         }
453
454         wxString summary_text;
455
456         if (counts[dcp::VerificationNote::Type::ERROR] == 1) {
457                 /// TRANSLATORS: this will be used at the start of a string like "1 error, 2 Bv2.1 errors and 3 warnings."
458                 summary_text = _("1 error, ");
459         } else {
460                 /// TRANSLATORS: this will be used at the start of a string like "1 error, 2 Bv2.1 errors and 3 warnings."
461                 summary_text = wxString::Format("%d errors, ", counts[dcp::VerificationNote::Type::ERROR]);
462         }
463
464         if (counts[dcp::VerificationNote::Type::BV21_ERROR] == 1) {
465                 /// TRANSLATORS: this will be used in the middle of a string like "1 error, 2 Bv2.1 errors and 3 warnings."
466                 summary_text += _("1 Bv2.1 error, ");
467         } else {
468                 /// TRANSLATORS: this will be used in the middle of a string like "1 error, 2 Bv2.1 errors and 3 warnings."
469                 summary_text += wxString::Format("%d Bv2.1 errors, ", counts[dcp::VerificationNote::Type::BV21_ERROR]);
470         }
471
472         if (counts[dcp::VerificationNote::Type::WARNING] == 1) {
473                 /// TRANSLATORS: this will be used at the end of a string like "1 error, 2 Bv2.1 errors and 3 warnings."
474                 summary_text += _("and 1 warning.");
475         } else {
476                 /// TRANSLATORS: this will be used at the end of a string like "1 error, 2 Bv2.1 errors and 3 warnings."
477                 summary_text += wxString::Format("and %d warnings.", counts[dcp::VerificationNote::Type::WARNING]);
478         }
479
480         summary->SetLabel(summary_text);
481
482         if (counts[dcp::VerificationNote::Type::ERROR] == 0) {
483                 add_bullet (dcp::VerificationNote::Type::ERROR, _("No errors found."));
484         }
485
486         if (counts[dcp::VerificationNote::Type::BV21_ERROR] == 0) {
487                 add_bullet (dcp::VerificationNote::Type::BV21_ERROR, _("No SMPTE Bv2.1 errors found."));
488         }
489
490         if (counts[dcp::VerificationNote::Type::WARNING] == 0) {
491                 add_bullet (dcp::VerificationNote::Type::WARNING, _("No warnings found."));
492         }
493 }