Requirement: Add. mov suffix format video files in the Mediaprovider database
You can use the tool Mediainfo_gui_0.7.67_windows.3243836749.exe to view the Mov file encoding format type, which can be downloaded to http://download.csdn.net/detail/deng0zhaotai/8767089.
Full Name: D:\ Good song learners together. mov file format: MPEG-4 format Introduction : QuickTime encoding settings id:qt file size : 83.8 MIB Length: 1 min 2 s average mixed bitrate: 11.3 Mbps encoded date : UTC 2015-04-23 06:07:05 Mark Date: UTC 2015-04-23 06:08:3 8 encoding Function library: Apple QUICKTIME㏕IM:00:00:00:00㏕SC : 25㏕sz:1 Video ID : 1 file format: AVC file Format/info: Advanced Video Codec format introduction : [email protected] Formatting, CABAC: No format settings, reframes : 2 FRames format settings, gop:m=1, n=50 encoding settings ID:AVC1 encoding settings ID/information : Advanced Video Coding Length: 1 min. 2 sec Bit Rate : 11.2 Mbps Screen width: 1 920 megapixel screen height: 1 080 Pixel screen ratio: 16:9 frame rate Mode: constant frame rate : 25.000 fps color space: YUV Chroma sampling: 4:2:0 bit depth : 8-bit scanning mode: Progressive scan bits/(pixel*frame) (data density) : 0.216 Size: 82.8 MiB (99%) title: Apple Video Media office Processor/Apple alias data processing program language: 中文版 Date: UTC 2015- 04-23 06:07:05 Mark Date : UTC 2015-04-23 06:08:38 color primaries: bt.709 transmission characteristics : bt.709 Matrix factor: bt.709 Audio ID : 2 file Format: AAC file Format/info: Advanced Audio Codec format introduction : LC Encoding Set ID:40 length : 1 minutes 2 seconds source_duration/string:1 Minute 2 second code rate mode: CBR bitrate : Rated bitrate:-Kbps channel : 2 channel Channel position: FRONT:L R sample rate: 48.0 khz compression mode : lossy compression Size: 909 KiB (1) source_streamsize/string : 909 KiB (1%) standardTitle: Apple Audio Media processing program/Apple alias Data processing program language: English encoding Day Period: UTC 2015-04-23 06:07:05 Mark Date: UTC 2015-04-23 0 6:08:38 other id:3type:time code file formats : QuickTime TC Length: 1 min 2 sec timecode_firstframe : 00:00:00:00timecode_settings:striped title: timecode Media Processing program/ Apple alias Data processing program language: English Date: UTC 2015-04-23 06:08:38 Mark Date: UTC 2015-04-23 06:08:38
You can see two useful information
File format: MPEG-4
Format Description: QuickTime
Files that need to be modified: Frameworks/base/media/java/android/media/mediafile.java, we can refer to the existing video format to add
Video file types public static final int file_type_flv =; public static final int file_type_mp4 =; public static final int file_type_m4v =; public static final int file_type_3gpp =; public static final int file_type_3gpp2 =; public static final int file_type_wmv =; public static final int file_type_asf =; public static final int file_type_mkv =; public static final int file_type_mp2ts =; public static final int File_type_avi =; public static final int FILE_TYPE_WEBM =; public static final int File_type_mov =; private static final int first_video_file_type = file_type_flv; private static final int last_video_file_type = FILE_TYPE_WEBM;
Add: public static final int file_type_mov = 52; This line
Addfiletype ("MPEG", File_type_mp4, "Video/mpeg", mtpconstants.format_mpeg); Addfiletype ("MPG", File_type_mp4, "Video/mpeg", mtpconstants.format_mpeg); Addfiletype ("MP4", File_type_mp4, "Video/mp4", mtpconstants.format_mpeg); Addfiletype ("MOV", File_type_mov, "Video/quicktime", mtpconstants.format_mpeg); Addfiletype ("M4V", file_type_m4v, "Video/mp4", mtpconstants.format_mpeg); Addfiletype ("3GP", FILE_TYPE_3GPP, "VIDEO/3GPP", Mtpconstants.format_3gp_container); Addfiletype ("3GPP", FILE_TYPE_3GPP, "VIDEO/3GPP", Mtpconstants.format_3gp_container); Addfiletype ("3g2", File_type_3gpp2, "video/3gpp2", Mtpconstants.format_3gp_container); Addfiletype ("3GPP2", File_type_3gpp2, "video/3gpp2", Mtpconstants.format_3gp_container); Addfiletype ("MKV", File_type_mkv, "Video/x-matroska"); Addfiletype ("WEBM", FILE_TYPE_WEBM, "VIDEO/WEBM"); Addfiletype ("TS", File_type_mp2ts, "video/mp2ts"); Addfiletype ("AVI", File_type_avi, "Video/avi"); Addfiletype ("FLV", file_type_flv, "video/flv");By
File format: MPEG-4
Format Description: QuickTime
Information, add a line: Addfiletype ("MOV", File_type_mov, "Video/quicktime", mtpconstants.format_mpeg);
You also need to modify a function:
public static Boolean isvideofiletype (int fileType) { return (fileType >= first_video_file_type && FileType <= last_video_file_type) | | (FileType >= first_video_file_type2 && fileType <= last_video_file_type2) | | (FileType = = File_type_mov); }
Add Condition: FileType = = File_type_mov
You can delete the database: rm-rf/data/data/com.android.providers.media/databases/
Then restart your phone and you'll find it in the video view. mov Videos
Of course the above code can be optimized,
public static final int file_type_webm = 30;public static final int file_type_mov = 31;private static final int first_vide O_file_type = file_type_flv;private static final int last_video_file_type = File_type_mov;
Then there's a need to modify it later.
Image file types public static final int file_type_jpeg = 31; public static final int file_type_gif = 32; public static final int file_type_png = 33; public static final int file_type_bmp = 34; public static final int file_type_wbmp = 35; public static final int file_type_webp = 36; private static final int first_image_file_type = File_type_jpeg; private static final int last_image_file_type = FILE_TYPE_WEBP; Playlist file types public static final int file_type_m3u = 41; public static final int file_type_pls = 42; public static final int file_type_wpl = 43; public static final int file_type_httplive = 44; public static final int file_type_dash = 45; private static final int first_playlist_file_type = file_type_m3u; private static final int last_playlist_file_type = File_type_dash; DRM file types public static final int file_type_fl = 51;
Modified file: http://download.csdn.net/detail/deng0zhaotai/8767221
Android add a new video format--Media Library scan