merge with master
authorJinkun Jang <jinkun.jang@samsung.com>
Fri, 15 Mar 2013 16:11:55 +0000 (01:11 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Fri, 15 Mar 2013 16:11:55 +0000 (01:11 +0900)
14 files changed:
include/media_content.h
include/media_content_type.h
include/media_image.h
include/media_info.h
include/media_info_private.h
include/media_playlist.h
packaging/capi-content-media-content.spec
src/media_content.c
src/media_db.c
src/media_filter.c
src/media_image.c
src/media_info.c
src/media_playlist.c
test/media-content_test.c

index 8e6a5661f36143c12be4352cf7c08f95fab1eddd..5cc0c2d526fba52cbd919f7de4b96bebc5bbe306 100755 (executable)
@@ -73,6 +73,7 @@ int media_content_disconnect(void);
  * @param[in] path The file path
  * @return 0 on success, otherwise a negative error value.
  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @pre This function requires opened connection to content service by media_content_connect().
  *
  */
 int media_content_scan_file(const char *path);
@@ -85,6 +86,8 @@ int media_content_scan_file(const char *path);
  * The sub folders are also scanned, if there are sub folder in that folder. \n
  * If you want that the any folders are not scanned, you have to create a blank file ".scan_ignore" in that folder.
  * @param[in] path The folder path
+ * @param[in] is_recursive /@a true if scan recursively subdirectories,
+ *                    /@a false if scan only current directory,
  * @param[in] callback The callback to invoke when the scanning is finished
  * @param[in] user_data The user data to be passed to the callback function
  * @return 0 on success, otherwise a negative error value.
@@ -92,8 +95,33 @@ int media_content_scan_file(const char *path);
  * @see media_scan_completed_cb()
  *
  */
-int media_content_scan_folder(const char *path, media_scan_completed_cb callback, void *user_data);
+int media_content_scan_folder(const char *path, bool is_recursive, media_scan_completed_cb callback, void *user_data);
 
+/**
+ * @brief Subscribe notifications of media db change.
+ * @details This function subscribes notifications of media db change, which are published by media server or other apps.
+ * #media_content_db_update_cb() function will be called when notification of media db change is subscribed.
+ * @param[in] callback The callback to invoke when the scanning is finished
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @see media_content_db_update_cb()
+ * @see media_content_unset_db_updated_cb()
+ *
+ */
+int media_content_set_db_updated_cb(media_content_db_update_cb callback, void *user_data);
+
+/**
+
+ * @brief Unsubscribe notifications of media db change.
+ * @details This function unsubscribes notifications of media db change, which are published by media server or other apps.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @pre media_content_set_db_updated_cb()
+ * @see media_content_set_db_updated_cb()
+ *
+ */
+int media_content_unset_db_updated_cb(void);
 
 /**
  * @}
index a399bfc087f9b536a553b10179f3a850b36083d0..c2cb31d5b956c9da415a835cf20f016e77f39527 100755 (executable)
@@ -59,6 +59,25 @@ typedef enum
        MEDIA_CONTENT_STORAGE_EXTERNAL  = 1,            /**< The device's external storage */
 } media_content_storage_e;
 
+/**
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE
+ * @brief The enumerations of media content db update item
+ */
+typedef enum {
+       MEDIA_ITEM_FILE                 = 0,                            /**< File type ,an item updated to db */
+       MEDIA_ITEM_DIRECTORY    = 1,                            /**< Directory type, an item updated to db */
+} media_content_db_update_item_type_e;
+
+/**
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE
+ * @brief The enumerations of media content db update type
+ */
+typedef enum {
+       MEDIA_CONTENT_INSERT    = 0,                            /**< Insert, the type of DB update */
+       MEDIA_CONTENT_DELETE    = 1,                            /**< Delete, The type of DB update */
+       MEDIA_CONTENT_UPDATE    = 2,                            /**< Update, The type of DB update */
+} media_content_db_update_type_e;
+
 /**
  * @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE
  * @brief The type of orientation.
@@ -136,6 +155,7 @@ typedef enum {
        MEDIA_CONTENT_GROUP_LONGITUDE,
        MEDIA_CONTENT_GROUP_LATITUDE,
        MEDIA_CONTENT_GROUP_ALTITUDE,
+       MEDIA_CONTENT_GROUP_BURST_IMAGE,
        MEDIA_CONTENT_GROUP_RATING,
        MEDIA_CONTENT_GROUP_AUTHOR,
        MEDIA_CONTENT_GROUP_PROVIDER,
@@ -224,6 +244,34 @@ typedef struct filter_s *filter_h;
  */
 typedef void (*media_scan_completed_cb)(media_content_error_e error, void * user_data);
 
