[ACR-1379]Add new API to get number of condition. mc_seach_get_condition_count() 14/201914/5 accepted/tizen/unified/20190328.012824 submit/tizen/20190327.074346
authorhj kim <backto.kim@samsung.com>
Thu, 21 Mar 2019 02:06:51 +0000 (11:06 +0900)
committerhj kim <backto.kim@samsung.com>
Wed, 27 Mar 2019 07:41:18 +0000 (07:41 +0000)
Change-Id: I477f6b2fed6c7f01468415d409051ec59008a939

include/media_controller_metadata.h
packaging/capi-media-controller.spec
src/media_controller_metadata.c

index b765b9e..64841d4 100755 (executable)
@@ -45,8 +45,8 @@ extern "C" {
  *
  * @remarks The @a dst should be released using @c mc_metadata_destroy().
  *
- * @param[in] src The source handle to the media controller metadata
- * @param[out] dst The destination handle to the media controller metadata
+ * @param[in] src The source handle of the media controller metadata
+ * @param[out] dst The destination handle of the media controller metadata
  *
  * @return @c 0 on success,
  *         otherwise a negative error value
@@ -86,7 +86,7 @@ int mc_metadata_destroy(mc_metadata_h metadata);
  * @remarks The @a value should be released using free(). \n
  *              If the attribute value of the metadata is empty, return value is NULL.
  *
- * @param[in] metadata    The handle to metadata
+ * @param[in] metadata    The handle of the media controller metadata
  * @param[in] attribute    The key attribute name to get
  * @param[out] value      The value of the attribute
  *
@@ -288,8 +288,8 @@ int mc_metadata_decode_resolution(const char *encoded_resolution, unsigned int *
  *
  * @remarks The @a dst should be released using @c mc_playback_ability_destroy().
  *
- * @param[in] src The source handle to the playback ability
- * @param[out] dst The destination handle to the playback ability
+ * @param[in] src The source handle of the playback ability
+ * @param[out] dst The destination handle of the playback ability
  *
  * @return @c 0 on success,
  *         otherwise a negative error value
@@ -328,7 +328,7 @@ int mc_playback_ability_destroy(mc_playback_ability_h ability);
  *
  * @remarks If the ability's support is not set, the result value is #MC_ABILITY_SUPPORTED_UNDECIDED.
  *
- * @param[in] ability    The handle to ability
+ * @param[in] ability    The handle of the playback ability
  * @param[in] action    The playback action to get
  * @param[out] supported      The support value of the ability
  *
@@ -385,7 +385,7 @@ typedef bool (*mc_search_condition_cb)(mc_content_type_e content_type, mc_search
  *
  * @remarks The @a search should be released using @c mc_search_destroy().
  *
- * @param[out] search The handle to search
+ * @param[out] search The handle of the media controller search
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #MEDIA_CONTROLLER_ERROR_NONE Successful
@@ -402,7 +402,7 @@ int mc_search_create(mc_search_h *search);
  *            But it's not allowed to set more than 20 conditions. If you try to set more than 20 conditions, this function will return #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER.
  * @since_tizen 5.0
  *
- * @param[in] search The handle to search
+ * @param[in] search The handle of the media controller search
  * @param[in] content_type The content type to search
  * @param[in] category The category to search
  * @param[in] search_keyword The key word to search
@@ -420,7 +420,7 @@ int mc_search_set_condition(mc_search_h search, mc_content_type_e content_type,
 /**
  * @brief Destroys search.
  * @since_tizen 5.0
- * @param[in] search The handle to search
+ * @param[in] search The handle of the media controller search
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #MEDIA_CONTROLLER_ERROR_NONE Successful
@@ -432,13 +432,32 @@ int mc_search_set_condition(mc_search_h search, mc_content_type_e content_type,
 int mc_search_destroy(mc_search_h search);
 
 /**
+ * @brief Gets the number of conditions to search.
+ * @since_tizen 5.5
+ *
+ * @param[in] search        The handle of the media controller search
+ * @param[out] condition_count      The number of conditions.
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTROLLER_ERROR_NONE Successful
+ * @retval #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see mc_search_create()
+ * @see mc_search_set_condition()
+ * @see mc_search_foreach_condition()
+ */
+int mc_search_get_condition_count(mc_search_h search, int *condition_count);
+
+/**
  * @brief Retrieves all search conditions.
  * @details This function gets all search conditions set.
  *            The callback function will be invoked for every retrieved search condition.
  *            If there were no search conditions set with mc_search_set_condition(), this function will return #MEDIA_CONTROLLER_ERROR_NONE, and the callback will not be invoked.
  * @since_tizen 5.0
  *
- * @param[in] search    The handle to search
+ * @param[in] search    The handle of the media controller search
  * @param[in] callback      The callback function to be invoked.
  * @param[in] user_data   The user data to be passed to the callback function
  *
@@ -464,8 +483,8 @@ int mc_search_foreach_condition(mc_search_h search, mc_search_condition_cb callb
  *
  * @remarks The @a dst should be released using @c mc_search_destroy().
  *
- * @param[in] src The source handle to the media controller search
- * @param[out] dst The destination handle to the media controller search
+ * @param[in] src The source handle of the media controller search
+ * @param[out] dst The destination handle of the media controller search
  *
  * @return @c 0 on success,
  *         otherwise a negative error value
index 85af5ba..0e5f3d8 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-controller
 Summary:    A media controller library in Tizen Native API
-Version:    0.1.84
+Version:    0.1.85
 Release:    1
 Group:      Multimedia/API
 License:    Apache-2.0
index 1621b7b..aaa5953 100755 (executable)
@@ -372,6 +372,18 @@ int mc_search_destroy(mc_search_h search)
        return ret;
 }
 
+int mc_search_get_condition_count(mc_search_h search, int *condition_count)
+{
+       media_controller_search_s *mc_search = (media_controller_search_s *)search;
+
+       mc_retvm_if(mc_search == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid search");
+       mc_retvm_if(condition_count == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid condition_count");
+
+       *condition_count = g_list_length(mc_search->search_list);
+
+       return MEDIA_CONTROLLER_ERROR_NONE;
+}
+
 int mc_search_foreach_condition(mc_search_h search, mc_search_condition_cb callback, void *user_data)
 {
        media_controller_search_s *mc_search = (media_controller_search_s *)search;