Implementation of media library in Android

Source: Internet
Author: User
Go to media library implementation in Android
Author: Jl
In {
Tagshow (Event)
} "> In Android, the media library is contentprovider {
Tagshow (Event)
} "> The implementation, the so-called media library, is not a resource manager, but a multimedia {
Tagshow (Event)
} "> File Management: multimedia files contain a lot of information, such as authors, years, albums, and covers. In Android, the provider is implemented in

Frameworks/base/CORE /{
Tagshow (Event)
} "> JAVA/Android/provider/mediastore. Java
Packages/providers/mediaprovider/src/COM/Android/providers/media.
Frameworks/base/Media/Java/Android/Media/mediascanner *
Frameworks/base/Media/JNI/android_media _*

The identification of specific media files is as follows:

External/opencore/Android/mediascanner. cpp

In addition, to help you manually control when to scan media files and obtain scanned messages, there are two additional items:

Mediascannerpolicer, and mediascannerservice. The relationships between them are as follows:

When there is an action_boot_completed, action_media_mounted or action_media_scanner_scan_file intent request, our service will start. However, it takes a long time to scan files. Therefore, this is an asynchronous process. There is a scanner, and there are two scanning points: External Storage {
Tagshow (Event)
} "> Device and/root/media.

/* Audio */

Addfiletype ("MP3", file_type_mp3, "audio/MPEG ");

Addfiletype ("m4a", file_type_m4a, "audio/MP4 ");

Addfiletype ("WAV", file_type_wav, "audio/X-WAV ");

Addfiletype ("Amr", file_type_amr, "audio/AMR ");

Addfiletype ("AWB", file_type_awb, "audio/AMR-WB ");

Addfiletype ("WMA", file_type_wma, "audio/X-MS-WMA ");

Addfiletype ("Ogg", file_type_ogg, "application/Ogg ");

Addfiletype ("mid", file_type_mid, "audio/Midi ");

Addfiletype ("xmf", file_type_mid, "audio/Midi ");

Addfiletype ("rtttl", file_type_mid, "audio/Midi ");

Addfiletype ("SMF", file_type_smf, "audio/SP-Midi ");

Addfiletype ("IMy", file_type_imy, "audio/imelody ");

/* Video */

Addfiletype ("MP4", file_type_mp4, "Video/MP4 ");

Addfiletype ("m4v", file_type_m4v, "Video/MP4 ");

Addfiletype ("3GP", file_type_3gpp, "Video/3GPP ");

Addfiletype ("3GPP", file_type_3gpp, "Video/3GPP ");

Addfiletype ("3g2", file_type_3gpp2, "Video/3gpp2 ");

Addfiletype ("3gpp2", file_type_3gpp2, "Video/3gpp2 ");

Addfiletype ("WMV", file_type_wmv, "Video/X-MS-WMV ");

/* Image */

Addfiletype ("jpg", file_type_jpeg, "image/JPEG ");

Addfiletype ("Jpeg", file_type_jpeg, "image/JPEG ");

Addfiletype ("GIF", file_type_gif, "image/GIF ");

Addfiletype ("PNG", file_type_png, "image/PNG ");

Addfiletype ("BMP", file_type_bmp, "image/X-MS-BMP ");

Addfiletype ("wbmp", file_type_wbmp, "image/vnd. WAP. wbmp ");

/* Audio play list */

Addfiletype ("M3U", file_type_m3u, "audio/X-mpegurl ");

Addfiletype ("pls", file_type_pls, "audio/X-scpls ");

Addfiletype ("WPL", file_type_wpl, "application/vnd. MS-WPL ");

For details about how to parse the code, see mediascanner. cpp.

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.