I am developing a H.264 decoder using MediaCodec API. I am trying to call MediaCodec java API in JNI layer inside a function like:
void Decompress(const unsigned char *encodedInputdata, unsigned int inputLength, unsigned char **outputDecodedData, int &width, int &height) {
// encodedInputdata is encoded H.264 remote stream
// .....
// outputDecodedData = call JNI function of MediaCodec Java API to decode
// .....
}
Later I will send the outputDecodedData
to my existing video rendering pipeline and render on Surface
.
I hope I will be able to write a Java function to decode the input stream, but these would be challenge -
- This resource states that -
...you can't do anything with the decoded video frame but render them to surface
Here a Surface
has been passed decoder.configure(format, surface, null, 0)
to render the output ByteBuffer
on the surface and claimed We can't use this buffer but render it due to the API limit
.
So, will I able to send the output ByteBuffer
to native layer to cast as unsigned char*
and pass to my rendering pipeline instead of passing a Surface
ot configure()
?