mirror of
https://github.com/androidx/media.git
synced 2025-05-06 23:20:42 +08:00
Generalize MimeTypes.isWebm to MimeTypes.isMatroska
It seems more natural given we always end up instantiating a Matroska extractor, not one that's specific to the WebM subset of Matroska. There's also no reason not to support Matroska MIME types in DASH. PiperOrigin-RevId: 316975451
This commit is contained in:
parent
92fd3bc2ff
commit
88883ffd67
@ -101,6 +101,7 @@ public final class MimeTypes {
|
||||
|
||||
public static final String APPLICATION_MP4 = BASE_TYPE_APPLICATION + "/mp4";
|
||||
public static final String APPLICATION_WEBM = BASE_TYPE_APPLICATION + "/webm";
|
||||
public static final String APPLICATION_MATROSKA = BASE_TYPE_APPLICATION + "/x-matroska";
|
||||
public static final String APPLICATION_MPD = BASE_TYPE_APPLICATION + "/dash+xml";
|
||||
public static final String APPLICATION_M3U8 = BASE_TYPE_APPLICATION + "/x-mpegURL";
|
||||
public static final String APPLICATION_SS = BASE_TYPE_APPLICATION + "/vnd.ms-sstr+xml";
|
||||
@ -539,14 +540,17 @@ public final class MimeTypes {
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns whether the given {@code mimeType} is a WebM MIME type. */
|
||||
public static boolean isWebm(@Nullable String mimeType) {
|
||||
/** Returns whether the given {@code mimeType} is a Matroska MIME type, including WebM. */
|
||||
public static boolean isMatroska(@Nullable String mimeType) {
|
||||
if (mimeType == null) {
|
||||
return false;
|
||||
}
|
||||
return mimeType.startsWith(MimeTypes.VIDEO_WEBM)
|
||||
|| mimeType.startsWith(MimeTypes.AUDIO_WEBM)
|
||||
|| mimeType.startsWith(MimeTypes.APPLICATION_WEBM);
|
||||
|| mimeType.startsWith(MimeTypes.APPLICATION_WEBM)
|
||||
|| mimeType.startsWith(MimeTypes.VIDEO_MATROSKA)
|
||||
|| mimeType.startsWith(MimeTypes.AUDIO_MATROSKA)
|
||||
|| mimeType.startsWith(MimeTypes.APPLICATION_MATROSKA);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -789,7 +789,7 @@ public class DefaultDashChunkSource implements DashChunkSource {
|
||||
// All other text types are raw formats that do not need an extractor.
|
||||
return null;
|
||||
}
|
||||
} else if (MimeTypes.isWebm(containerMimeType)) {
|
||||
} else if (MimeTypes.isMatroska(containerMimeType)) {
|
||||
extractor = new MatroskaExtractor(MatroskaExtractor.FLAG_DISABLE_SEEK_FOR_CUES);
|
||||
} else {
|
||||
int flags = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user