mirror of
https://github.com/samsonjs/media.git
synced 2026-04-06 11:25:46 +00:00
webm_extractor: Add VP8 to the list of codecs.
VP8 can be decoded by MediaCodec (since very early versions of android). Now that we want WebmExtractor to be general purpose, adding VP8 makes sense as it is a common use case.
This commit is contained in:
parent
5ea7424ee3
commit
6cb46e4549
2 changed files with 9 additions and 2 deletions
|
|
@ -55,6 +55,7 @@ public final class WebmExtractor implements Extractor {
|
|||
private static final int CUES_STATE_BUILT = 2;
|
||||
|
||||
private static final String DOC_TYPE_WEBM = "webm";
|
||||
private static final String CODEC_ID_VP8 = "V_VP8";
|
||||
private static final String CODEC_ID_VP9 = "V_VP9";
|
||||
private static final String CODEC_ID_VORBIS = "A_VORBIS";
|
||||
private static final String CODEC_ID_OPUS = "A_OPUS";
|
||||
|
|
@ -136,6 +137,7 @@ public final class WebmExtractor implements Extractor {
|
|||
private int seekEntryId;
|
||||
private long seekEntryPosition;
|
||||
|
||||
// Cue related elements.
|
||||
private boolean seekForCues;
|
||||
private long cuesContentPosition = UNKNOWN;
|
||||
private long seekPositionAfterBuildingCues = UNKNOWN;
|
||||
|
|
@ -640,7 +642,10 @@ public final class WebmExtractor implements Extractor {
|
|||
* @throws ParserException If the codec is unsupported.
|
||||
*/
|
||||
private MediaFormat buildVideoFormat() throws ParserException {
|
||||
if (videoTrackFormat != null && CODEC_ID_VP9.equals(videoTrackFormat.codecId)) {
|
||||
if (videoTrackFormat != null && CODEC_ID_VP8.equals(videoTrackFormat.codecId)) {
|
||||
return MediaFormat.createVideoFormat(MimeTypes.VIDEO_VP8, MediaFormat.NO_VALUE, durationUs,
|
||||
videoTrackFormat.pixelWidth, videoTrackFormat.pixelHeight, null);
|
||||
} else if (videoTrackFormat != null && CODEC_ID_VP9.equals(videoTrackFormat.codecId)) {
|
||||
return MediaFormat.createVideoFormat(MimeTypes.VIDEO_VP9, MediaFormat.NO_VALUE, durationUs,
|
||||
videoTrackFormat.pixelWidth, videoTrackFormat.pixelHeight, null);
|
||||
} else {
|
||||
|
|
@ -793,7 +798,8 @@ public final class WebmExtractor implements Extractor {
|
|||
}
|
||||
|
||||
private boolean isCodecSupported(String codecId) {
|
||||
return CODEC_ID_VP9.equals(codecId)
|
||||
return CODEC_ID_VP8.equals(codecId)
|
||||
|| CODEC_ID_VP9.equals(codecId)
|
||||
|| CODEC_ID_OPUS.equals(codecId)
|
||||
|| CODEC_ID_VORBIS.equals(codecId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public class MimeTypes {
|
|||
public static final String VIDEO_MP4 = BASE_TYPE_VIDEO + "/mp4";
|
||||
public static final String VIDEO_WEBM = BASE_TYPE_VIDEO + "/webm";
|
||||
public static final String VIDEO_H264 = BASE_TYPE_VIDEO + "/avc";
|
||||
public static final String VIDEO_VP8 = BASE_TYPE_VIDEO + "/x-vnd.on2.vp8";
|
||||
public static final String VIDEO_VP9 = BASE_TYPE_VIDEO + "/x-vnd.on2.vp9";
|
||||
public static final String VIDEO_MP4V = BASE_TYPE_VIDEO + "/mp4v-es";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue