mirror of
https://github.com/androidx/media.git
synced 2025-05-17 04:29:55 +08:00
Cleanup to use getCodecsOfType()
Use the `Util.getCodecsOfType()` method rather than hard coded codec strings
This commit is contained in:
parent
232820d3e1
commit
4ad4a826ab
@ -458,19 +458,18 @@ public final class HlsPlaylistParser implements ParsingLoadable.Parser<HlsPlayli
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TYPE_SUBTITLES:
|
case TYPE_SUBTITLES:
|
||||||
String subtitleMime = MimeTypes.TEXT_VTT; // Assume VTT unless variant declares it
|
sampleMimeType = MimeTypes.TEXT_VTT;
|
||||||
variant = getVariantWithSubtitleGroup(variants, groupId);
|
variant = getVariantWithSubtitleGroup(variants, groupId);
|
||||||
if (variant != null) {
|
if (variant != null) {
|
||||||
@Nullable
|
@Nullable
|
||||||
String codecs[] = Util.splitCodecs(variant.format.codecs);
|
String codecs = Util.getCodecsOfType(variant.format.codecs, C.TRACK_TYPE_AUDIO);
|
||||||
for (String codec : codecs) {
|
sampleMimeType = MimeTypes.getMediaMimeType(codecs);
|
||||||
if (codec.equalsIgnoreCase("stpp.ttml.im1t")) { // TOOD move this all to Utils.x
|
if (sampleMimeType == null) {
|
||||||
subtitleMime = MimeTypes.APPLICATION_TTML;
|
sampleMimeType = MimeTypes.TEXT_VTT;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
formatBuilder.setSampleMimeType(subtitleMime).setMetadata(metadata);
|
formatBuilder.setSampleMimeType(sampleMimeType).setMetadata(metadata);
|
||||||
subtitles.add(new Rendition(uri, formatBuilder.build(), groupId, name));
|
subtitles.add(new Rendition(uri, formatBuilder.build(), groupId, name));
|
||||||
break;
|
break;
|
||||||
case TYPE_CLOSED_CAPTIONS:
|
case TYPE_CLOSED_CAPTIONS:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user