gst/multipart/: Convert audio/x-adpcm to and from the audio/G726-X in the muxer and...
authorMersad Jelacic <mersad@axis.com>
Thu, 28 Aug 2008 10:09:16 +0000 (10:09 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Thu, 28 Aug 2008 10:09:16 +0000 (10:09 +0000)
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.

ChangeLog
gst/multipart/multipartdemux.c
gst/multipart/multipartmux.c

index 805e2fc..180bfd4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * sys/osxaudio/gstosxaudiosink.c:
index 200f36a..eeffd4e 100644 (file)
@@ -110,6 +110,10 @@ typedef struct
 static const GstNamesMap gstnames[] = {
   /* RFC 2046 says audio/basic is mulaw, mono, 8000Hz */
   {"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}
 };
 
index a4a1300..45bc4bd 100644 (file)
@@ -293,6 +293,7 @@ gst_multipart_mux_get_mime (GstMultipartMux * mux, GstStructure * s)
   const gchar *name;
   gint rate;
   gint channels;
+  gint bitrate = 0;
 
   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 */
   mime = g_hash_table_lookup (klass->mimetypes, name);
   if (mime == NULL) {
-    /* no mime type mapping, use name */
-    mime = name;
+    if (!strcmp (name, "audio/x-adpcm"))
+      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 */
   if (g_ascii_strcasecmp (mime, "audio/basic") == 0) {