Android adds or removes support for certain media file formats

Source: Internet
Author: User

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:

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.