From e9be8466213a1263cfd9cd9a877d979c2184f9d8 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 9 Mar 2007 16:38:06 +0000 Subject: [PATCH] Use new metadata copy function. Original commit message from CVS: * ext/pango/gsttextrender.c: (gst_text_render_chain): * ext/vorbis/vorbistag.c: (gst_vorbis_tag_parse_packet): * gst-libs/gst/netbuffer/gstnetbuffer.c: (gst_netbuffer_copy): Use new metadata copy function. * gst/ffmpegcolorspace/gstffmpegcolorspace.c: (gst_ffmpegcsp_transform): * gst/videoscale/gstvideoscale.c: (gst_video_scale_transform): Basetransform copied the metadata for us. --- ChangeLog | 12 ++++++ ext/pango/gsttextrender.c | 2 +- ext/vorbis/vorbistag.c | 2 +- gst-libs/gst/netbuffer/gstnetbuffer.c | 50 +++++----------------- gst/ffmpegcolorspace/gstffmpegcolorspace.c | 3 +- gst/videoscale/gstvideoscale.c | 2 - 6 files changed, 26 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index 86fc579d9a..e51a5fbacd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2007-03-09 Wim Taymans + + * ext/pango/gsttextrender.c: (gst_text_render_chain): + * ext/vorbis/vorbistag.c: (gst_vorbis_tag_parse_packet): + * gst-libs/gst/netbuffer/gstnetbuffer.c: (gst_netbuffer_copy): + Use new metadata copy function. + + * gst/ffmpegcolorspace/gstffmpegcolorspace.c: + (gst_ffmpegcsp_transform): + * gst/videoscale/gstvideoscale.c: (gst_video_scale_transform): + Basetransform copied the metadata for us. + 2007-03-09 Tim-Philipp Müller * ext/pango/gsttextoverlay.c: (gst_text_overlay_text_event), diff --git a/ext/pango/gsttextrender.c b/ext/pango/gsttextrender.c index 067b8a420d..d287507269 100644 --- a/ext/pango/gsttextrender.c +++ b/ext/pango/gsttextrender.c @@ -286,7 +286,7 @@ gst_text_render_chain (GstPad * pad, GstBuffer * inbuf) if (ret != GST_FLOW_OK) goto done; - gst_buffer_stamp (outbuf, inbuf); + gst_buffer_copy_metadata (outbuf, inbuf, GST_BUFFER_COPY_TIMESTAMPS); data = GST_BUFFER_DATA (outbuf); for (n = 0; n < render->width * render->height; n++) { diff --git a/ext/vorbis/vorbistag.c b/ext/vorbis/vorbistag.c index 6092fc385b..2a7ff7f98d 100644 --- a/ext/vorbis/vorbistag.c +++ b/ext/vorbis/vorbistag.c @@ -148,7 +148,7 @@ gst_vorbis_tag_parse_packet (GstVorbisParse * parse, GstBuffer * buffer) new_buf = gst_tag_list_to_vorbiscomment_buffer (new_tags, (guint8 *) "\003vorbis", 7, encoder); - gst_buffer_stamp (new_buf, buffer); + gst_buffer_copy_metadata (new_buf, buffer, GST_BUFFER_COPY_TIMESTAMPS); gst_tag_list_free (new_tags); g_free (encoder); diff --git a/gst-libs/gst/netbuffer/gstnetbuffer.c b/gst-libs/gst/netbuffer/gstnetbuffer.c index 141606ea9c..b897c9bdaf 100644 --- a/gst-libs/gst/netbuffer/gstnetbuffer.c +++ b/gst-libs/gst/netbuffer/gstnetbuffer.c @@ -88,40 +88,6 @@ gst_netbuffer_finalize (GstNetBuffer * nbuf) GST_MINI_OBJECT_CLASS (parent_class)->finalize (GST_MINI_OBJECT (nbuf)); } -/* this is copy'n'pasted from _gst_buffer_copy() in lack of a better solution; - * keep in sync with _gst_buffer_copy() */ -static void -notgst_buffer_copy_fields_in_place (GstBuffer * copy, GstBuffer * buffer) -{ - guint mask; - - GST_LOG ("copying %p to %p", buffer, copy); - - /* copy relevant flags */ - mask = GST_BUFFER_FLAG_PREROLL | GST_BUFFER_FLAG_IN_CAPS | - GST_BUFFER_FLAG_DELTA_UNIT | GST_BUFFER_FLAG_DISCONT | - GST_BUFFER_FLAG_GAP; - GST_MINI_OBJECT_FLAGS (copy) |= GST_MINI_OBJECT_FLAGS (buffer) & mask; - - /* we simply copy everything from our parent */ - copy->data = g_memdup (buffer->data, buffer->size); - /* make sure it gets freed (even if the parent is subclassed, we return a - normal buffer) */ - copy->malloc_data = copy->data; - - copy->size = buffer->size; - - GST_BUFFER_TIMESTAMP (copy) = GST_BUFFER_TIMESTAMP (buffer); - GST_BUFFER_DURATION (copy) = GST_BUFFER_DURATION (buffer); - GST_BUFFER_OFFSET (copy) = GST_BUFFER_OFFSET (buffer); - GST_BUFFER_OFFSET_END (copy) = GST_BUFFER_OFFSET_END (buffer); - - if (GST_BUFFER_CAPS (buffer)) - GST_BUFFER_CAPS (copy) = gst_caps_ref (GST_BUFFER_CAPS (buffer)); - else - GST_BUFFER_CAPS (copy) = NULL; -} - static GstNetBuffer * gst_netbuffer_copy (GstNetBuffer * nbuf) { @@ -129,15 +95,21 @@ gst_netbuffer_copy (GstNetBuffer * nbuf) copy = gst_netbuffer_new (); - /* can't just chain up to parent_class::copy() because that will allocate - * a normal GstBuffer for us, so we'd lose the to/from fields and we don't - * want that */ - notgst_buffer_copy_fields_in_place (GST_BUFFER_CAST (copy), - GST_BUFFER_CAST (nbuf)); + /* we simply copy everything from our parent */ + GST_BUFFER_DATA (copy) = + g_memdup (GST_BUFFER_DATA (nbuf), GST_BUFFER_SIZE (nbuf)); + /* make sure it gets freed (even if the parent is subclassed, we return a + normal buffer) */ + GST_BUFFER_MALLOCDATA (copy) = GST_BUFFER_DATA (copy); + GST_BUFFER_SIZE (copy) = GST_BUFFER_SIZE (nbuf); memcpy (©->to, &nbuf->to, sizeof (nbuf->to)); memcpy (©->from, &nbuf->from, sizeof (nbuf->from)); + /* copy metadata */ + gst_buffer_copy_metadata (GST_BUFFER_CAST (copy), + GST_BUFFER_CAST (nbuf), GST_BUFFER_COPY_ALL); + return copy; } diff --git a/gst/ffmpegcolorspace/gstffmpegcolorspace.c b/gst/ffmpegcolorspace/gstffmpegcolorspace.c index 8ac9942375..dda50a78c5 100644 --- a/gst/ffmpegcolorspace/gstffmpegcolorspace.c +++ b/gst/ffmpegcolorspace/gstffmpegcolorspace.c @@ -466,8 +466,7 @@ gst_ffmpegcsp_transform (GstBaseTransform * btrans, GstBuffer * inbuf, if (result == -1) goto not_supported; - /* copy timestamps */ - gst_buffer_stamp (outbuf, inbuf); + /* baseclass copies timestamps */ GST_DEBUG ("from %d -> to %d done", space->from_pixfmt, space->to_pixfmt); return GST_FLOW_OK; diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index 5d038cb6a7..cbe5236a25 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -712,8 +712,6 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in, videoscale = GST_VIDEO_SCALE (trans); - gst_buffer_stamp (out, in); - src = &videoscale->src; dest = &videoscale->dest;