6

I am thinking about using hardware encoding on my Nexus Tablet, since I need to use some video algorithm, I want to make it C.

There is a native-media sample in Google NDK which support native use of OMX to do the decode job. But it seems that it doesn't support encode yet. Now we have the MediaCodec API, which can provide the hardware encode. I check the java file, it seems that most of it function is written in C. So I am wondering if this is possible:

1)find the corresponding C files
2)compile these C file into .so file
3)write a .cpp file according to the MediaCodec.java file, this .cpp file will call the functions in the .so file and perform the similar function as MediaCodec.java.

Then I can do the encode in C.

Is that right? And is that possible? If that possible, do i need to modify the system on my tablet?

Thank you!

GrIsHu
  • 29,068
  • 10
  • 64
  • 102
Brendon Tsai
  • 1,267
  • 1
  • 17
  • 31
  • 2
    `MediaCodec` is written in C++, with a very thin Java wrapper around it. I don't believe the C++ `MediaCodec` is exposed in the NDK though. You could certainly write a thin C++ wrapper to go around it. It might make more sense to do all of the higher-level stuff in Java and just write native functions for the parts that need to be fast (e.g. anything that touches every pixel in the image). – fadden Mar 03 '14 at 15:43
  • @fadden Thank you! So to use that native function, I need to compile the corresponding source code files into .so file, right? (Since it is not exposed in NDK) – Brendon Tsai Mar 04 '14 at 01:41

0 Answers0