*/
int sound_manager_get_device_channels(sound_device_h device, int *channels);
+/**
+ * @internal
+ * @brief Gets the current device id for media playback stream.
+ * @since_tizen 7.5
+ *
+ * @param[out] device_id The output device id that a media playback stream can go out
+ * @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
+ * @see sound_manager_get_current_media_playback_device_type()
+ */
+int sound_manager_get_current_media_playback_device_id(int *device_id);
+
/**
* @}
*/
int _get_current_volume_type(const char *direction, char **volume_type);
-int _get_current_media_routing_path(const char *direction, sound_device_type_e *device_type);
+int _get_current_media_routing_path(const char *direction, int *device_id, sound_device_type_e *device_type);
void _update_focus_status(unsigned int index, unsigned int acquired_focus_status);
Name: capi-media-sound-manager
Summary: Sound Manager library
-Version: 0.7.1
+Version: 0.7.2
Release: 0
Group: Multimedia/API
License: Apache-2.0
int sound_manager_get_current_media_playback_device_type(sound_device_type_e *device_type)
{
+ int unused;
SM_ARG_CHECK(device_type);
- return _get_current_media_routing_path("out", device_type);
+ return _get_current_media_routing_path("out", &unused, device_type);
}
int sound_manager_get_current_playback_focus(sound_stream_focus_change_reason_e *acquired_by, int *flags, char **extra_info)
return _convert_sound_manager_error_code(__func__, ret);
}
+
+int sound_manager_get_current_media_playback_device_id(int *device_id)
+{
+ sound_device_type_e unused;
+ SM_ARG_CHECK(device_id);
+
+ return _get_current_media_routing_path("out", device_id, &unused);
+}
\ No newline at end of file
return ret;
}
-int _get_current_media_routing_path(const char *direction, sound_device_type_e *device_type)
+int _get_current_media_routing_path(const char *direction, int *device_id, sound_device_type_e *device_type)
{
int ret = SOUND_MANAGER_ERROR_NONE;
GVariant *result = NULL;
GError *err = NULL;
const gchar *dbus_device_type = NULL;
const gchar *dbus_ret = NULL;
+ unsigned int dbus_device_id;
SM_ARG_CHECK(direction);
+ SM_ARG_CHECK(device_id);
SM_ARG_CHECK(device_type);
if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE)
PA_STREAM_MANAGER_INTERFACE,
PA_STREAM_MANAGER_METHOD_NAME_GET_CURRENT_MEDIA_ROUTING_PATH,
g_variant_new("(s)", direction),
- G_VARIANT_TYPE("(ss)"),
+ G_VARIANT_TYPE("(uss)"),
G_DBUS_CALL_FLAGS_NONE,
DBUS_METHOD_TIMEOUT,
NULL,
//LCOV_EXCL_STOP
}
- g_variant_get(result, "(&s&s)", &dbus_device_type, &dbus_ret);
+ g_variant_get(result, "(u&s&s)", &dbus_device_id, &dbus_device_type, &dbus_ret);
if (!strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret))) {
+ *device_id = (int)dbus_device_id;
if (_convert_device_type_str_to_enum(dbus_device_type, device_type) < 0)
ret = SOUND_MANAGER_ERROR_INTERNAL;//LCOV_EXCL_LINE
} else {
- if (!strncmp("none", dbus_device_type, strlen(dbus_device_type)))
- ret = SOUND_MANAGER_ERROR_NO_DATA;
- else
- ret = SOUND_MANAGER_ERROR_INTERNAL;
+ ret = (!strncmp("none", dbus_device_type, strlen(dbus_device_type))) ?
+ SOUND_MANAGER_ERROR_NO_DATA : SOUND_MANAGER_ERROR_INTERNAL;
}
LOGI("dbus_ret[%s] ret[0x%x]", dbus_ret, ret);
case CURRENT_STATUS_GET_CURRENT_MEDIA_PLAYBACK_DEVICE_TYPE: {
int ret = SOUND_MANAGER_ERROR_NONE;
sound_device_type_e device_type;
+ int device_id;
ret = sound_manager_get_current_media_playback_device_type(&device_type);
if (ret)
else
g_print("device type is [%s]\n", g_device_type_str[device_type]);
+ ret = sound_manager_get_current_media_playback_device_id(&device_id);
+ if (ret)
+ g_print("fail to sound_manager_get_current_media_playback_device_id, ret(0x%x)\n", ret);
+ else
+ g_print("device id is [%d]\n", device_id);
+
reset_menu_state();
break;
}