From 6261e729be8cfd164b87d60df49e97f51cec96f8 Mon Sep 17 00:00:00 2001 From: shts Date: Wed, 13 Feb 2019 13:13:49 +0900 Subject: [PATCH 1/2] Make available high profile --- .../androidtranscoder/engine/MediaFormatValidator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/main/java/net/ypresto/androidtranscoder/engine/MediaFormatValidator.java b/lib/src/main/java/net/ypresto/androidtranscoder/engine/MediaFormatValidator.java index 67ea5ba8..73136bc4 100644 --- a/lib/src/main/java/net/ypresto/androidtranscoder/engine/MediaFormatValidator.java +++ b/lib/src/main/java/net/ypresto/androidtranscoder/engine/MediaFormatValidator.java @@ -26,6 +26,7 @@ class MediaFormatValidator { // Refer: http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Profiles private static final byte PROFILE_IDC_BASELINE = 66; + private static final byte PROFILE_IDC_HI = 100; public static void validateVideoOutputFormat(MediaFormat format) { String mime = format.getString(MediaFormat.KEY_MIME); @@ -36,7 +37,8 @@ public static void validateVideoOutputFormat(MediaFormat format) { } ByteBuffer spsBuffer = AvcCsdUtils.getSpsBuffer(format); byte profileIdc = AvcSpsUtils.getProfileIdc(spsBuffer); - if (profileIdc != PROFILE_IDC_BASELINE) { + boolean availableProfile = (profileIdc == PROFILE_IDC_BASELINE || profileIdc == PROFILE_IDC_HI); + if (!availableProfile) { throw new InvalidOutputFormatException("Non-baseline AVC video profile is not supported by Android OS, actual profile_idc: " + profileIdc); } } From df7ee275c652f18876babb8951541ec15a6037c9 Mon Sep 17 00:00:00 2001 From: shts Date: Tue, 7 May 2019 11:15:05 +0900 Subject: [PATCH 2/2] Remove profile validation --- .../engine/MediaFormatValidator.java | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/lib/src/main/java/net/ypresto/androidtranscoder/engine/MediaFormatValidator.java b/lib/src/main/java/net/ypresto/androidtranscoder/engine/MediaFormatValidator.java index 73136bc4..6182ee60 100644 --- a/lib/src/main/java/net/ypresto/androidtranscoder/engine/MediaFormatValidator.java +++ b/lib/src/main/java/net/ypresto/androidtranscoder/engine/MediaFormatValidator.java @@ -18,15 +18,8 @@ import android.media.MediaFormat; import net.ypresto.androidtranscoder.format.MediaFormatExtraConstants; -import net.ypresto.androidtranscoder.utils.AvcCsdUtils; -import net.ypresto.androidtranscoder.utils.AvcSpsUtils; - -import java.nio.ByteBuffer; class MediaFormatValidator { - // Refer: http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Profiles - private static final byte PROFILE_IDC_BASELINE = 66; - private static final byte PROFILE_IDC_HI = 100; public static void validateVideoOutputFormat(MediaFormat format) { String mime = format.getString(MediaFormat.KEY_MIME); @@ -35,12 +28,6 @@ public static void validateVideoOutputFormat(MediaFormat format) { if (!MediaFormatExtraConstants.MIMETYPE_VIDEO_AVC.equals(mime)) { throw new InvalidOutputFormatException("Video codecs other than AVC is not supported, actual mime type: " + mime); } - ByteBuffer spsBuffer = AvcCsdUtils.getSpsBuffer(format); - byte profileIdc = AvcSpsUtils.getProfileIdc(spsBuffer); - boolean availableProfile = (profileIdc == PROFILE_IDC_BASELINE || profileIdc == PROFILE_IDC_HI); - if (!availableProfile) { - throw new InvalidOutputFormatException("Non-baseline AVC video profile is not supported by Android OS, actual profile_idc: " + profileIdc); - } } public static void validateAudioOutputFormat(MediaFormat format) {