Tizen Native API
|
Functions | |
int | media_content_connect (void) |
Connects to the media content service. | |
int | media_content_disconnect (void) |
Disconnects from the media content service. | |
int | media_content_scan_file (const char *path) |
Requests to scan a media file. | |
int | media_content_scan_folder (const char *path, bool is_recursive, media_scan_completed_cb callback, void *user_data) |
Requests to scan a media folder, asynchronously. | |
int | media_content_cancel_scan_folder (const char *path) |
Requests to cancel the media folder scanning. | |
int | media_content_set_db_updated_cb (media_content_db_update_cb callback, void *user_data) |
Subscribes notifications of the media DB change. | |
int | media_content_unset_db_updated_cb (void) |
Unsubscribes notifications of the media DB change. | |
Typedefs | |
typedef void(* | media_scan_completed_cb )(media_content_error_e error, void *user_data) |
Called when the media scanning is finished. | |
typedef void(* | media_content_db_update_cb )(media_content_error_e error, int pid, media_content_db_update_item_type_e update_item, media_content_db_update_type_e update_type, media_content_type_e media_type, char *uuid, char *path, char *mime_type, void *user_data) |
Called when the notification of the media DB change is subscribed. |
The Media Content API provides functions, enumerations used in the entire Content Service.
Required Header
#include <media_content.h>
Overview
The Media Content API provides functions and enumerations used in the entire Content Service.
The information about media items i.e. image, audio and video, are managed in the content database and operations that involve database requires an active connection with the media content service.
During media scanning, Media Service extract media information automatically. media information include basic file info like path, size, modified time etc and some metadata like ID3tag, EXIF, thumbnail, etc. (thumbnail extracted only in Internal and SD card storage.
Media content services do not manage hidden files.
The API provides functions for connecting (media_content_connect()) and disconnecting (media_content_disconnect()) from the media content service.
The API consists of Media Folder,Media Tag,Media Filter, Media Information API and others.
API | Description |
---|---|
Media Folder | Provide information about folders (e.g. path, name, modification date) stored on the device. Provide information about the media items present in the folders. |
Media Tag | Provide information about media tags. Provide functions to insert or delete tag from database. Provide functions to add and remove media item from tags in the database. |
Media Filter | Provide functions for creating and destroying media filters. Provide functions to get filter properties |
Media Information | Provide generic information about media content items (i.e. image, audio, video and others). Provide details about audio files (e.g. name, author, genre etc) present in the device. Provide details about image files (e.g. width, height, orientation etc) present in the device. Provide details about video files (e.g. width, height, duration etc) present in the device . |
Media Playlist | Provide information about the media playlist. |
Media Album | Provide information about the media album. |
Media Group | Provide information about the media group(e.g. media artist, composer, genre, year). |
Media Bookmark | Provide information about the media bookmark. |
Typedef Documentation
typedef void(* media_content_db_update_cb)(media_content_error_e error, int pid, media_content_db_update_item_type_e update_item, media_content_db_update_type_e update_type, media_content_type_e media_type, char *uuid, char *path, char *mime_type, void *user_data) |
Called when the notification of the media DB change is subscribed.
- Since :
- 2.3
- Parameters:
-
[in] error The error code [in] pid The PID which publishes notification [in] update_item The update item of notification [in] update_type The update type of notification [in] media_type The type of the media content (media_content_type_e) [in] uuid The UUID of media or directory, which is updated [in] path The path of the media or directory [in] mime_type The mime type of the media info [in] user_data The user data passed from the foreach function
- Precondition:
- media_content_db_update_subscribe().
- See also:
- media_content_db_update_subscribe()
typedef void(* media_scan_completed_cb)(media_content_error_e error, void *user_data) |
Called when the media scanning is finished.
- Since :
- 2.3
- Parameters:
-
[in] error The error code [in] user_data The user data passed from the foreach function
- Precondition:
- media_content_scan().
- See also:
- media_content_scan()
Enumeration Type Documentation
Enumeration for collations.
- Since :
- 2.3
Enumeration for a media content error.
- Since :
- 2.3
- Enumerator:
Enumeration for the storage type.
This information is used to establish where the folder is.
- Since :
- 2.3
enum media_content_type_e |
enum media_group_e |
Enumeration for a media group.
- Since :
- 2.3
- Enumerator:
Function Documentation
int media_content_cancel_scan_folder | ( | const char * | path | ) |
Requests to cancel the media folder scanning.
- Since :
- 2.4
- Parameters:
-
[in] path The folder path
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTENT_ERROR_NONE Successful MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- Precondition:
- media_content_scan_folder()
int media_content_connect | ( | void | ) |
Connects to the media content service.
Any media content related function call should be invoked after this function call.
- Since :
- 2.3
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTENT_ERROR_NONE Successful MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
- Postcondition:
- media_content_disconnect()
- See also:
- media_content_disconnect()
int media_content_disconnect | ( | void | ) |
Disconnects from the media content service.
This function closes connection to the media content service. Any further media content related operation cannot be performed after this function is called.
- Since :
- 2.3
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTENT_ERROR_NONE Successful MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
- Precondition:
- media_content_connect()
- See also:
- media_content_connect()
int media_content_scan_file | ( | const char * | path | ) |
Requests to scan a media file.
This function requests to scan a media file to the media server. If media file is not registered to DB yet, that media file information will be added to the media DB. If it is already registered to the DB, then this tries to refresh information. If requested file does not exist on file system, information of the media file will be removed from the media DB.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/content.write
http://tizen.org/privilege/mediastorage
http://tizen.org/privilege/externalstorage
- Remarks:
- You must add privilege http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path.
If you want to access only internal storage by using this API, you should add privilege http://tizen.org/privilege/mediastorage.
Or if you want to access only external storage by using this API, you shold add privilege http://tizen.org/privilege/externalstorage.
If you can access both storage, you must add all privilege.
If you do not update media item in content storage, you cannot see proper media files in the Application which use media database.
- Parameters:
-
[in] path The file path
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTENT_ERROR_NONE Successful MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
- Precondition:
- This function requires opened connection to content service by media_content_connect().
int media_content_scan_folder | ( | const char * | path, |
bool | is_recursive, | ||
media_scan_completed_cb | callback, | ||
void * | user_data | ||
) |
Requests to scan a media folder, asynchronously.
This function requests to scan a media folder to the media server with given completed callback function. media_scan_completed_cb() function will be called when the scanning is finished. The sub folders are also scanned, if there are sub folders in that folder.
If any folder must not be scanned, a blank file ".scan_ignore" has to be created in that folder.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/content.write
http://tizen.org/privilege/mediastorage
http://tizen.org/privilege/externalstorage
- Remarks:
- You must add privilege http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path.
If you want to access only internal storage by using this API, you should add privilege http://tizen.org/privilege/mediastorage.
Or if you want to access only external storage by using this API, you shold add privilege http://tizen.org/privilege/externalstorage.
If you can access both storage, you must add all privilege.
If you do not update media folder or item in content storage, you cannot see proper folder and media files in the Application which use media database.
- Parameters:
-
[in] path The folder path [in] is_recursive Set true
to scan recursively subdirectories, otherwisefalse
to scan only the current directory[in] callback The callback to be invoked when the scanning is finished [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTENT_ERROR_NONE Successful MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
- See also:
- media_scan_completed_cb()
int media_content_set_db_updated_cb | ( | media_content_db_update_cb | callback, |
void * | user_data | ||
) |
Subscribes notifications of the media DB change.
This function subscribes notifications of the media DB change which are published by the media server or other apps. media_content_db_update_cb() function will be called when notification of the media DB change is subscribed.
- Since :
- 2.3
- Parameters:
-
[in] callback The callback to be invoked when the scanning is finished [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTENT_ERROR_NONE Successful MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
int media_content_unset_db_updated_cb | ( | void | ) |
Unsubscribes notifications of the media DB change.
This function unsubscribes notifications of the media DB change which are published by the media server or other apps.
- Since :
- 2.3
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTENT_ERROR_NONE Successful MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
- Precondition:
- media_content_set_db_updated_cb()
- See also:
- media_content_set_db_updated_cb()