From 345dc31f205befe34c47ea2266c7ef5150943e47 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 30 Mar 2012 18:12:39 +0200 Subject: [PATCH] update for buffer api change --- gst-libs/gst/rtp/gstrtcpbuffer.c | 4 ++-- gst-libs/gst/rtp/gstrtpbuffer.c | 4 ++-- gst-libs/gst/tag/gstexiftag.c | 2 +- gst-libs/gst/tag/gstxmptag.c | 2 +- gst/gdp/gstgdppay.c | 10 +++++----- sys/ximage/ximagepool.c | 2 +- sys/xvimage/xvimagepool.c | 2 +- tests/check/elements/decodebin.c | 2 +- tests/check/elements/subparse.c | 2 +- tests/check/gst/typefindfunctions.c | 8 ++++---- tests/check/libs/audio.c | 26 +++++++++++++------------- tests/check/libs/tag.c | 6 +++--- tests/examples/app/appsrc-ra.c | 6 +++--- tests/examples/app/appsrc-seekable.c | 6 +++--- tests/examples/app/appsrc-stream.c | 6 +++--- tests/examples/app/appsrc-stream2.c | 6 +++--- 16 files changed, 47 insertions(+), 47 deletions(-) diff --git a/gst-libs/gst/rtp/gstrtcpbuffer.c b/gst-libs/gst/rtp/gstrtcpbuffer.c index 4a235155df..7b83b28339 100644 --- a/gst-libs/gst/rtp/gstrtcpbuffer.c +++ b/gst-libs/gst/rtp/gstrtcpbuffer.c @@ -70,7 +70,7 @@ gst_rtcp_buffer_new_take_data (gpointer data, guint len) g_return_val_if_fail (len > 0, NULL); result = gst_buffer_new (); - gst_buffer_take_memory (result, -1, + gst_buffer_append_memory (result, gst_memory_new_wrapped (0, data, len, 0, len, data, g_free)); return result; @@ -235,7 +235,7 @@ gst_rtcp_buffer_new (guint mtu) data = g_malloc0 (mtu); result = gst_buffer_new (); - gst_buffer_take_memory (result, -1, + gst_buffer_append_memory (result, gst_memory_new_wrapped (0, data, mtu, 0, 0, data, g_free)); return result; diff --git a/gst-libs/gst/rtp/gstrtpbuffer.c b/gst-libs/gst/rtp/gstrtpbuffer.c index cc7bef7ad2..53b5eb6819 100644 --- a/gst-libs/gst/rtp/gstrtpbuffer.c +++ b/gst-libs/gst/rtp/gstrtpbuffer.c @@ -126,7 +126,7 @@ gst_rtp_buffer_allocate_data (GstBuffer * buffer, guint payload_len, GST_RTP_HEADER_SSRC (map.data) = 0; gst_memory_unmap (mem, &map); - gst_buffer_take_memory (buffer, -1, mem); + gst_buffer_append_memory (buffer, mem); } /** @@ -149,7 +149,7 @@ gst_rtp_buffer_new_take_data (gpointer data, gsize len) g_return_val_if_fail (len > 0, NULL); result = gst_buffer_new (); - gst_buffer_take_memory (result, -1, + gst_buffer_append_memory (result, gst_memory_new_wrapped (0, data, len, 0, len, data, g_free)); return result; diff --git a/gst-libs/gst/tag/gstexiftag.c b/gst-libs/gst/tag/gstexiftag.c index 58ba409fb6..e015285566 100644 --- a/gst-libs/gst/tag/gstexiftag.c +++ b/gst-libs/gst/tag/gstexiftag.c @@ -1353,7 +1353,7 @@ parse_exif_undefined_tag (GstExifReader * reader, const GstExifTagMatch * tag, GstBuffer *buf; buf = gst_buffer_new (); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (0, data, count, 0, count, data, g_free)); data = NULL; diff --git a/gst-libs/gst/tag/gstxmptag.c b/gst-libs/gst/tag/gstxmptag.c index 4f416b83f9..0f5716802f 100644 --- a/gst-libs/gst/tag/gstxmptag.c +++ b/gst-libs/gst/tag/gstxmptag.c @@ -1875,7 +1875,7 @@ gst_tag_list_to_xmp_buffer_full (const GstTagList * list, gboolean read_only, bdata = g_string_free (data, FALSE); buffer = gst_buffer_new (); - gst_buffer_take_memory (buffer, -1, + gst_buffer_append_memory (buffer, gst_memory_new_wrapped (0, bdata, bsize, 0, bsize, bdata, g_free)); return buffer; diff --git a/gst/gdp/gstgdppay.c b/gst/gdp/gstgdppay.c index 40a88b3254..aab3f85a9f 100644 --- a/gst/gdp/gstgdppay.c +++ b/gst/gdp/gstgdppay.c @@ -227,12 +227,12 @@ gst_gdp_buffer_from_caps (GstGDPPay * this, GstCaps * caps) GST_LOG_OBJECT (this, "creating GDP header and payload buffer from caps"); headerbuf = gst_buffer_new (); - gst_buffer_take_memory (headerbuf, -1, + gst_buffer_append_memory (headerbuf, gst_memory_new_wrapped (0, header, len, 0, len, header, g_free)); payloadbuf = gst_buffer_new (); plen = gst_dp_header_payload_length (header); - gst_buffer_take_memory (payloadbuf, -1, + gst_buffer_append_memory (payloadbuf, gst_memory_new_wrapped (0, payload, plen, 0, plen, payload, g_free)); return gst_buffer_append (headerbuf, payloadbuf); @@ -258,7 +258,7 @@ gst_gdp_pay_buffer_from_buffer (GstGDPPay * this, GstBuffer * buffer) GST_LOG_OBJECT (this, "creating GDP header and payload buffer from buffer"); headerbuf = gst_buffer_new (); - gst_buffer_take_memory (headerbuf, -1, + gst_buffer_append_memory (headerbuf, gst_memory_new_wrapped (0, header, len, 0, len, header, g_free)); /* we do not want to lose the ref on the incoming buffer */ @@ -291,13 +291,13 @@ gst_gdp_buffer_from_event (GstGDPPay * this, GstEvent * event) GST_LOG_OBJECT (this, "creating GDP header and payload buffer from event"); headerbuf = gst_buffer_new (); - gst_buffer_take_memory (headerbuf, -1, + gst_buffer_append_memory (headerbuf, gst_memory_new_wrapped (0, header, len, 0, len, header, g_free)); payloadbuf = gst_buffer_new (); plen = gst_dp_header_payload_length (header); if (plen && payload != NULL) { - gst_buffer_take_memory (payloadbuf, -1, + gst_buffer_append_memory (payloadbuf, gst_memory_new_wrapped (0, payload, plen, 0, plen, payload, g_free)); } diff --git a/sys/ximage/ximagepool.c b/sys/ximage/ximagepool.c index 349c9c2490..f2f2aa28b2 100644 --- a/sys/ximage/ximagepool.c +++ b/sys/ximage/ximagepool.c @@ -231,7 +231,7 @@ gst_buffer_add_ximage_meta (GstBuffer * buffer, GstXImageBufferPool * xpool) error_caught = FALSE; XSetErrorHandler (handler); - gst_buffer_take_memory (buffer, -1, + gst_buffer_append_memory (buffer, gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE, meta->ximage->data, meta->size, 0, meta->size, NULL, NULL)); diff --git a/sys/xvimage/xvimagepool.c b/sys/xvimage/xvimagepool.c index 4ffdbd8b0d..a7123149ee 100644 --- a/sys/xvimage/xvimagepool.c +++ b/sys/xvimage/xvimagepool.c @@ -265,7 +265,7 @@ gst_buffer_add_xvimage_meta (GstBuffer * buffer, GstXvImageBufferPool * xvpool) error_caught = FALSE; XSetErrorHandler (handler); - gst_buffer_take_memory (buffer, -1, + gst_buffer_append_memory (buffer, gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE, meta->xvimage->data, meta->size, 0, meta->size, NULL, NULL)); diff --git a/tests/check/elements/decodebin.c b/tests/check/elements/decodebin.c index 0de9bc2c1a..26b14bd173 100644 --- a/tests/check/elements/decodebin.c +++ b/tests/check/elements/decodebin.c @@ -50,7 +50,7 @@ src_need_data_cb (GstElement * src, guint size, gpointer data) GstFlowReturn ret; buf = gst_buffer_new (); - gst_buffer_take_memory (buf, 0, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, (gpointer) dummytext, sizeof (dummytext), 0, sizeof (dummytext), NULL, NULL)); diff --git a/tests/check/elements/subparse.c b/tests/check/elements/subparse.c index 811075e024..4da9835435 100644 --- a/tests/check/elements/subparse.c +++ b/tests/check/elements/subparse.c @@ -48,7 +48,7 @@ buffer_from_static_string (const gchar * s) len = strlen (s); buf = gst_buffer_new (); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, (gpointer) s, len, 0, len, NULL, NULL)); diff --git a/tests/check/gst/typefindfunctions.c b/tests/check/gst/typefindfunctions.c index c3fe0559ed..625c9b0d28 100644 --- a/tests/check/gst/typefindfunctions.c +++ b/tests/check/gst/typefindfunctions.c @@ -62,7 +62,7 @@ GST_START_TEST (test_quicktime_mpeg4video) GstCaps *caps = NULL; buf = gst_buffer_new (); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, (gpointer) qt_redirect_396042, sizeof (qt_redirect_396042), 0, sizeof (qt_redirect_396042), NULL, @@ -93,7 +93,7 @@ GST_START_TEST (test_broken_flac_in_ogg) GstCaps *caps = NULL; buf = gst_buffer_new (); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, (gpointer) flac_id_packet, sizeof (flac_id_packet), 0, sizeof (flac_id_packet), NULL, NULL)); @@ -130,7 +130,7 @@ typefind_test_file (const gchar * filename) } buf = gst_buffer_new (); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, (gpointer) data, data_len, 0, data_len, NULL, NULL)); @@ -352,7 +352,7 @@ GST_START_TEST (test_random_data) data[i] = g_random_int () & 0xff; buf = gst_buffer_new (); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, data, TEST_RANDOM_DATA_SIZE, 0, TEST_RANDOM_DATA_SIZE, NULL, NULL)); diff --git a/tests/check/libs/audio.c b/tests/check/libs/audio.c index fa5db6b53b..1bfb548759 100644 --- a/tests/check/libs/audio.c +++ b/tests/check/libs/audio.c @@ -41,7 +41,7 @@ GST_START_TEST (test_buffer_clipping_time) /* Clip start and end */ buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_TIME); @@ -71,7 +71,7 @@ GST_START_TEST (test_buffer_clipping_time) /* Clip only start */ buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_TIME); @@ -101,7 +101,7 @@ GST_START_TEST (test_buffer_clipping_time) /* Clip only stop */ buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_TIME); @@ -131,7 +131,7 @@ GST_START_TEST (test_buffer_clipping_time) /* Buffer outside segment */ buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_TIME); @@ -150,7 +150,7 @@ GST_START_TEST (test_buffer_clipping_time) /* Clip start and end but don't touch duration and offset_end */ buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_TIME); @@ -183,7 +183,7 @@ GST_START_TEST (test_buffer_clipping_time) */ buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_TIME); @@ -207,7 +207,7 @@ GST_START_TEST (test_buffer_clipping_time) */ buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_PERCENT); @@ -239,7 +239,7 @@ GST_START_TEST (test_buffer_clipping_samples) /* Clip start and end */ buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_DEFAULT); @@ -269,7 +269,7 @@ GST_START_TEST (test_buffer_clipping_samples) /* Clip only start */ buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_DEFAULT); @@ -299,7 +299,7 @@ GST_START_TEST (test_buffer_clipping_samples) /* Clip only stop */ buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_DEFAULT); @@ -329,7 +329,7 @@ GST_START_TEST (test_buffer_clipping_samples) /* Buffer outside segment */ buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_DEFAULT); @@ -348,7 +348,7 @@ GST_START_TEST (test_buffer_clipping_samples) /* Clip start and end but don't touch duration and offset_end */ buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_DEFAULT); @@ -381,7 +381,7 @@ GST_START_TEST (test_buffer_clipping_samples) */ buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_DEFAULT); diff --git a/tests/check/libs/tag.c b/tests/check/libs/tag.c index 9bd3d08def..62ad204635 100644 --- a/tests/check/libs/tag.c +++ b/tests/check/libs/tag.c @@ -444,7 +444,7 @@ GST_START_TEST (test_vorbis_tags) gchar *vendor = NULL; buf = gst_buffer_new (); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, (gpointer) speex_comments_buf1, sizeof (speex_comments_buf1), 0, sizeof (speex_comments_buf1), NULL, @@ -490,7 +490,7 @@ GST_START_TEST (test_vorbis_tags) gchar *vendor = NULL; buf = gst_buffer_new (); - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, (gpointer) vorbis_comments_buf, sizeof (vorbis_comments_buf), 0, sizeof (vorbis_comments_buf), NULL, @@ -1047,7 +1047,7 @@ GST_START_TEST (test_xmp_parsing) buf = gst_buffer_new (); len = strlen (text) + 1; - gst_buffer_take_memory (buf, -1, + gst_buffer_append_memory (buf, gst_memory_new_wrapped (0, text, len, 0, len, NULL, NULL)); list = gst_tag_list_from_xmp_buffer (buf); diff --git a/tests/examples/app/appsrc-ra.c b/tests/examples/app/appsrc-ra.c index a33ab0332d..eb58c90d3c 100644 --- a/tests/examples/app/appsrc-ra.c +++ b/tests/examples/app/appsrc-ra.c @@ -71,8 +71,6 @@ feed_data (GstElement * appsrc, guint size, App * app) GstBuffer *buffer; GstFlowReturn ret; - buffer = gst_buffer_new (); - if (app->offset >= app->length) { /* we are EOS, send end-of-stream */ g_signal_emit_by_name (app->appsrc, "end-of-stream", &ret); @@ -80,10 +78,12 @@ feed_data (GstElement * appsrc, guint size, App * app) } /* read the amount of data, we are allowed to return less if we are EOS */ + buffer = gst_buffer_new (); + if (app->offset + size > app->length) size = app->length - app->offset; - gst_buffer_take_memory (buffer, -1, + gst_buffer_append_memory (buffer, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, app->data, app->length, app->offset, size, NULL, NULL)); diff --git a/tests/examples/app/appsrc-seekable.c b/tests/examples/app/appsrc-seekable.c index 24b9ba5089..533aab331e 100644 --- a/tests/examples/app/appsrc-seekable.c +++ b/tests/examples/app/appsrc-seekable.c @@ -76,8 +76,6 @@ feed_data (GstElement * appsrc, guint size, App * app) guint len; GstFlowReturn ret; - buffer = gst_buffer_new (); - if (app->offset >= app->length) { /* we are EOS, send end-of-stream */ g_signal_emit_by_name (app->appsrc, "end-of-stream", &ret); @@ -85,11 +83,13 @@ feed_data (GstElement * appsrc, guint size, App * app) } /* read any amount of data, we are allowed to return less if we are EOS */ + buffer = gst_buffer_new (); + len = CHUNK_SIZE; if (app->offset + len > app->length) len = app->length - app->offset; - gst_buffer_take_memory (buffer, -1, + gst_buffer_append_memory (buffer, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, app->data, app->length, app->offset, len, NULL, NULL)); diff --git a/tests/examples/app/appsrc-stream.c b/tests/examples/app/appsrc-stream.c index 51398d7e12..01e9362f6e 100644 --- a/tests/examples/app/appsrc-stream.c +++ b/tests/examples/app/appsrc-stream.c @@ -83,8 +83,6 @@ read_data (App * app) guint len; GstFlowReturn ret; - buffer = gst_buffer_new (); - if (app->offset >= app->length) { /* we are EOS, send end-of-stream and remove the source */ g_signal_emit_by_name (app->appsrc, "end-of-stream", &ret); @@ -92,11 +90,13 @@ read_data (App * app) } /* read the next chunk */ + buffer = gst_buffer_new (); + len = CHUNK_SIZE; if (app->offset + len > app->length) len = app->length - app->offset; - gst_buffer_take_memory (buffer, -1, + gst_buffer_append_memory (buffer, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, app->data, app->length, app->offset, len, NULL, NULL)); diff --git a/tests/examples/app/appsrc-stream2.c b/tests/examples/app/appsrc-stream2.c index 618fd11901..9050e1aa1a 100644 --- a/tests/examples/app/appsrc-stream2.c +++ b/tests/examples/app/appsrc-stream2.c @@ -83,8 +83,6 @@ feed_data (GstElement * appsrc, guint size, App * app) guint len; GstFlowReturn ret; - buffer = gst_buffer_new (); - if (app->offset >= app->length) { /* we are EOS, send end-of-stream */ g_signal_emit_by_name (app->appsrc, "end-of-stream", &ret); @@ -92,11 +90,13 @@ feed_data (GstElement * appsrc, guint size, App * app) } /* read the next chunk */ + buffer = gst_buffer_new (); + len = CHUNK_SIZE; if (app->offset + len > app->length) len = app->length - app->offset; - gst_buffer_take_memory (buffer, -1, + gst_buffer_append_memory (buffer, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, app->data, app->length, app->offset, len, NULL, NULL));