audiofilter: fix get_unit_size
authorRené Stadler <rene.stadler@collabora.co.uk>
Fri, 28 Oct 2011 08:44:38 +0000 (10:44 +0200)
committerRené Stadler <rene.stadler@collabora.co.uk>
Fri, 28 Oct 2011 09:24:00 +0000 (11:24 +0200)
gst-libs/gst/audio/gstaudiofilter.c

index 19e6fbe..3e08049 100644 (file)
@@ -145,19 +145,18 @@ static gboolean
 gst_audio_filter_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
     gsize * size)
 {
-  GstStructure *structure;
-  gboolean ret = TRUE;
+  GstAudioInfo info;
   gint width, channels;
 
-  structure = gst_caps_get_structure (caps, 0);
+  if (!gst_audio_info_from_caps (&info, caps))
+    return FALSE;
 
-  ret &= gst_structure_get_int (structure, "width", &width);
-  ret &= gst_structure_get_int (structure, "channels", &channels);
+  width = GST_AUDIO_INFO_WIDTH (&info);
+  channels = GST_AUDIO_INFO_CHANNELS (&info);
 
-  if (ret)
-    *size = (width / 8) * channels;
+  *size = (width / 8) * channels;
 
-  return ret;
+  return TRUE;
 }
 
 /**