Tizen Native API

Functions

int media_storage_get_storage_info_from_db (const char *storage_id, media_storage_h *storage)
 Gets media storage from database.
int media_storage_get_storage_count_from_db (filter_h filter, int *storage_count)
 Gets the count of media storage for the passed filter from the media database.
int media_storage_foreach_storage_from_db (filter_h filter, media_storage_cb callback, void *user_data)
 Iterates through media storage from the media database.
int media_storage_get_media_count_from_db (const char *storage_id, filter_h filter, int *media_count)
 Gets the count of media files for the passed filter in the given storage from the media database.
int media_storage_foreach_media_from_db (const char *storage_id, filter_h filter, media_info_cb callback, void *user_data)
 Iterates through the media files with an optional filter in the given storage from the media database.
int media_storage_destroy (media_storage_h storage)
 Destroys media storage handle.
int media_storage_clone (media_storage_h *dst, media_storage_h src)
 Clones the media storage handle.
int media_storage_get_id (media_storage_h storage, char **storage_id)
 Gets the storage id of media storage.
int media_storage_get_name (media_storage_h storage, char **storage_name)
 Gets the storage name of media storage.
int media_storage_get_path (media_storage_h storage, char **storage_path)
 Gets the storage path of media storage.
int media_storage_get_type (media_storage_h storage, media_content_storage_e *storage_type)
 Gets the storage type of media storage.

Typedefs

typedef void * media_storage_h
 The structure type for the Media storage handle.
typedef bool(* media_storage_cb )(media_storage_h storage, void *user_data)
 Called for every storage in the obtained list of storages.

Defines

#define MEDIA_STORAGE_ID   "STORAGE_ID"
 Media storage ID. You can use above define to set the condition of storage filter and order keyword.
#define MEDIA_STORAGE_PATH   "STORAGE_PATH"
 Media storage path. You can use above define to set the condition of storage filter and order keyword.

The Media Storage Information API provides functions to manage storage information on the media items.

Required Header

#include <media_content.h>

Overview

A Storage allows you to manage external storage.
The system generates the storage id when the external storage is added. And the system manages the media information in each of the storage by using storage id.
So you can get the information from the storage that you want to view.


Define Documentation

#define MEDIA_STORAGE_ID   "STORAGE_ID"

Media storage ID. You can use above define to set the condition of storage filter and order keyword.

Since :
2.4
#define MEDIA_STORAGE_PATH   "STORAGE_PATH"

Media storage path. You can use above define to set the condition of storage filter and order keyword.

Since :
2.4

Typedef Documentation

typedef bool(* media_storage_cb)(media_storage_h storage, void *user_data)

Called for every storage in the obtained list of storages.

Since :
2.4

Iterates over a media storage list.

Remarks:
You should not destroy storage returned by this function.
Parameters:
[in]storageThe handle of the media storage
[in]user_dataThe user data passed from the foreach function
Returns:
true to continue with the next iteration of the loop, otherwise false to break out of the loop
Precondition:
media_storage_foreach_storage_from_db() will invoke this function.
See also:
media_storage_foreach_storage_from_db()
typedef void* media_storage_h

The structure type for the Media storage handle.

Since :
2.4

Function Documentation

Clones the media storage handle.

This function copies the media storage handle from a source to the destination. There is no media_storage_create() function. The media_storage_h is created internally and available through media storage foreach function such as media_storage_foreach_storage_from_db(). To use this handle outside of these foreach functions, use this function.

Since :
2.4
Remarks:
You must release the destination handle using media_storage_destroy().
Parameters:
[out]dstThe destination handle to the media storage
[in]srcThe source handle to media storage
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
See also:
media_storage_destroy()
media_storage_foreach_storage_from_db()
media_storage_get_storage_info_from_db()

Destroys media storage handle.

The function frees all resources related to the media storage handle. This handle can no longer be used to perform any operation. New media storage handle has to be created before the next usage.

Since :
2.4
Parameters:
[in]storageThe media storage handle
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
Precondition:
Get copy of media_storage_h handle by calling media_storage_clone().
See also:
media_storage_clone()
int media_storage_foreach_media_from_db ( const char *  storage_id,
filter_h  filter,
media_info_cb  callback,
void *  user_data 
)

Iterates through the media files with an optional filter in the given storage from the media database.

