Skip to content

Commit

Permalink
Add support for reading MPEG 4 SP in matroska streams.
Browse files Browse the repository at this point in the history
Issue: google#641
  • Loading branch information
ojw28 committed Jul 23, 2015
1 parent 03305c9 commit 9e0ca9e
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ public final class WebmExtractor implements Extractor {
private static final String DOC_TYPE_MATROSKA = "matroska";
private static final String CODEC_ID_VP8 = "V_VP8";
private static final String CODEC_ID_VP9 = "V_VP9";
private static final String CODEC_ID_MPEG4_SP = "V_MPEG4/ISO/SP";
private static final String CODEC_ID_MPEG4_ASP = "V_MPEG4/ISO/ASP";
private static final String CODEC_ID_MPEG4_AP = "V_MPEG4/ISO/AP";
private static final String CODEC_ID_H264 = "V_MPEG4/ISO/AVC";
private static final String CODEC_ID_H265 = "V_MPEGH/ISO/HEVC";
private static final String CODEC_ID_VORBIS = "A_VORBIS";
Expand Down Expand Up @@ -962,6 +965,9 @@ private long scaleTimecodeToUs(long unscaledTimecode) throws ParserException {
private static boolean isCodecSupported(String codecId) {
return CODEC_ID_VP8.equals(codecId)
|| CODEC_ID_VP9.equals(codecId)
|| CODEC_ID_MPEG4_SP.equals(codecId)
|| CODEC_ID_MPEG4_ASP.equals(codecId)
|| CODEC_ID_MPEG4_AP.equals(codecId)
|| CODEC_ID_H264.equals(codecId)
|| CODEC_ID_H265.equals(codecId)
|| CODEC_ID_OPUS.equals(codecId)
Expand Down Expand Up @@ -1067,6 +1073,13 @@ public MediaFormat getMediaFormat(long durationUs) throws ParserException {
case CODEC_ID_VP9:
mimeType = MimeTypes.VIDEO_VP9;
break;
case CODEC_ID_MPEG4_SP:
case CODEC_ID_MPEG4_ASP:
case CODEC_ID_MPEG4_AP:
mimeType = MimeTypes.VIDEO_MP4V;
initializationData =
codecPrivate == null ? null : Collections.singletonList(codecPrivate);
break;
case CODEC_ID_H264:
mimeType = MimeTypes.VIDEO_H264;
Pair<List<byte[]>, Integer> h264Data = parseAvcCodecPrivate(
Expand Down

0 comments on commit 9e0ca9e

Please sign in to comment.