*/
int sound_manager_get_focus_state(sound_stream_info_h stream_info, sound_stream_focus_state_e *state_for_playback, sound_stream_focus_state_e *state_for_recording);
+/**
+ * @brief Gets the sound type of the stream information.
+ * @since_tizen 3.0
+ * @param[in] stream_info The handle of stream information
+ * @param[out] sound_type The sound type
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Call sound_manager_create_stream_information() before calling this function.
+ * @see sound_manager_create_stream_information()
+ * @see sound_manager_destroy_stream_information()
+ * @see sound_manager_set_volume()
+ * @see sound_manager_get_max_volume()
+ * @see sound_manager_get_volume()
+ */
+int sound_manager_get_sound_type(sound_stream_info_h stream_info, sound_type_e *sound_type);
+
/**
* @brief Registers the watch callback function to be invoked when the focus state for each sound stream type is changed regardless of the process.
* @since_tizen 3.0
typedef struct _stream_conf_info_s {
int priority;
int route_type;
+ const gchar *volume_type;
gchar *avail_in_devices[AVAIL_DEVICES_MAX];
gchar *avail_out_devices[AVAIL_DEVICES_MAX];
gchar *avail_frameworks[AVAIL_FRAMEWORKS_MAX];
int _convert_sound_type(sound_type_e sound_type, const char **volume_type);
-int _convert_sound_type_to_enum(char *sound_type, sound_type_e *sound_type_enum);
+int _convert_sound_type_to_enum(const char *sound_type, sound_type_e *sound_type_enum);
int _get_volume_max_level(const char *direction, const char *volume_type, unsigned int *max_level);
Name: capi-media-sound-manager
Summary: Sound Manager library
-Version: 0.3.22
+Version: 0.3.23
Release: 0
Group: Multimedia/API
License: Apache-2.0
if (mm_sound_vol_type == VOLUME_TYPE_UNKNOWN) {
/* get the volume type of the current playing stream */
ret = _get_current_volume_type("out", &volume_type);
- if (ret == MM_ERROR_NONE) {
- ret = _convert_sound_type_to_enum(volume_type, type);
- free(volume_type);
- }
+ if (ret == MM_ERROR_NONE)
+ ret = _convert_sound_type_to_enum((const char*)volume_type, type);
} else {
*type = mm_sound_vol_type;
}
return _convert_sound_manager_error_code(__func__, ret);
}
+int sound_manager_get_sound_type(sound_stream_info_h stream_info, sound_type_e *sound_type)
+{
+ int ret = MM_ERROR_NONE;
+ sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
+
+ LOGI(">> enter");
+
+ SM_INSTANCE_CHECK(stream_h);
+ SM_NULL_ARG_CHECK(sound_type);
+
+ ret = _convert_sound_type_to_enum(stream_h->stream_conf_info.volume_type, sound_type);
+
+ LOGI("<< leave : sound type(%d)", *sound_type);
+
+ return _convert_sound_manager_error_code(__func__, ret);
+}
+
int sound_manager_set_focus_state_watch_cb(sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_watch_cb callback, void *user_data)
{
int ret = MM_ERROR_NONE;
return ret;
}
-int _convert_sound_type_to_enum(char *sound_type, sound_type_e *sound_type_enum)
+int _convert_sound_type_to_enum(const char *sound_type, sound_type_e *sound_type_enum)
{
int ret = MM_ERROR_NONE;
PA_STREAM_MANAGER_INTERFACE,
PA_STREAM_MANAGER_METHOD_NAME_GET_STREAM_INFO,
g_variant_new("(s)", stream_type),
- G_VARIANT_TYPE("(vvvvv)"),
+ G_VARIANT_TYPE("(vvvvvv)"),
G_DBUS_CALL_FLAGS_NONE,
2000,
NULL,
g_variant_unref(child);
LOGI("route_type(%d)", info->route_type);
- /* get availabe in-devices */
+ /* get volume types */
child = g_variant_get_child_value(result, 2);
item = g_variant_get_variant(child);
+ g_variant_iter_init(&iter, item);
+ while (g_variant_iter_loop(&iter, "&s", &name)) {
+ if (!strncmp(name, "none", strlen("none"))) {
+ /* skip it */
+ } else {
+ /* we use volume type only for out direction */
+ if (name) {
+ LOGI(" volume-type : %s", name);
+ info->volume_type = strdup(name);
+ break;
+ }
+ }
+ }
+ g_variant_iter_free(&iter);
+ g_variant_unref(item);
+ g_variant_unref(child);
+
+ /* get availabe in-devices */
+ child = g_variant_get_child_value(result, 3);
+ item = g_variant_get_variant(child);
size = g_variant_n_children(item);
LOGI("num of avail-in-devices are %d", size);
g_variant_iter_init(&iter, item);
g_variant_unref(child);
/* get available out-devices */
- child = g_variant_get_child_value(result, 3);
+ child = g_variant_get_child_value(result, 4);
item = g_variant_get_variant(child);
size = g_variant_n_children(item);
LOGI("num of avail-out-devices are %d", size);
g_variant_unref(child);
/* get available frameworks */
- child = g_variant_get_child_value(result, 4);
+ child = g_variant_get_child_value(result, 5);
item = g_variant_get_variant(child);
size = g_variant_n_children(item);
LOGI("num of avail-frameworks are %d", size);
CURRENT_STATUS_ACQUIRE_FOCUS,
CURRENT_STATUS_RELEASE_FOCUS,
CURRENT_STATUS_GET_ACQUIRED_FOCUS,
+ CURRENT_STATUS_GET_SOUND_TYPE,
CURRENT_STATUS_DESTROY_STREAM_INFO,
CURRENT_STATUS_SET_FOCUS_WATCH_CB,
CURRENT_STATUS_UNSET_FOCUS_WATCH_CB,
g_menu_state = CURRENT_STATUS_RELEASE_FOCUS;
else if (strncmp(cmd, "gfs", 3) == 0)
g_menu_state = CURRENT_STATUS_GET_ACQUIRED_FOCUS;
+ else if (strncmp(cmd, "gst", 3) == 0)
+ g_menu_state = CURRENT_STATUS_GET_SOUND_TYPE;
else if (strncmp(cmd, "sfw", 3) == 0)
g_menu_state = CURRENT_STATUS_SET_FOCUS_WATCH_CB;
else if (strncmp(cmd, "ufw", 3) == 0)
g_print("-----------------------------------------------------------------------------------------\n");
g_print("csi. Create Stream Info\t");
g_print("dsi. Destroy Stream Info\n");
+ g_print("gst. Get Sound Type\n");
g_print("ads. Add device for stream routing\t");
g_print("rds. Remove device for stream routing\t");
g_print("aps. Apply devices for stream routing\n");
g_print("*** input focus type to release (0:playback, 1:recording, 2:both)\n");
else if (g_menu_state == CURRENT_STATUS_GET_ACQUIRED_FOCUS)
g_print("*** press enter to get focus state\n");
+ else if (g_menu_state == CURRENT_STATUS_GET_SOUND_TYPE)
+ g_print("*** press enter to get sound type\n");
else if (g_menu_state == CURRENT_STATUS_DESTROY_STREAM_INFO)
g_print("*** press enter to destroy stream information\n");
else if (g_menu_state == CURRENT_STATUS_SET_FOCUS_WATCH_CB)
reset_menu_state();
break;
}
+ case CURRENT_STATUS_GET_SOUND_TYPE: {
+ int ret = SOUND_MANAGER_ERROR_NONE;
+ sound_type_e sound_type;
+ if (g_stream_info_h) {
+ ret = sound_manager_get_sound_type(g_stream_info_h, &sound_type);
+ if (ret)
+ g_print("fail to sound_manager_get_sound_type(), ret(0x%x)\n", ret);
+ else
+ g_print("sound_type(%d)\n", sound_type);
+
+ } else
+ g_print("please create stream info. first\n");
+
+ reset_menu_state();
+ break;
+ }
case CURRENT_STATUS_DESTROY_STREAM_INFO: {
int ret = SOUND_MANAGER_ERROR_NONE;
ret = sound_manager_destroy_stream_information(g_stream_info_h);