segment: Handle WebVTT as per HLS spec
|Reported by:||Ridley Combs||Owned by:|
|Blocking:||Reproduced by developer:||no|
|Analyzed by developer:||no|
As per the HLS spec:
Subtitle segments MUST be formatted as WebVTT [WebVTT] files. Each subtitle segment MUST contain all subtitle cues that are intended to be displayed during the period indicated by the segment EXTINF duration. The start time offset and end time offset of each cue MUST indicate the total display time for that cue, even if that time range extends beyond the EXTINF duration. A WebVTT segment MAY contain no cues; this indicates that no subtitles are to be displayed during that period.
This means that the segment (or HLS) muxer needs to handle two particular cases, when muxing WebVTT for HLS:
- No frames exist during a segment's duration, so a blank segment should be written.
- A frame spans two or more different segments, so it should be written in all of them.
This behavior could be triggered by an option, or automatically when the underlying format is WebVTT.
Relatedly, the WebVTT muxer should provide an option to write the X-TIMESTAMP-MAP header for HLS synchronization.