Search in sources :

Example 21 with MediaCodec

use of android.media.MediaCodec in project android_frameworks_base by crdroidandroid.

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;
}
Also used : MediaCodec(android.media.MediaCodec)

Aggregations

MediaCodec (android.media.MediaCodec)21 IOException (java.io.IOException)10 MediaFormat (android.media.MediaFormat)7 Surface (android.view.Surface)5 TargetApi (android.annotation.TargetApi)2 MediaExtractor (android.media.MediaExtractor)2 MediaMuxer (android.media.MediaMuxer)2 SuppressLint (android.annotation.SuppressLint)1 Point (android.graphics.Point)1 BufferInfo (android.media.MediaCodec.BufferInfo)1 ParcelFileDescriptor (android.os.ParcelFileDescriptor)1 EglCore (com.android.grafika.gles.EglCore)1 WindowSurface (com.android.grafika.gles.WindowSurface)1 FileNotFoundException (java.io.FileNotFoundException)1 ByteBuffer (java.nio.ByteBuffer)1 CalledByNative (org.chromium.base.CalledByNative)1