+
+ /* Try to read PNG files from the same folder that the XML is in; the wisdom of this is
+ debatable, at best...
+ */
+ for (auto i: _subtitles) {
+ auto im = dynamic_pointer_cast<SubtitleImage>(i);
+ if (im && im->png_image().size() == 0) {
+ /* Even more dubious; allow <id>.png or urn:uuid:<id>.png */
+ auto p = file.parent_path() / String::compose("%1.png", im->id());
+ if (boost::filesystem::is_regular_file(p)) {
+ im->read_png_file (p);
+ } else if (starts_with (im->id(), "urn:uuid:")) {
+ p = file.parent_path() / String::compose("%1.png", remove_urn_uuid(im->id()));
+ if (boost::filesystem::is_regular_file(p)) {
+ im->read_png_file (p);
+ }
+ }
+ }
+ }
+ _standard = Standard::SMPTE;
+ }
+
+ /* Check that all required image data have been found */
+ for (auto i: _subtitles) {
+ auto im = dynamic_pointer_cast<SubtitleImage>(i);
+ if (im && im->png_image().size() == 0) {
+ throw MissingSubtitleImageError (im->id());
+ }