[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-03-05 UTC。"],[],[],null,["# Media modules\n\nAndroid 10 or higher includes several updatable media\ncomponents that enable updating framework components through Google Play Store\ninfrastructure or through a partner-provided over-the-air (OTA) mechanism. Media\ncomponents are packaged together in modules that allows providing security\nupdates and feature updates without requiring a full system image update.\n\nUpdatable media components exist in the following modules.\n\n- **Media.** This module includes [media extractors](#media-extractors),\n [`MediaSession2` APIs](#media-session-api), and [`MediaParser`\n APIs](#media-parser-api).\n\n- **[Media Codecs](#media-codecs).** This module includes updatable software\n Codec2 components.\n\n- **[MediaProvider](/docs/core/media/media-provider).** This module\n optimizes indexed metadata (audio, video, and images from SD cards and USB\n devices) and makes that data available to apps through the [MediaStore public\n APIs](https://developer.android.com/reference/android/provider/MediaStore).\n\nFor details on adding custom extractors and decoders, see [Customizing Media\nComponents](/docs/core/media/updatable-media).\n\nMedia extractors\n----------------\n\nIn Android 9 and lower, extracters are compiled into a single\n`libstagefright.so` file. In Android 10 or higher,\nmedia extractors are separate components. Each extractor has its own `.so` file\nwith an entry point that provides a *sniffer* function to determine whether the\nextractor can handle the given media file, and a *factory* function that creates\nan instance of the extractor for the given media file. Each extractor is named\n(to help in debugging) and versioned to indicate which extractor is the newest.\n\nThe media framework automatically loads all available extractor `.so` files, so\nyou can create your own extractors by adding a new `.so` file without needing to\nmodify `libstagefright` or other media framework libraries. You can also ensure\nthat a custom extractor is preferred over the Google-provided extractor.\n\nMediaSession2 API\n-----------------\n\nThe MediaSession2 API allows media apps to expose their transport controls and\nplayback information to other processes such as the Android framework and other\napps. This component can't be customized.\n\nMediaParser API\n---------------\n\nThe MediaParser API allows ExoPlayer to make efficient use of framework media\ncontainer parsers to extract media samples from media containers. MediaParser\nincludes the following changes to source code boundaries:\n\n- `frameworks/base/apex/media/framework/java/android/media/MediaParser.java`.\n API and thin layer implementation.\n\n- `external/exoplayer/`. Exoplayer verbatim sources on which MediaParser is\n built.\n\nThe MediaParser API can't be customized. To test MediaParser, use the tests in\n`cts/tests/tests/mediaparser/`.\n\nMedia codecs\n------------\n\nThe Media Codecs module includes updatable software Codec2 components. Support\nfor customization differs between releases:\n\n- In Android 11 or higher (specifically [Google Play System Update\n v292100200](https://support.google.com/android/answer/7680439)),\n you can customize the parameters for ION memory allocation (see below for\n details).\n\n- In Android 9 or lower, the OMX codec API isn't updatable, but you can still\n use it in the vendor partition.\n\n### ION memory allocation\n\nIn Android 11 or higher and [Google Play System Update\nv292100200](https://support.google.com/android/answer/7680439) or\nhigher, you can customize the following parameters for ION memory allocation.\n\n| Parameter | Default value | Description |\n|----------------|---------------|-------------------------|\n| `heapMask` | `0xFFFFFFFF` | All heap types allowed. |\n| `allocFlags` | `0` | No flags set. |\n| `minAlignment` | `0` | No alignment. |\n\nTo override the parameters:\n\n1. Register a default `android.hardware.media.c2` service and provide custom ION\n usage parameters.\n\n - To create a new service, copy the\n [frameworks/av/media/codec2/hidl/services/vendor.cpp](https://android.googlesource.com/platform/frameworks/av/+/refs/heads/android16-release/media/codec2/hidl/services/vendor.cpp)\n file to your repository then modify `StoreImpl::Interface::SetIonUsage()`\n as needed.\n\n - To reuse the (OMX) `media.codec` process, copy and register the `StoreImpl`\n class from\n [frameworks/av/media/codec2/hidl/services/vendor.cpp](https://android.googlesource.com/platform/frameworks/av/+/refs/heads/android16-release/media/codec2/hidl/services/vendor.cpp)\n to the existing `mediacodec` file\n ([frameworks/av/services/mediacodec/main_codecservice.cpp](https://android.googlesource.com/platform/frameworks/av/+/refs/heads/android16-release/services/mediacodec/main_codecservice.cpp)).\n\n | **Note:** If the device already has default `android.hardware.media.c2` service for vendor codecs, that service is automatically used (you don't need to register a new one).\n2. Add the following code to the device `manifest.xml`.\n\n \u003chal format=\"hidl\"\u003e\n \u003cname\u003eandroid.hardware.media.c2\u003c/name\u003e\n \u003ctransport\u003ehwbinder\u003c/transport\u003e\n \u003cversion\u003e1.0\u003c/version\u003e\n \u003cinterface\u003e\n \u003cname\u003eIComponentStore\u003c/name\u003e\n \u003cinstance\u003edefault\u003c/instance\u003e\n \u003c/interface\u003e\n \u003c/hal\u003e\n\nFormat and dependences\n----------------------\n\nThe Media module (`com.android.media`) and Media Codec module\n(`com.android.media.swcodec`) are in [APEX](/docs/core/ota/apex)\nformat. Included media components rely only on NDK APIs.\n\nUpdates\n-------\n\nDuring an update, the framework components on the device load an APEX package\nthat contains Java and native code.\n\n**Figure 1.** The media component update flow\n\nAfter the framework installs the APEX package, the device reboots and mounts the\ndisk image and media system processes (`media.extractor` and `media.codec`) load\nthe updated modules from the mount point."]]