This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

To enable hardware codecs

Hi,

I need to play video in android ICS using hardware codecs. How can I enable that in android.

Also how can I come to know my CPU is using hardware codecs while running videos in android. Please suggest me any solutions.

Thanks in advance,

Regards,

Salih

  • If you are working with a release from
    http://omapedia.org/wiki/Release_Notes
    You can check code in 4AI1.x in next file
    /4AI.1.6/mydroid/frameworks/base/media/libstagefright/OMXCodec.cpp
    You can find next 2 arrays,
    static const CodecInfo kDecoderInfo[]
    static const CodecInfo kEncoderInfo[]
    they contains actual codecs, when one of them fails Android Stagefright uses the next one in the list.
    About knowing if it is HW or SW codec?
    In this same file has a variable named IsSoftwareCodec,that is by 2 functions, one of them is OMXCodec::findMatchingCodecs that is used by OMXCodec::Create and it has flags that marks if you use SW or HW codecs.
    These functions are used by AwesomePlayer.cpp when creating the video, they can be used by Audio codecs too, in the case of video AwesomePlayer::initVideoDecoder(uint32_t flags) is called as argument and then used in  mVideoSource = OMXCodec::Create.
    By default it selects both keeping the order of the list, you can read comments in those functions to get more information.
    The other function where it is used in OMX_Codecs.cpp is in QueryCodecs but in this case it uses a conditional over bool hwCodecOnly setting flags value to HW or zero.