media codec sample implementation in android 4.1

arpwal picture arpwal · Aug 24, 2012 · Viewed 7.2k times · Source

I am trying to display video buffers on an android. I am using the media codec API released in Android 4.1 Jelly Bean.

The sample goes like this:

 MediaCodec codec = MediaCodec.createDecoderByType(type);
 codec.configure(format, ...);

configure method accepts 3 other arguments, apart from MediaFormat. I have been able to figure out MediaFormat somehow but I am not sure about the other 3 parameters. (below).

 MediaSurface, MediaCrypto and Flags. 

Any leads?

Also, what should I do with the MediaCrypto argument, if I am not encrypting my video buffers.

Requirements:

1) Decode the buffers on the android device, 
2) Display them on the screen. 

Answer

Kimi_Jin picture Kimi_Jin · Sep 15, 2012