gst/audioconvert/gstaudioconvert.c: Get structure-name just once.
authorStefan Kost <ensonic@users.sourceforge.net>
Sun, 17 Sep 2006 11:24:21 +0000 (11:24 +0000)
committerStefan Kost <ensonic@users.sourceforge.net>
Sun, 17 Sep 2006 11:24:21 +0000 (11:24 +0000)
Original commit message from CVS:
* gst/audioconvert/gstaudioconvert.c: (set_structure_widths),
(gst_audio_convert_transform_caps):
Get structure-name just once.

ChangeLog
gst/audioconvert/gstaudioconvert.c

index d9f854c..647a5ef 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2006-09-17  Stefan Kost  <ensonic@users.sf.net>
 
+       * gst/audioconvert/gstaudioconvert.c: (set_structure_widths),
+       (gst_audio_convert_transform_caps):
+          Get structure-name just once.
+
+2006-09-17  Stefan Kost  <ensonic@users.sf.net>
+
        * tests/check/elements/audioresample.c: (GST_START_TEST):
        * tests/check/elements/videotestsrc.c: (check_rgb_buf):
        * tests/check/elements/volume.c: (GST_START_TEST):
index 8cb2bec..506ecdb 100644 (file)
@@ -399,7 +399,6 @@ set_structure_widths (GstStructure * s, int min, int max)
   for (width = min; width <= max; width += 8) {
     g_value_set_int (&val, width);
     gst_value_list_append_value (&list, &val);
-    GST_LOG ("Appended width %d to widths available", width);
   }
   gst_structure_set_value (s, "width", &list);
   g_value_unset (&val);
@@ -425,21 +424,22 @@ gst_audio_convert_transform_caps (GstBaseTransform * base,
   GstStructure *s, *structure;
   gboolean isfloat;
   gint width, depth, channels;
-  gchar *fields_used[] = { "width", "depth", "rate", "channels", "endianness",
-    "signed"
+  gchar *fields_used[] = {
+    "width", "depth", "rate", "channels", "endianness", "signed"
   };
+  const gchar *structure_name;
   int i;
 
   g_return_val_if_fail (GST_CAPS_IS_SIMPLE (caps), NULL);
 
   structure = gst_caps_get_structure (caps, 0);
+  structure_name = gst_structure_get_name (structure);
 
-  isfloat = strcmp (gst_structure_get_name (structure),
-      "audio/x-raw-float") == 0;
+  isfloat = strcmp (structure_name, "audio/x-raw-float") == 0;
 
   /* We operate on a version of the original structure with any additional
    * fields absent */
-  s = gst_structure_empty_new (gst_structure_get_name (structure));
+  s = gst_structure_empty_new (structure_name);
   for (i = 0; i < sizeof (fields_used) / sizeof (*fields_used); i++) {
     if (gst_structure_has_field (structure, fields_used[i]))
       gst_structure_set_value (s, fields_used[i],
@@ -462,6 +462,8 @@ gst_audio_convert_transform_caps (GstBaseTransform * base,
 
   /* Same, plus a float<->int conversion */
   append_with_other_format (ret, s, isfloat);
+  GST_DEBUG_OBJECT (base, "  step1: (%d) %" GST_PTR_FORMAT,
+      gst_caps_get_size (ret), ret);
 
   /* We don't mind increasing width/depth/channels, but reducing them is 
    * Very Bad. Only available if width, depth, channels are already fixed. */