/**
* @internal
+ * @brief Enumeration for rpi playback route
+ * @since_tizen 6.5
+ */
+typedef enum {
+ SOUND_RPI_PLAYBACK_AUTO, /**< NOT IN USE */
+ SOUND_RPI_PLAYBACK_HEADPHONE, /**< Headphone (default) */
+ SOUND_RPI_PLAYBACK_HDMI1, /**< HDMI1 */
+ SOUND_RPI_PLAYBACK_HDMI2, /**< HDMI2 (only for RPI4) */
+} sound_rpi_playback_route_type;
+
+/**
+ * @internal
* @brief Gets the maximum master volume level.
* @since_tizen 3.0
* @param[out] max_level The maximum volume level
int sound_manager_stop_aec(void);
/**
+ * @internal
+ * @brief Set force hdmi route
+ * @since_tizen 6.5
+ * @param[in] type The playback route type for rpi
+ * @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
+ * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
+ * @see sound_manager_get_rpi_playback_route()
+ */
+int sound_manager_set_rpi_playback_route(sound_rpi_playback_route_type type);
+
+/**
+ * @internal
+ * @brief Get force hdmi route status
+ * @since_tizen 6.5
+ * @remarks The default value is #SOUND_RPI_PLAYBACK_HEADPHONE.
+ * @param[out] type The current playback route type of rpi
+ * @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
+ * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
+ * @see sound_manager_set_rpi_playback_route()
+ */
+int sound_manager_get_rpi_playback_route(sound_rpi_playback_route_type *type);
+
+/**
* @}
*/
int _get_latest_stream_pid(int stream_type, unsigned int *pid);
+int _set_rpi_playback_route(sound_rpi_playback_route_type type);
+
+int _get_rpi_playback_route(sound_rpi_playback_route_type *type);
+
#ifdef __cplusplus
}
#endif
Name: capi-media-sound-manager
Summary: Sound Manager library
-Version: 0.6.35
+Version: 0.6.36
Release: 0
Group: Multimedia/API
License: Apache-2.0
return _stop_aec();
}
+int sound_manager_set_rpi_playback_route(sound_rpi_playback_route_type type)
+{
+ return _set_rpi_playback_route(type);
+}
+
+int sound_manager_get_rpi_playback_route(sound_rpi_playback_route_type *type)
+{
+ return _get_rpi_playback_route(type);
+}
\ No newline at end of file
#define PA_STREAM_MANAGER_METHOD_NAME_PUBLISH_LOCAL_DEVICE "PublishLocalDevice"
#define PA_STREAM_MANAGER_METHOD_NAME_DISCOVER_REMOTE_DEVICE "DiscoverRemoteDevice"
#define PA_STREAM_MANAGER_METHOD_NAME_SET_REMOTE_PERMISSION "SetRemotePermission"
+#define PA_STREAM_MANAGER_METHOD_NAME_SET_RPI_PLAYBACK_ROUTE "SetRpiPlaybackRoute"
#define PA_STREAM_MANAGER_SIGNAL_NAME_REMOTE_FOUND "RemoteFound"
#define VCONF_PATH_PREFIX_VOLUME "file/private/sound/volume/"
#define VCONF_PATH_MAX 64
+#define VCONF_SOUND_RPI_PLAYBACK_ROUTE "file/private/sound/rpi_playback_route"
+
#define SM_SOUND_TYPE_CHECK(x_sound_type, x_error) \
if (!strncmp(x_sound_type, "system", strlen(x_sound_type)) || \
!strncmp(x_sound_type, "notification", strlen(x_sound_type)) || \
return SOUND_MANAGER_ERROR_NONE;
}
+
+int _set_rpi_playback_route(sound_rpi_playback_route_type type)
+{
+ int ret;
+
+ LOGI("set rpi playback route : %u", type);
+
+ ret = __dbus_method_call(PA_STREAM_MANAGER_METHOD_NAME_SET_RPI_PLAYBACK_ROUTE, g_variant_new("(u)", type), NULL);
+ if (ret != SOUND_MANAGER_ERROR_NONE)
+ LOGE("_set_rpi_playback_route failed");
+
+ return ret;
+}
+
+int _get_rpi_playback_route(sound_rpi_playback_route_type *type)
+{
+ int route_type;
+ int ret;
+
+ ret = vconf_get_int(VCONF_SOUND_RPI_PLAYBACK_ROUTE, &route_type);
+ if (ret != 0) {
+ LOGE("Failed to get vconf [%s], err [%d]", VCONF_SOUND_RPI_PLAYBACK_ROUTE, ret);
+ return SOUND_MANAGER_ERROR_INVALID_OPERATION;
+ }
+
+ LOGI("current rpi playback route : %u", route_type);
+ *type = route_type;
+
+ return SOUND_MANAGER_ERROR_NONE;
+}
+
//LCOV_EXCL_STOP
static int __check_manual_route_type(sound_stream_info_s *stream_info)
CURRENT_STATUS_SET_REMOTE_PERMISSION,
CURRENT_STATUS_LAUNCH_ECHO_CANCEL,
CURRENT_STATUS_QUIT_ECHO_CANCEL,
+ CURRENT_STATUS_SET_RPI_PLAYBACK_ROUTE,
+ CURRENT_STATUS_GET_RPI_PLAYBACK_ROUTE,
};
g_menu_state = CURRENT_STATUS_LAUNCH_ECHO_CANCEL;
else if (strncmp(cmd, "qec", MAX_CMD_LEN) == 0)
g_menu_state = CURRENT_STATUS_QUIT_ECHO_CANCEL;
+ else if (strncmp(cmd, "srpr", MAX_CMD_LEN) == 0)
+ g_menu_state = CURRENT_STATUS_SET_RPI_PLAYBACK_ROUTE;
+ else if (strncmp(cmd, "grpr", MAX_CMD_LEN) == 0)
+ g_menu_state = CURRENT_STATUS_GET_RPI_PLAYBACK_ROUTE;
else if (strncmp(cmd, "q", MAX_CMD_LEN) == 0) {
g_print("closing the test suite\n");
quit_program();
g_print("alw. *Allow remote device\n");
g_print("lec. *Launch EC\n");
g_print("qec. *Quit EC\n");
+ g_print("srpr. *Set RPI playback route\t");
+ g_print("grpr. *Get RPI playback route\n");
g_print(" * is for internal usage.\n");
g_print("=========================================================================================\n");
}
g_print("*** press enter to launch acoustic echo cancellation service\n");
else if (g_menu_state == CURRENT_STATUS_QUIT_ECHO_CANCEL)
g_print("*** press enter to quit acoustic echo cancellation service\n");
+ else if (g_menu_state == CURRENT_STATUS_SET_RPI_PLAYBACK_ROUTE)
+ g_print("*** input rpi playback route to set (0:auto, 1:headphone, 2:HDMI1, 3:HDMI2(rpi4 only)\n");
+ else if (g_menu_state == CURRENT_STATUS_GET_RPI_PLAYBACK_ROUTE)
+ g_print("*** press enter to get rpi playback route\n");
else {
g_print("*** unknown status.\n");
quit_program();
reset_menu_state();
break;
}
+ case CURRENT_STATUS_SET_RPI_PLAYBACK_ROUTE: {
+ int ret;
+ sound_rpi_playback_route_type type = atoi(cmd);
+
+ ret = sound_manager_set_rpi_playback_route(type);
+ if (!ret)
+ g_print("success to set rpi playback route\n");
+ else
+ g_print("fail to set rpi playback route\n");
+
+ reset_menu_state();
+ break;
+ }
+ case CURRENT_STATUS_GET_RPI_PLAYBACK_ROUTE: {
+ int ret;
+ sound_rpi_playback_route_type type;
+
+ ret = sound_manager_get_rpi_playback_route(&type);
+ if (!ret)
+ g_print("success to get rpi playback route : %u\n", type);
+ else
+ g_print("fail to get rpi playback route\n");
+
+ reset_menu_state();
+ break;
+ }
}
end:
g_timeout_add(100, timeout_menu_display, 0);