Audio (1)-AudioFlinger loading audio module Process

Source: Internet
Author: User

Currently, the following device interfaces are supported in Android4.2 (defined in AudioFlinger. cpp ):

    *  audio_interfaces[] =    AUDIO_HARDWARE_MODULE_ID_PRIMARY,     AUDIO_HARDWARE_MODULE_ID_A2DP,     AUDIO_HARDWARE_MODULE_ID_USB,  };

Constants in the array are also defined in/hardware/libhardware/include/audio. h:

 AUDIO_HARDWARE_MODULE_ID_PRIMARY "primary" AUDIO_HARDWARE_MODULE_ID_A2DP "a2dp" AUDIO_HARDWARE_MODULE_ID_USB "usb"

During initialization, AudioFlinger does not take the initiative to load the audio module. It provides a loadHwModule (const char * name) interface to call AudioPolicyService. name is one of the supported devices. The following primary device is used as an example:

int hw_get_module_by_class(  *class_id,   *  hw_module_t **  hw_module_t *hmi =         (i= ; i<HAL_VARIANT_KEYS_COUNT+ ; i++ (i < (property_get(variant_keys[i], prop, NULL) == (path),  (access(path, R_OK) == ) (path),  (access(path, R_OK) == ) (path),  (access(path, R_OK) == ) = - (i < HAL_VARIANT_KEYS_COUNT+=

The inst parameter is "primary", and class_id is AUDIO_HARDWARE_MODULE_ID, which is defined in audio. h:

 AUDIO_HARDWARE_MODULE_ID "audio"

This method traverses the variant_keys array:

   *variant_keys[] =,      

In system property, extract the key values and splice the passed primary in order to check whether the *. so file exists.

For example, for our company's platform, the first two properties in the array are null, and ro. board. if platform is "mrvl", the so file name is audio. primary. mrvl. so.

Search in two different directories:

 HAL_LIBRARY_PATH1 "/system/lib/hw" HAL_LIBRARY_PATH2 "/vendor/lib/hw"

4. Call the load function to open this *. so.

Related Article

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.