gst/multipart/: Convert audio/x-adpcm to and from the audio/G726-X in the muxer and demuxer. Fixes #549551.

Original commit message from CVS:
Patch by: Mersad Jelacic <mersad at axis dot com>
* gst/multipart/multipartdemux.c:
* gst/multipart/multipartmux.c: (gst_multipart_mux_get_mime):
Convert audio/x-adpcm to and from the audio/G726-X in the muxer and
demuxer. Fixes #549551.
This commit is contained in:
Mersad Jelacic 2008-08-28 10:09:16 +00:00 committed by Wim Taymans
parent d92f63d3ab
commit 9b08b5307f
3 changed files with 35 additions and 2 deletions

View file

@ -1,3 +1,12 @@
2008-08-28 Wim Taymans <wim.taymans@collabora.co.uk>
Patch by: Mersad Jelacic <mersad at axis dot com>
* gst/multipart/multipartdemux.c:
* gst/multipart/multipartmux.c: (gst_multipart_mux_get_mime):
Convert audio/x-adpcm to and from the audio/G726-X in the muxer and
demuxer. Fixes #549551.
2008-08-27 Edward Hervey <edward.hervey@collabora.co.uk> 2008-08-27 Edward Hervey <edward.hervey@collabora.co.uk>
* sys/osxaudio/gstosxaudiosink.c: * sys/osxaudio/gstosxaudiosink.c:

View file

@ -110,6 +110,10 @@ typedef struct
static const GstNamesMap gstnames[] = { static const GstNamesMap gstnames[] = {
/* RFC 2046 says audio/basic is mulaw, mono, 8000Hz */ /* RFC 2046 says audio/basic is mulaw, mono, 8000Hz */
{"audio/basic", "audio/x-mulaw, channels=1, rate=8000"}, {"audio/basic", "audio/x-mulaw, channels=1, rate=8000"},
{"audio/G726-16", "audio/x-adpcm, bitrate=16000"},
{"audio/G726-24", "audio/x-adpcm, bitrate=24000"},
{"audio/G726-32", "audio/x-adpcm, bitrate=32000"},
{"audio/G726-40", "audio/x-adpcm, bitrate=40000"},
{NULL, NULL} {NULL, NULL}
}; };

View file

@ -293,6 +293,7 @@ gst_multipart_mux_get_mime (GstMultipartMux * mux, GstStructure * s)
const gchar *name; const gchar *name;
gint rate; gint rate;
gint channels; gint channels;
gint bitrate = 0;
klass = GST_MULTIPART_MUX_GET_CLASS (mux); klass = GST_MULTIPART_MUX_GET_CLASS (mux);
@ -301,8 +302,27 @@ gst_multipart_mux_get_mime (GstMultipartMux * mux, GstStructure * s)
/* use hashtable to convert to mime type */ /* use hashtable to convert to mime type */
mime = g_hash_table_lookup (klass->mimetypes, name); mime = g_hash_table_lookup (klass->mimetypes, name);
if (mime == NULL) { if (mime == NULL) {
/* no mime type mapping, use name */ if (!strcmp (name, "audio/x-adpcm"))
mime = name; gst_structure_get_int (s, "bitrate", &bitrate);
switch (bitrate) {
case 16000:
mime = "audio/G726-16";
break;
case 24000:
mime = "audio/G726-24";
break;
case 32000:
mime = "audio/G726-32";
break;
case 40000:
mime = "audio/G726-40";
break;
default:
/* no mime type mapping, use name */
mime = name;
break;
}
} }
/* RFC2046 requires audio/basic to be mulaw 8000Hz mono */ /* RFC2046 requires audio/basic to be mulaw 8000Hz mono */
if (g_ascii_strcasecmp (mime, "audio/basic") == 0) { if (g_ascii_strcasecmp (mime, "audio/basic") == 0) {