-base: don't use buffer caps
authorWim Taymans <wim.taymans@collabora.co.uk>
Mon, 9 May 2011 11:05:12 +0000 (13:05 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 9 May 2011 11:05:12 +0000 (13:05 +0200)
Port to newest 0.11 core API, remove GST_PAD_CAPS and GST_BUFFER_CAPS.

45 files changed:
ext/libvisual/visual.c
ext/ogg/gstoggaviparse.c
ext/ogg/gstoggdemux.c
ext/ogg/gstoggmux.c
ext/ogg/gstoggparse.c
ext/ogg/gstogmparse.c
ext/pango/gstbasetextoverlay.c
ext/pango/gsttextrender.c
ext/theora/gsttheoradec.c
ext/theora/gsttheoraenc.c
ext/theora/gsttheoraparse.c
ext/vorbis/gstvorbisdec.c
ext/vorbis/gstvorbisenc.c
ext/vorbis/gstvorbisparse.c
gst-libs/gst/app/gstappsrc.c
gst-libs/gst/audio/audio.c
gst-libs/gst/cdda/gstcddabasesrc.c
gst-libs/gst/rtp/gstbasertpdepayload.c
gst-libs/gst/rtp/gstbasertppayload.c
gst-libs/gst/tag/gsttagdemux.c
gst-libs/gst/tag/gstvorbistag.c
gst-libs/gst/tag/tags.c
gst-libs/gst/video/convertframe.c
gst-libs/gst/video/video.c
gst-libs/gst/video/video.h
gst/adder/gstadder.c
gst/audioconvert/gstaudioconvert.c
gst/audiorate/gstaudiorate.c
gst/audioresample/gstaudioresample.c
gst/audiotestsrc/gstaudiotestsrc.c
gst/encoding/gstsmartencoder.c
gst/gdp/gstgdpdepay.c
gst/gdp/gstgdppay.c
gst/playback/gstdecodebin2.c
gst/playback/gstplaybin.c
gst/playback/gstplaysink.c
gst/subparse/gstssaparse.c
gst/subparse/gstsubparse.c
gst/tcp/gstmultifdsink.c
gst/tcp/gsttcpclientsrc.c
gst/videorate/gstvideorate.c
tests/examples/app/appsink-src.c
tests/examples/seek/jsseek.c
tests/examples/seek/seek.c
tests/examples/snapshot/snapshot.c

index fd04d01..45a09fb 100644 (file)
@@ -629,20 +629,17 @@ get_buffer (GstVisual * visual, GstBuffer ** outbuf)
   GstFlowReturn ret;
 
   /* we don't know an output format yet, pick one */
-  if (GST_PAD_CAPS (visual->srcpad) == NULL) {
+  if (!gst_pad_has_current_caps (visual->srcpad)) {
     if (!gst_vis_src_negotiate (visual))
       return GST_FLOW_NOT_NEGOTIATED;
   }
 
-  GST_DEBUG_OBJECT (visual, "allocating output buffer with caps %"
-      GST_PTR_FORMAT, GST_PAD_CAPS (visual->srcpad));
+  GST_DEBUG_OBJECT (visual, "allocating output buffer");
 
   ret = gst_buffer_pool_acquire_buffer (visual->pool, outbuf, NULL);
   if (ret != GST_FLOW_OK)
     return ret;
 
-  gst_buffer_set_caps (*outbuf, GST_PAD_CAPS (visual->srcpad));
-
   return GST_FLOW_OK;
 }
 
@@ -659,7 +656,7 @@ gst_visual_chain (GstPad * pad, GstBuffer * buffer)
 
   /* If we don't have an output format yet, preallocate a buffer to try and
    * set one */
-  if (GST_PAD_CAPS (visual->srcpad) == NULL) {
+  if (!gst_pad_has_current_caps (visual->srcpad)) {
     ret = get_buffer (visual, &outbuf);
     if (ret != GST_FLOW_OK) {
       gst_buffer_unref (buffer);
index 1ebd09f..d79a2dd 100644 (file)
@@ -261,7 +261,6 @@ gst_ogg_avi_parse_setcaps (GstPad * pad, GstCaps * caps)
 
     /* now output the raw vorbis header packets */
     out = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, offs, sizes[i]);
-    gst_buffer_set_caps (out, outcaps);
     gst_pad_push (ogg->srcpad, out);
 
     offs += sizes[i];
index 5050ce1..a66341b 100644 (file)
@@ -229,7 +229,7 @@ gst_ogg_pad_query_types (GstPad * pad)
 static GstCaps *
 gst_ogg_pad_getcaps (GstPad * pad)
 {
-  return gst_caps_ref (GST_PAD_CAPS (pad));
+  return gst_pad_get_current_caps (pad);
 }
 
 static gboolean
@@ -574,7 +574,6 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet,
     goto not_added;
 
   buf = gst_buffer_new_and_alloc (packet->bytes - offset - trim);
-  gst_buffer_set_caps (buf, GST_PAD_CAPS (pad));
 
   /* set delta flag for OGM content */
   if (delta_unit)
@@ -1772,7 +1771,8 @@ gst_ogg_demux_activate_chain (GstOggDemux * ogg, GstOggChain * chain,
     gst_ogg_pad_mark_discont (pad);
     pad->last_ret = GST_FLOW_OK;
 
-    if (pad->map.is_skeleton || pad->added || GST_PAD_CAPS (pad) == NULL)
+    if (pad->map.is_skeleton || pad->added
+        || !gst_pad_has_current_caps (GST_PAD_CAST (pad)))
       continue;
 
     GST_DEBUG_OBJECT (ogg, "adding pad %" GST_PTR_FORMAT, pad);
index 1a16e4a..deb329f 100644 (file)
@@ -499,8 +499,6 @@ static GstFlowReturn
 gst_ogg_mux_push_buffer (GstOggMux * mux, GstBuffer * buffer,
     GstOggPadData * oggpad)
 {
-  GstCaps *caps;
-
   /* fix up OFFSET and OFFSET_END again */
   GST_BUFFER_OFFSET (buffer) = mux->offset;
   mux->offset += gst_buffer_get_size (buffer);
@@ -515,11 +513,6 @@ gst_ogg_mux_push_buffer (GstOggMux * mux, GstBuffer * buffer,
       mux->last_ts = run_time;
   }
 
-  caps = gst_pad_get_negotiated_caps (mux->srcpad);
-  gst_buffer_set_caps (buffer, caps);
-  if (caps)
-    gst_caps_unref (caps);
-
   return gst_pad_push (mux->srcpad, buffer);
 }
 
@@ -806,13 +799,15 @@ gst_ogg_mux_queue_pads (GstOggMux * ogg_mux)
 
           /* if we're not yet in data mode, ensure we're setup on the first packet */
           if (!pad->have_type) {
+            GstCaps *caps;
+
             /* Use headers in caps, if any; this will allow us to be resilient
              * to starting streams on the fly, and some streams (like VP8
              * at least) do not send headers packets, as other muxers don't
              * expect/need them. */
+            caps = gst_pad_get_current_caps (GST_PAD_CAST (pad));
             pad->have_type =
-                gst_ogg_stream_setup_map_from_caps_headers (&pad->map,
-                GST_BUFFER_CAPS (buf));
+                gst_ogg_stream_setup_map_from_caps_headers (&pad->map, caps);
 
             if (!pad->have_type) {
               /* fallback on the packet */
@@ -820,11 +815,13 @@ gst_ogg_mux_queue_pads (GstOggMux * ogg_mux)
             }
             if (!pad->have_type) {
               GST_ERROR_OBJECT (pad, "mapper didn't recognise input stream "
-                  "(pad caps: %" GST_PTR_FORMAT ")", GST_PAD_CAPS (pad));
+                  "(pad caps: %" GST_PTR_FORMAT ")", caps);
             } else {
               GST_DEBUG_OBJECT (pad, "caps detected: %" GST_PTR_FORMAT,
                   pad->map.caps);
             }
+            if (caps)
+              gst_caps_unref (caps);
           }
 
           if (pad->have_type)
index 54e1977..42949c1 100644 (file)
@@ -604,9 +604,6 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
               GstOggStream *stream = (GstOggStream *) l->data;
               GstBuffer *buf = GST_BUFFER (stream->headers->data);
 
-              buf = gst_buffer_make_writable (buf);
-              gst_buffer_set_caps (buf, caps);
-
               result = gst_pad_push (ogg->srcpad, buf);
               if (result != GST_FLOW_OK)
                 return result;
@@ -619,9 +616,6 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
               for (j = stream->headers->next; j != NULL; j = j->next) {
                 GstBuffer *buf = GST_BUFFER (j->data);
 
-                buf = gst_buffer_make_writable (buf);
-                gst_buffer_set_caps (buf, caps);
-
                 result = gst_pad_push (ogg->srcpad, buf);
                 if (result != GST_FLOW_OK)
                   return result;
@@ -648,10 +642,8 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
                   g_list_length (stream->unknown_pages) + 1);
 
               for (k = stream->unknown_pages; k != NULL; k = k->next) {
-                GstBuffer *buf;
+                GstBuffer *buf = GST_BUFFER (k->data);
 
-                buf = gst_buffer_make_writable (GST_BUFFER (k->data));
-                gst_buffer_set_caps (buf, caps);
                 result = gst_pad_push (ogg->srcpad, buf);
                 if (result != GST_FLOW_OK)
                   return result;
@@ -671,7 +663,7 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
               GstBuffer *buf = stream->stored_buffers->data;
 
               buf = gst_buffer_make_writable (buf);
-              gst_buffer_set_caps (buf, ogg->caps);
+
               GST_BUFFER_TIMESTAMP (buf) = buffertimestamp;
               if (!keyframe) {
                 GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
@@ -689,7 +681,6 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
             }
 
             pagebuffer = gst_buffer_make_writable (pagebuffer);
-            gst_buffer_set_caps (pagebuffer, ogg->caps);
             if (!keyframe) {
               GST_BUFFER_FLAG_SET (pagebuffer, GST_BUFFER_FLAG_DELTA_UNIT);
             } else {
index c046cfb..d8238cc 100644 (file)
@@ -622,16 +622,19 @@ gst_ogm_parse_stream_header (GstOgmParse * ogm, const guint8 * data, guint size)
     goto cannot_decode;
 
   if (ogm->srcpad) {
-    GstCaps *current_caps = GST_PAD_CAPS (ogm->srcpad);
-
-    if (current_caps && caps && !gst_caps_is_equal (current_caps, caps)) {
-      GST_WARNING_OBJECT (ogm, "Already an existing pad %s:%s",
-          GST_DEBUG_PAD_NAME (ogm->srcpad));
-      gst_pad_set_active (ogm->srcpad, FALSE);
-      gst_element_remove_pad (GST_ELEMENT (ogm), ogm->srcpad);
-      ogm->srcpad = NULL;
-    } else {
-      GST_DEBUG_OBJECT (ogm, "Existing pad has the same caps, do nothing");
+    GstCaps *current_caps = gst_pad_get_current_caps (ogm->srcpad);
+
+    if (current_caps) {
+      if (caps && !gst_caps_is_equal (current_caps, caps)) {
+        GST_WARNING_OBJECT (ogm, "Already an existing pad %s:%s",
+            GST_DEBUG_PAD_NAME (ogm->srcpad));
+        gst_pad_set_active (ogm->srcpad, FALSE);
+        gst_element_remove_pad (GST_ELEMENT (ogm), ogm->srcpad);
+        ogm->srcpad = NULL;
+      } else {
+        GST_DEBUG_OBJECT (ogm, "Existing pad has the same caps, do nothing");
+      }
+      gst_caps_unref (current_caps);
     }
   }
 
@@ -640,8 +643,8 @@ gst_ogm_parse_stream_header (GstOgmParse * ogm, const guint8 * data, guint size)
 
     ogm->srcpad = gst_pad_new_from_template (ogm->srcpadtempl, "src");
     gst_pad_use_fixed_caps (ogm->srcpad);
-    gst_pad_set_caps (ogm->srcpad, caps);
     gst_pad_set_active (ogm->srcpad, TRUE);
+    gst_pad_set_caps (ogm->srcpad, caps);
     gst_element_add_pad (GST_ELEMENT (ogm), ogm->srcpad);
     GST_INFO_OBJECT (ogm, "Added pad %s:%s with caps %" GST_PTR_FORMAT,
         GST_DEBUG_PAD_NAME (ogm->srcpad), caps);
@@ -714,8 +717,6 @@ gst_ogm_parse_comment_packet (GstOgmParse * ogm, GstBuffer * buf)
     /* do not push packet downstream, just let parent unref it */
     ret = GST_FLOW_OK;
   } else {
-    buf = gst_buffer_copy (buf);
-    gst_buffer_set_caps (buf, GST_PAD_CAPS (ogm->srcpad));
     ret = gst_pad_push (ogm->srcpad, buf);
   }
 
@@ -820,7 +821,6 @@ gst_ogm_parse_data_packet (GstOgmParse * ogm, GstBuffer * buf,
   }
 
   if (ogm->srcpad) {
-    gst_buffer_set_caps (sbuf, GST_PAD_CAPS (ogm->srcpad));
     GST_LOG_OBJECT (ogm, "Pushing buffer with ts=%" GST_TIME_FORMAT,
         GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (sbuf)));
     ret = gst_pad_push (ogm->srcpad, sbuf);
index 37b6c03..e02b3b0 100644 (file)
@@ -2423,10 +2423,13 @@ gst_base_text_overlay_video_chain (GstPad * pad, GstBuffer * buffer)
    * duration (we only use those estimated values internally though, we
    * don't want to set bogus values on the buffer itself) */
   if (stop == -1) {
+    GstCaps *caps;
     GstStructure *s;
     gint fps_num, fps_denom;
 
-    s = gst_caps_get_structure (GST_PAD_CAPS (pad), 0);
+    /* FIXME, store this in setcaps */
+    caps = gst_pad_get_current_caps (pad);
+    s = gst_caps_get_structure (caps, 0);
     if (gst_structure_get_fraction (s, "framerate", &fps_num, &fps_denom) &&
         fps_num && fps_denom) {
       GST_DEBUG_OBJECT (overlay, "estimating duration based on framerate");
@@ -2435,6 +2438,7 @@ gst_base_text_overlay_video_chain (GstPad * pad, GstBuffer * buffer)
       GST_WARNING_OBJECT (overlay, "no duration, assuming minimal duration");
       stop = start + 1;         /* we need to assume some interval */
     }
+    gst_caps_unref (caps);
   }
 
   gst_object_sync_values (G_OBJECT (overlay), GST_BUFFER_TIMESTAMP (buffer));
index 8e17bee..31f671c 100644 (file)
@@ -506,7 +506,6 @@ gst_text_render_chain (GstPad * pad, GstBuffer * inbuf)
 
   GST_DEBUG ("Allocating buffer WxH = %dx%d", render->width, render->height);
   outbuf = gst_buffer_new_and_alloc (render->width * render->height * 4);
-  gst_buffer_set_caps (outbuf, caps);
 
   gst_buffer_copy_into (outbuf, inbuf, GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
   data = gst_buffer_map (outbuf, &size, NULL, GST_MAP_WRITE);
index 5e01734..7265d6b 100644 (file)
@@ -1122,8 +1122,6 @@ theora_handle_image (GstTheoraDec * dec, th_ycbcr_buffer buf, GstBuffer ** out)
   if (G_UNLIKELY (result != GST_FLOW_OK))
     goto no_buffer;
 
-  gst_buffer_set_caps (*out, GST_PAD_CAPS (dec->srcpad));
-
   data = gst_buffer_map (*out, &size, NULL, GST_MAP_WRITE);
 
   /* FIXME, we can do things slightly more efficient when we know that
index 9558b2b..aaa6510 100644 (file)
@@ -696,7 +696,6 @@ theora_buffer_from_packet (GstTheoraEnc * enc, ogg_packet * packet,
   }
 
   gst_buffer_fill (buf, 0, packet->packet, packet->bytes);
-  gst_buffer_set_caps (buf, GST_PAD_CAPS (enc->srcpad));
   /* see ext/ogg/README; OFFSET_END takes "our" granulepos, OFFSET its
    * time representation */
   GST_BUFFER_OFFSET_END (buf) =
@@ -1208,9 +1207,6 @@ theora_enc_chain (GstPad * pad, GstBuffer * buffer)
     caps = theora_set_header_on_caps (caps, buffers);
     GST_DEBUG ("here are the caps: %" GST_PTR_FORMAT, caps);
     gst_pad_set_caps (enc->srcpad, caps);
-
-    g_slist_foreach (buffers, (GFunc) gst_buffer_set_caps, caps);
-
     gst_caps_unref (caps);
 
     /* push out the header buffers */
index df9aeca..41c76b1 100644 (file)
@@ -364,8 +364,6 @@ theora_parse_push_headers (GstTheoraParse * parse)
     GstBuffer *buf;
 
     if ((buf = parse->streamheader[i])) {
-      buf = gst_buffer_make_writable (buf);
-      gst_buffer_set_caps (buf, GST_PAD_CAPS (parse->srcpad));
       gst_pad_push (parse->srcpad, buf);
       parse->streamheader[i] = NULL;
     }
@@ -498,8 +496,6 @@ theora_parse_push_buffer (GstTheoraParse * parse, GstBuffer * buf,
   GST_BUFFER_TIMESTAMP (buf) = this_time;
   GST_BUFFER_DURATION (buf) = next_time - this_time;
 
-  gst_buffer_set_caps (buf, GST_PAD_CAPS (parse->srcpad));
-
   if (parse->times)
     theora_parse_munge_granulepos (parse, buf, keyframe, frame);
 
index d52c505..45374eb 100644 (file)
@@ -914,7 +914,6 @@ vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet,
 
   /* alloc buffer for it */
   out = gst_buffer_new_and_alloc (size);
-  gst_buffer_set_caps (out, GST_PAD_CAPS (vd->srcpad));
 
   /* get samples ready for reading now, should be sample_count */
 #ifdef USE_TREMOLO
index 1670cf4..8b4b5ef 100644 (file)
@@ -840,8 +840,6 @@ gst_vorbis_enc_buffer_from_packet (GstVorbisEnc * vorbisenc,
     vorbisenc->next_discont = FALSE;
   }
 
-  gst_buffer_set_caps (outbuf, vorbisenc->srccaps);
-
   GST_LOG_OBJECT (vorbisenc, "encoded buffer of %d bytes",
       gst_buffer_get_size (outbuf));
   return outbuf;
@@ -862,8 +860,6 @@ gst_vorbis_enc_buffer_from_header_packet (GstVorbisEnc * vorbisenc,
   GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE;
   GST_BUFFER_DURATION (outbuf) = GST_CLOCK_TIME_NONE;
 
-  gst_buffer_set_caps (outbuf, vorbisenc->srccaps);
-
   GST_DEBUG ("created header packet buffer, %d bytes",
       gst_buffer_get_size (outbuf));
   return outbuf;
@@ -1099,10 +1095,6 @@ gst_vorbis_enc_chain (GstPad * pad, GstBuffer * buffer)
     GST_DEBUG ("here are the caps: %" GST_PTR_FORMAT, caps);
     gst_pad_set_caps (vorbisenc->srcpad, caps);
 
-    gst_buffer_set_caps (buf1, caps);
-    gst_buffer_set_caps (buf2, caps);
-    gst_buffer_set_caps (buf3, caps);
-
     /* push out buffers */
     /* push_buffer takes the reference even for failure */
     if ((ret = gst_vorbis_enc_push_buffer (vorbisenc, buf1)) != GST_FLOW_OK)
index 5a7a576..7155fec 100644 (file)
@@ -232,14 +232,8 @@ vorbis_parse_push_headers (GstVorbisParse * parse)
   vorbis_parse_drain_event_queue (parse);
 
   /* push out buffers, ignoring return value... */
-  outbuf1 = gst_buffer_make_writable (outbuf1);
-  gst_buffer_set_caps (outbuf1, GST_PAD_CAPS (parse->srcpad));
   gst_pad_push (parse->srcpad, outbuf1);
-  outbuf2 = gst_buffer_make_writable (outbuf2);
-  gst_buffer_set_caps (outbuf2, GST_PAD_CAPS (parse->srcpad));
   gst_pad_push (parse->srcpad, outbuf2);
-  outbuf3 = gst_buffer_make_writable (outbuf3);
-  gst_buffer_set_caps (outbuf3, GST_PAD_CAPS (parse->srcpad));
   gst_pad_push (parse->srcpad, outbuf3);
 
   g_list_free (parse->streamheader);
@@ -278,8 +272,6 @@ vorbis_parse_push_buffer (GstVorbisParse * parse, GstBuffer * buf,
   GST_BUFFER_TIMESTAMP (buf) =
       GST_BUFFER_OFFSET (buf) - GST_BUFFER_DURATION (buf);
 
-  gst_buffer_set_caps (buf, GST_PAD_CAPS (parse->srcpad));
-
   return gst_pad_push (parse->srcpad, buf);
 }
 
index 6f2be80..893f15e 100644 (file)
@@ -981,10 +981,6 @@ gst_app_src_create (GstBaseSrc * bsrc, guint64 offset, guint size,
       /* only update the offset when in random_access mode */
       if (priv->stream_type == GST_APP_STREAM_TYPE_RANDOM_ACCESS)
         priv->offset += buf_size;
-      if (caps) {
-        *buf = gst_buffer_make_writable (*buf);
-        gst_buffer_set_caps (*buf, caps);
-      }
 
       /* signal that we removed an item */
       g_cond_broadcast (priv->cond);
index ee15e62..ce832c8 100644 (file)
@@ -49,24 +49,31 @@ gst_audio_frame_byte_size (GstPad * pad)
 
   int width = 0;
   int channels = 0;
-  const GstCaps *caps = NULL;
+  GstCaps *caps;
   GstStructure *structure;
 
   /* get caps of pad */
-  caps = GST_PAD_CAPS (pad);
+  caps = gst_pad_get_current_caps (pad);
 
-  if (caps == NULL) {
-    /* ERROR: could not get caps of pad */
-    g_warning ("gstaudio: could not get caps of pad %s:%s\n",
-        GST_DEBUG_PAD_NAME (pad));
-    return 0;
-  }
+  if (caps == NULL)
+    goto no_caps;
 
   structure = gst_caps_get_structure (caps, 0);
 
   gst_structure_get_int (structure, "width", &width);
   gst_structure_get_int (structure, "channels", &channels);
+  gst_caps_unref (caps);
+
   return (width / 8) * channels;
+
+  /* ERRORS */
+no_caps:
+  {
+    /* ERROR: could not get caps of pad */
+    g_warning ("gstaudio: could not get caps of pad %s:%s\n",
+        GST_DEBUG_PAD_NAME (pad));
+    return 0;
+  }
 }
 
 /**
@@ -113,34 +120,38 @@ gst_audio_duration_from_pad_buffer (GstPad * pad, GstBuffer * buf)
   int width = 0;
   int channels = 0;
   int rate = 0;
-
-  GstClockTime length;
-
-  const GstCaps *caps = NULL;
+  GstCaps *caps;
   GstStructure *structure;
 
   g_assert (GST_IS_BUFFER (buf));
+
   /* get caps of pad */
-  caps = GST_PAD_CAPS (pad);
-  if (caps == NULL) {
+  caps = gst_pad_get_current_caps (pad);
+  if (caps == NULL)
+    goto no_caps;
+
+  structure = gst_caps_get_structure (caps, 0);
+  bytes = gst_buffer_get_size (buf);
+  gst_structure_get_int (structure, "width", &width);
+  gst_structure_get_int (structure, "channels", &channels);
+  gst_structure_get_int (structure, "rate", &rate);
+  gst_caps_unref (caps);
+
+  g_assert (bytes != 0);
+  g_assert (width != 0);
+  g_assert (channels != 0);
+  g_assert (rate != 0);
+
+  return (bytes * 8 * GST_SECOND) / (rate * channels * width);
+
+  /* ERRORS */
+no_caps:
+  {
     /* ERROR: could not get caps of pad */
     g_warning ("gstaudio: could not get caps of pad %s:%s\n",
         GST_DEBUG_PAD_NAME (pad));
-    length = GST_CLOCK_TIME_NONE;
-  } else {
-    structure = gst_caps_get_structure (caps, 0);
-    bytes = gst_buffer_get_size (buf);
-    gst_structure_get_int (structure, "width", &width);
-    gst_structure_get_int (structure, "channels", &channels);
-    gst_structure_get_int (structure, "rate", &rate);
-
-    g_assert (bytes != 0);
-    g_assert (width != 0);
-    g_assert (channels != 0);
-    g_assert (rate != 0);
-    length = (bytes * 8 * GST_SECOND) / (rate * channels * width);
+    return GST_CLOCK_TIME_NONE;
   }
-  return length;
 }
 
 /**
index bac2112..48d1860 100644 (file)
@@ -1613,10 +1613,6 @@ gst_cdda_base_src_create (GstPushSrc * pushsrc, GstBuffer ** buffer)
     return GST_FLOW_ERROR;
   }
 
-  if (GST_BUFFER_CAPS (buf) == NULL) {
-    gst_buffer_set_caps (buf, GST_PAD_CAPS (GST_BASE_SRC_PAD (src)));
-  }
-
   format = GST_FORMAT_TIME;
   if (gst_pad_query_position (GST_BASE_SRC_PAD (src), &format, &qry_position)) {
     gint64 next_ts = 0;
index ad1de25..91a0199 100644 (file)
@@ -392,22 +392,14 @@ gst_base_rtp_depayload_chain (GstPad * pad, GstBuffer * in)
 not_negotiated:
   {
     /* this is not fatal but should be filtered earlier */
-    if (GST_BUFFER_CAPS (in) == NULL) {
-      GST_ELEMENT_ERROR (filter, CORE, NEGOTIATION,
-          ("No RTP format was negotiated."),
-          ("Input buffers need to have RTP caps set on them. This is usually "
-              "achieved by setting the 'caps' property of the upstream source "
-              "element (often udpsrc or appsrc), or by putting a capsfilter "
-              "element before the depayloader and setting the 'caps' property "
-              "on that. Also see http://cgit.freedesktop.org/gstreamer/"
-              "gst-plugins-good/tree/gst/rtp/README"));
-    } else {
-      GST_ELEMENT_ERROR (filter, CORE, NEGOTIATION,
-          ("No RTP format was negotiated."),
-          ("RTP caps on input buffer were rejected, most likely because they "
-              "were incomplete or contained wrong values. Check the debug log "
-              "for more information."));
-    }
+    GST_ELEMENT_ERROR (filter, CORE, NEGOTIATION,
+        ("No RTP format was negotiated."),
+        ("Input buffers need to have RTP caps set on them. This is usually "
+            "achieved by setting the 'caps' property of the upstream source "
+            "element (often udpsrc or appsrc), or by putting a capsfilter "
+            "element before the depayloader and setting the 'caps' property "
+            "on that. Also see http://cgit.freedesktop.org/gstreamer/"
+            "gst-plugins-good/tree/gst/rtp/README"));
     gst_buffer_unref (in);
     return GST_FLOW_NOT_NEGOTIATED;
   }
@@ -550,7 +542,6 @@ typedef struct
 {
   GstBaseRTPDepayload *depayload;
   GstBaseRTPDepayloadClass *bclass;
-  GstCaps *caps;
   gboolean do_ts;
   gboolean rtptime;
 } HeaderData;
@@ -561,7 +552,6 @@ set_headers (GstBuffer ** buffer, guint idx, HeaderData * data)
   GstBaseRTPDepayload *depayload = data->depayload;
 
   *buffer = gst_buffer_make_writable (*buffer);
-  gst_buffer_set_caps (*buffer, data->caps);
 
   /* set the timestamp if we must and can */
   if (data->bclass->set_gst_timestamp && data->do_ts)
@@ -583,7 +573,6 @@ gst_base_rtp_depayload_prepare_push (GstBaseRTPDepayload * filter,
   HeaderData data;
 
   data.depayload = filter;
-  data.caps = GST_PAD_CAPS (filter->srcpad);
   data.rtptime = rtptime;
   data.do_ts = do_ts;
   data.bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter);
index 81c630a..d8432b0 100644 (file)
@@ -708,7 +708,6 @@ typedef struct
   guint32 ssrc;
   guint16 seqnum;
   guint8 pt;
-  GstCaps *caps;
   GstClockTime timestamp;
   guint64 offset;
   guint32 rtptime;
@@ -740,7 +739,6 @@ set_headers (GstBuffer ** buffer, guint group, guint idx, HeaderData * data)
   gst_rtp_buffer_set_timestamp (&rtp, data->rtptime);
   gst_rtp_buffer_unmap (&rtp);
 
-  gst_buffer_set_caps (*buffer, data->caps);
   /* increment the seqnum for each buffer */
   data->seqnum++;
 
@@ -770,7 +768,6 @@ gst_basertppayload_prepare_push (GstBaseRTPPayload * payload,
   data.seqnum = payload->seqnum;
   data.ssrc = payload->current_ssrc;
   data.pt = payload->pt;
-  data.caps = GST_PAD_CAPS (payload->srcpad);
 
   /* find the first buffer with a timestamp */
   if (is_list) {
index 935aea7..c628734 100644 (file)
@@ -468,7 +468,6 @@ gst_tag_demux_trim_buffer (GstTagDemux * tagdemux, GstBuffer ** buf_ref,
 
     GST_BUFFER_OFFSET (buf) = out_offset;
     GST_BUFFER_OFFSET_END (buf) = out_offset + out_size;
-    gst_buffer_set_caps (buf, tagdemux->priv->src_caps);
   }
 
   return TRUE;
@@ -709,10 +708,6 @@ gst_tag_demux_chain (GstPad * pad, GstBuffer * buf)
           demux->priv->send_tag_event = FALSE;
         }
 
-        /* Ensure the caps are set correctly */
-        outbuf = gst_buffer_make_writable (outbuf);
-        gst_buffer_set_caps (outbuf, GST_PAD_CAPS (demux->priv->srcpad));
-
         GST_LOG_OBJECT (demux, "Pushing buffer %p", outbuf);
 
         return gst_pad_push (demux->priv->srcpad, outbuf);
@@ -1327,8 +1322,6 @@ gst_tag_demux_read_range (GstTagDemux * demux,
 
     /* this should only happen in streaming mode */
     g_assert (*buffer != NULL);
-
-    gst_buffer_set_caps (*buffer, demux->priv->src_caps);
   }
 
   return ret;
index 0365509..603ffe9 100644 (file)
@@ -551,12 +551,15 @@ static GList *
 gst_tag_to_metadata_block_picture (const gchar * tag,
     const GValue * image_value)
 {
+#if 0
   gchar *comment_data, *data_result;
   const gchar *mime_type;
   guint mime_type_len;
   GstStructure *mime_struct;
   GstBuffer *buffer;
+#endif
   GList *l = NULL;
+#if 0
   guint8 *data;
   gsize size;
   GstByteWriter writer;
@@ -564,9 +567,14 @@ gst_tag_to_metadata_block_picture (const gchar * tag,
   gint width = 0, height = 0;
   guint8 *metadata_block;
   guint metadata_block_len;
+#endif
 
   g_return_val_if_fail (image_value != NULL, NULL);
 
+  /* FIXME, no more buffer caps */
+  g_assert_not_reached ();
+
+#if 0
   buffer = gst_value_get_buffer (image_value);
   g_return_val_if_fail (gst_caps_is_fixed (buffer->caps), NULL);
   mime_struct = gst_caps_get_structure (buffer->caps, 0);
@@ -621,6 +629,7 @@ gst_tag_to_metadata_block_picture (const gchar * tag,
   g_free (comment_data);
 
   l = g_list_append (l, data_result);
+#endif
 
   return l;
 }
index 37ddd08..b536239 100644 (file)
@@ -612,8 +612,9 @@ gst_tag_image_data_to_image_buffer (const guint8 * image_data,
         image_type, NULL);
   }
 
-  gst_buffer_set_caps (image, caps);
+  g_warning ("extra image data can't be set");
   gst_caps_unref (caps);
+
   return image;
 
 /* ERRORS */
index 6ba3e30..5220eb9 100644 (file)
@@ -233,6 +233,7 @@ link_failed:
 /**
  * gst_video_convert_frame:
  * @buf: a #GstBuffer
+ * @from_caps: the #GstCaps to convert from
  * @to_caps: the #GstCaps to convert to
  * @timeout: the maximum amount of time allowed for the processing.
  * @err: pointer to a #GError. Can be %NULL.
@@ -250,23 +251,21 @@ link_failed:
  *
  */
 GstBuffer *
-gst_video_convert_frame (GstBuffer * buf, const GstCaps * to_caps,
-    GstClockTime timeout, GError ** err)
+gst_video_convert_frame (GstBuffer * buf, GstCaps * from_caps,
+    const GstCaps * to_caps, GstClockTime timeout, GError ** err)
 {
   GstMessage *msg;
   GstBuffer *result = NULL;
   GError *error = NULL;
   GstBus *bus;
-  GstCaps *from_caps, *to_caps_copy = NULL;
+  GstCaps *to_caps_copy = NULL;
   GstFlowReturn ret;
   GstElement *pipeline, *src, *sink;
   guint i, n;
 
   g_return_val_if_fail (buf != NULL, NULL);
   g_return_val_if_fail (to_caps != NULL, NULL);
-  g_return_val_if_fail (GST_BUFFER_CAPS (buf) != NULL, NULL);
-
-  from_caps = GST_BUFFER_CAPS (buf);
+  g_return_val_if_fail (from_caps != NULL, NULL);
 
   to_caps_copy = gst_caps_new_empty ();
   n = gst_caps_get_size (to_caps);
@@ -597,14 +596,15 @@ done:
  *
  */
 void
-gst_video_convert_frame_async (GstBuffer * buf, const GstCaps * to_caps,
-    GstClockTime timeout, GstVideoConvertFrameCallback callback,
-    gpointer user_data, GDestroyNotify destroy_notify)
+gst_video_convert_frame_async (GstBuffer * buf, GstCaps * from_caps,
+    const GstCaps * to_caps, GstClockTime timeout,
+    GstVideoConvertFrameCallback callback, gpointer user_data,
+    GDestroyNotify destroy_notify)
 {
   GMainContext *context = NULL;
   GError *error = NULL;
   GstBus *bus;
-  GstCaps *from_caps, *to_caps_copy = NULL;
+  GstCaps *to_caps_copy = NULL;
   GstElement *pipeline, *src, *sink;
   guint i, n;
   GSource *source;
@@ -612,7 +612,7 @@ gst_video_convert_frame_async (GstBuffer * buf, const GstCaps * to_caps,
 
   g_return_if_fail (buf != NULL);
   g_return_if_fail (to_caps != NULL);
-  g_return_if_fail (GST_BUFFER_CAPS (buf) != NULL);
+  g_return_if_fail (from_caps != NULL);
   g_return_if_fail (callback != NULL);
 
   context = g_main_context_get_thread_default ();
@@ -620,8 +620,6 @@ gst_video_convert_frame_async (GstBuffer * buf, const GstCaps * to_caps,
   if (!context)
     context = g_main_context_default ();
 
-  from_caps = GST_BUFFER_CAPS (buf);
-
   to_caps_copy = gst_caps_new_empty ();
   n = gst_caps_get_size (to_caps);
   for (i = 0; i < n; i++) {
index a369387..b7479eb 100644 (file)
@@ -65,37 +65,52 @@ gst_video_frame_rate (GstPad * pad)
 {
   const GValue *fps;
   gchar *fps_string;
-
-  const GstCaps *caps = NULL;
+  GstCaps *caps = NULL;
   GstStructure *structure;
 
   /* get pad caps */
-  caps = GST_PAD_CAPS (pad);
-  if (caps == NULL) {
+  caps = gst_pad_get_current_caps (pad);
+  if (caps == NULL)
+    goto no_caps;
+
+  structure = gst_caps_get_structure (caps, 0);
+  if ((fps = gst_structure_get_value (structure, "framerate")) == NULL)
+    goto no_framerate;
+
+  if (!GST_VALUE_HOLDS_FRACTION (fps))
+    goto no_fraction;
+
+  fps_string = gst_value_serialize (fps);
+  GST_DEBUG ("Framerate request on pad %s:%s: %s",
+      GST_DEBUG_PAD_NAME (pad), fps_string);
+  g_free (fps_string);
+
+  gst_caps_unref (caps);
+
+  return fps;
+
+  /* ERRORS */
+no_caps:
+  {
     g_warning ("gstvideo: failed to get caps of pad %s:%s",
         GST_DEBUG_PAD_NAME (pad));
     return NULL;
   }
-
-  structure = gst_caps_get_structure (caps, 0);
-  if ((fps = gst_structure_get_value (structure, "framerate")) == NULL) {
+no_framerate:
+  {
     g_warning ("gstvideo: failed to get framerate property of pad %s:%s",
         GST_DEBUG_PAD_NAME (pad));
+    gst_caps_unref (caps);
     return NULL;
   }
-  if (!GST_VALUE_HOLDS_FRACTION (fps)) {
+no_fraction:
+  {
     g_warning
         ("gstvideo: framerate property of pad %s:%s is not of type Fraction",
         GST_DEBUG_PAD_NAME (pad));
+    gst_caps_unref (caps);
     return NULL;
   }
-
-  fps_string = gst_value_serialize (fps);
-  GST_DEBUG ("Framerate request on pad %s:%s: %s",
-      GST_DEBUG_PAD_NAME (pad), fps_string);
-  g_free (fps_string);
-
-  return fps;
 }
 
 /**
@@ -115,7 +130,7 @@ gst_video_frame_rate (GstPad * pad)
 gboolean
 gst_video_get_size (GstPad * pad, gint * width, gint * height)
 {
-  const GstCaps *caps = NULL;
+  GstCaps *caps = NULL;
   GstStructure *structure;
   gboolean ret;
 
@@ -123,28 +138,36 @@ gst_video_get_size (GstPad * pad, gint * width, gint * height)
   g_return_val_if_fail (width != NULL, FALSE);
   g_return_val_if_fail (height != NULL, FALSE);
 
-  caps = GST_PAD_CAPS (pad);
-
-  if (caps == NULL) {
-    g_warning ("gstvideo: failed to get caps of pad %s:%s",
-        GST_DEBUG_PAD_NAME (pad));
-    return FALSE;
-  }
+  caps = gst_pad_get_current_caps (pad);
+  if (caps == NULL)
+    goto no_caps;
 
   structure = gst_caps_get_structure (caps, 0);
   ret = gst_structure_get_int (structure, "width", width);
   ret &= gst_structure_get_int (structure, "height", height);
+  gst_caps_unref (caps);
 
-  if (!ret) {
-    g_warning ("gstvideo: failed to get size properties on pad %s:%s",
-        GST_DEBUG_PAD_NAME (pad));
-    return FALSE;
-  }
+  if (!ret)
+    goto no_size;
 
   GST_DEBUG ("size request on pad %s:%s: %dx%d",
       GST_DEBUG_PAD_NAME (pad), width ? *width : -1, height ? *height : -1);
 
   return TRUE;
+
+  /* ERROR */
+no_caps:
+  {
+    g_warning ("gstvideo: failed to get caps of pad %s:%s",
+        GST_DEBUG_PAD_NAME (pad));
+    return FALSE;
+  }
+no_size:
+  {
+    g_warning ("gstvideo: failed to get size properties on pad %s:%s",
+        GST_DEBUG_PAD_NAME (pad));
+    return FALSE;
+  }
 }
 
 /**
index fdd6b43..e0dce17 100644 (file)
@@ -488,11 +488,11 @@ gboolean gst_video_format_convert (GstVideoFormat format, int width, int height,
 GstEvent *gst_video_event_new_still_frame (gboolean in_still);
 gboolean gst_video_event_parse_still_frame (GstEvent *event, gboolean *in_still);
 
-GstBuffer *gst_video_convert_frame(GstBuffer *buf, const GstCaps *to_caps,
+GstBuffer *gst_video_convert_frame(GstBuffer *buf, GstCaps *from_caps, const GstCaps *to_caps,
                                   GstClockTime timeout, GError **error);
 
 typedef void (*GstVideoConvertFrameCallback) (GstBuffer *buf, GError *error, gpointer user_data);
-void gst_video_convert_frame_async(GstBuffer *buf, const GstCaps *to_caps,
+void gst_video_convert_frame_async(GstBuffer *buf, GstCaps *from_caps, const GstCaps *to_caps,
                                   GstClockTime timeout, GstVideoConvertFrameCallback callback,
                                    gpointer user_data, GDestroyNotify destroy_notify);
 
index 5aced2c..60d11c2 100644 (file)
@@ -220,6 +220,21 @@ gst_adder_sink_getcaps (GstPad * pad)
   return result;
 }
 
+typedef struct
+{
+  GstPad *pad;
+  GstCaps *caps;
+} IterData;
+
+static void
+setcapsfunc (const GValue * item, IterData * data)
+{
+  GstPad *otherpad = g_value_get_object (item);
+
+  if (otherpad != data->pad)
+    gst_pad_set_caps (data->pad, data->caps);
+}
+
 /* the first caps we receive on any of the sinkpads will define the caps for all
  * the other sinkpads because we can only mix streams with the same caps.
  */
@@ -227,28 +242,39 @@ static gboolean
 gst_adder_setcaps (GstPad * pad, GstCaps * caps)
 {
   GstAdder *adder;
-  GList *pads;
   GstStructure *structure;
   const char *media_type;
+  GstIterator *it;
+  GstIteratorResult ires;
+  IterData idata;
+  gboolean done;
 
   adder = GST_ADDER (GST_PAD_PARENT (pad));
 
   GST_LOG_OBJECT (adder, "setting caps on pad %p,%s to %" GST_PTR_FORMAT, pad,
       GST_PAD_NAME (pad), caps);
 
+  it = gst_element_iterate_pads (GST_ELEMENT_CAST (adder));
+
   /* FIXME, see if the other pads can accept the format. Also lock the
    * format on the other pads to this new format. */
-  GST_OBJECT_LOCK (adder);
-  pads = GST_ELEMENT (adder)->pads;
-  while (pads) {
-    GstPad *otherpad = GST_PAD (pads->data);
+  idata.caps = caps;
+  idata.pad = pad;
+
+  done = FALSE;
+  while (!done) {
+    ires = gst_iterator_foreach (it, (GstIteratorForeachFunction) setcapsfunc,
+        &idata);
 
-    if (otherpad != pad) {
-      gst_caps_replace (&GST_PAD_CAPS (otherpad), caps);
+    switch (ires) {
+      case GST_ITERATOR_RESYNC:
+        gst_iterator_resync (it);
+        break;
+      default:
+        done = TRUE;
+        break;
     }
-    pads = g_list_next (pads);
   }
-  GST_OBJECT_UNLOCK (adder);
 
   /* parse caps now */
   structure = gst_caps_get_structure (caps, 0);
@@ -1100,11 +1126,6 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
 
       GST_LOG_OBJECT (adder, "channel %p: preparing output buffer of %d bytes",
           collect_data, outsize);
-      /* make data and metadata writable, can simply return the inbuf when we
-       * are the only one referencing this buffer. If this is the last (and
-       * only) GAP buffer, it will automatically copy the GAP flag. */
-      outbuf = gst_buffer_make_writable (inbuf);
-      gst_buffer_set_caps (outbuf, GST_PAD_CAPS (adder->srcpad));
 
       outdata = gst_buffer_map (outbuf, NULL, NULL, GST_MAP_WRITE);
     } else {
index c1f3fe9..90bcc43 100644 (file)
@@ -1070,10 +1070,6 @@ gst_audio_convert_transform (GstBaseTransform * base, GstBuffer * inbuf,
   gint samples;
   gpointer src, dst;
 
-  GST_CAT_LOG_OBJECT (GST_CAT_PERFORMANCE, base, "converting audio from %"
-      GST_PTR_FORMAT " to %" GST_PTR_FORMAT, GST_BUFFER_CAPS (inbuf),
-      GST_BUFFER_CAPS (outbuf));
-
   /* get amount of samples to convert. */
   samples = gst_buffer_get_size (inbuf) / this->ctx.in.unit_size;
 
index 4a31e9d..c90dcff 100644 (file)
@@ -634,7 +634,6 @@ gst_audio_rate_chain (GstPad * pad, GstBuffer * buf)
         GST_BUFFER_FLAG_SET (fill, GST_BUFFER_FLAG_DISCONT);
         audiorate->discont = FALSE;
       }
-      gst_buffer_set_caps (fill, GST_PAD_CAPS (audiorate->srcpad));
 
       ret = gst_pad_push (audiorate->srcpad, fill);
       if (ret != GST_FLOW_OK)
@@ -681,8 +680,6 @@ gst_audio_rate_chain (GstPad * pad, GstBuffer * buf)
       gst_buffer_unref (buf);
       buf = trunc;
 
-      gst_buffer_set_caps (buf, GST_PAD_CAPS (audiorate->srcpad));
-
       audiorate->drop += truncsamples;
       GST_DEBUG_OBJECT (audiorate, "truncating %" G_GUINT64_FORMAT " samples",
           truncsamples);
index 44a22dd..c4d3c0d 100644 (file)
@@ -821,8 +821,6 @@ gst_audio_resample_push_drain (GstAudioResample * resample, guint history_len)
     return;
 
   outbuf = gst_buffer_new_and_alloc (outsize);
-  gst_buffer_set_caps (outbuf,
-      GST_PAD_CAPS (GST_BASE_TRANSFORM_SRC_PAD (resample)));
 
   data = gst_buffer_map (outbuf, NULL, NULL, GST_MAP_WRITE);
 
index 144a230..f0ff750 100644 (file)
@@ -1092,7 +1092,6 @@ gst_audio_test_src_create (GstBaseSrc * basesrc, guint64 offset,
   bytes = src->generate_samples_per_buffer * src->sample_size * src->channels;
 
   buf = gst_buffer_new_and_alloc (bytes);
-  gst_buffer_set_caps (buf, GST_PAD_CAPS (basesrc->srcpad));
 
   next_byte = src->next_byte + (src->reverse ? (-bytes) : bytes);
   next_time = gst_util_uint64_scale_int (next_sample, GST_SECOND,
index ed0e42b..9daa6cc 100644 (file)
@@ -510,6 +510,7 @@ static gboolean
 setup_recoder_pipeline (GstSmartEncoder * smart_encoder)
 {
   GstPad *tmppad;
+  GstCaps *caps;
 
   /* Fast path */
   if (G_UNLIKELY (smart_encoder->encoder))
@@ -518,14 +519,18 @@ setup_recoder_pipeline (GstSmartEncoder * smart_encoder)
   GST_DEBUG ("Creating internal decoder and encoder");
 
   /* Create decoder/encoder */
-  smart_encoder->decoder = get_decoder (GST_PAD_CAPS (smart_encoder->sinkpad));
+  caps = gst_pad_get_current_caps (smart_encoder->sinkpad);
+  smart_encoder->decoder = get_decoder (caps);
   if (G_UNLIKELY (smart_encoder->decoder == NULL))
     goto no_decoder;
+  gst_caps_unref (caps);
   gst_element_set_bus (smart_encoder->decoder, GST_ELEMENT_BUS (smart_encoder));
 
-  smart_encoder->encoder = get_encoder (GST_PAD_CAPS (smart_encoder->sinkpad));
+  caps = gst_pad_get_current_caps (smart_encoder->sinkpad);
+  smart_encoder->encoder = get_encoder (caps);
   if (G_UNLIKELY (smart_encoder->encoder == NULL))
     goto no_encoder;
+  gst_caps_unref (caps);
   gst_element_set_bus (smart_encoder->encoder, GST_ELEMENT_BUS (smart_encoder));
 
   GST_DEBUG ("Creating internal pads");
@@ -536,8 +541,6 @@ setup_recoder_pipeline (GstSmartEncoder * smart_encoder)
   smart_encoder->internal_srcpad = gst_pad_new ("internal_src", GST_PAD_SRC);
   g_object_set_qdata ((GObject *) smart_encoder->internal_srcpad,
       INTERNAL_ELEMENT, smart_encoder);
-  gst_pad_set_caps (smart_encoder->internal_srcpad,
-      GST_PAD_CAPS (smart_encoder->sinkpad));
   gst_pad_set_active (smart_encoder->internal_srcpad, TRUE);
 
   /* Sink pad which will get the buffers from the encoder.
@@ -546,8 +549,6 @@ setup_recoder_pipeline (GstSmartEncoder * smart_encoder)
   smart_encoder->internal_sinkpad = gst_pad_new ("internal_sink", GST_PAD_SINK);
   g_object_set_qdata ((GObject *) smart_encoder->internal_sinkpad,
       INTERNAL_ELEMENT, smart_encoder);
-  gst_pad_set_caps (smart_encoder->internal_sinkpad,
-      GST_PAD_CAPS (smart_encoder->sinkpad));
   gst_pad_set_chain_function (smart_encoder->internal_sinkpad, internal_chain);
   gst_pad_set_active (smart_encoder->internal_sinkpad, TRUE);
 
@@ -575,15 +576,15 @@ setup_recoder_pipeline (GstSmartEncoder * smart_encoder)
 
 no_decoder:
   {
-    GST_WARNING ("Couldn't find a decoder for %" GST_PTR_FORMAT,
-        GST_PAD_CAPS (smart_encoder->sinkpad));
+    GST_WARNING ("Couldn't find a decoder for %" GST_PTR_FORMAT, caps);
+    gst_caps_unref (caps);
     return FALSE;
   }
 
 no_encoder:
   {
-    GST_WARNING ("Couldn't find an encoder for %" GST_PTR_FORMAT,
-        GST_PAD_CAPS (smart_encoder->sinkpad));
+    GST_WARNING ("Couldn't find an encoder for %" GST_PTR_FORMAT, caps);
+    gst_caps_unref (caps);
     return FALSE;
   }
 
index fd16a38..10b099f 100644 (file)
@@ -317,7 +317,6 @@ gst_gdp_depay_chain (GstPad * pad, GstBuffer * buffer)
         }
 
         /* set caps and push */
-        gst_buffer_set_caps (buf, this->caps);
         GST_LOG_OBJECT (this, "deserialized buffer %p, pushing, timestamp %"
             GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT
             ", offset %" G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT
index 2774349..e9485cf 100644 (file)
@@ -210,6 +210,7 @@ gst_gdp_stamp_buffer (GstGDPPay * this, GstBuffer * buffer)
   this->offset = GST_BUFFER_OFFSET_END (buffer);
 }
 
+#if 0
 static GstBuffer *
 gst_gdp_buffer_from_caps (GstGDPPay * this, GstCaps * caps)
 {
@@ -241,6 +242,7 @@ packet_failed:
     return NULL;
   }
 }
+#endif
 
 static GstBuffer *
 gst_gdp_pay_buffer_from_buffer (GstGDPPay * this, GstBuffer * buffer)
@@ -352,7 +354,6 @@ gst_gdp_pay_reset_streamheader (GstGDPPay * this)
     GST_DEBUG_OBJECT (this, "1.0, appending copy of new segment buffer %p",
         this->new_segment_buf);
     new_segment_buf = gst_buffer_copy (this->new_segment_buf);
-    gst_buffer_set_caps (new_segment_buf, NULL);
     g_value_init (&value, GST_TYPE_BUFFER);
     gst_value_set_buffer (&value, new_segment_buf);
     gst_value_array_append_value (&array, &value);
@@ -366,7 +367,6 @@ gst_gdp_pay_reset_streamheader (GstGDPPay * this)
       tag_buf = this->tag_buf;
       this->tag_buf = NULL;
 
-      gst_buffer_set_caps (tag_buf, NULL);
       g_value_init (&value, GST_TYPE_BUFFER);
       gst_value_set_buffer (&value, tag_buf);
       gst_value_array_append_value (&array, &value);
@@ -378,7 +378,6 @@ gst_gdp_pay_reset_streamheader (GstGDPPay * this)
   gst_gdp_stamp_buffer (this, this->caps_buf);
   GST_DEBUG_OBJECT (this, "appending copy of caps buffer %p", this->caps_buf);
   caps_buf = gst_buffer_copy (this->caps_buf);
-  gst_buffer_set_caps (caps_buf, NULL);
   g_value_init (&value, GST_TYPE_BUFFER);
   gst_value_set_buffer (&value, caps_buf);
   gst_value_array_append_value (&array, &value);
@@ -453,10 +452,6 @@ gst_gdp_pay_reset_streamheader (GstGDPPay * this)
 
   GST_DEBUG_OBJECT (this, "Setting caps on src pad %" GST_PTR_FORMAT, caps);
   gst_pad_set_caps (this->srcpad, caps);
-  this->caps_buf = gst_buffer_make_writable (this->caps_buf);
-  gst_buffer_set_caps (this->caps_buf, caps);
-  this->new_segment_buf = gst_buffer_make_writable (this->new_segment_buf);
-  gst_buffer_set_caps (this->new_segment_buf, caps);
 
   /* if these are our first ever buffers, send out new_segment first */
   if (!this->sent_streamheader) {
@@ -482,7 +477,6 @@ gst_gdp_pay_reset_streamheader (GstGDPPay * this)
     goto done;
   }
   if (this->tag_buf) {
-    gst_buffer_set_caps (this->tag_buf, caps);
     GST_DEBUG_OBJECT (this, "Pushing GDP tag buffer %p", this->tag_buf);
     /* we stored these bufs with refcount 1, so make sure we keep a ref */
     r = gst_pad_push (this->srcpad, gst_buffer_ref (this->tag_buf));
@@ -510,7 +504,6 @@ gst_gdp_pay_reset_streamheader (GstGDPPay * this)
     this->queue = g_list_delete_link (this->queue, this->queue);
 
     /* set caps and push */
-    gst_buffer_set_caps (buffer, caps);
     r = gst_pad_push (this->srcpad, buffer);
     if (r != GST_FLOW_OK) {
       GST_WARNING_OBJECT (this, "pushing queued GDP buffer returned %d", r);
@@ -540,7 +533,6 @@ gst_gdp_queue_buffer (GstGDPPay * this, GstBuffer * buffer)
   if (this->sent_streamheader) {
     GST_LOG_OBJECT (this, "Pushing GDP buffer %p, caps %" GST_PTR_FORMAT,
         buffer, this->caps);
-    gst_buffer_set_caps (buffer, GST_PAD_CAPS (this->srcpad));
     return gst_pad_push (this->srcpad, buffer);
   }
 
@@ -557,7 +549,9 @@ static GstFlowReturn
 gst_gdp_pay_chain (GstPad * pad, GstBuffer * buffer)
 {
   GstGDPPay *this;
+#if 0
   GstCaps *caps;
+#endif
   GstBuffer *outbuffer;
   GstFlowReturn ret;
 
@@ -587,7 +581,7 @@ gst_gdp_pay_chain (GstPad * pad, GstBuffer * buffer)
       this->new_segment_buf = outbuffer;
     }
   }
-
+#if 0
   /* make sure we've received caps before */
   caps = gst_buffer_get_caps (buffer);
   if (!this->caps && !caps)
@@ -613,6 +607,7 @@ gst_gdp_pay_chain (GstPad * pad, GstBuffer * buffer)
 
   if (caps)
     gst_caps_unref (caps);
+#endif
 
   /* create a GDP header packet,
    * then create a GST buffer of the header packet and the buffer contents */
@@ -641,6 +636,7 @@ done:
   return ret;
 
   /* ERRORS */
+#if 0
 no_caps:
   {
     /* when returning a fatal error as a GstFlowReturn we must post an error
@@ -660,6 +656,7 @@ no_caps_buffer:
     ret = GST_FLOW_ERROR;
     goto done;
   }
+#endif
 no_buffer:
   {
     GST_ELEMENT_ERROR (this, STREAM, ENCODE, (NULL),
index 2921f6c..65c793c 100644 (file)
@@ -1885,10 +1885,7 @@ get_pad_caps (GstPad * pad)
 
   /* first check the pad caps, if this is set, we are positively sure it is
    * fixed and exactly what the element will produce. */
-  GST_OBJECT_LOCK (pad);
-  if ((caps = GST_PAD_CAPS (pad)))
-    gst_caps_ref (caps);
-  GST_OBJECT_UNLOCK (pad);
+  caps = gst_pad_get_current_caps (pad);
 
   /* then use the getcaps function if we don't have caps. These caps might not
    * be fixed in some cases, in which case analyze_new_pad will set up a
index ac26013..f2c267e 100644 (file)
@@ -784,6 +784,7 @@ handoff (GstElement * identity, GstBuffer * frame, gpointer data)
 {
   GstPlayBin *play_bin = GST_PLAY_BIN (data);
 
+#if 0
   /* applications need to know the buffer caps,
    * make sure they are always set on the frame */
   if (GST_BUFFER_CAPS (frame) == NULL) {
@@ -794,6 +795,7 @@ handoff (GstElement * identity, GstBuffer * frame, gpointer data)
       gst_object_unref (pad);
     }
   }
+#endif
 
   gst_buffer_replace (&play_bin->frame, frame);
 }
index fe067b6..98facaf 100644 (file)
@@ -2850,7 +2850,8 @@ gst_play_sink_convert_frame (GstPlaySink * playsink, GstCaps * caps)
     GstBuffer *temp;
     GError *err = NULL;
 
-    temp = gst_video_convert_frame (result, caps, 25 * GST_SECOND, &err);
+    /* FIXME, need to get the input buffer caps */
+    temp = gst_video_convert_frame (result, NULL, caps, 25 * GST_SECOND, &err);
     gst_buffer_unref (result);
     if (temp == NULL && err) {
       /* I'm really uncertain whether we should make playsink post an error
index e599466..48dca78 100644 (file)
@@ -275,8 +275,6 @@ gst_ssa_parse_push_line (GstSsaParse * parse, gchar * txt,
   GST_BUFFER_TIMESTAMP (buf) = start;
   GST_BUFFER_DURATION (buf) = duration;
 
-  gst_buffer_set_caps (buf, GST_PAD_CAPS (parse->srcpad));
-
   GST_LOG_OBJECT (parse, "Pushing buffer with timestamp %" GST_TIME_FORMAT
       " and duration %" GST_TIME_FORMAT, GST_TIME_ARGS (start),
       GST_TIME_ARGS (duration));
index b7b6815..88c124e 100644 (file)
@@ -1484,7 +1484,6 @@ handle_buffer (GstSubParse * self, GstBuffer * buf)
 
       /* +1 for terminating NUL character */
       buf = gst_buffer_new_and_alloc (subtitle_len + 1);
-      gst_buffer_set_caps (buf, GST_PAD_CAPS (self->srcpad));
 
       /* copy terminating NUL character as well */
       gst_buffer_fill (buf, 0, subtitle, subtitle_len + 1);
index 24d2190..7f40e35 100644 (file)
@@ -1303,9 +1303,13 @@ gst_multi_fd_sink_client_queue_buffer (GstMultiFdSink * sink,
   gboolean send_streamheader = FALSE;
   GstStructure *s;
 
+#if 0
   /* before we queue the buffer, we check if we need to queue streamheader
    * buffers (because it's a new client, or because they changed) */
   caps = gst_buffer_get_caps (buffer);  /* cleaned up after streamheader */
+#else
+  caps = NULL;
+#endif
   if (!client->caps) {
     GST_DEBUG_OBJECT (sink,
         "[fd %5d] no previous caps for this client, send streamheader",
@@ -2476,13 +2480,16 @@ gst_multi_fd_sink_render (GstBaseSink * bsink, GstBuffer * buf)
 {
   GstMultiFdSink *sink;
   gboolean in_caps;
+#if 0
   GstCaps *bufcaps, *padcaps;
+#endif
 
   sink = GST_MULTI_FD_SINK (bsink);
 
   g_return_val_if_fail (GST_OBJECT_FLAG_IS_SET (sink, GST_MULTI_FD_SINK_OPEN),
       GST_FLOW_WRONG_STATE);
 
+#if 0
   /* since we check every buffer for streamheader caps, we need to make
    * sure every buffer has caps set */
   bufcaps = gst_buffer_get_caps (buf);
@@ -2491,10 +2498,12 @@ gst_multi_fd_sink_render (GstBaseSink * bsink, GstBuffer * buf)
   /* make sure we have caps on the pad */
   if (!padcaps && !bufcaps)
     goto no_caps;
+#endif
 
   /* get IN_CAPS first, code below might mess with the flags */
   in_caps = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
 
+#if 0
   /* stamp the buffer with previous caps if no caps set */
   if (!bufcaps) {
     if (!gst_buffer_is_writable (buf)) {
@@ -2518,6 +2527,7 @@ gst_multi_fd_sink_render (GstBaseSink * bsink, GstBuffer * buf)
     /* since we keep this buffer out of the scope of this method */
     gst_buffer_ref (buf);
   }
+#endif
 
   GST_LOG_OBJECT (sink, "received buffer %p, in_caps: %s, offset %"
       G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT
@@ -2563,12 +2573,14 @@ gst_multi_fd_sink_render (GstBaseSink * bsink, GstBuffer * buf)
   return GST_FLOW_OK;
 
   /* ERRORS */
+#if 0
 no_caps:
   {
     GST_ELEMENT_ERROR (sink, CORE, NEGOTIATION, (NULL),
         ("Received first buffer without caps set"));
     return GST_FLOW_NOT_NEGOTIATED;
   }
+#endif
 }
 
 static void
index 2de0bce..3429b9a 100644 (file)
@@ -197,8 +197,6 @@ gst_tcp_client_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
         GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (*outbuf)),
         GST_TIME_ARGS (GST_BUFFER_DURATION (*outbuf)),
         GST_BUFFER_OFFSET (*outbuf), GST_BUFFER_OFFSET_END (*outbuf));
-
-    gst_buffer_set_caps (*outbuf, src->caps);
   }
 
   return ret;
index fe32329..ec58476 100644 (file)
@@ -498,8 +498,6 @@ gst_video_rate_flush_prev (GstVideoRate * videorate, gboolean duplicate)
   /* adapt for looping, bring back to time in current segment. */
   GST_BUFFER_TIMESTAMP (outbuf) = push_ts - videorate->segment.accum;
 
-  gst_buffer_set_caps (outbuf, GST_PAD_CAPS (videorate->srcpad));
-
   GST_LOG_OBJECT (videorate,
       "old is best, dup, pushing buffer outgoing ts %" GST_TIME_FORMAT,
       GST_TIME_ARGS (push_ts));
index 0dd6d3e..9772e8a 100644 (file)
@@ -36,10 +36,6 @@ on_new_buffer_from_source (GstElement * elt, ProgramData * data)
 
   gst_buffer_copy_into (app_buffer, buffer, GST_BUFFER_COPY_MEMORY, 0, size);
 
-  /* newer basesrc will set caps for use automatically but it does not really
-   * hurt to set it on the buffer again */
-  gst_buffer_set_caps (app_buffer, GST_BUFFER_CAPS (buffer));
-
   /* we don't need the appsink buffer anymore */
   gst_buffer_unref (buffer);
 
index b7283e8..614ccf4 100644 (file)
@@ -2051,7 +2051,11 @@ shot_cb (GtkButton * button, gpointer data)
      * that it can only be an rgb buffer. The only thing we have not specified
      * on the caps is the height, which is dependant on the pixel-aspect-ratio
      * of the source material */
+#if 0
     caps = GST_BUFFER_CAPS (buffer);
+#endif
+    /* FIXME, get the caps on the buffer somehow */
+    caps = NULL;
     if (!caps) {
       g_warning ("could not get snapshot format\n");
       goto done;
index b20574e..9a37413 100644 (file)
@@ -2041,7 +2041,11 @@ shot_cb (GtkButton * button, gpointer data)
      * that it can only be an rgb buffer. The only thing we have not specified
      * on the caps is the height, which is dependant on the pixel-aspect-ratio
      * of the source material */
+#if 0
     caps = GST_BUFFER_CAPS (buffer);
+#endif
+    /* FIXME, need to get the caps of the buffer somehow */
+    caps = NULL;
     if (!caps) {
       g_warning ("could not get snapshot format\n");
       goto done;
index 252f82f..b1ec777 100644 (file)
@@ -118,7 +118,11 @@ main (int argc, char *argv[])
      * that it can only be an rgb buffer. The only thing we have not specified
      * on the caps is the height, which is dependant on the pixel-aspect-ratio
      * of the source material */
+#if 0
     caps = GST_BUFFER_CAPS (buffer);
+#endif
+    /* FIXME, get buffer caps somehow */
+    caps = NULL;
     if (!caps) {
       g_print ("could not get snapshot format\n");
       exit (-1);