diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-02-06 11:33:12 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-02-07 01:04:51 +0100 |
| commit | 06eebda835e00582e70890890aad08beaf63db05 (patch) | |
| tree | 131409f3e146f5881b1ff629e19a3a1cd4d5d745 | |
| parent | fbcfa342d9f8d6f1430065ad18a1a1b8f7b925db (diff) | |
Don't give confusing errors about WEBVTT when there are errors in a Subrip file (#2733).
| -rw-r--r-- | cscript | 2 | ||||
| -rw-r--r-- | src/lib/string_text_file.cc | 12 |
2 files changed, 10 insertions, 4 deletions
@@ -508,7 +508,7 @@ def dependencies(target, options): deps = [] deps.append(('libdcp', 'v1.8.94')) - deps.append(('libsub', 'v1.6.46')) + deps.append(('libsub', 'v1.6.47')) deps.append(('leqm-nrt', '30dcaea1373ac62fba050e02ce5b0c1085797a23')) deps.append(('rtaudio', 'f619b76')) # We get our OpenSSL libraries from the environment, but we diff --git a/src/lib/string_text_file.cc b/src/lib/string_text_file.cc index 348ccd1d5..9b43b35a6 100644 --- a/src/lib/string_text_file.cc +++ b/src/lib/string_text_file.cc @@ -25,6 +25,7 @@ #include "string_text_file_content.h" #include <dcp/file.h> #include <sub/collect.h> +#include <sub/exceptions.h> #include <sub/ssa_reader.h> #include <sub/stl_binary_reader.h> #include <sub/subrip_reader.h> @@ -105,9 +106,14 @@ StringTextFile::StringTextFile (shared_ptr<const StringTextFileContent> content) if (ext == ".srt") { try { reader.reset(new sub::SubripReader(utf8.get())); - } catch (...) { - /* Sometimes files are have the .srt extension but are really WEBVTT */ - reader.reset(new sub::WebVTTReader(utf8.get())); + } catch (sub::SubripError& subrip_error) { + /* Sometimes files are have the .srt extension but are really WEBVTT... */ + try { + reader.reset(new sub::WebVTTReader(utf8.get())); + } catch (sub::WebVTTHeaderError&) { + /* ...but in this case there isn't even a WebVTT error */ + throw subrip_error; + } } } else if (ext == ".ssa" || ext == ".ass") { reader.reset(new sub::SSAReader(utf8.get())); |
