Tizen Native API  5.0
Media Storage

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.

Functions

int media_storage_get_storage_info_from_db (const char *storage_id, media_storage_h *storage) TIZEN_DEPRECATED_API
 Gets media storage from database.
int media_storage_get_storage_count_from_db (filter_h filter, int *storage_count) TIZEN_DEPRECATED_API
 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) TIZEN_DEPRECATED_API
 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) TIZEN_DEPRECATED_API
 Gets the count of media files for the passed filter in the given storage_id 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) TIZEN_DEPRECATED_API
 Iterates through the media files with an optional filter in the given storage_id from the media database.
int media_storage_destroy (media_storage_h storage) TIZEN_DEPRECATED_API
 Destroys media storage handle.
int media_storage_clone (media_storage_h *dst, media_storage_h src) TIZEN_DEPRECATED_API
 Clones the media storage handle.
int media_storage_get_id (media_storage_h storage, char **storage_id) TIZEN_DEPRECATED_API
 Gets the storage id of media storage.
int media_storage_get_name (media_storage_h storage, char **storage_name) TIZEN_DEPRECATED_API
 Gets the storage name of media storage.
int media_storage_get_path (media_storage_h storage, char **storage_path) TIZEN_DEPRECATED_API
 Gets the storage path of media storage.
int media_storage_get_type (media_storage_h storage, media_content_storage_e *storage_type) TIZEN_DEPRECATED_API
 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.

Typedef Documentation

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

Called for every storage in the obtained list of storages.

Deprecated:
Deprecated since 5.0.

Iterates over a media storage list.

Since :
2.4
Remarks:
You should not destroy storage returned by this function.
The callback is called in the main loop.
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.

Deprecated:
Deprecated since 5.0.
Since :
2.4

Function Documentation

Clones the media storage handle.

Deprecated:
Deprecated since 5.0.

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:
The dst should be released using media_storage_destroy().
Parameters:
[out]dstThe destination handle to the media storage
[in]srcThe source handle to the 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.

Deprecated:
Deprecated since 5.0.

The function frees all resources related to the media storage handle. This handle can no longer be used to perform any operations. 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_id from the media database.

Deprecated:
Deprecated since 5.0. Use media_info_foreach_media_from_db() instead.

This function gets all media files associated with the given storage and meeting desired filter option and calls callback 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.
Use media_info_foreach_media_from_db() if you want to search for internal storage.
Parameters:
[in]storage_idThe ID of the media storage
[in]filterThe handle to the media 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
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.

Deprecated:
Deprecated since 5.0. Use Storage instead.

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 handle to the media 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
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.

Deprecated:
Deprecated since 5.0.
Since :
2.4
Remarks:
The storage_id should be released using free().
Parameters:
[in]storageThe media storage handle
[out]storage_idThe 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_id from the media database.

Deprecated:
Deprecated since 5.0. Use media_info_get_media_count_from_db() instead.
Since :
2.4
Remarks:
Use media_info_get_media_count_from_db() if you want to search for internal storage.
Parameters:
[in]storage_idThe ID of the media storage
[in]filterThe handle to the media filter
[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
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.

Deprecated:
Deprecated since 4.0.
Since :
2.4
Remarks:
The storage_name should be released using free(). If the requested storage is not the cloud storage, this function returns NULL.
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.

Deprecated:
Deprecated since 5.0. Use Storage instead.
Since :
2.4
Remarks:
The storage_path should be released 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.

Deprecated:
Deprecated since 5.0. Use Storage instead.
Since :
2.4
Parameters:
[in]filterThe handle to the media 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
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.

Deprecated:
Deprecated since 5.0.
Since :
2.4
Remarks:
The storage should be released using media_storage_destroy().
Parameters:
[in]storage_idThe ID of the media storage
[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
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.

Deprecated:
Deprecated since 5.0. Use storage_get_type_dev() instead.
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