This function gets all media files associated with the given storage and meeting desired filter option and calls registered callback function for every retrieved media item. If NULL is passed to the filter, no filtering is applied.

Since :
2.4
Remarks:
Do not call updating DB function like media_info_update_to_db(), media_info_refresh_metadata_to_db(), audio_meta_update_to_db(), image_meta_update_to_db() and video_meta_update_to_db() in your callback function, your callback function is invoked as inline function.
So, your callback function is in read state in SQLite. When you are in read state, sometimes you do not update DB.
We do not recommend you call updating DB function in callback of foreach function.
Parameters:
[in]storage_idThe ID of the media storage
[in]filterThe handle to the media info filter
[in]callbackThe callback function to be invoked
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_DB_FAILEDDB Operation failed
MEDIA_CONTENT_ERROR_DB_BUSYDB Operation busy
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
This function requires opened connection to content service by media_content_connect().
Postcondition:
This function invokes media_info_cb().
See also:
media_info_cb
media_content_connect()
media_filter_create()
int media_storage_foreach_storage_from_db ( filter_h  filter,
media_storage_cb  callback,
void *  user_data 
)

Iterates through media storage from the media database.

This function gets all media storage handles meeting the given filter. The callback function will be invoked for every retrieved media storage. If NULL is passed to the filter, then no filtering is applied.

Since :
2.4
Parameters:
[in]filterThe media storage handle filter
[in]callbackThe callback function to be invoked
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_DB_FAILEDDB Operation failed
MEDIA_CONTENT_ERROR_DB_BUSYDB Operation busy
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
This function requires opened connection to content service by media_content_connect().
Postcondition:
This function invokes media_storage_destroy().
See also:
media_content_connect()
media_storage_destroy()
int media_storage_get_id ( media_storage_h  storage,
char **  storage_id 
)

Gets the storage id of media storage.

Since :
2.4
Remarks:
You must release storage_id using free().
Parameters:
[in]storageThe media storage handle
[out]storage_idThe storage id of the media storage
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
int media_storage_get_media_count_from_db ( const char *  storage_id,
filter_h  filter,
int *  media_count 
)

Gets the count of media files for the passed filter in the given storage from the media database.

Since :
2.4
Parameters:
[in]storage_idThe ID of the media storage
[in]filterThe filter of the media content
[out]media_countThe count of media storage items
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_DB_FAILEDDB Operation failed
MEDIA_CONTENT_ERROR_DB_BUSYDB Operation busy
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
This function requires opened connection to content service by media_content_connect().
See also:
media_content_connect()
int media_storage_get_name ( media_storage_h  storage,
char **  storage_name 
)

Gets the storage name of media storage.

Since :
2.4
Remarks:
You must release storage_name using free().
Parameters:
[in]storageThe media storage handle
[out]storage_nameThe storage name of the media storage
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
int media_storage_get_path ( media_storage_h  storage,
char **  storage_path 
)

Gets the storage path of media storage.

Since :
2.4
Remarks:
You must release storage_path using free().
Parameters:
[in]storageThe media storage handle
[out]storage_pathThe storage path of the media storage
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
int media_storage_get_storage_count_from_db ( filter_h  filter,
int *  storage_count 
)

Gets the count of media storage for the passed filter from the media database.

Since :
2.4
Parameters:
[in]filterThe handle to filter
[out]storage_countThe count of storage
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_INVALID_OPERATIONInvalid operation
MEDIA_CONTENT_ERROR_DB_FAILEDDB Operation failed
MEDIA_CONTENT_ERROR_DB_BUSYDB Operation busy
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
This function requires opened connection to content service by media_content_connect().
See also:
media_content_connect()
int media_storage_get_storage_info_from_db ( const char *  storage_id,
media_storage_h storage 
)

Gets media storage from database.

Since :
2.4
Parameters:
[in]storage_idThe storage id to get media storage info
[out]storageThe media storage handle
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_DB_FAILEDDB Operation failed
MEDIA_CONTENT_ERROR_DB_BUSYDB Operation busy
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
This function requires opened connection to content service by media_content_connect().
See also:
media_content_connect()
int media_storage_get_type ( media_storage_h  storage,
media_content_storage_e storage_type 
)

Gets the storage type of media storage.

Since :
2.4
Parameters:
[in]storageThe media storage handle
[out]storage_typeThe storage type of the media storage
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter