Merge CAPS branch
authorDavid Schleef <ds@schleef.org>
Mon, 22 Dec 2003 01:47:09 +0000 (01:47 +0000)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Sun, 2 Jan 2011 14:30:04 +0000 (14:30 +0000)
Original commit message from CVS:
Merge CAPS branch

ext/jack/gstjack.c

index 85d5765..4a987ae 100644 (file)
@@ -77,7 +77,7 @@ static GstPadTemplate*        gst_jack_sink_request_pad_factory();
 static GstPad*         gst_jack_request_new_pad (GstElement *element, GstPadTemplate *templ,
                                                   const gchar *name);
 static GstElementStateReturn   gst_jack_change_state (GstElement *element);
-static GstPadLinkReturn        gst_jack_link (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn        gst_jack_link (GstPad *pad, const GstCaps *caps);
 
 static void            gst_jack_loop (GstElement *element);
 
@@ -264,11 +264,9 @@ gst_jack_src_request_pad_factory (void)
     
     if (!template) {
        GstCaps *caps;
-       caps = gst_caps_new ("src",
-                             "audio/x-raw-float",
-                             GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS);
+       caps = gst_caps_from_string (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS);
         template = gst_pad_template_new ("%s", GST_PAD_SRC,
-                                        GST_PAD_REQUEST, caps, NULL);
+            GST_PAD_REQUEST, caps);
     }
     
     return template;
@@ -281,11 +279,9 @@ gst_jack_sink_request_pad_factory (void)
     
     if (!template) {
        GstCaps *caps;
-       caps = gst_caps_new ("sink",
-                            "audio/x-raw-float",
-                             GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS);
+       caps = gst_caps_from_string (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS);
         template = gst_pad_template_new ("%s", GST_PAD_SINK,
-                                         GST_PAD_REQUEST, caps, NULL);
+            GST_PAD_REQUEST, caps);
     }
     
     return template;
@@ -397,10 +393,10 @@ gst_jack_change_state (GstElement *element)
             while (l) {
                 pad = GST_JACK_PAD (l);
                 caps = gst_pad_get_caps (pad->pad);
-                gst_caps_set (caps, "rate", GST_PROPS_INT_TYPE,
-                              (gint)this->bin->rate, NULL);
-                gst_caps_set (caps, "buffer-frames", GST_PROPS_INT_TYPE,
-                              (gint)this->bin->nframes, NULL);
+                gst_caps_set_simple (caps,
+                    "rate", G_TYPE_INT, (int)this->bin->rate,
+                    "buffer-frames", G_TYPE_INT, (gint)this->bin->nframes,
+                    NULL);
                 if (gst_pad_try_set_caps (pad->pad, caps) <= 0)
                     return GST_STATE_FAILURE;
                 l = g_list_next (l);
@@ -421,24 +417,22 @@ gst_jack_change_state (GstElement *element)
 }
 
 static GstPadLinkReturn
-gst_jack_link (GstPad *pad, GstCaps *caps)
+gst_jack_link (GstPad *pad, const GstCaps *caps)
 {
   GstJack *this;
   gint rate, buffer_frames;
+  GstStructure *structure;
   
   this = GST_JACK (GST_OBJECT_PARENT (pad));
   
-  if (GST_CAPS_IS_FIXED (caps)) {
-      gst_caps_get_int (caps, "rate", &rate);
-      gst_caps_get_int (caps, "buffer-frames", &buffer_frames);
-      if (this->bin && (rate != this->bin->rate ||
-                        buffer_frames != this->bin->nframes))
-          return GST_PAD_LINK_REFUSED;
-      
-      return GST_PAD_LINK_OK;
-  }
+  structure = gst_caps_get_structure (caps, 0);
+  gst_structure_get_int  (structure, "rate", &rate);
+  gst_structure_get_int  (structure, "buffer-frames", &buffer_frames);
+  if (this->bin && (rate != this->bin->rate ||
+                    buffer_frames != this->bin->nframes))
+      return GST_PAD_LINK_REFUSED;
   
-  return GST_PAD_LINK_DELAYED;
+  return GST_PAD_LINK_OK;
 }
 
 static void