mirror of
https://github.com/androidx/media.git
synced 2025-05-09 16:40:55 +08:00
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).
This commit is contained in:
parent
eb282639c5
commit
10f3be6d50
@ -166,7 +166,7 @@ public final class HlsPlaylistParser implements UriLoadable.Parser<HlsPlaylist>
|
|||||||
} else if (line.startsWith(STREAM_INF_TAG)) {
|
} else if (line.startsWith(STREAM_INF_TAG)) {
|
||||||
bitrate = HlsParserUtil.parseIntAttr(line, BANDWIDTH_ATTR_REGEX, BANDWIDTH_ATTR);
|
bitrate = HlsParserUtil.parseIntAttr(line, BANDWIDTH_ATTR_REGEX, BANDWIDTH_ATTR);
|
||||||
codecs = HlsParserUtil.parseOptionalStringAttr(line, CODECS_ATTR_REGEX);
|
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,
|
String resolutionString = HlsParserUtil.parseOptionalStringAttr(line,
|
||||||
RESOLUTION_ATTR_REGEX);
|
RESOLUTION_ATTR_REGEX);
|
||||||
if (resolutionString != null) {
|
if (resolutionString != null) {
|
||||||
|
@ -26,13 +26,16 @@ public final class Variant implements FormatWrapper {
|
|||||||
|
|
||||||
public final String url;
|
public final String url;
|
||||||
public final Format format;
|
public final Format format;
|
||||||
public final String name;
|
|
||||||
|
|
||||||
public Variant(int index, String name, String url, int bitrate, String codecs, int width, int height) {
|
public Variant(int index, String name, String url, int bitrate, String codecs, int width, int height) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.name = name;
|
if (name != null) {
|
||||||
format = new Format(Integer.toString(index), MimeTypes.APPLICATION_M3U8, width, height, -1, -1,
|
format = new Format(name, MimeTypes.APPLICATION_M3U8, width, height, -1, -1,
|
||||||
-1, bitrate, null, codecs);
|
-1, bitrate, null, codecs);
|
||||||
|
} else {
|
||||||
|
format = new Format(Integer.toString(index), MimeTypes.APPLICATION_M3U8, width, height, -1, -1,
|
||||||
|
-1, bitrate, null, codecs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user