本文整理汇总了Java中net.ypresto.androidtranscoder.format.MediaFormatExtraConstants类的典型用法代码示例。如果您正苦于以下问题:Java MediaFormatExtraConstants类的具体用法?Java MediaFormatExtraConstants怎么用?Java MediaFormatExtraConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MediaFormatExtraConstants类属于net.ypresto.androidtranscoder.format包,在下文中一共展示了MediaFormatExtraConstants类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSpsBuffer
import net.ypresto.androidtranscoder.format.MediaFormatExtraConstants; //导入依赖的package包/类
/**
* @return ByteBuffer contains SPS without NAL header.
*/
public static ByteBuffer getSpsBuffer(MediaFormat format) {
ByteBuffer sourceBuffer = format.getByteBuffer(MediaFormatExtraConstants.KEY_AVC_SPS).asReadOnlyBuffer(); // might be direct buffer
ByteBuffer prefixedSpsBuffer = ByteBuffer.allocate(sourceBuffer.limit()).order(sourceBuffer.order());
prefixedSpsBuffer.put(sourceBuffer);
prefixedSpsBuffer.flip();
skipStartCode(prefixedSpsBuffer);
byte spsNalData = prefixedSpsBuffer.get();
if (spsNalData != AVC_SPS_NAL && spsNalData != AVC_SPS_NAL_2 && spsNalData != AVC_SPS_NAL_3) {
throw new IllegalStateException("Got non SPS NAL data.");
}
return prefixedSpsBuffer.slice();
}
示例2: validateVideoOutputFormat
import net.ypresto.androidtranscoder.format.MediaFormatExtraConstants; //导入依赖的package包/类
public static void validateVideoOutputFormat(MediaFormat format) {
String mime = format.getString(MediaFormat.KEY_MIME);
// Refer: http://developer.android.com/guide/appendix/media-formats.html#core
// Refer: http://en.wikipedia.org/wiki/MPEG-4_Part_14#Data_streams
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);
}
}
示例3: validateAudioOutputFormat
import net.ypresto.androidtranscoder.format.MediaFormatExtraConstants; //导入依赖的package包/类
public static void validateAudioOutputFormat(MediaFormat format) {
String mime = format.getString(MediaFormat.KEY_MIME);
if (!MediaFormatExtraConstants.MIMETYPE_AUDIO_AAC.equals(mime)) {
throw new InvalidOutputFormatException("Audio codecs other than AAC is not supported, actual mime type: " + mime);
}
}