summaryrefslogtreecommitdiffstats
path: root/audio/gstsbcutil.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-11-01 19:45:00 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-11-01 19:45:00 +0000
commit96d6078ada20a76f885ea04893aac5f0ca5fe48d (patch)
tree5a555aaae3228f5c5faf2497b71227557aecc650 /audio/gstsbcutil.c
parenta4bc7122fb5c7e4545cf8055cf71d1e88515998f (diff)
Fix sbc negotiation and improves buffer handling by using GstAdapter.
Diffstat (limited to 'audio/gstsbcutil.c')
-rw-r--r--audio/gstsbcutil.c63
1 files changed, 25 insertions, 38 deletions
diff --git a/audio/gstsbcutil.c b/audio/gstsbcutil.c
index e55220c3..1d7a1227 100644
--- a/audio/gstsbcutil.c
+++ b/audio/gstsbcutil.c
@@ -39,25 +39,6 @@ gint gst_sbc_select_rate_from_list(const GValue *value)
}
/*
- * Selects one rate from a range of possible rates
- * TODO - use a better approach to this (it is selecting the maximum value)
- */
-gint gst_sbc_select_rate_from_range(const GValue *value)
-{
- return gst_value_get_int_range_max(value);
-}
-
-/*
- * Selects one number of channels from a list of possible numbers
- * TODO - use a better approach to this (it is selecting the last element)
- */
-gint gst_sbc_select_channels_from_list(const GValue *value)
-{
- guint size = gst_value_list_get_size(value);
- return g_value_get_int(gst_value_list_get_value(value, size-1));
-}
-
-/*
* Selects one number of channels option from a range of possible numbers
* TODO - use a better approach to this (it is selecting the maximum value)
*/
@@ -77,15 +58,6 @@ gint gst_sbc_select_blocks_from_list(const GValue *value)
}
/*
- * Selects one blocks option from a range of possible blocks
- * TODO - use a better approach to this (it is selecting the maximum value)
- */
-gint gst_sbc_select_blocks_from_range(const GValue *value)
-{
- return gst_value_get_int_range_max(value);
-}
-
-/*
* Selects one number of subbands from a list
* TODO - use a better approach to this (it is selecting the last element)
*/
@@ -96,15 +68,6 @@ gint gst_sbc_select_subbands_from_list(const GValue *value)
}
/*
- * Selects one subbands option from a range
- * TODO - use a better approach to this (it is selecting the maximum value)
- */
-gint gst_sbc_select_subbands_from_range(const GValue *value)
-{
- return gst_value_get_int_range_max(value);
-}
-
-/*
* Selects one bitpool option from a range
* TODO - use a better approach to this (it is selecting the maximum value)
*/
@@ -187,8 +150,32 @@ const gchar *gst_sbc_get_allocation_string(int alloc)
case CFG_ALLOCATION_SNR:
return "snr";
case CFG_ALLOCATION_AUTO:
- return NULL; /* TODO what should be selected here? */
+ return "loudness"; /* TODO what should be selected here? */
default:
return NULL;
}
}
+
+GstCaps* gst_sbc_caps_from_sbc(struct ipc_data_cfg *cfg,
+ struct ipc_codec_sbc *sbc, gint channels)
+{
+ GstCaps *caps;
+ const gchar *mode_str;
+ const gchar *allocation_str;
+
+ mode_str = gst_sbc_get_mode_string(cfg->mode);
+ allocation_str = gst_sbc_get_allocation_string(sbc->allocation);
+
+ caps = gst_caps_new_simple("audio/x-sbc",
+ "rate", G_TYPE_INT, cfg->rate,
+ "channels", G_TYPE_INT, channels,
+ "mode", G_TYPE_STRING, mode_str,
+ "subbands", G_TYPE_INT, sbc->subbands,
+ "blocks", G_TYPE_INT, sbc->blocks,
+ "allocation", G_TYPE_STRING, allocation_str,
+ "bitpool", G_TYPE_INT, sbc->bitpool,
+ NULL);
+
+ return caps;
+}
+