Tizen Native API
5.0
|
The Media Content API provides functions, enumerations used in the entire Content Service.
#include <media_content.h>
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.)
Since 3.0, a thumbnail is not automatically extracted during media scanning. A thumbnail will be created only when media_info_create_thumbnail() is called by any application.
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. |
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_add_db_updated_cb (media_content_db_update_cb callback, void *user_data, media_content_noti_h *noti_handle) |
Subscribes notifications of the media DB change. | |
int | media_content_remove_db_updated_cb (media_content_noti_h noti_handle) |
Removes notifications of the media DB change. | |
Typedefs | |
typedef void * | media_content_noti_h |
The structure type for the Media content noti handle. | |
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. | |
Defines | |
#define | MEDIA_CONTENT_ERROR_CLASS TIZEN_ERROR_MEDIA_CONTENT |
Error class. |
#define MEDIA_CONTENT_ERROR_CLASS TIZEN_ERROR_MEDIA_CONTENT |
Error class.
Class for Media Content error
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 following error codes can be received:
MEDIA_CONTENT_ERROR_NONE : Success
[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 of the media info |
[in] | user_data | The user data passed from the foreach function |
typedef void* media_content_noti_h |
The structure type for the Media content noti handle.
typedef void(* media_scan_completed_cb)(media_content_error_e error, void *user_data) |
Called when the media scanning is finished.
The following error codes can be received:
MEDIA_CONTENT_ERROR_NONE : Success
MEDIA_CONTENT_ERROR_INVALID_PARAMETER : Invalid parameter
MEDIA_CONTENT_ERROR_INVALID_OPERATION : Invalid operation
MEDIA_CONTENT_ERROR_PERMISSION_DENIED : Permission denied
MEDIA_CONTENT_ERROR_OUT_OF_MEMORY : Out of memory
MEDIA_CONTENT_ERROR_DB_FAILED : DB Operation failed
MEDIA_CONTENT_ERROR_DB_BUSY : DB Operation busy
MEDIA_CONTENT_ERROR_NETWORK : Network fail
[in] | error | The error code |
[in] | user_data | The user data passed from the foreach function |
Enumeration for collations.
Enumeration for a media content error.
Enumeration for the storage type.
This information is used to establish where the folder is.
enum media_content_type_e |
Enumeration for the media file format.
enum media_group_e |
Enumeration for a media group.
int media_content_add_db_updated_cb | ( | media_content_db_update_cb | callback, |
void * | user_data, | ||
media_content_noti_h * | noti_handle | ||
) |
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.
Using this function, multiple callback is possible to register in one process.
[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 |
[out] | noti_handle | The handle to db updated notification |
0
on success, otherwise a negative error valueMEDIA_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 |
int media_content_cancel_scan_folder | ( | const char * | path | ) |
Requests to cancel the media folder scanning.
[in] | path | The folder path |
0
on success, otherwise a negative error valueMEDIA_CONTENT_ERROR_NONE | Successful |
MEDIA_CONTENT_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_CONTENT_ERROR_INVALID_OPERATION | Invalid operation |
int media_content_connect | ( | void | ) |
Connects to the media content service.
Any media content related function call should be invoked after this function call.
0
on success, otherwise a negative error valueMEDIA_CONTENT_ERROR_NONE | Successful |
MEDIA_CONTENT_ERROR_DB_FAILED | DB operation failed |
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.
0
on success, otherwise a negative error valueMEDIA_CONTENT_ERROR_NONE | Successful |
MEDIA_CONTENT_ERROR_DB_FAILED | DB operation failed |
int media_content_remove_db_updated_cb | ( | media_content_noti_h | noti_handle | ) |
Removes 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.
[in] | noti_handle | The handle to db updated notification |
0
on success, otherwise a negative error valueMEDIA_CONTENT_ERROR_NONE | Successful |
MEDIA_CONTENT_ERROR_INVALID_PARAMETER | Invalid parameter |
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.
If file information does not exist in DB, this function will be return MEDIA_CONTENT_ERROR_INVALID_PARAMETER.
[in] | path | The file path |
0
on success, otherwise a negative error valueMEDIA_CONTENT_ERROR_NONE | Successful |
MEDIA_CONTENT_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_CONTENT_ERROR_INVALID_OPERATION | Invalid operation |
MEDIA_CONTENT_ERROR_PERMISSION_DENIED | Permission denied |
MEDIA_CONTENT_ERROR_DB_FAILED | DB Operation failed |
MEDIA_CONTENT_ERROR_DB_BUSY | DB Operation busy |
MEDIA_CONTENT_ERROR_NOT_SUPPORTED | Not supported |
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. After adding or removing a folder from the filesystem, call this function on its source location (this will add or remove an entry from the database).
After moving or renaming a folder in the filesystem, call this function on its source location (this will remove an entry from the database) and call this function again on its destination location (this will add a new entry to the database).
Alternatively, you can call this function on any parent of source location and on any parent of destination location.
You can also call the function once, on a folder which is a parent of both source and destination.
[in] | path | The folder path |
[in] | is_recursive | Set true to scan recursively subdirectories, otherwise false 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 |
0
on success, otherwise a negative error valueMEDIA_CONTENT_ERROR_NONE | Successful |
MEDIA_CONTENT_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_CONTENT_ERROR_INVALID_OPERATION | Invalid operation |
MEDIA_CONTENT_ERROR_PERMISSION_DENIED | Permission denied |
MEDIA_CONTENT_ERROR_OUT_OF_MEMORY | Out of memory |
MEDIA_CONTENT_ERROR_DB_FAILED | DB Operation failed |
MEDIA_CONTENT_ERROR_DB_BUSY | DB Operation busy |
MEDIA_CONTENT_ERROR_NETWORK | Network fail |