Skip to content

Commit

Permalink
Merge pull request #73 from shts/master
Browse files Browse the repository at this point in the history
Make high-profile available
  • Loading branch information
ypresto committed Aug 19, 2019
2 parents 012c3ab + df7ee27 commit c0ee729
Showing 1 changed file with 0 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +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;

public static void validateVideoOutputFormat(MediaFormat format) {
String mime = format.getString(MediaFormat.KEY_MIME);
Expand All @@ -34,11 +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);
if (profileIdc != PROFILE_IDC_BASELINE) {
throw new InvalidOutputFormatException("Non-baseline AVC video profile is not supported by Android OS, actual profile_idc: " + profileIdc);
}
}

public static void validateAudioOutputFormat(MediaFormat format) {
Expand Down

0 comments on commit c0ee729

Please sign in to comment.