The priority of soft decoding and hard decoding in Android

Source: Internet
Author: User
Tags naming convention


Let's take a look at the name of the decoder in the Android system, and the soft decoder usually starts with omx.google. A hard decoder is usually a OMX. [Hardware_vendor], such as TI's decoder is the beginning of omx.ti. Of course, there are some non-compliance with this naming convention, not to OMX, it will also be considered a soft decoder.

Judging rules See Frameworks/av/media/libstagefright/omxcodec.cpp:

    1. static bool Issoftwarecodec (const char *componentname)  {
    2.     if  (!strncmp ("Omx.google.",  componentname, 11))  {
    3.         return true;
    4.     }
    5.     if  (!strncmp ("OMX.",  componentname, 4))  {
    6.         return false;
    7.     }
    8.     return true;
    9. }


In fact, there are many decoders in the system, but the decoder that can be used by the application is based on the configuration, namely/system/etc/media_codecc.xml. This file is typically provided by hardware or system manufacturers during the build of the entire system, usually in the Device/[company]/[codename] directory of the code, such as Device/samsung/tuna/media_ Codecs.xml. This file configures what codec are available in the system and which of these codec corresponds to the media file type. In this file, the soft and hard codec provided in the system need to be listed.

That is, if the system actually contains a codec, but is not configured in this file, then the application can not be used!

In this configuration file, these codec will be preserved if multiple codec correspond to the same type of media format. When the system is used, the first matching codec will be selected. Unless it is clear whether to soft decode or hard decode, but the Android framework layer for the upper service of the Awesomeplayer in the processing of audio and video, the choice is whether to choose soft or hard solution parameters are not set. So while the bottom layer is supported for selection, the default codec selection rules are only accepted for Java programs that use MediaPlayer on the upper level.


But Android provides command-line program/system/bin/stagefright when playing audio files, it is possible to choose whether to use soft decoding or hard decoding according to the parameters, but the tool only supports playing audio, does not support playing video.

In general, if the system has a corresponding media hardware decoder, the system developers should be configured in Media_codecs.xml, so in most cases, if there is a hardware decoder, then we always use the hardware decoder. In rare cases, the hardware decoder is present, but not configured, and I guess it is only possible that the hard decoder has bugs and is not yet suitable for publishing.

The priority of soft decoding and hard decoding in Android

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.