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.
This commit is contained in:
Wim Taymans 2007-03-09 16:38:06 +00:00
parent b9ca5573a9
commit e9be846621
6 changed files with 26 additions and 45 deletions

View file

@ -1,3 +1,15 @@
2007-03-09 Wim Taymans <wim@fluendo.com>
* 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 <tim at centricular dot net>
* ext/pango/gsttextoverlay.c: (gst_text_overlay_text_event),

View file

@ -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++) {

View file

@ -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);

View file

@ -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 (&copy->to, &nbuf->to, sizeof (nbuf->to));
memcpy (&copy->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;
}

View file

@ -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;

View file

@ -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;