Tizen Native API
4.0
|
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) |
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_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) |
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) |
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) TIZEN_DEPRECATED_API |
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. |
Typedef Documentation
typedef bool(* media_storage_cb)(media_storage_h storage, void *user_data) |
Called for every storage in the obtained list of storages.
Iterates over a media storage list.
- Since :
- 3.0
- Remarks:
- You should not destroy storage returned by this function.
The callback is called in the main loop.
- Parameters:
-
[in] storage The handle of the media storage [in] user_data The user data passed from the foreach function
- Returns:
true
to continue with the next iteration of the loop, otherwisefalse
to break out of the loop
- Precondition:
- media_storage_foreach_storage_from_db() will invoke this function.
typedef void* media_storage_h |
The structure type for the Media storage handle.
- Since :
- 3.0
Function Documentation
int media_storage_clone | ( | media_storage_h * | dst, |
media_storage_h | src | ||
) |
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 :
- 3.0
- Remarks:
- The dst should be released using media_storage_destroy().
- Parameters:
-
[out] dst The destination handle to the media storage [in] src The source handle to the media storage
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTENT_ERROR_NONE Successful MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
int media_storage_destroy | ( | media_storage_h | storage | ) |
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 :
- 3.0
- Parameters:
-
[in] storage The media storage handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTENT_ERROR_NONE Successful MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid 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.
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 :
- 3.0
- 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_id The ID of the media storage [in] filter The handle to the media filter [in] callback The callback function to be invoked [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_OUT_OF_MEMORY Out of memory MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
- Precondition:
- This function requires opened connection to content service by media_content_connect().
- Postcondition:
- This function invokes media_info_cb().
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 :
- 3.0
- Parameters:
-
[in] filter The handle to the media filter [in] callback The callback function to be invoked [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_OUT_OF_MEMORY Out of memory MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
- Precondition:
- This function requires opened connection to content service by media_content_connect().
- Postcondition:
- This function invokes media_storage_destroy().
int media_storage_get_id | ( | media_storage_h | storage, |
char ** | storage_id | ||
) |
Gets the storage id of media storage.
- Since :
- 3.0
- Remarks:
- The storage_id should be released using free().
- Parameters:
-
[in] storage The media storage handle [out] storage_id The ID of the media storage
- 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_OUT_OF_MEMORY Out 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.
- Since :
- 3.0
- Parameters:
-
[in] storage_id The ID of the media storage [in] filter The handle to the media filter [out] media_count The count of media storage items
- 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_DB_FAILED DB Operation failed MEDIA_CONTENT_ERROR_DB_BUSY DB 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 :
- 3.0
- Remarks:
- The storage_name should be released using free(). If the requested storage is not the cloud storage, this function returns NULL.
- Parameters:
-
[in] storage The media storage handle [out] storage_name The storage name of the media storage
- 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_OUT_OF_MEMORY Out of memory
int media_storage_get_path | ( | media_storage_h | storage, |
char ** | storage_path | ||
) |
Gets the storage path of media storage.
- Since :
- 3.0
- Remarks:
- The storage_path should be released using free().
- Parameters:
-
[in] storage The media storage handle [out] storage_path The storage path of the media storage
- 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_OUT_OF_MEMORY Out 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 :
- 3.0
- Parameters:
-
[in] filter The handle to the media filter [out] storage_count The count of storage
- 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_DB_FAILED DB Operation failed MEDIA_CONTENT_ERROR_DB_BUSY DB 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.
- Since :
- 3.0
- Remarks:
- The storage should be released using media_storage_destroy().
- Parameters:
-
[in] storage_id The ID of the media storage [out] storage The media storage handle
- 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_OUT_OF_MEMORY Out of memory MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed MEDIA_CONTENT_ERROR_DB_BUSY DB 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.
- Since :
- 3.0
- Parameters:
-
[in] storage The media storage handle [out] storage_type The storage type of the media storage
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTENT_ERROR_NONE Successful MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter