Add new API sound_manager_new_device_list, and deprecate sound_manager_get_current_de... refsf/for/tizen_3.0
authorJeongho Mok <jho.mok@samsung.com>
Wed, 23 Nov 2016 07:22:18 +0000 (16:22 +0900)
committerJeongho Mok <jho.mok@samsung.com>
Wed, 23 Nov 2016 08:01:56 +0000 (17:01 +0900)
[Version] 0.3.78
[Profile] Common
[Issue Type] Add API

Change-Id: I14f6fa7e1940ad167eb9ad7f1cb6eb1f544fae6a

include/sound_manager.h
packaging/capi-media-sound-manager.spec
src/sound_manager.c
test/sound_manager_test.c

index 0eb46d83bc93f1b6c7389cadf6bf8575bc679351..4f9196b302a46deb653a1bef3a6c81d26f48ef0f 100644 (file)
@@ -675,7 +675,7 @@ int sound_manager_get_sound_type(sound_stream_info_h stream_info, sound_type_e *
  * @brief Adds the device to the stream information for the stream routing.
  * @since_tizen 3.0
  *
- * @remarks    Use sound_manager_get_current_device_list() and sound_manager_get_next_device() to get the device.\n
+ * @remarks    Use sound_manager_new_device_list() and sound_manager_get_next_device() to get the device.\n
  *     #SOUND_MANAGER_ERROR_POLICY could be returned according to the stream type of the @a stream_info.\n
  *     The available types of the @a stream_info for this function are #SOUND_STREAM_TYPE_VOIP and #SOUND_STREAM_TYPE_MEDIA_EXTERNAL_ONLY.
  *
@@ -699,7 +699,7 @@ int sound_manager_add_device_for_stream_routing(sound_stream_info_h stream_info,
  * @brief Removes the device to the stream information for the stream routing.
  * @since_tizen 3.0
  *
- * @remarks    Use sound_manager_get_current_device_list() and sound_manager_get_next_device() to get the device.\n
+ * @remarks    Use sound_manager_new_device_list() and sound_manager_get_next_device() to get the device.\n
  *
  * @param[in]  stream_info     The handle of stream information
  * @param[in]  device          The device item from sound_device_list_h
@@ -1228,10 +1228,11 @@ int sound_manager_unset_session_interrupted_cb(void) TIZEN_DEPRECATED_API;
  */
 
 /**
+ * @deprecated Deprecated since 3.0. Use sound_manager_new_device_list instead.
  * @brief Gets the list consisting of connected devices.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks    @a device_list should be freed using sound_manager_free_device_list() since 3.0.\n
+ * @remarks    @a Calling this API will deallocate previously obtained list and each item.\n
  *     Use sound_manager_get_next_device() to get the first node of the list.
  *
  * @param[in]  device_mask     The mask value
@@ -1249,24 +1250,54 @@ int sound_manager_unset_session_interrupted_cb(void) TIZEN_DEPRECATED_API;
  * @see sound_manager_get_device_id()
  * @see sound_manager_get_device_name()
  * @see sound_manager_get_device_state()
- * @see sound_manager_free_device_list()
  */
 int sound_manager_get_current_device_list(sound_device_mask_e device_mask, sound_device_list_h *device_list);
 
+/**
+ * @addtogroup CAPI_MEDIA_SOUND_MANAGER_DEVICE_MODULE
+ * @{
+ */
+
+/**
+ * @brief Gets the list consisting of connected devices.
+ * @since_tizen 3.0
+ *
+ * @remarks    @a device_list should be freed using sound_manager_free_device_list().\n
+ *     Use sound_manager_get_next_device() to get the first node of the list.
+ *
+ * @param[in]  device_mask     The mask value
+ * @param[out] device_list     The list of connected devices
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SOUND_MANAGER_ERROR_NO_DATA No data
+ * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
+ * @see sound_manager_get_next_device()
+ * @see sound_manager_get_prev_device()
+ * @see sound_manager_get_device_type()
+ * @see sound_manager_get_device_io_direction()
+ * @see sound_manager_get_device_id()
+ * @see sound_manager_get_device_name()
+ * @see sound_manager_get_device_state()
+ * @see sound_manager_free_device_list()
+ */
+int sound_manager_new_device_list(sound_device_mask_e device_mask, sound_device_list_h *device_list);
+
 /**
  * @brief Frees device list and each item of list.
  * @since_tizen 3.0
  *
  * @remarks    This function will deallocate not only device list itself but also each item.
  *
- * @param[in]  device_list     The device list got with sound_manager_get_current_device_list.
+ * @param[in]  device_list     The device list got with sound_manager_new_device_list.
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
  *
  *
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_new_device_list()
  * @see sound_manager_get_next_device()
  * @see sound_manager_get_prev_device()
  * @see sound_manager_get_device_type()
@@ -1287,7 +1318,7 @@ int sound_manager_free_device_list(sound_device_list_h device_list);
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #SOUND_MANAGER_ERROR_NO_DATA No data
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_new_device_list()
  * @see sound_manager_get_prev_device()
  * @see sound_manager_get_device_type()
  * @see sound_manager_get_device_io_direction()
@@ -1308,7 +1339,7 @@ int sound_manager_get_next_device(sound_device_list_h device_list, sound_device_
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #SOUND_MANAGER_ERROR_NO_DATA No data
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_new_device_list()
  * @see sound_manager_get_next_device()
  * @see sound_manager_get_device_type()
  * @see sound_manager_get_device_io_direction()
@@ -1328,7 +1359,7 @@ int sound_manager_get_prev_device(sound_device_list_h device_list, sound_device_
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_new_device_list()
  * @see sound_manager_get_next_device()
  * @see sound_manager_get_prev_device()
  * @see sound_manager_get_device_io_direction()
@@ -1348,7 +1379,7 @@ int sound_manager_get_device_type(sound_device_h device, sound_device_type_e *ty
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_new_device_list()
  * @see sound_manager_get_next_device()
  * @see sound_manager_get_prev_device()
  * @see sound_manager_get_device_type()
@@ -1368,7 +1399,7 @@ int sound_manager_get_device_io_direction(sound_device_h device, sound_device_io
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_new_device_list()
  * @see sound_manager_get_next_device()
  * @see sound_manager_get_prev_device()
  * @see sound_manager_get_device_type()
@@ -1389,7 +1420,7 @@ int sound_manager_get_device_id(sound_device_h device, int *id);
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_new_device_list()
  * @see sound_manager_get_next_device()
  * @see sound_manager_get_prev_device()
  * @see sound_manager_get_device_type()
@@ -1409,7 +1440,7 @@ int sound_manager_get_device_name(sound_device_h device, char **name);
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_new_device_list()
  * @see sound_manager_get_next_device()
  * @see sound_manager_get_prev_device()
  * @see sound_manager_get_device_type()
@@ -1432,7 +1463,7 @@ int sound_manager_get_device_state(sound_device_h device, sound_device_state_e *
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_new_device_list()
  * @see sound_manager_get_next_device()
  * @see sound_manager_get_prev_device()
  * @see sound_manager_get_device_type()
index 7132e37779b4bb0d8b5c1f789f87312bc4f515de..5b9750e8bcd0e5262c28619aad227a4b835e3c39 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.3.77
+Version:    0.3.78
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index bb33c99e330ccc5a383eb7cb17bfaec39ae55d9d..57c8d4afb439a068e71325941c3729edff5d333e 100644 (file)
@@ -1179,6 +1179,15 @@ int sound_manager_get_current_device_list(sound_device_mask_e device_mask, sound
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
+int sound_manager_new_device_list(sound_device_mask_e device_mask, sound_device_list_h *device_list)
+{
+       int ret = MM_ERROR_NONE;
+
+       ret = mm_sound_new_device_list((mm_sound_device_flags_e)device_mask, device_list);
+
+       return _convert_sound_manager_error_code(__func__, ret);
+}
+
 int sound_manager_free_device_list(sound_device_list_h device_list)
 {
        int ret = MM_ERROR_NONE;
index f5f2becf0ffd62d9fa5517b3c8ef49bc0818b659..0f162e51a31f630a5dc28208fb70a4700d3755a0 100644 (file)
@@ -54,6 +54,7 @@ enum {
        CURRENT_STATUS_GET_DEVICE_MASK,
        CURRENT_STATUS_GET_DEVICE_LIST,
        CURRENT_STATUS_PRINT_DEVICE_LIST,
+       CURRENT_STATUS_NEW_DEVICE_LIST,
        CURRENT_STATUS_FREE_DEVICE_LIST,
        CURRENT_STATUS_GET_DEVICE_NEXT,
        CURRENT_STATUS_GET_DEVICE_PREV,
@@ -202,6 +203,8 @@ void _interpret_main_menu(char *cmd)
                g_menu_state = CURRENT_STATUS_GET_DEVICE_MASK;
        else if (strncmp(cmd, "gl", 3) == 0)
                g_menu_state = CURRENT_STATUS_GET_DEVICE_LIST;
+       else if (strncmp(cmd, "nl", 3) == 0)
+               g_menu_state = CURRENT_STATUS_NEW_DEVICE_LIST;
        else if (strncmp(cmd, "pl", 3) == 0)
                g_menu_state = CURRENT_STATUS_PRINT_DEVICE_LIST;
        else if (strncmp(cmd, "fl", 3) == 0)
@@ -320,6 +323,7 @@ void display_sub_basic()
        g_print("gk. Get Devices Mask\n");
        g_print("gl. Get Devices List\t");
        g_print("pl. Print Devices List\t");
+       g_print("nl. New Devices List\t");
        g_print("fl. Free Devices List\n");
        g_print("gn. Get Next Device\t\t");
        g_print("gp. Get Prev Device\n");
@@ -413,6 +417,8 @@ static void displaymenu()
                g_print("*** press enter to get device mask\n");
        else if (g_menu_state == CURRENT_STATUS_GET_DEVICE_LIST)
                g_print("*** press enter to get device list\n");
+       else if (g_menu_state == CURRENT_STATUS_NEW_DEVICE_LIST)
+               g_print("*** press enter to new device list\n");
        else if (g_menu_state == CURRENT_STATUS_PRINT_DEVICE_LIST)
                g_print("*** press enter to print device list\n");
        else if (g_menu_state == CURRENT_STATUS_FREE_DEVICE_LIST)
@@ -967,6 +973,15 @@ static void interpret(char *cmd)
                reset_menu_state();
                break;
        }
+       case CURRENT_STATUS_NEW_DEVICE_LIST: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               if (!(ret = sound_manager_new_device_list(g_device_mask, &g_device_list)))
+                       g_print("success to new device list\n");
+               else
+                       g_print("fail to new device list, ret[0x%x]\n", ret);
+               reset_menu_state();
+               break;
+       }
        case CURRENT_STATUS_PRINT_DEVICE_LIST: {
                sound_device_list_h device_list;
                sound_device_h device;
@@ -984,8 +999,6 @@ static void interpret(char *cmd)
                                g_print("[ Device #%d %s %s ]\n", id, type, name);
                                g_print("    Direc[ %-4s ] State[ %-12s ] Avail-Modes[ %s ]\n", direc, state, avail_modes);
                        }
-                       if ((ret = sound_manager_free_device_list(device_list)))
-                               g_print("fail to free device list, ret[0x%x]\n", ret);
                } else {
                        g_print("fail to get current device list, ret[0x%x]\n", ret);
                }