Android adds or removes support for certain media file formats
1. Add some formats
Taking the rmvb format as an example, a video file in rmvb format is copied to the SD card of the mobile phone due to the lisence problem. This file cannot be displayed as a video file; if your company has a pre-installed third-party apk to support video playing in this format, you can follow the method below to add support for rmvb format.
In frameworks \ base \ media \ java \ android \ media \ MediaFile. java: about 270 lines, add the mimeType in RMVB format:
AddFileType ("AVI", FILE_TYPE_AVI, "video/avi ");
AddFileType ("MOV", FILE_TYPE_QUICKTIME_VIDEO, "video/quicktime ");
AddFileType ("QT", FILE_TYPE_QUICKTIME_VIDEO, "video/quicktime ");
AddFileType ("RMVB", FILE_TYPE_RMVB, "video/x-pn-realvideo"); // Add RMVB
Then compile the framework/base module, the generated framework. jar and secondary-framework.jar to push to the phone, and then restart the phone:
Adb push framework. jar system/framework
Adb push secondary-framework.jar system/framework
Adb reboot
Ii. Cancel a certain format
Take the WMA/WMV format as an example. If you want to cancel the support for this format, follow these steps:
Step 1: The mime type in this format was originally set to video \ audio and changed to unknown.
Modify frameworks \ base \ media \ java \ android \ media \ MediaFile. java
// AddFileType ("WMV", FILE_TYPE_WMV, "video/x-ms-wmv", MtpConstants. FORMAT_WMV );
// AddFileType ("ASF", FILE_TYPE_ASF, "video/x-ms-asf ");
// AddFileType ("WMA", FILE_TYPE_WMA, "audio/x-ms-wma", MtpConstants. FORMAT_WMA );
If you want to completely remove the corresponding video codec, continue step 2 and step 3.
Step 2: Check whether the following files contain macros MTK_ASF_PLAYBACK_SUPPORT (JB2, JB3, JB5), MTK_WMV_PLAYBACK_SUPPORT, and MTK_WMA_PLAYBACK_SUPPORT (JB9, kk)
Alps \ mediatek \ config \ Project Name \ ProjectConfig. mk
Alps \ mediatek \ config \ Platform Name \ ProjectConfig. mk
Alps \ mediatek \ config \ commone \ ProjectConfig. mk
If yes,
Set MTK_ASF_PLAYBACK_SUPPORT to no;
Set MTK_WMV_PLAYBACK_SUPPORT to no;
Set MTK_WMA_PLAYBACK_SUPPORT to no;
Step 3 modify the media_codecs.xml File
Mediatek \ config \ common \ media_codecs.xml
Mediatek \ config \ Platform Name \ media_codec.xml
Remove: