int media_content_cancel_scan_folder(const char *path);
/**
+ * @deprecated Deprecated since 3.0. Use media_content_add_db_updated_cb() instead.
* @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.
int media_content_set_db_updated_cb(media_content_db_update_cb callback, void *user_data);
/**
+ * @deprecated Deprecated since 3.0. Use media_content_remove_db_updated_cb() instead.
* @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.
*
int media_content_unset_db_updated_cb(void);
/**
+ * @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. \n
+ * media_content_db_update_cb() function will be called when notification of the media DB change is subscribed. \n
+ * Using this API, multiple callback is possible to register in one process.
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks To release the registered callback, you must use media_content_remove_db_updated_cb() API. \n
+ * media_content_unset_db_updated_cb() API can not release the callbacks added by this API. \n
+ * If you set the same callback that you previously added, this API returns MEDIA_CONTENT_ERROR_INVALID_OPERATION error. \n
+ *
+ * @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
+ * @param[out] noti_handle The handle to db updated notification
+ *
+ * @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
+ *
+ * @see media_content_db_update_cb()
+ * @see media_content_remove_db_updated_cb()
+ */
+int media_content_add_db_updated_cb(media_content_db_update_cb callback, void *user_data, media_content_noti_h *noti_handle);
+
+
+/**
+ * @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 3.0
+ *
+ * @param[in] noti_handle The handle to db updated notification
+ *
+ * @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 media_content_add_db_updated_cb()
+ *
+ * @see media_content_add_db_updated_cb()
+ */
+int media_content_remove_db_updated_cb(media_content_noti_h noti_handle);
+
+/**
* @}
*/
return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
}
+int media_content_add_db_updated_cb(media_content_db_update_cb callback, void *user_data, media_content_noti_h *noti_handle)
+{
+ 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;
return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
}
+
+
+int media_content_remove_db_updated_cb(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);
+}
+