From a10d127c355c094aaa0c1890b001f9a833c926a7 Mon Sep 17 00:00:00 2001 From: Zaheer Abbas Merali Date: Fri, 22 Aug 2008 11:29:26 +0000 Subject: gst/multipart/: Conform to RFC2046. audio/basic is mulaw 8000Hz mono. Original commit message from CVS: * gst/multipart/multipartdemux.c: * gst/multipart/multipartmux.c: Conform to RFC2046. audio/basic is mulaw 8000Hz mono. --- gst/multipart/multipartdemux.c | 7 ++++++- gst/multipart/multipartmux.c | 13 +++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'gst/multipart') diff --git a/gst/multipart/multipartdemux.c b/gst/multipart/multipartdemux.c index f5efda70..200f36ad 100644 --- a/gst/multipart/multipartdemux.c +++ b/gst/multipart/multipartdemux.c @@ -108,7 +108,8 @@ typedef struct /* convert from mime types to gst structure names. Add more when needed. */ static const GstNamesMap gstnames[] = { - {"audio/basic", "audio/x-mulaw"}, + /* RFC 2046 says audio/basic is mulaw, mono, 8000Hz */ + {"audio/basic", "audio/x-mulaw, channels=1, rate=8000"}, {NULL, NULL} }; @@ -221,6 +222,7 @@ gst_multipart_demux_get_gstname (GstMultipartDemux * demux, gchar * mimetype) /* no gst name mapping, use mime type */ gstname = mimetype; } + GST_DEBUG_OBJECT (demux, "gst name for %s is %s", mimetype, gstname); return gstname; } @@ -264,6 +266,7 @@ gst_multipart_find_pad_by_mime (GstMultipartDemux * demux, gchar * mime, /* take the mime type, convert it to the caps name */ capsname = gst_multipart_demux_get_gstname (demux, mime); caps = gst_caps_from_string (capsname); + GST_DEBUG_OBJECT (demux, "caps for pad: %s", capsname); gst_pad_use_fixed_caps (pad); gst_pad_set_caps (pad, caps); gst_caps_unref (caps); @@ -515,6 +518,8 @@ gst_multipart_demux_chain (GstPad * pad, GstBuffer * buf) GST_DEBUG_OBJECT (multipart, "pushing buffer with timestamp %" GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf))); + GST_DEBUG_OBJECT (multipart, "buffer has caps %s", + gst_caps_to_string (GST_BUFFER_CAPS (outbuf))); res = gst_pad_push (srcpad->pad, outbuf); if (res != GST_FLOW_OK) break; diff --git a/gst/multipart/multipartmux.c b/gst/multipart/multipartmux.c index 498f8252..a4a1300f 100644 --- a/gst/multipart/multipartmux.c +++ b/gst/multipart/multipartmux.c @@ -291,6 +291,8 @@ gst_multipart_mux_get_mime (GstMultipartMux * mux, GstStructure * s) GstMultipartMuxClass *klass; const gchar *mime; const gchar *name; + gint rate; + gint channels; klass = GST_MULTIPART_MUX_GET_CLASS (mux); @@ -302,6 +304,17 @@ gst_multipart_mux_get_mime (GstMultipartMux * mux, GstStructure * s) /* no mime type mapping, use name */ mime = name; } + /* RFC2046 requires audio/basic to be mulaw 8000Hz mono */ + if (g_ascii_strcasecmp (mime, "audio/basic") == 0) { + if (gst_structure_get_int (s, "rate", &rate) && + gst_structure_get_int (s, "channels", &channels)) { + if (rate != 8000 || channels != 1) { + mime = name; + } + } else { + mime = name; + } + } return mime; } -- cgit