Commit e7da2636 by aquilescanta Committed by Oliver Woodman

Add MediaParser-based implementation of ChunkExtractor

PiperOrigin-RevId: 315720712
parent 3ce57ae2
...@@ -529,6 +529,16 @@ public final class MimeTypes { ...@@ -529,6 +529,16 @@ public final class MimeTypes {
} }
} }
/** Returns whether the given {@code mimeType} is a WebM MIME type. */
public static boolean isWebm(@Nullable String mimeType) {
if (mimeType == null) {
return false;
}
return mimeType.startsWith(MimeTypes.VIDEO_WEBM)
|| mimeType.startsWith(MimeTypes.AUDIO_WEBM)
|| mimeType.startsWith(MimeTypes.APPLICATION_WEBM);
}
/** /**
* Returns the top-level type of {@code mimeType}, or null if {@code mimeType} is null or does not * Returns the top-level type of {@code mimeType}, or null if {@code mimeType} is null or does not
* contain a forward slash character ({@code '/'}). * contain a forward slash character ({@code '/'}).
......
...@@ -771,11 +771,6 @@ public class DefaultDashChunkSource implements DashChunkSource { ...@@ -771,11 +771,6 @@ public class DefaultDashChunkSource implements DashChunkSource {
return getFirstSegmentNum() + availableSegmentCount - 1; return getFirstSegmentNum() + availableSegmentCount - 1;
} }
private static boolean mimeTypeIsWebm(String mimeType) {
return mimeType.startsWith(MimeTypes.VIDEO_WEBM) || mimeType.startsWith(MimeTypes.AUDIO_WEBM)
|| mimeType.startsWith(MimeTypes.APPLICATION_WEBM);
}
@Nullable @Nullable
private static ChunkExtractor createChunkExtractor( private static ChunkExtractor createChunkExtractor(
int trackType, int trackType,
...@@ -784,6 +779,7 @@ public class DefaultDashChunkSource implements DashChunkSource { ...@@ -784,6 +779,7 @@ public class DefaultDashChunkSource implements DashChunkSource {
List<Format> closedCaptionFormats, List<Format> closedCaptionFormats,
@Nullable TrackOutput playerEmsgTrackOutput) { @Nullable TrackOutput playerEmsgTrackOutput) {
String containerMimeType = representation.format.containerMimeType; String containerMimeType = representation.format.containerMimeType;
Extractor extractor; Extractor extractor;
if (MimeTypes.isText(containerMimeType)) { if (MimeTypes.isText(containerMimeType)) {
if (MimeTypes.APPLICATION_RAWCC.equals(containerMimeType)) { if (MimeTypes.APPLICATION_RAWCC.equals(containerMimeType)) {
...@@ -793,7 +789,7 @@ public class DefaultDashChunkSource implements DashChunkSource { ...@@ -793,7 +789,7 @@ public class DefaultDashChunkSource implements DashChunkSource {
// All other text types are raw formats that do not need an extractor. // All other text types are raw formats that do not need an extractor.
return null; return null;
} }
} else if (mimeTypeIsWebm(containerMimeType)) { } else if (MimeTypes.isWebm(containerMimeType)) {
extractor = new MatroskaExtractor(MatroskaExtractor.FLAG_DISABLE_SEEK_FOR_CUES); extractor = new MatroskaExtractor(MatroskaExtractor.FLAG_DISABLE_SEEK_FOR_CUES);
} else { } else {
int flags = 0; int flags = 0;
......
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