Original article link: http://blog.csdn.net/tx3344/article/details/8109185
1. What is openmax used in Android? With the basic framework and playback process of awesomeplayer in the previous article, we can clearly see that awesomeplayer in Android uses openmax for coding and decoding. In fact, in the openmax interface design, he can be used as codec. Its components can form a complete player, including sourc, Demux, decode, and output. But why does Android only use him for code? I think there are the following aspects:
1. the decoder must be the most important and resource-consuming part of the player. If you rely on the soft solution, you can directly use the CPU for computation, especially for HD videos. You can do nothing else. Therefore, decoder is the most necessary part of hardware acceleration. The current high-definition decoding chips are both the main chip + Dsp Structure, and the decoding work is done through the DSP, so it will not occupy the main chip too much. All the capabilities of DSP hardware codec in the chip are presented through the openmax standard interface, providing upper-layer players for use. I think this is the most important part of openmax.
2. Source mainly deals with protocols. Demux breaks down the container part. Most container formats do not need to be supported by hardware. Only the TS Stream format is most likely to be supported by hardware. Because the TS format is special, the size of a single package is too small, only 188 bytes. This is why the common decoding chip now provides support for the hardware ts Demux.
3. video/audio output is closely related to the operating system. Let's take a look at the famous open-source player VLC. VLC is available in MAC, Linux, and windows, with little difference in functionality. So he is cross-platform. Where is cross-platform? The main workload is the output module after audio and video decoding. Because the image rendering and audio output methods of different systems are different, VLC needs to implement different output for each platform. This part of content is obviously not suitable in openmax.
Therefore, Hardware Abstraction coding and decoding in openmax is the most commonly used, and is also why Android only uses it to abstract code. 2. openmax implementation framework in Android
1. As mentioned above, Android only uses openmax for code. Therefore, Android abstracts a layer of omxcodec for upper-layer players. The audio/video decoder mvideosource and maudiosource in the player are all omxcodec instances.
2. omxcodec uses the iomx dependency Binder Mechanism to obtain the OMX service. The OMX service is implemented by openmax in Android.
3. OMX manages Software Codec and hardware codec as plug-ins.