From: Sangchul Lee Date: Wed, 13 Feb 2019 02:23:25 +0000 (+0900) Subject: Add sound_manager_is_stream_on_device_by_id() for internal use X-Git-Tag: submit/tizen/20190214.074524^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4091cebfdb6d78bb6be772cb4d1b4e6910ee2057;p=platform%2Fcore%2Fapi%2Fsound-manager.git Add sound_manager_is_stream_on_device_by_id() for internal use [Version] 0.5.18 [Issue Type] API Change-Id: Ied2143e2e098c379f17df2f49e1688f672d45466 Signed-off-by: Sangchul Lee --- diff --git a/include/sound_manager_internal.h b/include/sound_manager_internal.h index a4de502..dcf2e34 100644 --- a/include/sound_manager_internal.h +++ b/include/sound_manager_internal.h @@ -740,6 +740,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); + /** * @} */ diff --git a/include/sound_manager_internal_tv.h b/include/sound_manager_internal_tv.h index ca5f344..b9fb146 100644 --- a/include/sound_manager_internal_tv.h +++ b/include/sound_manager_internal_tv.h @@ -695,6 +695,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); + /** * @} */ diff --git a/packaging/capi-media-sound-manager.spec b/packaging/capi-media-sound-manager.spec index 7e2cd07..dc131e8 100644 --- a/packaging/capi-media-sound-manager.spec +++ b/packaging/capi-media-sound-manager.spec @@ -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 diff --git a/src/sound_manager_internal.c b/src/sound_manager_internal.c index c1f5600..7e61c35 100644 --- a/src/sound_manager_internal.c +++ b/src/sound_manager_internal.c @@ -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 diff --git a/test/sound_manager_test.c b/test/sound_manager_test.c index 3dd9a70..894aaaa 100644 --- a/test/sound_manager_test.c +++ b/test/sound_manager_test.c @@ -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;