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.
This commit is contained in:
Zaheer Abbas Merali 2008-08-22 11:29:26 +00:00
parent f209c1be01
commit a10d127c35
3 changed files with 25 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2008-08-22 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* gst/multipart/multipartdemux.c:
* gst/multipart/multipartmux.c:
Conform to RFC2046. audio/basic is mulaw 8000Hz mono.
2008-08-21 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
* sys/directdraw/gstdirectdrawsink.c (gst_directdraw_sink_buffer_alloc,

View file

@ -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;

View file

@ -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;
}