use of android.media.MediaCodec in project android_frameworks_base by DirtyUnicorns.
the class GpuVideoTrackDecoder method initMediaCodec.
@Override
protected MediaCodec initMediaCodec(MediaFormat format) {
MediaCodec mediaCodec;
try {
mediaCodec = MediaCodec.createDecoderByType(format.getString(MediaFormat.KEY_MIME));
} catch (IOException e) {
throw new RuntimeException("failed to create decoder for " + format.getString(MediaFormat.KEY_MIME), e);
}
Surface surface = new Surface(mSurfaceTexture);
mediaCodec.configure(format, surface, null, 0);
surface.release();
return mediaCodec;
}
use of android.media.MediaCodec in project android_frameworks_base by DirtyUnicorns.
the class AudioTrackDecoder method initMediaCodec.
@Override
protected MediaCodec initMediaCodec(MediaFormat format) {
MediaCodec mediaCodec;
try {
mediaCodec = MediaCodec.createDecoderByType(format.getString(MediaFormat.KEY_MIME));
} catch (IOException e) {
throw new RuntimeException("failed to create decoder for " + format.getString(MediaFormat.KEY_MIME), e);
}
mediaCodec.configure(format, null, null, 0);
return mediaCodec;
}
use of android.media.MediaCodec in project speechutils by Kaljurand.
the class AudioUtils method createCodec.
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static MediaCodec createCodec(String componentName, MediaFormat format) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
try {
MediaCodec codec = MediaCodec.createByCodecName(componentName);
codec.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
return codec;
} catch (IllegalStateException e) {
Log.e("codec '" + componentName + "' failed configuration.");
} catch (IOException e) {
Log.e("codec '" + componentName + "' failed configuration.");
}
}
return null;
}
use of android.media.MediaCodec in project android_frameworks_base by ResurrectionRemix.
the class CpuVideoTrackDecoder method initMediaCodec.
@Override
protected MediaCodec initMediaCodec(MediaFormat format) {
// Find a codec for our video that can output to one of our supported color-spaces
MediaCodec mediaCodec = findDecoderCodec(format, new int[] { CodecCapabilities.COLOR_Format32bitARGB8888, CodecCapabilities.COLOR_FormatYUV420Planar });
if (mediaCodec == null) {
throw new RuntimeException("Could not find a suitable decoder for format: " + format + "!");
}
mediaCodec.configure(format, null, null, 0);
return mediaCodec;
}
use of android.media.MediaCodec in project android_frameworks_base by crdroidandroid.
the class GpuVideoTrackDecoder method initMediaCodec.
@Override
protected MediaCodec initMediaCodec(MediaFormat format) {
MediaCodec mediaCodec;
try {
mediaCodec = MediaCodec.createDecoderByType(format.getString(MediaFormat.KEY_MIME));
} catch (IOException e) {
throw new RuntimeException("failed to create decoder for " + format.getString(MediaFormat.KEY_MIME), e);
}
Surface surface = new Surface(mSurfaceTexture);
mediaCodec.configure(format, surface, null, 0);
surface.release();
return mediaCodec;
}
Aggregations