Be more tolerant of metadata in WebVTT.
authorCarl Hetherington <cth@carlh.net>
Sun, 13 Nov 2022 23:32:33 +0000 (00:32 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 13 Nov 2022 23:32:33 +0000 (00:32 +0100)
src/web_vtt_reader.cc
test/data/test.vtt

index 2781654bac5b41db37110f8ef0ea9d9a303b6192..2e772f143b99a8e65cdd0de325e500758faf9af3 100644 (file)
@@ -55,7 +55,7 @@ WebVTTReader::read(std::function<optional<string> ()> get_line)
        enum class State {
                /* expecting WEBVTT */
                HEADER,
-               /* awaiting a NOTE or a subtitle timing line */
+               /* awaiting a NOTE, some other metadata, or a subtitle timing line */
                DATA,
                /* reading the text of a subtitle */
                SUBTITLE,
@@ -125,8 +125,6 @@ WebVTTReader::read(std::function<optional<string> ()> get_line)
 
                                rs.vertical_position.line = 0;
                                state = State::SUBTITLE;
-                       } else if (!line->empty()) {
-                               throw WebVTTError(*line, "a note or time", _context);
                        }
                        break;
                case State::SUBTITLE:
index 461c8a2ca4979640f3071f9a463d0caf91b84eae..6cd60eb709fab6bdf30552a8c13e9d03ee49cd33 100644 (file)
@@ -1,4 +1,6 @@
 WEBVTT - you can put something here
+Some: people
+Seem: to put stuff here
 
 NOTE You can have notes
 That span multiple lines