From: Jaechul Lee Date: Wed, 19 Aug 2020 09:05:30 +0000 (+0900) Subject: fixup! add publish and allow remote access internal api X-Git-Tag: accepted/tizen/6.0/unified/20201030.121651^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_6.0_hotfix;p=platform%2Fcore%2Fapi%2Fsound-manager.git fixup! add publish and allow remote access internal api [Version] 0.6.28 [Issue Type] Bug Change-Id: Iee298861f07c7222fae8ed72a223678c697ecfdc Signed-off-by: Jaechul Lee --- diff --git a/include/sound_manager_internal_tv.h b/include/sound_manager_internal_tv.h index 2b0a98f..645127a 100644 --- a/include/sound_manager_internal_tv.h +++ b/include/sound_manager_internal_tv.h @@ -72,6 +72,7 @@ typedef enum { SOUND_STREAM_TYPE_SOLO, /**< Sound stream type for solo */ SOUND_STREAM_TYPE_VOICE_RECOGNITION_SERVICE, /**< Sound stream type for voice recognition by service (Since 4.0) */ SOUND_STREAM_TYPE_MEDIA_COMPRESSED, /**< Sound stream type for compressed media (Since 4.0) */ + SOUND_STREAM_TYPE_MEDIA_NETWORK_SOURCE, /**< Sound stream type for network source media (Since 5.5) */ } sound_stream_type_internal_e; /** @@ -836,6 +837,24 @@ int sound_manager_stop_virtual_stream(virtual_sound_stream_h virtual_stream); /** * @internal + * @brief Sets the virtual stream volume. + * @since_tizen 5.5 + * @param[in] virtual_stream The handle of virtual stream + * @param[in] ratio The volume ratio to be set (Min.:0.0 ~ Max.:1.0, default:1.0) + * @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_INVALID_STATE Invalid state + * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system + * @see sound_manager_create_virtual_stream() + * @see sound_manager_destroy_virtual_stream() + * @see sound_manager_start_virtual_stream() + */ +int sound_manager_set_virtual_stream_volume(virtual_sound_stream_h virtual_stream, double ratio); + +/** + * @internal * @brief Set sound filter and apply to audio streams given selected stream type. * @since_tizen 4.0 * @param[in] stream_type stream type to apply @@ -962,6 +981,21 @@ int sound_manager_is_stream_on_device_by_id(sound_stream_info_h stream_info, int /** * @internal + * @brief Sets ACM master mode. + * @since_tizen 5.5 + * + * @remarks The master mode is not enabled as default. + * + * @param[in] enable The master mode to be set: (@c true = master, @c false = slave) + * @return @c 0 on success, + * otherwise a negative error value + * @retval #SOUND_MANAGER_ERROR_NONE Success + * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system + */ +int sound_manager_set_acm_master_mode(bool enable); + +/** + * @internal * @brief Enumeration for stream type. * @since_tizen 6.0 * @remarks These values can be combined with bitwise 'or'. @@ -995,6 +1029,130 @@ typedef enum { int sound_manager_get_latest_stream_pid(int stream_type, unsigned int *pid); /** + * @internal + * @brief Called when the remote client is connected or disconnected. + * @since_tizen 6.0 + * @remarks This callback indicates that the new remote client is connected or existing remote client is disconnected. \n + The parameters are the identification of the remote client such as unique id, name, description, and recording or not, \n + which can help the user to make a decision to allow access from the remote client using sound_manager_set_remote_permission(). + * @param[in] id The id of the remote client + * @param[in] name The name of the remote client + * @param[in] is_recording The flag indicating whether it's recording client or not + * @param[in] description The brief description of the remote client + * @param[in] is_connected The state of remote client connection: (@c true = connected, @c false = disconnected) + * @param[in] user_data The user data passed from the callback registration function + * @pre You should register this callback using sound_manager_publish_local_device(). + * @see sound_manager_publish_local_device() + * @see sound_manager_unpublish_local_device() + * @see sound_manager_set_allow_remote_access() + */ +typedef void (*sound_manager_remote_client_connected_cb) (int id, const char *name, bool is_recording, + const char *description, bool is_connected, void *user_data); + +/** + * @internal + * @brief Publishes device's built-in audio devices to the local network. + * @since_tizen 6.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/internet + * @remarks This function publishes the device's built-in audio devices such as speakers and microphones to the local network. \n + * The registered callback function will be invoked when the remote clients discover published audio devices and the connection established. + * @param[in] callback The remote client connection state changed callback function + * @param[in] user_data The user data to be passed to the callback function + * @return @c 0 on success, + * otherwise a negative error value + * @retval #SOUND_MANAGER_ERROR_NONE Success + * @retval #SOUND_MANAGER_ERROR_NOT_SUPPORTED Not supported + * @retval #SOUND_MANAGER_ERROR_PERMISSION_DENIED Permission denied + * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation + * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system + * @post sound_manager_remote_client_connected_cb() will be invoked. + * @see sound_manager_unpublish_local_device() + * @see sound_manager_set_remote_permission() + */ +int sound_manager_publish_local_device(sound_manager_remote_client_connected_cb callback, void *user_data); + +/** + * @internal + * @brief Unpublishes device's built-in audio devices to local network. + * @since_tizen 6.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/internet + * @remarks This function unpublishes the device's built-in audio devices to the local network. + * @return @c 0 on success, + * otherwise a negative error value + * @retval #SOUND_MANAGER_ERROR_NONE Success + * @retval #SOUND_MANAGER_ERROR_NOT_SUPPORTED Not supported + * @retval #SOUND_MANAGER_ERROR_PERMISSION_DENIED Permission denied + * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation + * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system + * @pre You should have already published using sound_manager_publish_local_device(). + * @see sound_manager_publish_local_device() + * @see sound_manager_set_remote_permission() + */ +int sound_manager_unpublish_local_device(void); + +/** + * @internal + * @brief Sets the permission of accessing the local device from the remote client. + * @since_tizen 6.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/internet + * @remarks + * @param[in] id The remote client id + * @param[in] allowed The permission to allow accessing from the remote client. + * @return @c 0 on success, + * otherwise a negative error value + * @retval #SOUND_MANAGER_ERROR_NONE Success + * @retval #SOUND_MANAGER_ERROR_NOT_SUPPORTED Not supported + * @retval #SOUND_MANAGER_ERROR_PERMISSION_DENIED Permission denied + * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation + * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system + * @see sound_manager_publish_local_device() + * @see sound_manager_unpublish_local_device() + */ +int sound_manager_set_remote_permission(int id, bool allowed); + +/** + * @internal + * @brief Starts discovering of published remote devices on the local network. + * @since_tizen 6.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/internet + * @remarks + * @return @c 0 on success, + * otherwise a negative error value + * @retval #SOUND_MANAGER_ERROR_NONE Success + * @retval #SOUND_MANAGER_ERROR_NOT_SUPPORTED Not supported + * @retval #SOUND_MANAGER_ERROR_PERMISSION_DENIED Permission denied + * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation + * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system + * @see sound_manager_stop_discover_remote_device() + */ +int sound_manager_start_discover_remote_device(void); + +/** + * @internal + * @brief Stops discovering of published remote devices on the local network. + * @since_tizen 6.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/internet + * @remark + * @return @c 0 on success, + * otherwise a negative error value + * @retval #SOUND_MANAGER_ERROR_NONE Success + * @retval #SOUND_MANAGER_ERROR_NOT_SUPPORTED Not supported + * @retval #SOUND_MANAGER_ERROR_PERMISSION_DENIED Permission denied + * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation + * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system + * @pre You should start discovering by sound_manager_start_discover_remote_device(). + * @see sound_manager_start_discover_remote_device() + */ +int sound_manager_stop_discover_remote_device(void); + +/** * @} */ diff --git a/packaging/capi-media-sound-manager.spec b/packaging/capi-media-sound-manager.spec index 764eecd..5fc5142 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.6.27 +Version: 0.6.28 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/test/sound_manager_test.c b/test/sound_manager_test.c index 5abb753..5035e99 100644 --- a/test/sound_manager_test.c +++ b/test/sound_manager_test.c @@ -98,9 +98,7 @@ enum { CURRENT_STATUS_START_VIRTUAL_STREAM, CURRENT_STATUS_STOP_VIRTUAL_STREAM, CURRENT_STATUS_DESTROY_VIRTUAL_STREAM, -#ifndef TIZEN_FEATURE_TV_PROD CURRENT_STATUS_SET_VIRTUAL_STREAM_VOLUME, -#endif CURRENT_STATUS_SET_FILTER, CURRENT_STATUS_SET_FILTER_PRESET, CURRENT_STATUS_UNSET_FILTER, @@ -110,8 +108,8 @@ enum { CURRENT_STATUS_GET_MAX_MASTER_VOLUME, CURRENT_STATUS_SET_MASTER_VOLUME, CURRENT_STATUS_GET_MASTER_VOLUME, - CURRENT_STATUS_SET_ACM_MASTER_MODE, #endif + CURRENT_STATUS_SET_ACM_MASTER_MODE, CURRENT_STATUS_CREATE_STREAM_DUCKING, CURRENT_STATUS_DESTROY_STREAM_DUCKING, CURRENT_STATUS_ACTIVATE_DUCKING, @@ -354,10 +352,8 @@ void _interpret_main_menu(char *cmd) g_menu_state = CURRENT_STATUS_STOP_VIRTUAL_STREAM; else if (strncmp(cmd, "vdt", MAX_CMD_LEN) == 0) g_menu_state = CURRENT_STATUS_DESTROY_VIRTUAL_STREAM; -#ifndef TIZEN_FEATURE_TV_PROD else if (strncmp(cmd, "vsv", MAX_CMD_LEN) == 0) g_menu_state = CURRENT_STATUS_SET_VIRTUAL_STREAM_VOLUME; -#endif else if (strncmp(cmd, "sft", MAX_CMD_LEN) == 0) g_menu_state = CURRENT_STATUS_SET_FILTER; else if (strncmp(cmd, "sfp", MAX_CMD_LEN) == 0) @@ -375,9 +371,9 @@ void _interpret_main_menu(char *cmd) g_menu_state = CURRENT_STATUS_SET_MASTER_VOLUME; else if (strncmp(cmd, "mgv", MAX_CMD_LEN) == 0) g_menu_state = CURRENT_STATUS_GET_MASTER_VOLUME; +#endif else if (strncmp(cmd, "acm", MAX_CMD_LEN) == 0) g_menu_state = CURRENT_STATUS_SET_ACM_MASTER_MODE; -#endif else if (strncmp(cmd, "csd", MAX_CMD_LEN) == 0) g_menu_state = CURRENT_STATUS_CREATE_STREAM_DUCKING; else if (strncmp(cmd, "dsd", MAX_CMD_LEN) == 0) @@ -491,9 +487,7 @@ void display_sub_basic() g_print("sso. *Set option for stream routing\n"); g_print("vcr. *Create VStream\t"); g_print("vsr. *Start VStream\t"); -#ifndef TIZEN_FEATURE_TV_PROD g_print("vsv. *Set VStream Volume\n"); -#endif g_print("vdt. *Destroy VStream\t"); g_print("vst. *Stop VStream\n"); g_print("sft. *Set Filter\t"); @@ -501,9 +495,7 @@ void display_sub_basic() g_print("uft. *Unset Filter\n"); g_print("isd. *Is Stream on Device by ID\n"); g_print("gsp. *Get PID of the Latest Stream\n"); -#ifndef TIZEN_FEATURE_TV_PROD g_print("acm. *Set ACM Master mode\n"); -#endif g_print("dis. *Discover remote devices\n"); g_print("pub. *Publish remote devices\n"); g_print("alw. *Allow remote device\n"); @@ -665,10 +657,8 @@ static void displaymenu() g_print("*** press enter to stop virtual stream\n"); else if (g_menu_state == CURRENT_STATUS_DESTROY_VIRTUAL_STREAM) g_print("*** press enter to destroy virtual stream\n"); -#ifndef TIZEN_FEATURE_TV_PROD else if (g_menu_state == CURRENT_STATUS_SET_VIRTUAL_STREAM_VOLUME) g_print("*** input volume ratio of virtual stream (Min:0.0 ~ Max:1.0)\n"); -#endif else if (g_menu_state == CURRENT_STATUS_SET_FILTER) g_print("*** input filter type of media stream (0:LOW_PASS 1:HIGH_PASS 2:DELAY 3:SOUNDALIVE)\n"); else if (g_menu_state == CURRENT_STATUS_SET_FILTER_PRESET) @@ -686,9 +676,9 @@ static void displaymenu() g_print("*** input master volume level\n"); else if (g_menu_state == CURRENT_STATUS_GET_MASTER_VOLUME) g_print("*** press enter to get master volume level\n"); +#endif else if (g_menu_state == CURRENT_STATUS_SET_ACM_MASTER_MODE) g_print("*** input master mode enable or disable (0:disable 1:enable)\n"); -#endif else if (g_menu_state == CURRENT_STATUS_CREATE_STREAM_DUCKING) g_print("*** input target stream (0:MEDIA 1:SYSTEM 2:ALARM 3:NOTIFICATION 4:EMERGENCY 5:VOICE_INFORMATION 6:VOICE_RECOGNITION 7:RINGTONE_VOIP 8:VOIP 9:MEDIA_EXTERNAL_ONLY\n"); else if (g_menu_state == CURRENT_STATUS_DESTROY_STREAM_DUCKING) @@ -2465,7 +2455,6 @@ static void interpret(char *cmd) reset_menu_state(); break; } -#ifndef TIZEN_FEATURE_TV_PROD case CURRENT_STATUS_SET_VIRTUAL_STREAM_VOLUME: { int ret = SOUND_MANAGER_ERROR_NONE; double ratio = 1.0; @@ -2482,7 +2471,6 @@ static void interpret(char *cmd) reset_menu_state(); break; } -#endif case CURRENT_STATUS_SET_FILTER: { int ret = SOUND_MANAGER_ERROR_NONE; sound_filter_e filter; @@ -2664,6 +2652,7 @@ static void interpret(char *cmd) reset_menu_state(); break; } +#endif case CURRENT_STATUS_SET_ACM_MASTER_MODE: { int ret = SOUND_MANAGER_ERROR_NONE; int selection = atoi(cmd); @@ -2682,7 +2671,6 @@ static void interpret(char *cmd) reset_menu_state(); break; } -#endif case CURRENT_STATUS_CREATE_STREAM_DUCKING: { int ret = SOUND_MANAGER_ERROR_NONE; sound_stream_type_e target_stream = SOUND_STREAM_TYPE_MEDIA;