Add sound_manager_is_stream_on_device_by_id() for internal use 61/199661/1 accepted/tizen/unified/20190215.055047 submit/tizen/20190214.074524
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 13 Feb 2019 02:23:25 +0000 (11:23 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 13 Feb 2019 02:23:25 +0000 (11:23 +0900)
[Version] 0.5.18
[Issue Type] API

Change-Id: Ied2143e2e098c379f17df2f49e1688f672d45466
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/sound_manager_internal.h
include/sound_manager_internal_tv.h
packaging/capi-media-sound-manager.spec
src/sound_manager_internal.c
test/sound_manager_test.c

index a4de502..dcf2e34 100644 (file)
@@ -741,6 +741,29 @@ int sound_manager_get_device_vendor_id(sound_device_h device, int *vendor_id);
 int sound_manager_get_device_product_id(sound_device_h device, int *product_id);
 
 /**
+ * @brief Checks if the stream information is using the device.
+ * @since_tizen 5.5
+ *
+ * @param[in]  stream_info     The handle of stream information
+ * @param[in]  device_id       The device id
+ * @param[out] is_on   Whether the stream info is using the device or not: (@c true = use, @c false = not use)
+ * @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_INTERNAL Internal error inside the sound system
+ * @see sound_manager_create_stream_information()
+ * @see sound_manager_destroy_stream_information()
+ * @see sound_manager_get_device_list()
+ * @see sound_manager_get_next_device()
+ * @see sound_manager_get_prev_device()
+ * @see sound_manager_get_device_id()
+ * @see sound_manager_get_device_name()
+ * @see sound_manager_free_device_list()
+ */
+int sound_manager_is_stream_on_device_by_id(sound_stream_info_h stream_info, int device_id, bool *is_on);
+
+/**
  * @}
  */
 
index ca5f344..b9fb146 100644 (file)
@@ -696,6 +696,29 @@ int sound_manager_get_device_vendor_id(sound_device_h device, int *vendor_id);
 int sound_manager_get_device_product_id(sound_device_h device, int *product_id);
 
 /**
+ * @brief Checks if the stream information is using the device.
+ * @since_tizen 5.5
+ *
+ * @param[in]  stream_info     The handle of stream information
+ * @param[in]  device_id       The device id
+ * @param[out] is_on   Whether the stream info is using the device or not: (@c true = use, @c false = not use)
+ * @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_INTERNAL Internal error inside the sound system
+ * @see sound_manager_create_stream_information()
+ * @see sound_manager_destroy_stream_information()
+ * @see sound_manager_get_device_list()
+ * @see sound_manager_get_next_device()
+ * @see sound_manager_get_prev_device()
+ * @see sound_manager_get_device_id()
+ * @see sound_manager_get_device_name()
+ * @see sound_manager_free_device_list()
+ */
+int sound_manager_is_stream_on_device_by_id(sound_stream_info_h stream_info, int device_id, bool *is_on);
+
+/**
  * @}
  */
 
index 7e2cd07..dc131e8 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.5.17
+Version:    0.5.18
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index c1f5600..7e61c35 100644 (file)
@@ -642,3 +642,18 @@ int sound_manager_get_device_product_id(sound_device_h device, int *product_id)
 
        return _convert_sound_manager_error_code(__func__, ret);
 }
+
+int sound_manager_is_stream_on_device_by_id(sound_stream_info_h stream_info, int device_id, bool *is_on)
+{
+       int ret = MM_ERROR_NONE;
+       sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
+
+       LOGI(">> enter");
+
+       SM_NULL_ARG_CHECK(stream_h);
+       SM_NULL_ARG_CHECK(is_on);
+
+       ret = mm_sound_is_stream_on_device_by_id(stream_h->pa_index, device_id, is_on);
+
+       return _convert_sound_manager_error_code(__func__, ret);
+}
\ No newline at end of file
index 3dd9a70..894aaaa 100644 (file)
@@ -88,6 +88,7 @@ enum {
        CURRENT_STATUS_SET_FILTER,
        CURRENT_STATUS_SET_FILTER_PRESET,
        CURRENT_STATUS_UNSET_FILTER,
+       CURRENT_STATUS_IS_STREAM_ON_DEVICE_BY_ID,
 #ifndef TIZEN_FEATURE_TV_PROD
        CURRENT_STATUS_GET_MAX_MASTER_VOLUME,
        CURRENT_STATUS_SET_MASTER_VOLUME,
@@ -294,6 +295,8 @@ void _interpret_main_menu(char *cmd)
                g_menu_state = CURRENT_STATUS_SET_FILTER_PRESET;
        else if (strncmp(cmd, "uft", 3) == 0)
                g_menu_state = CURRENT_STATUS_UNSET_FILTER;
+       else if (strncmp(cmd, "isd", 3) == 0)
+               g_menu_state = CURRENT_STATUS_IS_STREAM_ON_DEVICE_BY_ID;
 #ifndef TIZEN_FEATURE_TV_PROD
        else if (strncmp(cmd, "mgx", 3) == 0)
                g_menu_state = CURRENT_STATUS_GET_MAX_MASTER_VOLUME;
@@ -386,6 +389,7 @@ void display_sub_basic()
        g_print("sft. *Set Filter\t");
        g_print("sfp. *Set Filter Preset\t");
        g_print("uft. *Unset Filter\n");
+       g_print("isd. *Is Stream on Device by ID\n");
        g_print("                                                                 * is for internal usage.\n");
        g_print("=========================================================================================\n");
 }
@@ -514,6 +518,8 @@ static void displaymenu()
                g_print("*** input filter preset of media stream (LOW_PASS(1:none 2:240hz 3:480hz), HIGH_PASS(3:none 4:240hz 5:480hz) DELAY(6:none 7:1sec 8:2sec) SOUNDALIVE(9:normal 10:concert_hall))\n");
        else if (g_menu_state == CURRENT_STATUS_UNSET_FILTER)
                g_print("*** press enter to unset filter of media stream\n");
+       else if (g_menu_state == CURRENT_STATUS_IS_STREAM_ON_DEVICE_BY_ID)
+               g_print("*** input device id\n");
 #ifndef TIZEN_FEATURE_TV_PROD
        else if (g_menu_state == CURRENT_STATUS_GET_MAX_MASTER_VOLUME)
                g_print("*** press enter to get max master volume level\n");
@@ -2010,6 +2016,20 @@ static void interpret(char *cmd)
                reset_menu_state();
                break;
        }
+       case CURRENT_STATUS_IS_STREAM_ON_DEVICE_BY_ID: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               int device_id = 0;
+               bool is_on = false;
+
+               device_id = atoi(cmd);
+               ret = sound_manager_is_stream_on_device_by_id(g_stream_info_h, device_id, &is_on);
+               if (ret)
+                       g_print("fail to sound_manager_is_stream_on_device_by_id(), device_id(%d), ret(0x%x)\n", device_id, ret);
+               else
+                       g_print("stream info is on the device_id(%d): %s\n", device_id, is_on ? "true" : "false");
+               reset_menu_state();
+               break;
+       }
 #ifndef TIZEN_FEATURE_TV_PROD
        case CURRENT_STATUS_GET_MAX_MASTER_VOLUME: {
                int max_level;