+/**
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE
+ * @brief Called when notification of media db change is subscribed.
+ *
+ * @param[in] error The error code
+ * @param[in] pid pid which publish notification
+ * @param[in] update_item Update item of notification
+ * @param[in] update_type Update type of notification
+ * @param[in] media_type The type of media content(#media_content_type_e)
+ * @param[in] uuid UUID of media or directory, which is updated
+ * @param[in] path The path of media or directory
+ * @param[in] mime_type The mime type of media info
+ * @param[in] user_data The user data passed from the foreach function
+ * @pre media_content_db_update_subscribe()
+ * @see media_content_db_update_subscribe()
+ *
+ */
+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);
+
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE
@@ -275,6 +323,18 @@ typedef void (*media_insert_progress_cb)(media_content_error_e error, unsigned i
 typedef void (*media_insert_completed_cb)(media_content_error_e error, void * user_data);
 
 
+/**
+ * @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE
+ * @brief Called when burst shot is inserted completely.
+ *
+ * @param[in] media The handle to media info
+ * @param[in] user_data The user data passed from the foreach function
+ * @pre media_info_insert_burst_shot_to_db()
+ * @see media_info_insert_burst_shot_to_db()
+ *
+ */
+typedef void (*media_insert_burst_shot_completed_cb)(media_content_error_e error, void * user_data);
+
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE
@@ -461,6 +521,7 @@ typedef bool (*media_group_cb)(const char *group_name, void *user_data);
 #define MEDIA_HEIGHT "MEDIA_HEIGHT"    /**< media height*/
 #define MEDIA_DATETAKEN "MEDIA_DATETAKEN"      /**< media datetaken*/
 #define MEDIA_ORIENTATION "MEDIA_ORIENTATION"  /**< media orientation*/
+#define MEDIA_BURST_ID "BURST_ID" /**< media burst id*/
 #define MEDIA_PLAYED_COUNT "MEDIA_PLAYED_COUNT"        /**< media playedcount*/
 #define MEDIA_LAST_PLAYED_TIME "MEDIA_LAST_PLAYED_TIME"        /**< media last played time*/
 #define MEDIA_LAST_PLAYED_POSITION "MEDIA_LAST_PLAYED_POSITION"        /**< media last played position of file*/
@@ -475,6 +536,7 @@ typedef bool (*media_group_cb)(const char *group_name, void *user_data);
 #define MEDIA_KEYWORD "MEDIA_KEYWORD"  /**< media keyword*/
 #define MEDIA_IS_DRM "MEDIA_IS_DRM"    /**< is drm. 0-not drm, 1-drm*/
 #define MEDIA_STORAGE_TYPE "MEDIA_STORAGE_TYPE"        /**< media storage. 0-internal storage, 1-external storage*/
+
 /**
  * @}
  */
index e6d7762fada968fba76b9f2382e0ecbc2484cc46..c54562f921e68c53aeb30bf75a9e0664f133d722 100755 (executable)
@@ -116,6 +116,34 @@ int image_meta_get_orientation(image_meta_h image, media_content_orientation_e *
  */
 int image_meta_get_date_taken(image_meta_h image, char **date_taken);
 
+/**
+ * @brief Gets the burst shot id.
+ *
+ * @remarks @a burst id must be released with free() by you.
+ *
+ * @param[in] media The handle toimage metadata
+ * @param[out] burst_id The id of burst shot. if burst_id is NULL, this is not burst shot.
+ * @return 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
+ *
+ */
+int image_meta_get_burst_id(image_meta_h image, char **burst_id);
+
+/**
+ * @brief Checks whether the media is burst shot image.
+ *
+ * @param[in] media The handle to image metadata
+ * @param[out] is_burst_shot /@a true if the burst shot image,
+ *                    /@a false if not burst shot image.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ */
+int image_meta_is_burst_shot(image_meta_h image, bool *is_burst_shot);
+
 /**
  * @brief Sets the image orientation.
  *
index 5f6e17a2442ea45a58259c4746a9478965d7317e..b0741003f59d83f2dc570a0fb5dc777e1cb876f3 100755 (executable)
@@ -70,6 +70,24 @@ int media_info_insert_to_db (const char *path, media_info_h *info);
  */
 int media_info_insert_batch_to_db(const char **path_array,unsigned int array_length, media_insert_completed_cb callback, void *user_data);
 
+/**
+ * @brief Insert the burst shot images into the media database, asynchronously.
+ * @details This function insert the busrt images into the content storage.
+ * #media_insert_burst_shot_completed_cb will be called when insertion to media database is finished.
+ *
+ * @param[in] path_array The path array to the burst shot images
+ * @param[in] array_length The length of array
+ * @param[in] callback The callback to invoke when the images inserted completely
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 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
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ * @see media_insert_burst_shot_completed_cb()
+ */
+int media_info_insert_burst_shot_to_db(const char **path_array,unsigned int array_length, media_insert_burst_shot_completed_cb callback, void *user_data);
 
 /**
  * @brief Deletes media file from the media database.
@@ -377,7 +395,7 @@ int media_info_get_size(media_info_h media, unsigned long long *size);
  * @brief Gets added time.
  *
  * @param[in] media The handle to media info
- * @param[out] added_time The added time
+ * @param[out] added_time The added time to DB
  * @return 0 on success, otherwise a negative error value.
  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
@@ -389,7 +407,7 @@ int media_info_get_added_time(media_info_h media, time_t *added_time);
  * @brief Gets media info's date of modification.
  *
  * @param[in] media The handle to media info
- * @param[out] time The date of modification
+ * @param[out] time The date of modification of File. Get from File
  * @return 0 on success, otherwise a negative error value.
  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
@@ -913,7 +931,7 @@ int media_info_move_to_db(media_info_h media, const char* dst_path);
  * @param[in] user_data The user data to be passed to the callback function
  * @return 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_PARAMETER Invalid parameter ( Especially, if the request is duplicated, this error returns. )
  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
  * @pre This function requires opened connection to content service by media_content_connect().
  * @see media_content_connect()
index 9d1d6bbcb1cfc5e4d3ec1e664cd5b064b8df63ff..b334bbcc5bda003f0da9b133f37058cb76a929c4 100755 (executable)
@@ -85,6 +85,7 @@ typedef enum {
        MEDIA_PLAYLIST_ADD,
        MEDIA_PLAYLIST_REMOVE,
        MEDIA_PLAYLIST_UPDATE_PLAYLIST_NAME,
+       MEDIA_PLAYLIST_UPDATE_THUMBNAIL_PATH,
        MEDIA_PLAYLIST_UPDATE_PLAY_ORDER,
 } playlist_function_e;
 
@@ -99,6 +100,11 @@ typedef enum {
        MEDIA_GROUP_BOOKMARK_BY_MEDIA_ID,
 } group_list_e;
 
+typedef enum {
+       MEDIA_BATCH_INSERT_NORMAL,
+       MEDIA_BATCH_INSERT_BURSTSHOT,
+} media_batch_insert_e;
+
 typedef struct _filter_s
 {
        char *condition;
@@ -145,6 +151,7 @@ typedef struct
 {
        int playlist_id;        //playlist id
        char *name;             // playlist name
+       char *thumbnail_path;           //playlist thumbnail path
 }media_playlist_s;
 
 typedef struct
@@ -153,6 +160,7 @@ typedef struct
        int width;
        int height;
        char *date_taken;
+       char *burst_id;
        media_content_orientation_e orientation;
 }image_meta_s;
 
@@ -261,6 +269,7 @@ typedef struct
        char *media_id;         // media_uuid
        int function;                   // Add, remove, modify
        char *playlist_name;    // playlist_name
+       char *thumbnail_path;           //playlist thumbnail path
        int playlist_member_id; // playlist unique id of media. Same content which has same media_id can be added to Playlist
        int play_order;         //play_order
 }media_playlist_item_s;
@@ -284,6 +293,12 @@ typedef struct
        void *user_data;
 } media_insert_cb_s;
 
+typedef struct
+{
+       media_content_db_update_cb update_noti_cb;
+       void *user_data;
+} media_noti_cb_s;
+
 typedef struct attribute_s *attribute_h;
 
 
@@ -347,6 +362,7 @@ typedef struct _media_content_cb_data {
 #define DB_FIELD_MEDIA_HEIGHT                          "height"
 #define DB_FIELD_MEDIA_DATETAKEN                       "datetaken"
 #define DB_FIELD_MEDIA_ORIENTATION             "orientation"
+#define DB_FIELD_MEDIA_BURST_ID                        "burst_id"
 #define DB_FIELD_MEDIA_PLAYED_COUNT            "played_count"
 #define DB_FIELD_MEDIA_LAST_PLAYED_TIME                "last_played_time"
 #define DB_FIELD_MEDIA_LAST_PLAYED_POSITION    "last_played_position"
@@ -426,7 +442,7 @@ typedef struct _media_content_cb_data {
 //#define SELECT_TAG_LIST                              SELECT_EMPTY_TAG" UNION "SELECT_TAG_FROM_TAG_TAGMAP_MEDIA_JOIN
 //#define SELECT_PLAYLIST_LIST                 SELECT_EMPTY_PLAYLIST" UNION "SELECT_PLAYLIST_FROM_PLAYLIST_PLAYLISTMAP_MEDIA_JOIN
 #define SELECT_TAG_LIST                                "SELECT DISTINCT tag_id, name FROM "DB_VIEW_TAG" WHERE 1 "
-#define SELECT_PLAYLIST_LIST           "SELECT DISTINCT playlist_id, name FROM "DB_VIEW_PLAYLIST" WHERE 1 "
+#define SELECT_PLAYLIST_LIST           "SELECT DISTINCT playlist_id, name, thumbnail_path FROM "DB_VIEW_PLAYLIST" WHERE 1 "
 #define SELECT_BOOKMARK_LIST           "SELECT DISTINCT b.bookmark_id, b.media_uuid, b.marked_time, b.thumbnail_path FROM "BOOKMARK_MEDIA_JOIN
 
 /* Get Group Count */
@@ -446,6 +462,7 @@ typedef struct _media_content_cb_data {
 
 /* Get Media Count of Group */
 #define SELECT_MEDIA_COUNT_FROM_MEDIA                  "SELECT COUNT(*) FROM ("SELECT_MEDIA_ITEM               //to apply limit condition. "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1"
+#define SELECT_MEDIA_COUNT_FROM_MEDIA_SIMPLE   "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 "
 #define SELECT_MEDIA_COUNT_FROM_ALBUM                  "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 AND album_id='%d'"
 #define SELECT_MEDIA_COUNT_FROM_ARTIST                 "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 AND artist='%q'"
 #define SELECT_MEDIA_COUNT_FROM_GENRE                  "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 AND genre='%q'"
@@ -479,6 +496,7 @@ typedef struct _media_content_cb_data {
 /* Playlist Info */
 #define INSERT_PLAYLIST_TO_PLAYLIST                                            "INSERT INTO "DB_TABLE_PLAYLIST" (name) VALUES (%Q)"
 #define UPDATE_PLAYLIST_NAME_FROM_PLAYLIST                     "UPDATE "DB_TABLE_PLAYLIST" SET name='%q' WHERE playlist_id=%d"
+#define UPDATE_PLAYLIST_THUMBNAIL_FROM_PLAYLIST                        "UPDATE "DB_TABLE_PLAYLIST" SET thumbnail_path='%q' WHERE playlist_id=%d"
 #define SELECT_PLAYLIST_ID_FROM_PLAYLIST                               "SELECT playlist_id FROM "DB_TABLE_PLAYLIST" WHERE name='%q'"
 //#define SELECT_PLAYLIST_ITEM_ID_FROM_PLAYLIST_MAP            "SELECT pm._id, pm.media_uuid FROM "PLAYLISTMAP_MEDIA_JOIN" AND pm.playlist_id=%d"
 #define SELECT_PLAYLIST_ITEM_ID_FROM_PLAYLIST_VIEW             "SELECT pm_id, media_uuid FROM "DB_VIEW_PLAYLIST" WHERE playlist_id=%d "
@@ -511,7 +529,7 @@ typedef struct _media_content_cb_data {
 //#define MEDIA_INFO_ITEM "media_uuid, path, file_name, media_type, mime_type, size, added_time, modified_time, thumbnail_path, description,
 //                                                     rating, favourite, author, provider, content_name, category, location_tag, age_rating, is_drm, storage_type"
 #define MEDIA_INFO_ITEM "media_uuid, path, file_name, media_type, mime_type, size, added_time, modified_time, thumbnail_path, description, \
-                                                       rating, favourite, author, provider, content_name, category, location_tag, age_rating, keyword, is_drm, storage_type, longitude, latitude, altitude, width, height, datetaken, orientation, title, album, artist, genre, composer, year, recorded_date, copyright, track_num, bitrate, duration, played_count, last_played_time, last_played_position, samplerate, channel"
+                                                       rating, favourite, author, provider, content_name, category, location_tag, age_rating, keyword, is_drm, storage_type, longitude, latitude, altitude, width, height, datetaken, orientation, title, album, artist, genre, composer, year, recorded_date, copyright, track_num, bitrate, duration, played_count, last_played_time, last_played_position, samplerate, channel, burst_id"
 
 #define SELECT_MEDIA_ITEM                                      "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1"
 #define SELECT_MEDIA_FROM_MEDIA                        "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND media_uuid='%s'"
@@ -526,6 +544,7 @@ typedef struct _media_content_cb_data {
 #define SELECT_MEDIA_FROM_FOLDER                       "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND folder_uuid='%q'"
 #define SELECT_MEDIA_FROM_TAG                          "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE media_uuid IN (SELECT media_uuid FROM "DB_TABLE_TAG_MAP" WHERE tag_id=%d) AND validity=1"
 #define SELECT_MEDIA_FROM_PLAYLIST             "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE media_uuid IN (SELECT media_uuid FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d) AND validity=1"
+#define SELECT_MEDIA_PATH_BY_ID                        "SELECT path FROM "DB_TABLE_MEDIA" WHERE media_uuid='%q'"
 
 /* Delete */
 #define DELETE_MEDIA_FROM_MEDIA                                "DELETE FROM "DB_TABLE_MEDIA" WHERE media_uuid='%q'"
index 5786395716e9b2884177c811cfd027e081cf154a..ba3cdb0a8da7286b841479745b8e2a7257d95a5c 100755 (executable)
@@ -115,6 +115,10 @@ int media_playlist_foreach_media_from_db(int playlist_id, filter_h filter, playl
  * @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_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_NETWORK Network Fail
  * @pre This function requires opened connection to content service by media_content_connect().
  * @see media_content_connect()
  * @see media_playlist_delete_from_db()
@@ -145,7 +149,6 @@ int media_playlist_delete_from_db(int playlist_id);
  * @remarks @a playlist must be released with media_playlist_destroy() by you.
  *
  * @param[in] playlist_id The ID of media playlist
- * @param [in] filter The handle to audio filter
  * @param[out] playlist The media playlist handle associated with the playlist ID
  * @return 0 on success, otherwise a negative error value.
  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
@@ -155,7 +158,7 @@ int media_playlist_delete_from_db(int playlist_id);
  * @see media_playlist_destroy()
  *
  */
-int media_playlist_get_playlist_from_db(int playlist_id, filter_h filter, media_playlist_h *playlist);
+int media_playlist_get_playlist_from_db(int playlist_id, media_playlist_h *playlist);
 
 /**
  * @brief Destroys a playlist handle.
@@ -234,6 +237,36 @@ int media_playlist_get_name(media_playlist_h playlist, char **playlist_name);
  */
 int media_playlist_set_name(media_playlist_h playlist, const char *playlist_name);
 
+/**
+ * @brief Gets a thumbnail path of the playlist.
+ *
+ * @remarks @a path must be released with free() by you.
+ *
+ * @param [in] playlist The handle to media playlist
+ * @param [out] path The path of thumbnail
+ * @return 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_playlist_get_thumbnail_path(media_playlist_h playlist, char **path);
+
+/**
+ * @brief Sets the thumbnail path of the playlist.
+ *
+ * @param[in] playlist The handle to media playlist
+ * @param[in] path The path of thumbnail
+ * @return 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
+ * @post media_playlist_update_to_db()
+ *
+ */
+int media_playlist_set_thumbnail_path(media_playlist_h playlist, const char *path);
+
+
 /**
  * @brief Sets the played order in the playlist.
  *
index 539cb5a368f5f7f29b2ac3077dcbbec0a8941412..f59e2806ac2de1dfd225e75952ed089aab7d1af2 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-content-media-content
 Summary:    A Media content library in SLP C API
-Version: 0.2.36
+Version: 0.2.52
 Release:    0
 Group:      System/Libraries
 License:    Apache License, Version 2.0
index 161cd170b44e32d8c8d85adf9acbb9494564cf02..d6348702f26587dc6c7ff8a547cfbcd328dc34bf 100755 (executable)
@@ -26,6 +26,7 @@ static attribute_h g_alias_attr_handle = NULL;
 static MediaSvcHandle *db_handle = NULL;
 static int ref_count = 0;
 
+static __thread media_noti_cb_s *g_noti_info = NULL;
 
 static int __media_content_create_attr_handle(void);
 static int __media_content_create_alias_attr_handle(void);
@@ -131,6 +132,9 @@ static int __media_content_create_attr_handle(void)
        ret = _media_filter_attribute_add(g_attr_handle, MEDIA_ORIENTATION, DB_FIELD_MEDIA_ORIENTATION);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_BURST_ID, DB_FIELD_MEDIA_BURST_ID);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
        ret = _media_filter_attribute_add(g_attr_handle, MEDIA_PLAYED_COUNT, DB_FIELD_MEDIA_PLAYED_COUNT);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
@@ -297,6 +301,9 @@ static int __media_content_create_alias_attr_handle(void)
        ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_ORIENTATION, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ORIENTATION);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_BURST_ID, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_BURST_ID);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
        ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_PLAYED_COUNT, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_PLAYED_COUNT);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
@@ -487,7 +494,7 @@ int _content_error_capi(int type, int content_error)
        } else if(type == MEDIA_THUMBNAIL_TYPE) {
                if(content_error == MEDIA_THUMB_ERROR_NONE)
                        return MEDIA_CONTENT_ERROR_NONE;
-               else if(content_error == MEDIA_THUMB_ERROR_INVALID_PARAMETER)
+               else if(content_error == MEDIA_THUMB_ERROR_INVALID_PARAMETER || content_error == MEDIA_THUMB_ERROR_DUPLICATED_REQUEST)
                        return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
                else if(content_error == MEDIA_THUMB_ERROR_DB)
                        return MEDIA_CONTENT_ERROR_DB_FAILED;
@@ -513,6 +520,10 @@ int _content_error_capi(int type, int content_error)
                        return MEDIA_CONTENT_ERROR_DB_FAILED;
                else if(content_error == MS_MEDIA_ERR_SCANNING_BUSY)
                        return MEDIA_CONTENT_ERROR_DB_BUSY;
+               else if(content_error == MS_MEDIA_ERR_ALLOCATE_MEMORY_FAIL)
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               else if(content_error == MS_MEDIA_ERR_DBUS_GET || content_error == MS_MEDIA_ERR_DBUS_ADD_FILTER)
+                       return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
                else if(content_error == MS_MEDIA_ERR_VCONF_GET_FAIL)
                        return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
        }
@@ -633,57 +644,58 @@ int media_content_scan_file(const char *path)
 
        media_content_debug("Path : %s", path);
 
-       if (g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
-               /* This means this path has to be inserted or refreshed */
-               media_content_debug("This path exists in file system.");
-
-               media_svc_media_type_e media_type;
-               media_svc_storage_type_e storage_type;
-               char mime_type[255];
-
-               ret = media_svc_get_storage_type(path, &storage_type);
-               if (ret < 0) {
-                       media_content_error("media_svc_get_storage_type failed : %d (%s)", ret, path);
-                       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
-               }
+       if (g_file_test(path, G_FILE_TEST_EXISTS)) {
+               if (g_file_test(path, G_FILE_TEST_IS_REGULAR)) {
+                       /* This means this path has to be inserted or refreshed */
+                       media_content_debug("This path exists in file system.");
 
-               ret = media_svc_get_mime_type(path, mime_type);
-               if (ret < 0) {
-                       media_content_error("media_svc_get_mime_type failed : %d (%s)", ret, path);
-                       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
-               }
+                       media_svc_media_type_e media_type;
+                       media_svc_storage_type_e storage_type;
+                       char mime_type[255];
 
-               ret = media_svc_get_media_type(path, mime_type, &media_type);
-               if (ret < 0) {
-                       media_content_error("media_svc_get_media_type failed : %d (%s)", ret, path);
-                       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
-               }
+                       ret = media_svc_get_storage_type(path, &storage_type);
+                       if (ret < 0) {
+                               media_content_error("media_svc_get_storage_type failed : %d (%s)", ret, path);
+                               return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+                       }
 
-               ret = media_svc_check_item_exist_by_path(_content_get_db_handle(), path);
-               if (ret == MEDIA_INFO_ERROR_NONE) {
-                       /* Refresh */
-                       ret = media_svc_refresh_item(_content_get_db_handle(), storage_type, path, media_type);
+                       ret = media_svc_get_mime_type(path, mime_type);
                        if (ret < 0) {
-                               media_content_error("media_svc_refresh_item failed : %d", ret);
+                               media_content_error("media_svc_get_mime_type failed : %d (%s)", ret, path);
                                return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
                        }
 
-               } else if (ret == MEDIA_INFO_ERROR_DATABASE_NO_RECORD) {
-                       /* Insert */
-                       ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_type, path, mime_type, media_type);
+                       ret = media_svc_get_media_type(path, mime_type, &media_type);
                        if (ret < 0) {
-                               media_content_error("media_svc_insert_item_immediately failed : %d", ret);
+                               media_content_error("media_svc_get_media_type failed : %d (%s)", ret, path);
                                return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
                        }
 
-               } else {
-                       media_content_error("media_svc_check_item_exist_by_path failed : %d", ret);
-                       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+                       ret = media_svc_check_item_exist_by_path(_content_get_db_handle(), path);
+                       if (ret == MEDIA_INFO_ERROR_NONE) {
+                               /* Refresh */
+                               ret = media_svc_refresh_item(_content_get_db_handle(), storage_type, path, media_type);
+                               if (ret < 0) {
+                                       media_content_error("media_svc_refresh_item failed : %d", ret);
+                                       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+                               }
+
+                       } else if (ret == MEDIA_INFO_ERROR_DATABASE_NO_RECORD) {
+                               /* Insert */
+                               ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_type, path, mime_type, media_type);
+                               if (ret < 0) {
+                                       media_content_error("media_svc_insert_item_immediately failed : %d", ret);
+                                       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+                               }
+                       } else {
+                               media_content_error("media_svc_check_item_exist_by_path failed : %d", ret);
+                               return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+                       }
+               } else if (g_file_test(path, G_FILE_TEST_IS_DIR)) {
+                       /* Dierectory is not accpted in this function */
+                       media_content_error("This path is directory");
+                       return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
                }
-       } else if(g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
-               /* Dierectory is not accpted in this function */
-               media_content_error("This path is directory");
-               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        } else {
                /* This means this path has to be deleted */
                media_content_debug("This path doesn't exists in file system... So now start to delete it from DB");
@@ -714,7 +726,7 @@ void _media_content_scan_cb(media_request_result_s* result, void *user_data)
        return;
 }
 
-int media_content_scan_folder(const char *path, media_scan_completed_cb callback, void *user_data)
+int media_content_scan_folder(const char *path, bool is_recursive, media_scan_completed_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
@@ -733,10 +745,62 @@ int media_content_scan_folder(const char *path, media_scan_completed_cb callback
        cb_data->callback = callback;
        cb_data->user_data = user_data;
 
-       ret = media_directory_scanning_async(path, TRUE, _media_content_scan_cb, cb_data);
+       ret = media_directory_scanning_async(path, is_recursive, _media_content_scan_cb, cb_data);
        if (ret < 0) {
                media_content_error("media_directory_scanning_async failed : %d", ret);
        }
 
        return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
 }
+
+void _media_content_db_update_noti_cb(
+                                                       int pid,
+                                                       media_item_type_e item,
+                                                       media_item_update_type_e update_type,
+                                                       char* path,
+                                                       char* uuid,
+                                                       media_type_e content_type,
+                                                       char *mime_type,
+                                                       void *user_data)
+{
+       int error_value = MEDIA_CONTENT_ERROR_NONE;
+
+       media_noti_cb_s *_noti_info = (media_noti_cb_s *)user_data;
+
+       if(_noti_info != NULL)
+       {
+               if (_noti_info->update_noti_cb)
+                       _noti_info->update_noti_cb(error_value, pid, item, update_type, content_type, uuid, path, mime_type, _noti_info->user_data);
+       }
+
+       return;
+}
+
+int media_content_set_db_updated_cb(media_content_db_update_cb callback, void *user_data)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       g_noti_info = (media_noti_cb_s*)calloc(1, sizeof(media_noti_cb_s));
+       if (g_noti_info == NULL) {
+               media_content_error("Failed to create noti info");
+               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+       }
+
+       g_noti_info->update_noti_cb = callback;
+       g_noti_info->user_data = user_data;
+
+       ret = media_db_update_subscribe(_media_content_db_update_noti_cb, (void *)g_noti_info);
+
+       return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
+}
+
+int media_content_unset_db_updated_cb()
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       SAFE_FREE(g_noti_info);
+       ret = media_db_update_unsubscribe();
+
+       return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
+}
+
index 0846bacabfd20f97ebf77dc4e882c403240b9563..cfaead3b105a6774f76f2d1603740816e19beb5f 100755 (executable)
@@ -60,6 +60,8 @@ static char * __media_db_get_group_name(media_group_e group)
                        return DB_FIELD_MEDIA_LATITUDE;
                case MEDIA_CONTENT_GROUP_ALTITUDE:
                        return DB_FIELD_MEDIA_ALTITUDE;
+               case MEDIA_CONTENT_GROUP_BURST_IMAGE:
+                       return DB_FIELD_MEDIA_BURST_ID;
                case MEDIA_CONTENT_GROUP_RATING:
                        return DB_FIELD_MEDIA_RATING;
                case MEDIA_CONTENT_GROUP_AUTHOR:
@@ -561,6 +563,9 @@ int _media_db_get_playlist(filter_h filter, media_playlist_cb callback, void *us
                if(STRING_VALID((const char *)sqlite3_column_text(stmt, 1)))
                        _playlist->name = strdup((const char *)sqlite3_column_text(stmt, 1));
 
+               if(STRING_VALID((const char *)sqlite3_column_text(stmt, 2)))
+                       _playlist->thumbnail_path = strdup((const char *)sqlite3_column_text(stmt, 2));
+
                if(callback((media_playlist_h)_playlist, user_data) == false)
                {
                        media_playlist_destroy((media_playlist_h)_playlist);
@@ -928,12 +933,26 @@ int _media_db_get_group_item_count(const char *group_name, filter_h filter, grou
        char *select_query = NULL;
        char *condition_query = NULL;
        char *option_query = NULL;
+       bool is_simple = FALSE;
 
        media_content_debug_func();
 
        if(group_type == MEDIA_GROUP_NONE)
        {
-               select_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_MEDIA);
+               /* There are 2 ways to get count for media table for performance 
+                       If user wants to set offset and count, use SQL SELECT_MEDIA_COUNT_FROM_MEDIA.
+                       If user wants to get count without setting count, SELECT_MEDIA_COUNT_FROM_MEDIA_SIMPLE */
+               _filter = (filter_s *)filter;
+               if (_filter) {
+                       if ((_filter->offset < 0) && (_filter->count < 0)) {
+                               select_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_MEDIA_SIMPLE);
+                               is_simple = TRUE;
+                       } else {
+                               select_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_MEDIA);
+                       }
+               } else {
+                       select_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_MEDIA);
+               }
        }
        else if(group_type == MEDIA_GROUP_FOLDER)
        {
@@ -995,7 +1014,8 @@ int _media_db_get_group_item_count(const char *group_name, filter_h filter, grou
                if(STRING_VALID(option_query))
                        SAFE_STRLCAT(complete_select_query, option_query, sizeof(complete_select_query));
 
-               SAFE_STRLCAT(complete_select_query, QUERY_KEYWORD_BRACKET, sizeof(complete_select_query));
+               if (!is_simple)
+                       SAFE_STRLCAT(complete_select_query, QUERY_KEYWORD_BRACKET, sizeof(complete_select_query));
 
                SAFE_FREE(condition_query);
                SAFE_FREE(option_query);
index be78a0662138b0b3c1d40e9a3748f8a2aafc20ca..26a99c8733ef78a96913b80de32d524f855061dc 100755 (executable)
@@ -85,8 +85,8 @@ static void __filter_attribute_free_value(gpointer key, gpointer value, gpointer
 
 static char *__media_filter_replace_attr(attribute_h attr, char *name)
 {
-       char *key_temp;
-       char *generated_value;
+       char *key_temp = NULL;
+       char *generated_value = NULL;
        attribute_s *_attr = (attribute_s *)attr;
 
        if(!g_hash_table_lookup_extended(_attr->attr_map,
@@ -316,7 +316,7 @@ static int __tokenize(GList **token_list, const char *str)
                        {
                                if(tmp[j] == media_token[1][0] && tmp[j+1] == media_token[1][0])
                                {
-                                       j += 2;
+                                       j += 1;
                                        continue;
                                }
                                if(tmp[j] == media_token[1][0])
@@ -354,7 +354,7 @@ static int __tokenize(GList **token_list, const char *str)
                        {
                                if(tmp[j] == media_token[2][0] && tmp[j+1] == media_token[2][0])
                                {
-                                       j += 2;
+                                       j += 1;
                                        continue;
                                }
                                if(tmp[j] == media_token[2][0])
index c317654a22fced428c79e3b095cded0027f942b0..41c329cd8825244320f7a38c76cdcf90fa802034 100755 (executable)
@@ -32,6 +32,7 @@ int image_meta_destroy(image_meta_h image)
        {
                SAFE_FREE(_image->media_id);
                SAFE_FREE(_image->date_taken);
+               SAFE_FREE(_image->burst_id);
                SAFE_FREE(_image);
 
                ret = MEDIA_CONTENT_ERROR_NONE;
@@ -70,7 +71,6 @@ int image_meta_clone(image_meta_h *dst, image_meta_h src)
                                image_meta_destroy((image_meta_h)_dst);
                                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                        }
-                       _dst->media_id = strdup(_src->media_id);
                }
 
                if(STRING_VALID(_src->date_taken))
@@ -82,7 +82,17 @@ int image_meta_clone(image_meta_h *dst, image_meta_h src)
                                image_meta_destroy((image_meta_h)_dst);
                                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                        }
-                       _dst->date_taken = strdup(_src->date_taken);
+               }
+
+               if(STRING_VALID(_src->burst_id))
+               {
+                       _dst->burst_id = strdup(_src->burst_id);
+                       if(_dst->burst_id == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               image_meta_destroy((image_meta_h)_dst);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
                }
 
                _dst->width = _src->width;
@@ -107,7 +117,7 @@ int image_meta_get_media_id(image_meta_h image, char **media_id)
        int ret = MEDIA_CONTENT_ERROR_NONE;
        image_meta_s *_image = (image_meta_s*)image;
 
-       if(_image)
+       if(_image && media_id)
        {
                if(STRING_VALID(_image->media_id))
                {
@@ -177,7 +187,8 @@ int image_meta_get_orientation(image_meta_h image, media_content_orientation_e*
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        image_meta_s *_image = (image_meta_s*)image;
-       if(_image)
+
+       if(_image && orientation)
        {
                *orientation = _image->orientation;
                ret = MEDIA_CONTENT_ERROR_NONE;
@@ -196,7 +207,7 @@ int image_meta_get_date_taken(image_meta_h image, char **date_taken)
        int ret = MEDIA_CONTENT_ERROR_NONE;
        image_meta_s *_image = (image_meta_s*)image;
 
-       if(_image)
+       if(_image && date_taken)
        {
                if(STRING_VALID(_image->date_taken))
                {
@@ -224,6 +235,59 @@ int image_meta_get_date_taken(image_meta_h image, char **date_taken)
        return ret;
 }
 
+int image_meta_get_burst_id(image_meta_h image, char **burst_id)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       image_meta_s *_image = (image_meta_s*)image;
+
+       if(_image && burst_id)
+       {
+               if(STRING_VALID(_image->burst_id))
+               {
+                       *burst_id = strdup(_image->burst_id);
+                       if(*burst_id == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+               else
+               {
+                       *burst_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 image_meta_is_burst_shot(image_meta_h image, bool *is_burst_shot)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       image_meta_s *_image = (image_meta_s*)image;
+
+       if(_image && is_burst_shot)
+       {
+               if(STRING_VALID(_image->burst_id))
+                       *is_burst_shot = true;
+               else
+                       *is_burst_shot = false;
+
+               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 image_meta_set_orientation(image_meta_h image, media_content_orientation_e orientation)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
index 2e24b117e0c1dccc9bdebf594ed937f9153e37a4..fcadf94c58d2b67e7b64dd4e73e971a14377cad5 100755 (executable)
@@ -26,6 +26,7 @@ static int __media_info_get_media_info_from_db(char *path, media_info_h media);
 static void __media_info_insert_completed_cb(media_request_result_s *result, void *user_data);
 static void __media_info_thumbnail_completed_cb(int error, const char *path, void *user_data);
 static bool __media_info_delete_batch_cb(media_info_h media, void *user_data);
+static int __media_info_insert_batch(media_batch_insert_e insert_type, const char **path_array, unsigned int array_length, media_insert_completed_cb completed_cb, void *user_data);
 
 static int __media_info_get_media_info_from_db(char *path, media_info_h media)
 {
@@ -65,6 +66,39 @@ static int __media_info_get_media_info_from_db(char *path, media_info_h media)
        return ret;
 }
 
+static int __media_info_get_media_path_by_id_from_db(const char *media_id, char **path)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       sqlite3_stmt *stmt = NULL;
+       char *select_query = NULL;
+
+       if(!STRING_VALID(media_id))
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       select_query = sqlite3_mprintf(SELECT_MEDIA_PATH_BY_ID, media_id);
+
+       ret = _content_query_prepare(&stmt, select_query, NULL, NULL);
+       sqlite3_free(select_query);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       if(sqlite3_step(stmt) == SQLITE_ROW)
+       {
+               if(STRING_VALID((const char *)sqlite3_column_text(stmt, 0)))
+                       *path = strdup((const char *)sqlite3_column_text(stmt, 0));
+       } else {
+               media_content_debug("There's no media with this ID : %s", media_id);
+               *path = NULL;
+               ret = MEDIA_CONTENT_ERROR_DB_FAILED;
+       }
+
+       SQLITE3_FINALIZE(stmt);
+
+       return ret;
+}
+
 static void __media_info_insert_completed_cb(media_request_result_s *result, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -225,6 +259,9 @@ void _media_info_item_get_detail(sqlite3_stmt* stmt, media_info_h media)
                                _media->image_meta->date_taken = strdup((const char *)sqlite3_column_text(stmt, 26));
                
                        _media->image_meta->orientation = sqlite3_column_int(stmt, 27);
+
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 44)))
+                               _media->image_meta->burst_id = strdup((const char *)sqlite3_column_text(stmt, 44));
                }
 
        } else if(_media->media_type == MEDIA_CONTENT_TYPE_VIDEO) {
@@ -331,6 +368,7 @@ int media_info_insert_to_db (const char *path, media_info_h *info)
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
+#if 0
        media_content_debug("Register: %s", path);
        ret = media_file_register(path);
        if(ret != MS_MEDIA_ERR_NONE)
@@ -339,6 +377,46 @@ int media_info_insert_to_db (const char *path, media_info_h *info)
                return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
        }
 
+#else
+       ret = media_svc_check_item_exist_by_path(_content_get_db_handle(), path);
+       if (ret == MEDIA_INFO_ERROR_DATABASE_NO_RECORD) {
+               media_content_debug("media_svc_check_item_exist_by_path : no record : %s", path);
+
+               media_svc_media_type_e media_type;
+               media_svc_storage_type_e storage_type;
+               char mime_type[255] = {0, };
+
+               ret = media_svc_get_storage_type(path, &storage_type);
+               if (ret < 0) {
+                       media_content_error("media_svc_get_storage_type failed : %d (%s)", ret, path);
+                       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+               }
+
+               ret = media_svc_get_mime_type(path, mime_type);
+               if (ret < 0) {
+                       media_content_error("media_svc_get_mime_type failed : %d (%s)", ret, path);
+                       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+               }
+
+               ret = media_svc_get_media_type(path, mime_type, &media_type);
+               if (ret < 0) {
+                       media_content_error("media_svc_get_media_type failed : %d (%s)", ret, path);
+                       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+               }
+
+               media_content_debug("media_svc_insert_item_immediately: %s", path);
+               ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_type, path, mime_type, media_type);
+
+               if (ret < 0) {
+                       media_content_error("media_svc_insert_item_immediately failed : %d (%s)", ret, path);
+                       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+               }
+       } else if (ret != MEDIA_INFO_ERROR_NONE) {
+               media_content_error("media_svc_check_item_exist_by_path failed : %d (%s)", ret, path);
+               return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+       }
+#endif
+
        media_info_s *_media = (media_info_s*)calloc(1, sizeof(media_info_s));
        if(_media == NULL)
        {
@@ -357,37 +435,22 @@ int media_info_insert_to_db (const char *path, media_info_h *info)
        ret = __media_info_get_media_info_from_db(_media->file_path, (media_info_h)_media);
 
        *info = (media_info_h)_media;
-
        return ret;
 }
 
-int media_info_insert_batch_to_db(
-                                       const char **path_array,
+static int __media_info_insert_batch(media_batch_insert_e insert_type, const char **path_array,
                                        unsigned int array_length,
                                        media_insert_completed_cb completed_cb,
                                        void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-
-       if (path_array == NULL)
-       {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
-               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
-       }
-
-       if (array_length <= 0)
-       {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
-               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
-       }
-
        FILE *fp = NULL;
        char list_path[255] = {0,};
-       int i;
+       int idx = 0;
        int nwrites = 0;
 
-       for (i = 0; i < BATCH_REQUEST_MAX; i++) {
-               snprintf(list_path, sizeof(list_path), "%s/request-%ld-%d", MEDIA_CONTENT_INSERT_FILES_PATH, media_content_gettid(), i);
+       for (idx = 0; idx < BATCH_REQUEST_MAX; idx++) {
+               snprintf(list_path, sizeof(list_path), "%s/request-%ld-%d", MEDIA_CONTENT_INSERT_FILES_PATH, media_content_gettid(), idx);
 
                if (g_file_test(list_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
                        memset(list_path, 0x00, sizeof(list_path));
@@ -398,7 +461,7 @@ int media_info_insert_batch_to_db(
                }
        }
 
-       if (i == BATCH_REQUEST_MAX) {
+       if (idx == BATCH_REQUEST_MAX) {
                media_content_error("Too many batch request for one thread");
                return MEDIA_CONTENT_ERROR_DB_BUSY;
        }
@@ -409,11 +472,11 @@ int media_info_insert_batch_to_db(
                return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
        }
 
-       for (i = 0; i < array_length; i++) {
-               if (STRING_VALID(path_array[i])) {
-                       int size = strlen(path_array[i]);
+       for (idx = 0; idx < array_length; idx++) {
+               if (STRING_VALID(path_array[idx])) {
+                       int size = strlen(path_array[idx]);
 
-                       nwrites = fwrite(path_array[i], 1, size, fp);
+                       nwrites = fwrite(path_array[idx], 1, size, fp);
                        if (nwrites != size) {
                                media_content_error("failed to write thumbnail : %s", strerror(errno));
                                fclose(fp);
@@ -433,7 +496,7 @@ int media_info_insert_batch_to_db(
                                return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
                        }
                } else {
-                       media_content_error("path[%d] is invalid string", i);
+                       media_content_error("path[%d] is invalid string", idx);
                }
        }
 
@@ -444,9 +507,14 @@ int media_info_insert_batch_to_db(
        _cb_data->user_data = user_data;
        _cb_data->insert_list_path = strdup(list_path);
 
-       ret = media_files_register(list_path, __media_info_insert_completed_cb, _cb_data);
+       if(insert_type == MEDIA_BATCH_INSERT_NORMAL)
+               ret = media_files_register(list_path, __media_info_insert_completed_cb, _cb_data);
+       else if(insert_type == MEDIA_BATCH_INSERT_BURSTSHOT)
+               ret = media_burstshot_register(list_path, __media_info_insert_completed_cb, _cb_data);
+       else
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
 
-       if (ret < 0) {
+       if (ret != MEDIA_CONTENT_ERROR_NONE) {
                media_content_error("media_files_register failed : %d", ret);
                if (unlink(list_path) < 0) {
                        media_content_error("failed to delete : %s", strerror(errno));
@@ -454,74 +522,59 @@ int media_info_insert_batch_to_db(
                return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
        }
 
-#if 0
-       ret = media_svc_insert_item_begin(_content_get_db_handle(), array_length);
-       if (ret < 0)
+       return ret;
+}
+
+int media_info_insert_batch_to_db(
+                                       const char **path_array,
+                                       unsigned int array_length,
+                                       media_insert_completed_cb completed_cb,
+                                       void *user_data)
+{
+       if (path_array == NULL)
        {
-               media_content_error("media_svc_insert_item_begin failed : %d", ret);
-               return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       char *path = NULL;
-       media_svc_media_type_e media_type;
-       media_svc_storage_type_e storage_type;
-       char mime_type[255];
-
-       for (i = 0; i < array_length; i++) {
-               memset(mime_type, 0x00, sizeof(mime_type));
-               path = (char*)path_array[i];
-
-               ret = media_svc_get_storage_type(path, &storage_type);
-               if (ret < 0) {
-                       media_content_error("media_svc_get_storage_type failed : %d (%s)", ret, path);
-                       continue;
-               }
-
-               ret = media_svc_get_mime_type(path, mime_type);
-               if (ret < 0) {
-                       media_content_error("media_svc_get_mime_type failed : %d (%s)", ret, path);
-                       continue;
-               }
+       if (array_length <= 0)
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
 
-               ret = media_svc_get_media_type(path, mime_type, &media_type);
-               if (ret < 0) {
-                       media_content_error("media_svc_get_media_type failed : %d (%s)", ret, path);
-                       continue;
-               }
+       return __media_info_insert_batch(MEDIA_BATCH_INSERT_NORMAL, path_array, array_length, completed_cb, user_data);
+}
 
-               ret = media_svc_insert_item_bulk(_content_get_db_handle(), storage_type, path, mime_type, media_type);
-               if (ret < 0) {
-                       media_content_error("media_svc_insert_item_bulk failed : %d (%s)", ret, path);
-                       continue;
-               }
+int media_info_insert_burst_shot_to_db(const char **path_array, unsigned int array_length, media_insert_burst_shot_completed_cb callback, void *user_data)
+{
+       if (path_array == NULL)
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       ret = media_svc_insert_item_end(_content_get_db_handle());
-       if (ret < 0)
+       if (array_length <= 0)
        {
-               media_content_error("media_svc_insert_item_end failed : %d", ret);
-               return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       if (completed_cb) {
-               completed_cb(MEDIA_CONTENT_ERROR_NONE, user_data);
-       }
-#endif
-       return ret;
+       return __media_info_insert_batch(MEDIA_BATCH_INSERT_BURSTSHOT, path_array, array_length, callback, user_data);
 }
 
 int media_info_delete_from_db(const char *media_id)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       char *query_string = NULL;
-
        if(!STRING_VALID(media_id))
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
+#if 0
+       char *query_string = NULL;
        query_string = sqlite3_mprintf(DELETE_MEDIA_FROM_MEDIA, media_id);
 
        ret = _content_query_sql(query_string);
@@ -529,6 +582,21 @@ int media_info_delete_from_db(const char *media_id)
        sqlite3_free(query_string);
 
        return ret;
+#else
+       char *path = NULL;
+
+       ret = __media_info_get_media_path_by_id_from_db(media_id, &path);
+       if (ret < MEDIA_CONTENT_ERROR_NONE) {
+               media_content_error("__media_info_get_media_path_by_id_from_db failed : %d", ret);
+               SAFE_FREE(path);
+               return ret;
+       }
+
+       ret = media_svc_delete_item_by_path(_content_get_db_handle(), path);
+       SAFE_FREE(path);
+
+       return _content_error_capi(ret,MEDIA_CONTENT_TYPE);
+#endif
 }
 
 int media_info_delete_batch_from_db(filter_h filter)
@@ -569,6 +637,14 @@ int media_info_delete_batch_from_db(filter_h filter)
        }
 
        ret = _content_query_sql(query_string);
+       if (ret == MEDIA_CONTENT_ERROR_NONE) {
+               /*  Send notification for this
+                       In this case, send noti for internal storage and external storage
+               */
+               media_content_debug("Batch deletion is successfull. Send notification for this");
+               media_db_update_send(getpid(), MS_MEDIA_ITEM_DIRECTORY, MS_MEDIA_ITEM_UPDATE, MEDIA_CONTENT_PATH_PHONE, NULL, -1, NULL);
+               media_db_update_send(getpid(), MS_MEDIA_ITEM_DIRECTORY, MS_MEDIA_ITEM_UPDATE, MEDIA_CONTENT_PATH_MMC, NULL, -1, NULL);
+       }
 
        SAFE_FREE(condition_query);
        sqlite3_free(query_string);
@@ -600,6 +676,7 @@ int media_info_destroy(media_info_h media)
                if(_media->image_meta) {
                        SAFE_FREE(_media->image_meta->media_id);
                        SAFE_FREE(_media->image_meta->date_taken);
+                       SAFE_FREE(_media->image_meta->burst_id);
 
                        SAFE_FREE(_media->image_meta);
                } else if(_media->video_meta) {
@@ -800,6 +877,7 @@ int media_info_clone(media_info_h *dst, media_info_h src)
                _dst->rating = _src->rating;
                _dst->favourite = _src->favourite;
                _dst->is_drm = _src->is_drm;
+               _dst->storage_type = _src->storage_type;
 
                if(_src->media_type == MEDIA_CONTENT_TYPE_IMAGE && _src->image_meta) {
                        _dst->image_meta = (image_meta_s *)calloc(1, sizeof(image_meta_s));
@@ -820,6 +898,7 @@ int media_info_clone(media_info_h *dst, media_info_h src)
                                        return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                                }
                        }
+
                        if(STRING_VALID(_src->image_meta->date_taken))
                        {
                                _dst->image_meta->date_taken = strdup(_src->image_meta->date_taken);
@@ -831,6 +910,16 @@ int media_info_clone(media_info_h *dst, media_info_h src)
                                }
                        }
 
+                       if(STRING_VALID(_src->image_meta->burst_id))
+                       {
+                               _dst->image_meta->burst_id = strdup(_src->image_meta->burst_id);
+                               if(_dst->image_meta->burst_id == NULL)
+                               {
+                                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                       media_info_destroy((media_info_h)_dst);
+                                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                               }
+                       }
                        _dst->image_meta->width = _src->image_meta->width;
                        _dst->image_meta->height = _src->image_meta->height;
                        _dst->image_meta->orientation = _src->image_meta->orientation;
@@ -1242,6 +1331,10 @@ int media_info_get_image(media_info_h media, image_meta_h *image)
                _image->date_taken = strdup(_media->image_meta->date_taken);
        }
 
+       if(STRING_VALID(_media->image_meta->burst_id)) {
+               _image->burst_id = strdup(_media->image_meta->burst_id);
+       }
+
        *image = (image_meta_h)_image;
 
        return ret;
@@ -2472,6 +2565,15 @@ int media_info_update_to_db(media_info_h media)
                }
 
                ret = _content_query_sql(sql);
+               if (ret == MEDIA_CONTENT_ERROR_NONE) {
+                       /*  Send notification for this update */
+                       media_content_debug("Update is successfull. Send notification for this");
+                       if (_media->file_path && _media->mime_type) {
+                               media_db_update_send(getpid(), MS_MEDIA_ITEM_FILE, MS_MEDIA_ITEM_UPDATE, _media->file_path, _media->media_id, _media->media_type, _media->mime_type);
+                       } else {
+                               media_content_error("Can't media_db_update_send : path or mime type is NULL");
+                       }
+               }
        }
        else
        {
index d4dc1f8e9fdd294660cd5d22d1bd6d4fe985de2c..049313bb238eae8105892194303e380d3d413f78 100755 (executable)
@@ -29,6 +29,7 @@ static int __media_playlist_insert_playlist_record(const char *playlist_name, in
 static int __media_playlist_insert_item_to_playlist(int playlist_id, const char *media_id);
 static int __media_playlist_remove_item_from_playlist(int playlist_id, int playlist_member_id);
 static int __media_playlist_update_playlist_name(int playlist_id, const char *playlist_name);
+static int __media_playlist_update_thumbnail_path(int playlist_id, const char *path);
 static int __media_playlist_update_play_order(int playlist_id, int playlist_member_id, int play_order);
 
 static void __media_playlist_item_add(media_playlist_item_s *item_s)
@@ -53,6 +54,7 @@ static void __media_playlist_item_release(void)
                {
                        SAFE_FREE(item->media_id);
                        SAFE_FREE(item->playlist_name);
+                       SAFE_FREE(item->thumbnail_path);
                        SAFE_FREE(item);
                }
        }
@@ -150,6 +152,19 @@ static int __media_playlist_update_playlist_name(int playlist_id, const char *pl
        return ret;
 }
 
+static int __media_playlist_update_thumbnail_path(int playlist_id, const char *path)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       char *query_str = NULL;
+
+       query_str = sqlite3_mprintf(UPDATE_PLAYLIST_THUMBNAIL_FROM_PLAYLIST, path, playlist_id);
+
+       ret = _content_query_sql(query_str);
+       sqlite3_free(query_str);
+
+       return ret;
+}
+
 static int __media_playlist_update_play_order(int playlist_id, int playlist_member_id, int play_order)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -365,7 +380,7 @@ int media_playlist_clone(media_playlist_h *dst, media_playlist_h src)
        return ret;
 }
 
-int media_playlist_get_playlist_from_db(int playlist_id, filter_h filter, media_playlist_h *playlist)
+int media_playlist_get_playlist_from_db(int playlist_id, media_playlist_h *playlist)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        sqlite3_stmt *stmt = NULL;
@@ -387,6 +402,8 @@ int media_playlist_get_playlist_from_db(int playlist_id, filter_h filter, media_
                        _playlist->playlist_id = (int)sqlite3_column_int(stmt, 0);
                        if(STRING_VALID((const char *)sqlite3_column_text(stmt, 1)))
                                _playlist->name = strdup((const char *)sqlite3_column_text(stmt, 1));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 2)))
+                               _playlist->thumbnail_path = strdup((const char *)sqlite3_column_text(stmt, 2));
 
                        *playlist = (media_playlist_h)_playlist;
                }
@@ -452,6 +469,37 @@ int media_playlist_get_name(media_playlist_h playlist, char **name)
        return ret;
 }
 
+int media_playlist_get_thumbnail_path(media_playlist_h playlist, char **path)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       media_playlist_s *_playlist = (media_playlist_s*)playlist;
+       if(_playlist)
+       {
+               if(STRING_VALID(_playlist->thumbnail_path))
+               {
+                       *path = strdup(_playlist->thumbnail_path);
+                       if(*path == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+               else
+               {
+                       *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_playlist_get_play_order(media_playlist_h playlist, int playlist_member_id, int *play_order)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -525,6 +573,46 @@ int media_playlist_set_name(media_playlist_h playlist, const char *playlist_name
        return ret;
 }
 
+int media_playlist_set_thumbnail_path(media_playlist_h playlist, const char *path)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       media_playlist_s *_playlist = (media_playlist_s*)playlist;
+
+       if(_playlist != NULL && STRING_VALID(path))
+       {
+               SAFE_FREE(_playlist->thumbnail_path);
+
+               media_playlist_item_s *item = (media_playlist_item_s*)calloc(1, sizeof(media_playlist_item_s));
+
+               item->thumbnail_path = strdup(path);
+               item->function = MEDIA_PLAYLIST_UPDATE_THUMBNAIL_PATH;
+               if(item->thumbnail_path == NULL)
+               {
+                       SAFE_FREE(item);
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               }
+
+               _playlist->thumbnail_path = strdup(path);
+               if(_playlist->thumbnail_path == NULL)
+               {
+                       SAFE_FREE(item->thumbnail_path);
+                       SAFE_FREE(item);
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               }
+
+               __media_playlist_item_add(item);
+       }
+       else
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       return ret;
+}
+
 int media_playlist_set_play_order(media_playlist_h playlist, int playlist_member_id, int play_order)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -641,6 +729,12 @@ int media_playlist_update_to_db(media_playlist_h playlist)
                                }
                                break;
 
+                               case MEDIA_PLAYLIST_UPDATE_THUMBNAIL_PATH:
+                               {
+                                       ret = __media_playlist_update_thumbnail_path(_playlist->playlist_id, _playlist_item->thumbnail_path);
+                               }
+                               break;
+
                                case MEDIA_PLAYLIST_UPDATE_PLAY_ORDER:
                                {
                                        ret = __media_playlist_update_play_order(_playlist->playlist_id, _playlist_item->playlist_member_id, _playlist_item->play_order);
index 86c0f59b4311d7480decc79f0ab6cba23c197a7a..541865f36bf6bf7f4570953723d69ac1dfa8ac6c 100755 (executable)
@@ -344,6 +344,8 @@ bool media_item_cb(media_info_h media, void *user_data)
        {
                image_meta_h image;
                media_content_orientation_e orientation = 0;
+               bool is_burst_shot = false;
+               char *burst_id = NULL;
 
                if(media_info_get_image(media, &image) == MEDIA_CONTENT_ERROR_NONE)
                {
@@ -353,6 +355,20 @@ bool media_item_cb(media_info_h media, void *user_data)
                        else
                                media_content_debug("[image] orientation : %d", orientation);
 
+                       ret = image_meta_is_burst_shot(image, &is_burst_shot);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("error image_meta_is_burst_shot : [%d]", ret);
+                       if(is_burst_shot)
+                       {
+                               ret = image_meta_get_burst_id(image, &burst_id);
+                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                       media_content_error("error image_meta_get_burst_id : [%d]", ret);
+                               else
+                                       media_content_debug("[image] burst_id : [%s]", burst_id);
+
+                               SAFE_FREE(burst_id);
+                       }
+
                        ret = image_meta_destroy(image);
                        if(ret != MEDIA_CONTENT_ERROR_NONE)
                                media_content_error("error image_meta_destroy : [%d]", ret);
@@ -626,6 +642,7 @@ bool playlist_list_cb(media_playlist_h playlist, void *user_data)
        int playlist_id = 0;
        char *playlist_name = NULL;
        media_playlist_h playlist_h;
+       char *playlist_thumbnail_path = NULL;
 
        media_content_debug("playlist_list_cb ======");
 
@@ -647,7 +664,11 @@ bool playlist_list_cb(media_playlist_h playlist, void *user_data)
        media_content_debug("playlist_name : %s", playlist_name);
        SAFE_FREE(playlist_name);
 
-       media_playlist_get_playlist_from_db(playlist_id, NULL, &playlist_h);
+       media_playlist_get_thumbnail_path(playlist, &playlist_thumbnail_path);
+       media_content_debug("playlist_thumbnail_path : %s", playlist_thumbnail_path);
+       SAFE_FREE(playlist_thumbnail_path);
+
+       media_playlist_get_playlist_from_db(playlist_id, &playlist_h);
 
        media_playlist_destroy(playlist_h);
 
@@ -1027,6 +1048,7 @@ int test_gallery_scenario(void)
                                int width = 0, height = 0;
                                media_content_orientation_e orientation = 0;
                                char *datetaken = NULL;
+                               char *burst_id = NULL;
 
                                ret = media_info_get_image(media_handle, &image_handle);
                                if(ret != MEDIA_CONTENT_ERROR_NONE) {
@@ -1044,12 +1066,16 @@ int test_gallery_scenario(void)
                                        ret = image_meta_get_date_taken(image_handle, &datetaken);
                                        if(ret != MEDIA_CONTENT_ERROR_NONE)
                                                media_content_error("error image_meta_get_date_taken : [%d]", ret);
+                                       ret = image_meta_get_burst_id(image_handle, &burst_id);
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                               media_content_error("error image_meta_get_burst_id : [%d]", ret);
 
                                        media_content_debug("This is Image");
                                        media_content_debug("Width : %d, Height : %d, Orientation : %d, Date taken : %s", width, height, orientation, datetaken);
                                }
 
                                SAFE_FREE(datetaken);
+                               SAFE_FREE(burst_id);
                                ret = image_meta_destroy(image_handle);
                                if(ret != MEDIA_CONTENT_ERROR_NONE)
                                        media_content_error("error image_meta_destroy : [%d]", ret);
@@ -1620,6 +1646,12 @@ int test_playlist_operation(void)
                media_playlist_add_media(playlist_1, test_audio_id);
                media_playlist_add_media(playlist_1, test_audio_id);
                media_playlist_add_media(playlist_1, test_video_id);
+
+               #if 0
+               char *playlist_thumb_path = "/opt/usr/media/Images/Default.jpg";
+               media_playlist_set_thumbnail_path(playlist_1, playlist_thumb_path);
+               #endif
+
                media_playlist_update_to_db(playlist_1);
        }
 
@@ -2561,7 +2593,7 @@ int DFT_test(void)
        printf("Voice Memo size = [%d]\n", g_total_voice_memo_size);
        ret = media_filter_destroy(filter);
 
-       return 0;
+       return ret;
 }
 
 void insert_batch_cb(media_content_error_e error, void * user_data)
@@ -2615,6 +2647,50 @@ int test_batch_operations()
        return ret;
 }
 
+void insert_burst_shot_cb(media_content_error_e error, void * user_data)
+{
+       printf("media_info_insert_burst_shot_to_db completed![%d]\n", error);
+       g_main_loop_quit(g_loop);
+}
+
+gboolean test_insert_burst_shot_to_db_start(gpointer data)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       int i = 0;
+       char *file_list[10];
+
+       for (i = 0; i < 10; i++) {
+               char filepath[255] = {0,};
+               snprintf(filepath, sizeof(filepath), "%s%d.jpg", "/opt/usr/media/test/image", i+1);
+               media_content_debug("File : %s\n", filepath);
+               file_list[i] = strdup(filepath);
+       }
+
+       ret = media_info_insert_burst_shot_to_db((const char **)file_list, 10, insert_burst_shot_cb, NULL);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_content_error("media_info_insert_burst_shot_to_db failed : %d\n", ret);
+       }
+
+       return ret;
+}
+
+int test_insert_burst_shot_to_db(void)
+{
+       GSource *source = NULL;
+       GMainContext *context = NULL;
+
+       g_loop = g_main_loop_new(NULL, FALSE);
+       context = g_main_loop_get_context(g_loop);
+       source = g_idle_source_new();
+       g_source_set_callback (source, test_insert_burst_shot_to_db_start, NULL, NULL);
+       g_source_attach (source, context);
+
+       g_main_loop_run(g_loop);
+       g_main_loop_unref(g_loop);
+
+       return 0;
+}
+
 void _scan_cb(media_content_error_e err, void *user_data)
 {
        printf("scan callback is called : %d\n", err);
@@ -2644,7 +2720,7 @@ gboolean test_scan_dir_start(gpointer data)
 
        const char *dir_path = "/opt/usr/media";
 
-       ret = media_content_scan_folder(dir_path, _scan_cb, NULL);
+       ret = media_content_scan_folder(dir_path, TRUE, _scan_cb, NULL);
 
        if(ret != MEDIA_CONTENT_ERROR_NONE) {
                media_content_error("Fail to media_content_scan_file : %d", ret);
@@ -2671,6 +2747,137 @@ int test_scan_dir()
        return 0;
 }
 
+void _noti_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)
+{
+       if (error == 0) {
+               printf("noti success! : %d\n", error);
+       } else {
+               printf("error occured! : %d\n", error);
+       }
+
+       printf("Noti from PID(%d)\n", pid);
+
+       if (update_item == MEDIA_ITEM_FILE) {
+               printf("Noti item : MEDIA_ITEM_FILE\n");
+       } else if (update_item == MEDIA_ITEM_DIRECTORY) {
+               printf("Noti item : MEDIA_ITEM_DIRECTORY\n");
+       }
+
+       if (update_type == MEDIA_CONTENT_INSERT) {
+               printf("Noti type : MEDIA_CONTENT_INSERT\n");
+       } else if (update_type == MEDIA_CONTENT_DELETE) {
+               printf("Noti type : MEDIA_CONTENT_DELETE\n");
+       } else if (update_type == MEDIA_CONTENT_UPDATE) {
+               printf("Noti type : MEDIA_CONTENT_UPDATE\n");
+       }
+
+       printf("content type : %d\n", media_type);
+
+       if (path)
+               printf("path : %s\n", path);
+       else
+               printf("path not\n");
+
+       if (uuid)
+               printf("uuid : %s\n", uuid);
+       else
+               printf("uuid not\n");
+
+       if (mime_type)
+               printf("mime_type : %s\n", mime_type);
+       else
+               printf("mime not\n");
+
+       if (user_data) printf("String : %s\n", (char *)user_data);
+
+       //g_main_loop_quit(g_loop);
+       return;
+}
+
+gboolean _send_noti_operations(gpointer data)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       /* First of all, noti subscription */
+       char *user_str = strdup("hi");
+       media_content_set_db_updated_cb(_noti_cb, (void*)user_str);
+
+       /* media_info_insert_to_db */
+       media_info_h media_item = NULL;
+       char *path = "/opt/usr/media/test/image1.jpg";
+
+       ret = media_info_insert_to_db(path, &media_item);
+       if (ret < MEDIA_CONTENT_ERROR_NONE) {
+               media_content_error("media_info_insert_to_db failed : %d", ret);
+               return FALSE;
+       }
+
+       media_content_debug("media_info_insert_to_db success");
+
+       /* media_info_delete_batch_from_db */
+       filter_h filter;
+       char *condition = "MEDIA_PATH LIKE \'/opt/usr/media/test/image%%jpg\'";
+
+       ret = media_filter_create(&filter);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_content_error("Fail to create filter");
+               return ret;
+       }
+
+       ret = media_filter_set_condition(filter, condition, MEDIA_CONTENT_COLLATE_DEFAULT);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_filter_destroy(filter);
+               media_content_error("Fail to set condition");
+               return ret;
+       }
+       ret = media_info_delete_batch_from_db(filter);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_filter_destroy(filter);
+               media_content_error("media_info_delete_batch_from_db failed : %d\n", ret);
+               return ret;
+       }
+
+       media_filter_destroy(filter);
+
+       /* media_info_update_to_db */
+       ret = media_info_update_to_db(media_item);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_content_error("media_info_update_to_db failed : %d\n", ret);
+               return ret;
+       }
+
+       return FALSE;
+}
+
+int test_noti()
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       GSource *source = NULL;
+       GMainContext *context = NULL;
+
+       g_loop = g_main_loop_new(NULL, FALSE);
+       context = g_main_loop_get_context(g_loop);
+       source = g_idle_source_new();
+       g_source_set_callback (source, _send_noti_operations, NULL, NULL);
+       g_source_attach (source, context);
+
+       g_main_loop_run(g_loop);
+       g_main_loop_unref(g_loop);
+
+       test_filter_destroy();
+       media_content_unset_db_updated_cb();
+
+       return ret;
+}
+
 int main(int argc, char *argv[])
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -2750,6 +2957,10 @@ int main(int argc, char *argv[])
        if(ret != MEDIA_CONTENT_ERROR_NONE)
                return MEDIA_CONTENT_ERROR_NONE;
 
+       ret = test_insert_burst_shot_to_db();
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               return MEDIA_CONTENT_ERROR_NONE;
+
        ret = test_scan_file();
        if(ret != MEDIA_CONTENT_ERROR_NONE)
                return MEDIA_CONTENT_ERROR_NONE;
@@ -2757,6 +2968,10 @@ int main(int argc, char *argv[])
        ret = test_scan_dir();
        if(ret != MEDIA_CONTENT_ERROR_NONE)
                return MEDIA_CONTENT_ERROR_NONE;
+
+       ret = test_noti();
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               return MEDIA_CONTENT_ERROR_NONE;
 #endif
 
        ret = test_disconnect_database();