+++ /dev/null
-/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-
-#ifndef __TIZEN_MEDIA_CONTENT_INTERNAL_H__
-#define __TIZEN_MEDIA_CONTENT_INTERNAL_H__
-
-#include <media_content_type.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/**
- * @internal
- * @file media_content_internal.h
- * @brief This file contains API on main functional operations with storage that are related to media resources in the media database. \n
- * Operations include: inserting a new storage in media to the media database, removing storage from database, \n
- */
-
-/**
-* @internal
-* @brief Insert media storage to database.
-* @since_tizen 2.4
-*
-* @remarks You must release @a storage using media_storage_destroy().
-*
-* @privlevel platform
-* @privilege %http://tizen.org/privilege/content.write
-*
-* @param[in] storage_name The storage name to insert to database
-* @param[in] storage_path The storage path to insert to database
-* @param[in] storage_account The storage account to insert to database
-* @param[in] storage_type The storage type to insert to database
-* @param[out] storage The media storage handle
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @see media_storage_delete_from_db()
-*/
-int media_storage_insert_to_db(const char *storage_name, const char *storage_path, const char *storage_account, media_content_storage_e storage_type, media_storage_h *storage);
-
-/**
-* @internal
-* @brief Deletes the database for media storage.
-* @since_tizen 2.4
-*
-* @privlevel platform
-* @privilege %http://tizen.org/privilege/content.write
-*
-* @param[in] storage_id The storage ID to delete from database
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @see media_storage_insert_to_db()
-*/
-int media_storage_delete_from_db(const char *storage_id);
-
-/**
- * @brief Gets the storage account of media storage.
- * @since_tizen 2.4
- *
- * @remarks You must release @a storage_account using free().
- *
- * @param[in] storage The media storage handle
- * @param[out] storage_account The storage account of the media storage
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- *
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- */
-int media_storage_get_storage_account(media_storage_h storage, char **storage_account);
-
-/**
-* @internal
-* @brief Creates the media info handle.
-* @since_tizen 2.4
-*
-* @remarks You must release @a media using media_info_destroy().
-*
-* @param[out] media The media info handle
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @see media_info_destroy()
-*/
-int media_info_create_handle(media_info_h *media);
-
-/**
-* @internal
-* @brief Inserts media info to database with media info data.
-* @since_tizen 2.4
-*
-* @remarks You must release @a info using media_info_destroy().
-*
-* @privlevel platform
-* @privilege %http://tizen.org/privilege/content.write
-*
-* @param[in] media The media info handle
-* @param[out] info The media info handle to get data from database
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*/
-int media_info_insert_to_db_with_data(media_info_h media, media_info_h *info);
-
-/**
-* @internal
-* @brief Sets the path of media info handle.
-* @since_tizen 2.4
-*
-* @param[in] media The media info handle
-* @param[in] path The path of the media info
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @post media_info_insert_to_db_with_data()
-*/
-int media_info_set_path(media_info_h media, const char *path);
-
-/**
-* @internal
-* @brief Sets the MIME type of media info handle.
-* @since_tizen 2.4
-*
-* @param[in] media The media info handle
-* @param[in] mime_type The MIME type of the media info
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @post media_info_insert_to_db_with_data()
-*/
-int media_info_set_mime_type(media_info_h media, const char *mime_type);
-
-/**
-* @internal
-* @brief Sets the title of media info handle.
-* @since_tizen 2.4
-*
-* @param[in] media The media info handle
-* @param[in] title The title of media info handle
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @post media_info_insert_to_db_with_data()
-*/
-int media_info_set_title(media_info_h media, const char *title);
-
-/**
-* @internal
-* @brief Sets the album of media info handle.
-* @since_tizen 2.4
-*
-* @param[in] media The media info handle
-* @param[in] album The album of media info handle
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @post media_info_insert_to_db_with_data()
-*/
-int media_info_set_album(media_info_h media, const char *album);
-
-/**
-* @internal
-* @brief Sets the artist of media info handle.
-* @since_tizen 2.4
-*
-* @param[in] media The media info handle
-* @param[in] artist The artist of media info handle
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @post media_info_insert_to_db_with_data()
-*/
-int media_info_set_artist(media_info_h media, const char *artist);
-
-/**
-* @internal
-* @brief Sets the genre of media info handle.
-* @since_tizen 2.4
-*
-* @param[in] media The media info handle
-* @param[in] genre The genre of media info handle
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @post media_info_insert_to_db_with_data()
-*/
-int media_info_set_genre(media_info_h media, const char *genre);
-
-/**
-* @internal
-* @brief Sets the recorded date of media info handle.
-* @since_tizen 2.4
-*
-* @param[in] media The media info handle
-* @param[in] recorded_date The recorded date of media info handle
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @post media_info_insert_to_db_with_data()
-*/
-int media_info_set_recorded_date(media_info_h media, const char *recorded_date);
-
-/**
-* @internal
-* @brief Sets the thumbnail path of media info handle.
-* @since_tizen 2.4
-*
-* @param[in] media The media info handle
-* @param[in] thumbnail_path The thumbnail path of media info handle
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @post media_info_insert_to_db_with_data()
-*/
-int media_info_set_thumbnail_path(media_info_h media, const char *thumbnail_path);
-
-/**
-* @internal
-* @brief Sets the size of media info handle.
-* @since_tizen 2.4
-*
-* @param[in] media The media info handle
-* @param[in] size The size of media info handle
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @post media_info_insert_to_db_with_data()
-*/
-int media_info_set_size(media_info_h media, unsigned long long size);
-
-/**
-* @internal
-* @brief Sets the modified time of media info handle.
-* @since_tizen 2.4
-*
-* @param[in] media The media info handle
-* @param[in] modified_time The modified time of media info handle
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @post media_info_insert_to_db_with_data()
-*/
-int media_info_set_modified_time(media_info_h media, time_t modified_time);
-
-/**
-* @internal
-* @brief Sets the media type of media info handle.
-* @since_tizen 2.4
-*
-* @param[in] media The media info handle
-* @param[in] type The media type of media info handle
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @post media_info_insert_to_db_with_data()
-*/
-int media_info_set_media_type(media_info_h media, media_content_type_e type);
-
-/**
-* @internal
-* @brief Sets the duration of media info handle.
-* @since_tizen 2.4
-*
-* @param[in] media The media info handle
-* @param[in] duration The duration of media info handle
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @post media_info_insert_to_db_with_data()
-*/
-int media_info_set_duration(media_info_h media, int duration);
-
-/**
-* @internal
-* @brief Sets the width of media info handle.
-* @since_tizen 2.4
-*
-* @param[in] media The media info handle
-* @param[in] width The width of media info handle
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @post media_info_insert_to_db_with_data()
-*/
-int media_info_set_width(media_info_h media, int width);
-
-/**
-* @internal
-* @brief Sets the height of media info handle.
-* @since_tizen 2.4
-*
-* @param[in] media The media info handle
-* @param[in] height The height of media info handle
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @post media_info_insert_to_db_with_data()
-*/
-int media_info_set_height(media_info_h media, int height);
-
-/**
-* @internal
-* @brief Sets the storage type of media info handle.
-* @since_tizen 2.4
-*
-* @param[in] media The media info handle
-* @param[in] storage_type The storage type of media info handle
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @post media_info_insert_to_db_with_data()
-*/
-int media_info_set_storage_type(media_info_h media, media_content_storage_e storage_type);
-
-/**
-* @internal
-* @brief Sets the storage type of media info handle.
-* @since_tizen 2.4
-*
-* @param[in] media The media info handle
-* @param[in] storage_id The storage id of media info handle
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @post media_info_insert_to_db_with_data()
-*/
-int media_info_set_storage_id(media_info_h media, const char *storage_id);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /*__TIZEN_MEDIA_CONTENT_INTERNAL_H__*/
{
MEDIA_CONTENT_STORAGE_INTERNAL = 0, /**< The device's internal storage */
MEDIA_CONTENT_STORAGE_EXTERNAL = 1, /**< The device's external storage */
- MEDIA_CONTENT_STORAGE_CLOUD = 100, /**< The Cloud storage */
} media_content_storage_e;
/**
*/
typedef struct filter_s *filter_h;
-/**
- * @ingroup CAPI_CONTENT_MEDIA_STORAGE_MODULE
- * @brief The structure type for the Media storage handle.
- * @since_tizen 2.4
- */
-typedef void *media_storage_h;
/**
* @ingroup CAPI_MEDIA_CONTENT_MODULE
*/
typedef bool (*media_group_cb)(const char *group_name, void *user_data);
-/**
- * @ingroup CAPI_CONTENT_MEDIA_STORAGE_MODULE
- * @brief Called for every storage in the obtained list of storages.
- * @since_tizen 2.4
- *
- * @details Iterates over a media storage list.
- *
- * @remarks You should not destroy @a storage returned by this function.
- *
- * @param[in] storage The handle of the media storage
- * @param[in] user_data The user data passed from the foreach function
- *
- * @return @c true to continue with the next iteration of the loop,
- * otherwise @c false to break out of the loop
- *
- * @pre media_storage_foreach_storage_from_db() will invoke this function.
- *
- * @see media_storage_foreach_storage_from_db()
- */
-typedef bool (*media_storage_cb)(media_storage_h storage, void *user_data);
/**
* @}
int _media_db_get_group_item_by_id(int group_id, filter_h filter, media_info_cb callback, void *user_data, group_list_e group_type);
int _media_db_get_group_item(const char *group_name, filter_h filter, media_info_cb callback, void *user_data, group_list_e group_type);
int _media_db_get_media_group_item_count(const char *group_name, filter_h filter, media_group_e group, int *item_count);
-int _media_db_get_media_group_item(const char *group_name, filter_h filter, media_group_e group, media_info_cb callback, void *user_data);
int _media_db_get_storage(filter_h filter, media_storage_cb callback, void *user_data);
int _media_db_get_storage_id_by_media_id(const char *media_id, char *storage_id);
+++ /dev/null
-/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-#ifndef __TIZEN_MEDIA_STORAGE_H__
-#define __TIZEN_MEDIA_STORAGE_H__
-
-
-#include <media_content_type.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/**
- * @file media_storage.h
- * @brief This file contains API on main functional operations with storage that are related to media resources in the media database. \n
- * Operations include: getting number of storages, cloning and destroying storage, getting storage`s ID, name, path and type.
- */
-
-/**
-* @brief Gets media storage from database.
-* @since_tizen 2.4
-*
-* @param[in] storage_id The storage id to get media storage info
-* @param[out] storage The media storage handle
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
-* @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-
-*
-* @pre This function requires opened connection to content service by media_content_connect().
-*
-* @see media_content_connect()
-*/
-int media_storage_get_storage_info_from_db(const char *storage_id, media_storage_h *storage);
-
-/**
-* @brief Gets the count of media storage for the passed @a filter from the media database.
-* @since_tizen 2.4
-*
-* @param[in] filter The handle to filter
-* @param[out] storage_count The count of storage
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #MEDIA_CONTENT_ERROR_NONE Successful
-* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
-* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
-* @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
-* @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
-*
-* @pre This function requires opened connection to content service by media_content_connect().
-*
-* @see media_content_connect()
-*/
-int media_storage_get_storage_count_from_db(filter_h filter, int *storage_count);
-
-/**
- * @brief Iterates through media storage from the media database.
- * @details This function gets all media storage handles meeting the given @a filter.
- * The @a callback function will be invoked for every retrieved media storage.
- * If @c NULL is passed to the @a filter, then no filtering is applied.
- *
- * @since_tizen 2.4
- *
- * @param[in] filter The media storage handle filter
- * @param[in] callback The callback function to be invoked
- * @param[in] user_data The user data to be passed to the callback function
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- *
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
- * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
- * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
- *
- * @pre This function requires opened connection to content service by media_content_connect().
- * @post This function invokes media_storage_destroy().
- *
- * @see media_content_connect()
- * @see media_storage_destroy()
- */
-int media_storage_foreach_storage_from_db(filter_h filter, media_storage_cb callback, void *user_data);
-
-/**
- * @brief Gets the count of media files for the passed @a filter in the given @a storage from the media database.
- * @since_tizen 2.4
- *
- * @param[in] storage_id The ID of the media storage
- * @param[in] filter The filter of the media content
- * @param[out] media_count The count of media storage items
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- *
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
- * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
- * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
- *
- * @pre This function requires opened connection to content service by media_content_connect().
- *
- * @see media_content_connect()
- */
-int media_storage_get_media_count_from_db(const char *storage_id, filter_h filter, int *media_count);
-
-/**
- * @brief Iterates through the media files with an optional @a filter in the given @a storage from the media database.
- * @details 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 @c NULL is passed to the @a filter, no filtering is applied.
- *
- * @since_tizen 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. \n
- * So, your callback function is in read state in SQLite. When you are in read state, sometimes you do not update DB. \n
- * We do not recommend you call updating DB function in callback of foreach function.
- *
- * @param[in] storage_id The ID of the media storage
- * @param[in] filter The handle to the media info filter
- * @param[in] callback The callback function to be invoked
- * @param[in] user_data The user data to be passed to the callback function
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- *
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
- * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
- * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
- *
- * @pre This function requires opened connection to content service by media_content_connect().
- * @post This function invokes media_info_cb().
- *
- * @see #media_info_cb
- * @see media_content_connect()
- * @see media_filter_create()
- */
-int media_storage_foreach_media_from_db(const char *storage_id, filter_h filter, media_info_cb callback, void *user_data);
-
-/**
- * @brief Destroys media storage handle.
- * @details 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_tizen 2.4
- *
- * @param[in] storage The media storage handle
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- *
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- *
- * @pre Get copy of media_storage_h handle by calling media_storage_clone().
- *
- * @see media_storage_clone()
- */
-int media_storage_destroy(media_storage_h storage);
-
-/**
- * @brief Clones the media storage handle.
- *
- * @details 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_tizen 2.4
- *
- * @remarks You must release the destination handle using media_storage_destroy().
- *
- * @param[out] dst The destination handle to the media storage
- * @param[in] src The source handle to media storage
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- *
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- *
- * @see media_storage_destroy()
- * @see media_storage_foreach_storage_from_db()
- * @see media_storage_get_storage_info_from_db()
- */
-int media_storage_clone(media_storage_h *dst, media_storage_h src);
-
-/**
- * @brief Gets the storage id of media storage.
- * @since_tizen 2.4
- *
- * @remarks You must release @a storage_id using free().
- *
- * @param[in] storage The media storage handle
- * @param[out] storage_id The storage id of the media storage
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- *
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- */
-int media_storage_get_id(media_storage_h storage, char **storage_id);
-
-/**
- * @brief Gets the storage name of media storage.
- * @since_tizen 2.4
- *
- * @remarks You must release @a storage_name using free().
- *
- * @param[in] storage The media storage handle
- * @param[out] storage_name The storage name of the media storage
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- *
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- */
-int media_storage_get_name(media_storage_h storage, char **storage_name);
-
-/**
- * @brief Gets the storage path of media storage.
- * @since_tizen 2.4
- *
- * @remarks You must release @a storage_path using free().
- *
- * @param[in] storage The media storage handle
- * @param[out] storage_path The storage path of the media storage
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- *
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- */
-int media_storage_get_path(media_storage_h storage, char **storage_path);
-
-/**
- * @brief Gets the storage type of media storage.
- * @since_tizen 2.4
- *
- * @param[in] storage The media storage handle
- * @param[out] storage_type The storage type of the media storage
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- *
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int media_storage_get_type(media_storage_h storage, media_content_storage_e *storage_type);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __TIZEN_MEDIA_STORAGE_H__ */
media_svc_storage_type_e storage_type;
- ret = media_svc_get_storage_type(path, &storage_type);
+ ret = media_svc_get_storage_type(path, &storage_type, tzplatform_getuid(TZ_USER_NAME));
if(ret != MS_MEDIA_ERR_NONE) {
media_content_sec_error("media_svc_get_storage_type failed : %d (%s)", ret, path);
return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
return ret;
}
-int _media_db_get_storage(filter_h filter, media_storage_cb callback, void *user_data)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- char select_query[DEFAULT_QUERY_SIZE];
- char *condition_query = NULL;
- char *option_query = NULL;
- sqlite3_stmt *stmt = NULL;
- attribute_h attr = NULL;
-
- attr = _content_get_attirbute_handle();
- memset(select_query, 0x00, sizeof(select_query));
-
- if(!SAFE_STRLCPY(select_query, SELECT_STORAGE_LIST, sizeof(select_query)))
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _content_query_prepare(&stmt, select_query, condition_query, option_query);
- SAFE_FREE(condition_query);
- SAFE_FREE(option_query);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- while(sqlite3_step(stmt) == SQLITE_ROW)
- {
- media_storage_s *_storage = (media_storage_s*)calloc(1, sizeof(media_storage_s));
-
- if(_storage == NULL)
- {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- SQLITE3_FINALIZE(stmt);
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
-
- if(STRING_VALID((const char *)sqlite3_column_text(stmt, 0)))
- _storage->storage_id = strdup((const char *)sqlite3_column_text(stmt, 0));
-
- if(STRING_VALID((const char *)sqlite3_column_text(stmt, 1)))
- _storage->storage_name = strdup((const char *)sqlite3_column_text(stmt, 1));
-
- if(STRING_VALID((const char *)sqlite3_column_text(stmt, 2)))
- _storage->storage_path = strdup((const char *)sqlite3_column_text(stmt, 2));
-
- if(STRING_VALID((const char *)sqlite3_column_text(stmt, 3)))
- _storage->storage_account = strdup((const char *)sqlite3_column_text(stmt, 3));
-
- _storage->storage_type = (int)sqlite3_column_int(stmt, 4);
-
- if(callback((media_storage_h)_storage, user_data) == false)
- {
- media_storage_destroy((media_storage_h) _storage);
- break;
- }
-
- media_storage_destroy((media_storage_h) _storage);
- }
-
- SQLITE3_FINALIZE(stmt);
-
- return ret;
-}
-
int _media_db_get_storage_id_by_media_id(const char *media_id, char *storage_id)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
media_svc_storage_type_e storage_type = 0;
- ret = media_svc_get_storage_type(path, &storage_type);
+ ret = media_svc_get_storage_type(path, &storage_type, tzplatform_getuid(TZ_USER_NAME));
if(ret != MS_MEDIA_ERR_NONE) {
media_content_sec_error("media_svc_get_storage_type failed : %d", ret);
return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
SAFE_FREE(age_rating_pinyin);
SAFE_FREE(keyword_pinyin);
- if(_media->storage_type == MEDIA_CONTENT_STORAGE_CLOUD)
- {
- set_sql = NULL;
- sql = NULL;
-
- if(_media->media_type == MEDIA_CONTENT_TYPE_VIDEO)
- {
- set_sql = sqlite3_mprintf("title=%Q, album=%Q, artist=%Q, genre=%Q, duration=%d, width=%d, height=%d", \
- _media->title, _media->video_meta->album, _media->video_meta->artist, _media->video_meta->genre, _media->video_meta->duration, _media->video_meta->width, _media->video_meta->height);
- }
- else if((_media->media_type == MEDIA_CONTENT_TYPE_MUSIC) || (_media->media_type == MEDIA_CONTENT_TYPE_SOUND))
- {
- set_sql = sqlite3_mprintf("title=%Q, album=%Q, artist=%Q, genre=%Q, duration=%d", \
- _media->title, _media->audio_meta->album, _media->audio_meta->artist, _media->audio_meta->genre, _media->audio_meta->duration);
- }
- else if(_media->media_type == MEDIA_CONTENT_TYPE_IMAGE)
- {
- set_sql = sqlite3_mprintf("title=%Q, width=%d, height=%d", _media->title, _media->image_meta->width, _media->image_meta->height);
- }
- else
- {
- set_sql = sqlite3_mprintf("title=%Q", _media->title);
- }
-
- sql = sqlite3_mprintf("UPDATE %Q SET %s WHERE media_uuid=%Q", _media->storage_uuid, set_sql, _media->media_id);
-
- ret = _content_query_sql(sql);
-
- sqlite3_free(set_sql);
- sqlite3_free(sql);
- }
-
if (ret == MEDIA_CONTENT_ERROR_NONE) {
/* Send notification for this update */
media_content_debug("Update is successfull. Send notification for this");
return ret;
}
- if(storage_type == MEDIA_CONTENT_STORAGE_CLOUD)
- {
- media_info_destroy(media);
- media_content_error("Can't refresh cloud content!!");
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
ret = media_info_get_file_path(media, &file_path);
if(ret != MEDIA_CONTENT_ERROR_NONE)
{
return ret;
}
- ret = media_svc_get_storage_type(_media->file_path, &src_storage_type);
+ ret = media_svc_get_storage_type(_media->file_path, &src_storage_type, tzplatform_getuid(TZ_USER_NAME));
if(ret != MS_MEDIA_ERR_NONE)
{
media_content_sec_error("media_svc_get_storage_type failed : %d", ret);
return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
}
- ret = media_svc_get_storage_type(dst_path, &dst_storage_type);
+ ret = media_svc_get_storage_type(dst_path, &dst_storage_type, tzplatform_getuid(TZ_USER_NAME));
if(ret != MS_MEDIA_ERR_NONE)
{
media_content_sec_error("media_svc_get_storage_type failed : %d", ret);
media_svc_content_info_s *svc_content_info = NULL;
- ret = __media_info_map_data_usr_to_svc(_media, &svc_content_info, MEDIA_CONTENT_STORAGE_CLOUD);
- if(ret != MEDIA_CONTENT_ERROR_NONE)
- {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
-
if(svc_content_info == NULL)
{
media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+++ /dev/null
- /*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include <media_content.h>
-#include <media_info_private.h>
-
-static void __media_storage_get_detail(sqlite3_stmt* stmt, media_storage_h storage)
-{
- media_storage_s *_storage = (media_storage_s*)storage;
-
- if(STRING_VALID((const char *)sqlite3_column_text(stmt, 0)))
- _storage->storage_id = strdup((const char *)sqlite3_column_text(stmt, 0));
-
- if(STRING_VALID((const char *)sqlite3_column_text(stmt, 1)))
- _storage->storage_name = strdup((const char *)sqlite3_column_text(stmt, 1));
-
- if(STRING_VALID((const char *)sqlite3_column_text(stmt, 2)))
- _storage->storage_path = strdup((const char *)sqlite3_column_text(stmt, 2));
-
- if(STRING_VALID((const char *)sqlite3_column_text(stmt, 3)))
- _storage->storage_account = strdup((const char *)sqlite3_column_text(stmt, 3));
-
- _storage->storage_type = (int)sqlite3_column_int(stmt, 4);
-
- return;
-}
-
-int media_storage_insert_to_db(const char *storage_name, const char *storage_path, const char *storage_account, media_content_storage_e storage_type, media_storage_h *storage)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- char *storage_uuid = NULL;
- media_storage_s *_storage = NULL;
-
- if(!STRING_VALID(storage_name))
- {
- media_content_error("Invalid Storage Name");
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- if(!STRING_VALID(storage_path))
- {
- media_content_error("Invalid path");
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- storage_uuid = media_info_generate_uuid();
- if(storage_uuid == NULL)
- {
- media_content_error("Fail to get storage_id");
- return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
- }
-
- //ret = media_svc_insert_storage(_content_get_db_handle(), storage_uuid, storage_name, storage_path, storage_account, storage_type);
- if (ret != MS_MEDIA_ERR_NONE)
- {
- ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret);
- return ret;
- }
-
- _storage = (media_storage_s*)calloc(1, sizeof(media_storage_s));
- if(_storage == NULL)
- {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
-
- _storage->storage_id = strdup(storage_uuid);
- _storage->storage_path = strdup(storage_path);
- _storage->storage_name = strdup(storage_name);
- _storage->storage_type = storage_type;
-
- *storage = (media_storage_h)_storage;
-
- return ret;
-}
-
-int media_storage_delete_from_db(const char *storage_id)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- if(!STRING_VALID(storage_id))
- {
- media_content_error("Invalid Storage ID");
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- //ret = media_svc_delete_storage(_content_get_db_handle(), storage_id);
-
- return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
-}
-
-int media_storage_get_storage_info_from_db(const char *storage_id, media_storage_h *storage)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- char select_query[DEFAULT_QUERY_SIZE];
- sqlite3_stmt *stmt = NULL;
-
- if(!STRING_VALID(storage_id) || (storage == NULL))
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- memset(select_query, 0x00, sizeof(select_query));
- snprintf(select_query, sizeof(select_query), SELECT_STORAGE_INFO_FROM_STORAGE, storage_id);
-
- ret = _content_query_prepare(&stmt, select_query, NULL, NULL);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- while(sqlite3_step(stmt) == SQLITE_ROW)
- {
- media_storage_s *_storage = (media_storage_s*)calloc(1, sizeof(media_storage_s));
-
- if(_storage == NULL)
- {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- SQLITE3_FINALIZE(stmt);
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
-
- __media_storage_get_detail(stmt, (media_storage_h)_storage);
-
- *storage = (media_storage_h)_storage;
- }
-
- SQLITE3_FINALIZE(stmt);
-
- return ret;
-}
-
-int media_storage_get_storage_count_from_db(filter_h filter, int *storage_count)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- if(storage_count)
- {
- ret = _media_db_get_group_count(filter, MEDIA_GROUP_STORAGE, storage_count);
- }
- else
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-
-int media_storage_foreach_storage_from_db(filter_h filter, media_storage_cb callback, void *user_data)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- if(callback != NULL)
- {
- ret = _media_db_get_storage(filter, callback, user_data);
- }
- else
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-
-int media_storage_get_media_count_from_db(const char *storage_id, filter_h filter, int *media_count)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- if(STRING_VALID(storage_id) && media_count)
- {
- ret = _media_db_get_group_item_count(storage_id, filter, MEDIA_GROUP_STORAGE, media_count);
- }
- else
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-
-int media_storage_foreach_media_from_db(const char *storage_id, filter_h filter, media_info_cb callback, void *user_data)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- if((callback != NULL) && STRING_VALID(storage_id))
- {
- ret = _media_db_get_group_item(storage_id, filter, callback, user_data, MEDIA_GROUP_STORAGE);
- }
- else
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-
-int media_storage_destroy(media_storage_h storage)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_storage_s *_storage = (media_storage_s*)storage;
- if(_storage)
- {
- SAFE_FREE(_storage->storage_id);
- SAFE_FREE(_storage->storage_path);
- SAFE_FREE(_storage->storage_name);
- SAFE_FREE(_storage->storage_account);
- SAFE_FREE(_storage);
-
- ret = MEDIA_CONTENT_ERROR_NONE;
- }
- else
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-
-int media_storage_clone(media_storage_h *dst, media_storage_h src)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_storage_s *_src = (media_storage_s*)src;
-
- if(_src != NULL)
- {
- media_storage_s *_dst = (media_storage_s*)calloc(1, sizeof(media_storage_s));
- if(_dst == NULL)
- {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
-
- if(STRING_VALID(_src->storage_id))
- {
- _dst->storage_id = strdup(_src->storage_id);
- if(_dst->storage_id == NULL)
- {
- media_storage_destroy((media_storage_h)_dst);
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
- }
-
- if(STRING_VALID(_src->storage_name))
- {
- _dst->storage_name = strdup(_src->storage_name);
- if(_dst->storage_name == NULL)
- {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- media_storage_destroy((media_storage_h)_dst);
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
- }
-
- if(STRING_VALID(_src->storage_path))
- {
- _dst->storage_path = strdup(_src->storage_path);
- if(_dst->storage_path == NULL)
- {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- media_storage_destroy((media_storage_h)_dst);
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
- }
-
- if(STRING_VALID(_src->storage_account))
- {
- _dst->storage_account = strdup(_src->storage_account);
- if(_dst->storage_account == NULL)
- {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- media_storage_destroy((media_storage_h)_dst);
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
- }
-
- _dst->storage_type = _src->storage_type;
-
- *dst = (media_storage_h)_dst;
-
- ret = MEDIA_CONTENT_ERROR_NONE;
- }
- else
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-
-int media_storage_get_id(media_storage_h storage, char **storage_id)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_storage_s *_storage = (media_storage_s*)storage;
-
- if(_storage && storage_id)
- {
- if(STRING_VALID(_storage->storage_id))
- {
- *storage_id = strdup(_storage->storage_id);
- if(*storage_id == NULL)
- {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
- }
- else
- {
- *storage_id = NULL;
- }
-
- ret = MEDIA_CONTENT_ERROR_NONE;
- }
- else
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-
-int media_storage_get_name(media_storage_h storage, char **storage_name)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_storage_s *_storage = (media_storage_s*)storage;
-
- if(_storage && storage_name)
- {
- if(STRING_VALID(_storage->storage_name))
- {
- *storage_name = strdup(_storage->storage_name);
- if(*storage_name == NULL)
- {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
- }
- else
- {
- *storage_name = NULL;
- }
-
- ret = MEDIA_CONTENT_ERROR_NONE;
- }
- else
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-
-int media_storage_get_path(media_storage_h storage, char **storage_path)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_storage_s *_storage = (media_storage_s*)storage;
-
- if(_storage && storage_path)
- {
- if(STRING_VALID(_storage->storage_path))
- {
- *storage_path = strdup(_storage->storage_path);
- if(*storage_path == NULL)
- {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
- }
- else
- {
- *storage_path = NULL;
- }
-
- ret = MEDIA_CONTENT_ERROR_NONE;
- }
- else
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-
-int media_storage_get_storage_account(media_storage_h storage, char **storage_account)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_storage_s *_storage = (media_storage_s*)storage;
-
- if(_storage && storage_account)
- {
- if(STRING_VALID(_storage->storage_account))
- {
- *storage_account = strdup(_storage->storage_account);
- if(*storage_account == NULL)
- {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
- }
- else
- {
- *storage_account = NULL;
- }
-
- ret = MEDIA_CONTENT_ERROR_NONE;
- }
- else
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-
-int media_storage_get_type(media_storage_h storage, media_content_storage_e *storage_type)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_storage_s *_storage = (media_storage_s*)storage;
-
- if(_storage && storage_type)
- {
- *storage_type = _storage->storage_type;
- ret = MEDIA_CONTENT_ERROR_NONE;
- }
- else
- {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
}
/*2. Check Scan Ignore Directory*/
- ret = media_svc_get_storage_type(dir_path, &storage_type);
+ ret = media_svc_get_storage_type(dir_path, &storage_type, tzplatform_getuid(TZ_USER_NAME));
if(ret != MS_MEDIA_ERR_NONE)
{
media_content_error("media_svc_get_storage_type failed : %d", ret);
else
{
/*If root path, Stop Scanning*/
- if((storage_type == MEDIA_SVC_STORAGE_INTERNAL) && (strcmp(search_path, MEDIA_ROOT_PATH_INTERNAL) == 0))
+ if((storage_type == MEDIA_SVC_STORAGE_INTERNAL) && (strcmp(search_path, tzplatform_getenv(TZ_USER_CONTENT)) == 0))
{
//media_content_debug("Internal root path. Stop Scanning. Not found Ignore information");
break;
#include <stdlib.h>
#include <unistd.h>
#include <media_content.h>
-#include <media_content_internal.h>
#include <media_info_private.h>
#include <dlog.h>
#include <pthread.h>
return ret;
}
-int test_create_handle()
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_info_h media = NULL;
- media_info_h info = NULL;
- char *path = "/opt/usr/media/test_storage_path/cloud_other.txt";
- char *str_value = NULL;
- int int_value = -1;
-
- ret = media_info_create_handle(&media);
-
- ret = media_info_set_path(media, path);
- ret = media_info_set_mime_type(media, "test_mime_type");
- ret = media_info_set_title(media, "test_title");
- ret = media_info_set_album(media, "test_album");
- ret = media_info_set_artist(media, "test_artist");
- ret = media_info_set_genre(media, "test_genre");
- ret = media_info_set_width(media, 1920);
- ret = media_info_set_height(media, 1080);
- ret = media_info_set_recorded_date(media, "test_recorded_date");
- ret = media_info_set_thumbnail_path(media, "/opt/usr/media/test_thumbnail_path");
- ret = media_info_set_size(media, 5555);
- ret = media_info_set_modified_time(media, 4444);
- ret = media_info_set_media_type(media, MEDIA_CONTENT_TYPE_VIDEO);
- ret = media_info_set_duration(media, 3333);
- ret = media_info_set_width(media, 1111);
- ret = media_info_set_height(media, 2222);
- ret = media_info_set_storage_type(media, MEDIA_CONTENT_STORAGE_CLOUD);
- ret = media_info_set_storage_id(media, "5e0ad455-9b84-4489-ad51-4dd93b795413");
-
- ret = media_info_insert_to_db_with_data(media, &info);
- if(ret != MEDIA_CONTENT_ERROR_NONE)
- {
- media_content_error("media_info_insert_to_db_with_data failed : %d\n", ret);
- return ret;
- }
-
- ret = media_info_get_file_path(info, &str_value);
- media_content_debug("file_path = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_mime_type(info, &str_value);
- media_content_debug("mime_type = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_title(info, &str_value);
- media_content_debug("title = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_size(info,(unsigned long long*) &int_value);
- media_content_debug("size = [%d]", int_value);
-
- ret = media_info_get_modified_time(info, (time_t*)&int_value);
- media_content_debug("time = [%d]", int_value);
-
- ret = media_info_get_media_type(info, (media_content_type_e *)&int_value);
- media_content_debug("media_type = [%d]", int_value);
-
- ret = media_info_get_storage_type(info, (media_content_storage_e *)&int_value);
- media_content_debug("storage_type = [%d]", int_value);
-
- media_info_destroy(media);
- media_info_destroy(info);
-
- return ret;
-
-}
-
-int test_storage_item_insert()
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- media_info_h media = NULL;
-
- ret = media_info_create_handle(&media);
- ret = media_info_set_path(media, "/opt/storage/cloud/c_storage/test_file.png");
- ret = media_info_set_mime_type(media, "test_mime_type");
- ret = media_info_set_title(media, "test_title");
- ret = media_info_set_storage_type(media, MEDIA_CONTENT_STORAGE_CLOUD);
- ret = media_info_set_storage_id(media, "2a4e8103-33e3-4846-afe9-5be4681b0dba");
- ret = media_info_set_modified_time(media, 100);
- ret = media_info_set_media_type(media, MEDIA_CONTENT_TYPE_IMAGE);
- ret = media_info_insert_to_db_with_data(media, NULL);
-
- if(ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("media_info_insert_to_db_with_data failed : %d\n", ret);
-
- return ret;
-}
-
-int test_storage()
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- media_storage_h storage = NULL;
-#if 1
- char *storage_name = "test_storage_name";
- char *storage_path = "/opt/storage/cloud/c_storage/test_storage_path";
- char *storage_account = "test_storage_account";
-#endif
- char *storage_id = NULL;
- char *st_val = NULL;
- media_content_storage_e storage_type_out = -1;
- int storage_cnt = -1;
-
-#if 1
- ret = media_storage_insert_to_db(storage_name, storage_path, storage_account, MEDIA_CONTENT_STORAGE_CLOUD, &storage);
- if(ret != MEDIA_CONTENT_ERROR_NONE)
- {
- media_content_error("media_storage_insert_to_db failed : %d\n", ret);
- goto ERROR;
- }
- ret = media_storage_get_id(storage, &storage_id);
-
- ret = media_storage_destroy(storage);
- storage = NULL;
-#endif
- ret = media_storage_get_storage_count_from_db(NULL, &storage_cnt);
- if(ret != MEDIA_CONTENT_ERROR_NONE)
- {
- media_content_error("media_storage_get_storage_count_from_db failed : %d\n", ret);
- goto ERROR;
- }
- media_content_debug("storage_cnt = [%d]", storage_cnt);
-
- //media_storage_foreach_storage_from_db(filter_h filter, media_storage_cb callback, void *user_data);
-
- ret = media_storage_get_storage_info_from_db(storage_id, &storage);
- if(ret != MEDIA_CONTENT_ERROR_NONE)
- {
- media_content_error("media_storage_get_storage_info_from_db failed : %d\n", ret);
- goto ERROR;
- }
-
- ret = media_storage_get_id(storage, &st_val);
- if(ret != MEDIA_CONTENT_ERROR_NONE)
- {
- media_content_error("media_storage_get_id failed : %d\n", ret);
- goto ERROR;
- }
- media_content_debug("storage_id = [%s]", st_val);
- SAFE_FREE(st_val);
-
- ret = media_storage_get_name(storage, &st_val);
- if(ret != MEDIA_CONTENT_ERROR_NONE)
- {
- media_content_error("media_storage_get_name failed : %d\n", ret);
- goto ERROR;
- }
- media_content_debug("storage_name = [%s]", st_val);
- SAFE_FREE(st_val);
-
- ret = media_storage_get_path(storage, &st_val);
- if(ret != MEDIA_CONTENT_ERROR_NONE)
- {
- media_content_error("media_storage_get_path failed : %d\n", ret);
- goto ERROR;
- }
- media_content_debug("storage_path = [%s]", st_val);
- SAFE_FREE(st_val);
-
- ret = media_storage_get_storage_account(storage, &st_val);
- if(ret != MEDIA_CONTENT_ERROR_NONE)
- {
- media_content_error("media_storage_get_path failed : %d\n", ret);
- goto ERROR;
- }
- media_content_debug("storage_ccount = [%s]", st_val);
- SAFE_FREE(st_val);
-
- ret = media_storage_get_type(storage, &storage_type_out);
- if(ret != MEDIA_CONTENT_ERROR_NONE)
- {
- media_content_error("media_storage_get_type failed : %d\n", ret);
- goto ERROR;
- }
- media_content_debug("storage_type = [%d]", storage_type_out);
-
- //ret = media_storage_clone(media_storage_h *dst, media_storage_h src);
-
- //ret = media_storage_delete_from_db(storage_id);
-
-ERROR:
- SAFE_FREE(storage_id);
- SAFE_FREE(st_val);
-
- ret = media_storage_destroy(storage);
-
- return ret;
-}
-
int main(int argc, char *argv[])
{
int ret = MEDIA_CONTENT_ERROR_NONE;
ret = test_noti();
if(ret != MEDIA_CONTENT_ERROR_NONE)
return MEDIA_CONTENT_ERROR_NONE;
-
- ret = test_storage();
- if(ret != MEDIA_CONTENT_ERROR_NONE)
- return MEDIA_CONTENT_ERROR_NONE;
-
- ret = test_storage_item_insert();
- if(ret != MEDIA_CONTENT_ERROR_NONE)
- return MEDIA_CONTENT_ERROR_NONE;
-
- ret = test_create_handle();
- if(ret != MEDIA_CONTENT_ERROR_NONE)
- return MEDIA_CONTENT_ERROR_NONE;
#endif
ret = test_disconnect_database();