mirror of
https://github.com/androidx/media.git
synced 2025-05-16 12:09:50 +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;
|
||||
case TYPE_SUBTITLES:
|
||||
String subtitleMime = MimeTypes.TEXT_VTT; // Assume VTT unless variant declares it
|
||||
sampleMimeType = MimeTypes.TEXT_VTT;
|
||||
variant = getVariantWithSubtitleGroup(variants, groupId);
|
||||
if (variant != null) {
|
||||
@Nullable
|
||||
String codecs[] = Util.splitCodecs(variant.format.codecs);
|
||||
for (String codec : codecs) {
|
||||
if (codec.equalsIgnoreCase("stpp.ttml.im1t")) { // TOOD move this all to Utils.x
|
||||
subtitleMime = MimeTypes.APPLICATION_TTML;
|
||||
}
|
||||
String codecs = Util.getCodecsOfType(variant.format.codecs, C.TRACK_TYPE_AUDIO);
|
||||
sampleMimeType = MimeTypes.getMediaMimeType(codecs);
|
||||
if (sampleMimeType == null) {
|
||||
sampleMimeType = MimeTypes.TEXT_VTT;
|
||||
}
|
||||
}
|
||||
|
||||
formatBuilder.setSampleMimeType(subtitleMime).setMetadata(metadata);
|
||||
formatBuilder.setSampleMimeType(sampleMimeType).setMetadata(metadata);
|
||||
subtitles.add(new Rendition(uri, formatBuilder.build(), groupId, name));
|
||||
break;
|
||||
case TYPE_CLOSED_CAPTIONS:
|
||||
|
Loading…
x
Reference in New Issue
Block a user