summaryrefslogtreecommitdiffstats
path: root/ext/soup
diff options
context:
space:
mode:
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>2009-05-20 17:57:59 +0300
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>2009-05-22 00:55:08 +0300
commit1d6fd4b6ddb9c66ef45f74aef51a0a7a0ea0ff18 (patch)
treeb81efc05268e4dadc685aa19bceaa8d456985adc /ext/soup
parentcd0e75ac1aa65975fa4de03f1af796c99d2d71b7 (diff)
souphttpsrc: Set caps for audio/L16 content-type
When "Content-Type" header is "audio/L16", we need to set the caps on the outgoing buffers so that downstream elements can have means to detect the stream type and handle it appropriately. Tested with HTTP stream provided by pulse-audio's http module (git master).
Diffstat (limited to 'ext/soup')
-rw-r--r--ext/soup/gstsouphttpsrc.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c
index 12cd8fb1..ac2007a0 100644
--- a/ext/soup/gstsouphttpsrc.c
+++ b/ext/soup/gstsouphttpsrc.c
@@ -744,6 +744,8 @@ gst_soup_http_src_got_headers_cb (SoupMessage * msg, GstSoupHTTPSrc * src)
guint64 newsize;
+ GHashTable *params = NULL;
+
GST_DEBUG_OBJECT (src, "got headers");
if (src->automatic_redirect && SOUP_STATUS_IS_REDIRECTION (msg->status_code)) {
@@ -792,8 +794,39 @@ gst_soup_http_src_got_headers_cb (SoupMessage * msg, GstSoupHTTPSrc * src)
src->src_caps = gst_caps_new_simple ("application/x-icy",
"metadata-interval", G_TYPE_INT, icy_metaint, NULL);
}
+ } else if ((value =
+ soup_message_headers_get_content_type (msg->response_headers,
+ &params)) != NULL) {
+ GST_DEBUG_OBJECT (src, "Content-Type: %s", value);
+ if (g_ascii_strcasecmp (value, "audio/L16") == 0) {
+ gint channels = 2;
+ gint rate = 44100;
+ char *param;
+
+ if (src->src_caps)
+ gst_caps_unref (src->src_caps);
+
+ param = g_hash_table_lookup (params, "channels");
+ if (param != NULL)
+ channels = atol (param);
+
+ param = g_hash_table_lookup (params, "rate");
+ if (param != NULL)
+ rate = atol (param);
+
+ src->src_caps = gst_caps_new_simple ("audio/x-raw-int",
+ "channels", G_TYPE_INT, channels,
+ "rate", G_TYPE_INT, rate,
+ "width", G_TYPE_INT, 16,
+ "depth", G_TYPE_INT, 16,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "endianness", G_TYPE_INT, G_BIG_ENDIAN, NULL);
+ }
}
+ if (params != NULL)
+ g_hash_table_destroy (params);
+
if ((value =
soup_message_headers_get (msg->response_headers,
"icy-name")) != NULL) {