*/
int media_storage_get_scan_status(const char *storage_uuid, media_storage_scan_status_e *scan_status);
+/* Handle for dbus notification to use multiple callback */
+typedef void *media_content_noti_h;
+
+/**
+ * @brief Subscribes notifications of the media DB change.
+ * @details This function subscribes notifications of the media DB change which are published by the media server or other apps.
+ * media_content_db_update_cb() function will be called when notification of the media DB change is subscribed.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] callback The callback to be invoked when the scanning is finished
+ * @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_INVALID_OPERATION Invalid operation
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @see media_content_db_update_cb()
+ * @see media_content_unset_db_updated_cb_v2()
+ */
+int media_content_set_db_updated_cb_v2(media_content_noti_h *noti_handle, media_content_db_update_cb callback, void *user_data);
+
+
+/**
+ * @brief Unsubscribes notifications of the media DB change.
+ * @details This function unsubscribes notifications of the media DB change which are published by the media server or other apps.
+ *
+ * @since_tizen 2.4
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre media_content_set_db_updated_cb_v2()
+ *
+ * @see media_content_set_db_updated_cb_v2()
+ */
+int media_content_unset_db_updated_cb_v2(media_content_noti_h noti_handle);
+
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
#include <media_content.h>
#include <media_info_private.h>
#include <media_util_private.h>
+#include <media_content_internal.h>
#include <unicode/uscript.h>
#include <unicode/uloc.h>
return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
}
+
+int media_content_set_db_updated_cb_v2(media_content_noti_h *noti_handle, media_content_db_update_cb callback, void *user_data)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ media_noti_cb_s *noti_info = NULL;
+
+ if (noti_handle == NULL) {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (callback == NULL) {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ noti_info = (media_noti_cb_s*)calloc(1, sizeof(media_noti_cb_s));
+ if (noti_info == NULL) {
+ media_content_error("Failed to create noti info");
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+
+ noti_info->update_noti_cb = callback;
+ noti_info->user_data = user_data;
+
+ ret = media_db_update_subscribe_internal((MediaNotiHandle*)noti_handle, _media_content_db_update_noti_cb, (void *)noti_info);
+
+ return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
+}
+
+void __media_content_clear_user_data(void *user_data)
+{
+ media_noti_cb_s *noti_info = user_data;
+
+ SAFE_FREE(noti_info);
+
+ return;
+}
+
+int media_content_unset_db_updated_cb_v2(media_content_noti_h noti_handle)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ ret = media_db_update_unsubscribe_internal((MediaNotiHandle)noti_handle, __media_content_clear_user_data);
+
+ return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
+}
+