bluez: Make use of parameters selected in alsa plugin and fix auto selection.

This commit is contained in:
Luiz Augusto von Dentz 2008-02-14 21:22:38 +00:00 committed by Tim-Philipp Müller
parent 89f66da8ae
commit a85d0fb7e8

View File

@ -280,9 +280,7 @@ gst_avdtp_sink_init_sbc_pkt_conf (GstAvdtpSink * sink,
value = gst_structure_get_value (structure, "mode"); value = gst_structure_get_value (structure, "mode");
pref = g_value_get_string (value); pref = g_value_get_string (value);
if (strcmp (pref, "auto") == 0) if (strcmp (pref, "mono") == 0)
cfg->channel_mode = BT_A2DP_CHANNEL_MODE_AUTO;
else if (strcmp (pref, "mono") == 0)
cfg->channel_mode = BT_A2DP_CHANNEL_MODE_MONO; cfg->channel_mode = BT_A2DP_CHANNEL_MODE_MONO;
else if (strcmp (pref, "dual") == 0) else if (strcmp (pref, "dual") == 0)
cfg->channel_mode = BT_A2DP_CHANNEL_MODE_DUAL_CHANNEL; cfg->channel_mode = BT_A2DP_CHANNEL_MODE_DUAL_CHANNEL;
@ -297,9 +295,7 @@ gst_avdtp_sink_init_sbc_pkt_conf (GstAvdtpSink * sink,
value = gst_structure_get_value (structure, "allocation"); value = gst_structure_get_value (structure, "allocation");
pref = g_value_get_string (value); pref = g_value_get_string (value);
if (strcmp (pref, "auto") == 0) if (strcmp (pref, "loudness") == 0)
cfg->allocation_method = BT_A2DP_ALLOCATION_AUTO;
else if (strcmp (pref, "loudness") == 0)
cfg->allocation_method = BT_A2DP_ALLOCATION_LOUDNESS; cfg->allocation_method = BT_A2DP_ALLOCATION_LOUDNESS;
else if (strcmp (pref, "snr") == 0) else if (strcmp (pref, "snr") == 0)
cfg->allocation_method = BT_A2DP_ALLOCATION_SNR; cfg->allocation_method = BT_A2DP_ALLOCATION_SNR;
@ -434,16 +430,6 @@ gst_avdtp_sink_parse_sbc_caps (GstAvdtpSink * self, sbc_capabilities_t * sbc)
/* mode */ /* mode */
list = g_value_init (g_new0 (GValue, 1), GST_TYPE_LIST); list = g_value_init (g_new0 (GValue, 1), GST_TYPE_LIST);
if (sbc->channel_mode == BT_A2DP_CHANNEL_MODE_AUTO) {
g_value_set_static_string (value, "joint");
gst_value_list_prepend_value (list, value);
g_value_set_static_string (value, "stereo");
gst_value_list_prepend_value (list, value);
g_value_set_static_string (value, "mono");
gst_value_list_prepend_value (list, value);
g_value_set_static_string (value, "dual");
gst_value_list_prepend_value (list, value);
} else {
if (sbc->channel_mode & BT_A2DP_CHANNEL_MODE_MONO) { if (sbc->channel_mode & BT_A2DP_CHANNEL_MODE_MONO) {
g_value_set_static_string (value, "mono"); g_value_set_static_string (value, "mono");
gst_value_list_prepend_value (list, value); gst_value_list_prepend_value (list, value);
@ -460,7 +446,6 @@ gst_avdtp_sink_parse_sbc_caps (GstAvdtpSink * self, sbc_capabilities_t * sbc)
g_value_set_static_string (value, "joint"); g_value_set_static_string (value, "joint");
gst_value_list_prepend_value (list, value); gst_value_list_prepend_value (list, value);
} }
}
g_value_unset (value); g_value_unset (value);
if (list) { if (list) {
gst_structure_set_value (structure, "mode", list); gst_structure_set_value (structure, "mode", list);
@ -515,12 +500,6 @@ gst_avdtp_sink_parse_sbc_caps (GstAvdtpSink * self, sbc_capabilities_t * sbc)
/* allocation */ /* allocation */
g_value_init (value, G_TYPE_STRING); g_value_init (value, G_TYPE_STRING);
list = g_value_init (g_new0 (GValue, 1), GST_TYPE_LIST); list = g_value_init (g_new0 (GValue, 1), GST_TYPE_LIST);
if (sbc->allocation_method == BT_A2DP_ALLOCATION_AUTO) {
g_value_set_static_string (value, "loudness");
gst_value_list_prepend_value (list, value);
g_value_set_static_string (value, "snr");
gst_value_list_prepend_value (list, value);
} else {
if (sbc->allocation_method & BT_A2DP_ALLOCATION_LOUDNESS) { if (sbc->allocation_method & BT_A2DP_ALLOCATION_LOUDNESS) {
g_value_set_static_string (value, "loudness"); g_value_set_static_string (value, "loudness");
gst_value_list_prepend_value (list, value); gst_value_list_prepend_value (list, value);
@ -529,7 +508,6 @@ gst_avdtp_sink_parse_sbc_caps (GstAvdtpSink * self, sbc_capabilities_t * sbc)
g_value_set_static_string (value, "snr"); g_value_set_static_string (value, "snr");
gst_value_list_prepend_value (list, value); gst_value_list_prepend_value (list, value);
} }
}
g_value_unset (value); g_value_unset (value);
if (list) { if (list) {
gst_structure_set_value (structure, "allocation", list); gst_structure_set_value (structure, "allocation", list);
@ -572,10 +550,6 @@ gst_avdtp_sink_parse_sbc_caps (GstAvdtpSink * self, sbc_capabilities_t * sbc)
g_value_unset (value); g_value_unset (value);
/* channels */ /* channels */
if (sbc->channel_mode == BT_A2DP_CHANNEL_MODE_AUTO) {
g_value_init (value, GST_TYPE_INT_RANGE);
gst_value_set_int_range (value, 1, 2);
} else {
mono = FALSE; mono = FALSE;
stereo = FALSE; stereo = FALSE;
if (sbc->channel_mode & BT_A2DP_CHANNEL_MODE_MONO) if (sbc->channel_mode & BT_A2DP_CHANNEL_MODE_MONO)
@ -600,7 +574,7 @@ gst_avdtp_sink_parse_sbc_caps (GstAvdtpSink * self, sbc_capabilities_t * sbc)
g_value_set_int (value, 0); g_value_set_int (value, 0);
} }
} }
}
gst_structure_set_value (structure, "channels", value); gst_structure_set_value (structure, "channels", value);
g_free (value); g_free (value);