Commit 10f3be6d by Rik Heijdens

Hls NAME parsing changes

-   NAME is optionial now in the Hls Manifest
-   Use the id field in Format to store the NAME instead of
    a field in Variant to mimic DASH's behaviour
    (see the DASH Id PR, which is not merged yet at this time).
parent eb282639
......@@ -166,7 +166,7 @@ public final class HlsPlaylistParser implements UriLoadable.Parser<HlsPlaylist>
} else if (line.startsWith(STREAM_INF_TAG)) {
bitrate = HlsParserUtil.parseIntAttr(line, BANDWIDTH_ATTR_REGEX, BANDWIDTH_ATTR);
codecs = HlsParserUtil.parseOptionalStringAttr(line, CODECS_ATTR_REGEX);
name = HlsParserUtil.parseStringAttr(line, NAME_ATTR_REGEX, NAME_ATTR);
name = HlsParserUtil.parseOptionalStringAttr(line, NAME_ATTR_REGEX);
String resolutionString = HlsParserUtil.parseOptionalStringAttr(line,
RESOLUTION_ATTR_REGEX);
if (resolutionString != null) {
......
......@@ -26,13 +26,16 @@ public final class Variant implements FormatWrapper {
public final String url;
public final Format format;
public final String name;
public Variant(int index, String name, String url, int bitrate, String codecs, int width, int height) {
this.url = url;
this.name = name;
format = new Format(Integer.toString(index), MimeTypes.APPLICATION_M3U8, width, height, -1, -1,
-1, bitrate, null, codecs);
if (name != null) {
format = new Format(name, MimeTypes.APPLICATION_M3U8, width, height, -1, -1,
-1, bitrate, null, codecs);
} else {
format = new Format(Integer.toString(index), MimeTypes.APPLICATION_M3U8, width, height, -1, -1,
-1, bitrate, null, codecs);
}
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment