From 63f3f271641010ff094c7a6bafe175484b435b8c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 22 Feb 2012 02:05:24 +0100 Subject: [PATCH] update for new memory api --- gst-libs/gst/rtp/gstrtcpbuffer.c | 7 +++++-- gst-libs/gst/rtp/gstrtpbuffer.c | 2 +- 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 | 4 ++-- tests/check/elements/subparse.c | 2 +- tests/check/gst/typefindfunctions.c | 13 +++++++------ tests/check/libs/audio.c | 26 +++++++++++++------------- tests/check/libs/tag.c | 12 +++++++----- tests/examples/app/appsrc-ra.c | 2 +- tests/examples/app/appsrc-seekable.c | 2 +- tests/examples/app/appsrc-stream.c | 2 +- tests/examples/app/appsrc-stream2.c | 2 +- 16 files changed, 49 insertions(+), 43 deletions(-) diff --git a/gst-libs/gst/rtp/gstrtcpbuffer.c b/gst-libs/gst/rtp/gstrtcpbuffer.c index caf8fb965a..4a235155df 100644 --- a/gst-libs/gst/rtp/gstrtcpbuffer.c +++ b/gst-libs/gst/rtp/gstrtcpbuffer.c @@ -71,7 +71,7 @@ gst_rtcp_buffer_new_take_data (gpointer data, guint len) result = gst_buffer_new (); gst_buffer_take_memory (result, -1, - gst_memory_new_wrapped (0, data, g_free, len, 0, len)); + gst_memory_new_wrapped (0, data, len, 0, len, data, g_free)); return result; } @@ -228,12 +228,15 @@ GstBuffer * gst_rtcp_buffer_new (guint mtu) { GstBuffer *result; + guint8 *data; g_return_val_if_fail (mtu > 0, NULL); + data = g_malloc0 (mtu); + result = gst_buffer_new (); gst_buffer_take_memory (result, -1, - gst_memory_new_wrapped (0, g_malloc0 (mtu), g_free, mtu, 0, 0)); + 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 b12e9e36df..709832ea60 100644 --- a/gst-libs/gst/rtp/gstrtpbuffer.c +++ b/gst-libs/gst/rtp/gstrtpbuffer.c @@ -150,7 +150,7 @@ gst_rtp_buffer_new_take_data (gpointer data, gsize len) result = gst_buffer_new (); gst_buffer_take_memory (result, -1, - gst_memory_new_wrapped (0, data, g_free, len, 0, len)); + 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 f143f1d8d2..6cc37ea819 100644 --- a/gst-libs/gst/tag/gstexiftag.c +++ b/gst-libs/gst/tag/gstexiftag.c @@ -1327,7 +1327,7 @@ parse_exif_undefined_tag (GstExifReader * reader, const GstExifTagMatch * tag, buf = gst_buffer_new (); gst_buffer_take_memory (buf, -1, - gst_memory_new_wrapped (0, data, g_free, count, 0, count)); + gst_memory_new_wrapped (0, data, count, 0, count, data, g_free)); data = NULL; gst_tag_list_add (reader->taglist, GST_TAG_MERGE_APPEND, tag->gst_tag, diff --git a/gst-libs/gst/tag/gstxmptag.c b/gst-libs/gst/tag/gstxmptag.c index 545fc29d1e..b011cb01a2 100644 --- a/gst-libs/gst/tag/gstxmptag.c +++ b/gst-libs/gst/tag/gstxmptag.c @@ -1874,7 +1874,7 @@ gst_tag_list_to_xmp_buffer_full (const GstTagList * list, gboolean read_only, buffer = gst_buffer_new (); gst_buffer_take_memory (buffer, -1, - gst_memory_new_wrapped (0, bdata, g_free, bsize, 0, bsize)); + 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 6bcb3be9c5..bb5764f9ec 100644 --- a/gst/gdp/gstgdppay.c +++ b/gst/gdp/gstgdppay.c @@ -228,12 +228,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_memory_new_wrapped (0, header, g_free, len, 0, len)); + 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_memory_new_wrapped (0, payload, g_free, plen, 0, plen)); + gst_memory_new_wrapped (0, payload, plen, 0, plen, payload, g_free)); return gst_buffer_join (headerbuf, payloadbuf); @@ -259,7 +259,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_memory_new_wrapped (0, header, g_free, len, 0, len)); + gst_memory_new_wrapped (0, header, len, 0, len, header, g_free)); /* we do not want to lose the ref on the incoming buffer */ gst_buffer_ref (buffer); @@ -292,13 +292,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_memory_new_wrapped (0, header, g_free, len, 0, len)); + 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_memory_new_wrapped (0, payload, g_free, plen, 0, plen)); + gst_memory_new_wrapped (0, payload, plen, 0, plen, payload, g_free)); } return gst_buffer_join (headerbuf, payloadbuf); diff --git a/sys/ximage/ximagepool.c b/sys/ximage/ximagepool.c index 7ad88e932f..77ed34d908 100644 --- a/sys/ximage/ximagepool.c +++ b/sys/ximage/ximagepool.c @@ -219,7 +219,7 @@ gst_buffer_add_ximage_meta (GstBuffer * buffer, GstXImageBufferPool * xpool) gst_buffer_take_memory (buffer, -1, gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE, meta->ximage->data, - NULL, meta->size, 0, meta->size)); + meta->size, 0, meta->size, NULL, NULL)); g_mutex_unlock (ximagesink->x_lock); diff --git a/sys/xvimage/xvimagepool.c b/sys/xvimage/xvimagepool.c index 9c5b52a17c..c1570680ad 100644 --- a/sys/xvimage/xvimagepool.c +++ b/sys/xvimage/xvimagepool.c @@ -253,7 +253,7 @@ gst_buffer_add_xvimage_meta (GstBuffer * buffer, GstXvImageBufferPool * xvpool) gst_buffer_take_memory (buffer, -1, gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE, meta->xvimage->data, - NULL, meta->size, 0, meta->size)); + meta->size, 0, meta->size, NULL, NULL)); g_mutex_unlock (xvimagesink->x_lock); diff --git a/tests/check/elements/decodebin.c b/tests/check/elements/decodebin.c index fb3de73116..21dc4f4f9d 100644 --- a/tests/check/elements/decodebin.c +++ b/tests/check/elements/decodebin.c @@ -52,8 +52,8 @@ src_need_data_cb (GstElement * src, guint size, gpointer data) buf = gst_buffer_new (); gst_buffer_take_memory (buf, 0, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, - (gpointer) dummytext, NULL, sizeof (dummytext), 0, - sizeof (dummytext))); + (gpointer) dummytext, sizeof (dummytext), 0, + sizeof (dummytext), NULL, NULL)); GST_BUFFER_OFFSET (buf) = 0; diff --git a/tests/check/elements/subparse.c b/tests/check/elements/subparse.c index b0f43ba86f..4366f660ab 100644 --- a/tests/check/elements/subparse.c +++ b/tests/check/elements/subparse.c @@ -50,7 +50,7 @@ buffer_from_static_string (const gchar * s) buf = gst_buffer_new (); gst_buffer_take_memory (buf, -1, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, - (gpointer) s, NULL, len, 0, len)); + (gpointer) s, len, 0, len, NULL, NULL)); return buf; } diff --git a/tests/check/gst/typefindfunctions.c b/tests/check/gst/typefindfunctions.c index 218fe76892..c3fe0559ed 100644 --- a/tests/check/gst/typefindfunctions.c +++ b/tests/check/gst/typefindfunctions.c @@ -64,8 +64,9 @@ GST_START_TEST (test_quicktime_mpeg4video) buf = gst_buffer_new (); gst_buffer_take_memory (buf, -1, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, - (gpointer) qt_redirect_396042, NULL, - sizeof (qt_redirect_396042), 0, sizeof (qt_redirect_396042))); + (gpointer) qt_redirect_396042, + sizeof (qt_redirect_396042), 0, sizeof (qt_redirect_396042), NULL, + NULL)); GST_BUFFER_OFFSET (buf) = 0; @@ -94,8 +95,8 @@ GST_START_TEST (test_broken_flac_in_ogg) buf = gst_buffer_new (); gst_buffer_take_memory (buf, -1, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, - (gpointer) flac_id_packet, NULL, - sizeof (flac_id_packet), 0, sizeof (flac_id_packet))); + (gpointer) flac_id_packet, + sizeof (flac_id_packet), 0, sizeof (flac_id_packet), NULL, NULL)); GST_BUFFER_OFFSET (buf) = 0; @@ -131,7 +132,7 @@ typefind_test_file (const gchar * filename) buf = gst_buffer_new (); gst_buffer_take_memory (buf, -1, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, - (gpointer) data, NULL, data_len, 0, data_len)); + (gpointer) data, data_len, 0, data_len, NULL, NULL)); GST_BUFFER_OFFSET (buf) = 0; @@ -353,7 +354,7 @@ GST_START_TEST (test_random_data) buf = gst_buffer_new (); gst_buffer_take_memory (buf, -1, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, - data, NULL, TEST_RANDOM_DATA_SIZE, 0, TEST_RANDOM_DATA_SIZE)); + data, TEST_RANDOM_DATA_SIZE, 0, TEST_RANDOM_DATA_SIZE, NULL, NULL)); GST_BUFFER_OFFSET (buf) = 0; diff --git a/tests/check/libs/audio.c b/tests/check/libs/audio.c index 745a0a61a2..31aa2da5e0 100644 --- a/tests/check/libs/audio.c +++ b/tests/check/libs/audio.c @@ -42,7 +42,7 @@ GST_START_TEST (test_buffer_clipping_time) buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); gst_buffer_take_memory (buf, -1, - gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000)); + gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_TIME); s.start = 4 * GST_SECOND; @@ -72,7 +72,7 @@ GST_START_TEST (test_buffer_clipping_time) buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); gst_buffer_take_memory (buf, -1, - gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000)); + gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_TIME); s.start = 4 * GST_SECOND; @@ -102,7 +102,7 @@ GST_START_TEST (test_buffer_clipping_time) buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); gst_buffer_take_memory (buf, -1, - gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000)); + gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_TIME); s.start = 2 * GST_SECOND; @@ -132,7 +132,7 @@ GST_START_TEST (test_buffer_clipping_time) buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); gst_buffer_take_memory (buf, -1, - gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000)); + gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_TIME); s.start = 12 * GST_SECOND; @@ -151,7 +151,7 @@ GST_START_TEST (test_buffer_clipping_time) buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); gst_buffer_take_memory (buf, -1, - gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000)); + gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_TIME); s.start = 4 * GST_SECOND; @@ -184,7 +184,7 @@ GST_START_TEST (test_buffer_clipping_time) buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); gst_buffer_take_memory (buf, -1, - gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000)); + gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_TIME); s.start = 0 * GST_SECOND; @@ -208,7 +208,7 @@ GST_START_TEST (test_buffer_clipping_time) buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); gst_buffer_take_memory (buf, -1, - gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000)); + gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_PERCENT); s.start = 0; @@ -240,7 +240,7 @@ GST_START_TEST (test_buffer_clipping_samples) buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); gst_buffer_take_memory (buf, -1, - gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000)); + gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_DEFAULT); s.start = 400; @@ -270,7 +270,7 @@ GST_START_TEST (test_buffer_clipping_samples) buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); gst_buffer_take_memory (buf, -1, - gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000)); + gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_DEFAULT); s.start = 400; @@ -300,7 +300,7 @@ GST_START_TEST (test_buffer_clipping_samples) buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); gst_buffer_take_memory (buf, -1, - gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000)); + gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_DEFAULT); s.start = 200; @@ -330,7 +330,7 @@ GST_START_TEST (test_buffer_clipping_samples) buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); gst_buffer_take_memory (buf, -1, - gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000)); + gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_DEFAULT); s.start = 1200; @@ -349,7 +349,7 @@ GST_START_TEST (test_buffer_clipping_samples) buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); gst_buffer_take_memory (buf, -1, - gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000)); + gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_DEFAULT); s.start = 400; @@ -382,7 +382,7 @@ GST_START_TEST (test_buffer_clipping_samples) buf = gst_buffer_new (); data = (guint8 *) g_malloc (1000); gst_buffer_take_memory (buf, -1, - gst_memory_new_wrapped (0, data, g_free, 1000, 0, 1000)); + gst_memory_new_wrapped (0, data, 1000, 0, 1000, data, g_free)); gst_segment_init (&s, GST_FORMAT_DEFAULT); s.start = 0; diff --git a/tests/check/libs/tag.c b/tests/check/libs/tag.c index b03987c6fc..b90857535e 100644 --- a/tests/check/libs/tag.c +++ b/tests/check/libs/tag.c @@ -446,8 +446,9 @@ GST_START_TEST (test_vorbis_tags) buf = gst_buffer_new (); gst_buffer_take_memory (buf, -1, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, - (gpointer) speex_comments_buf1, NULL, - sizeof (speex_comments_buf1), 0, sizeof (speex_comments_buf1))); + (gpointer) speex_comments_buf1, + sizeof (speex_comments_buf1), 0, sizeof (speex_comments_buf1), NULL, + NULL)); /* make sure it doesn't memcmp over the end of the buffer */ fail_unless (gst_tag_list_from_vorbiscomment_buffer (buf, @@ -491,8 +492,9 @@ GST_START_TEST (test_vorbis_tags) buf = gst_buffer_new (); gst_buffer_take_memory (buf, -1, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, - (gpointer) vorbis_comments_buf, NULL, - sizeof (vorbis_comments_buf), 0, sizeof (vorbis_comments_buf))); + (gpointer) vorbis_comments_buf, + sizeof (vorbis_comments_buf), 0, sizeof (vorbis_comments_buf), NULL, + NULL)); /* make sure it doesn't memcmp over the end of the buffer */ fail_unless (gst_tag_list_from_vorbiscomment_buffer (buf, @@ -1046,7 +1048,7 @@ GST_START_TEST (test_xmp_parsing) buf = gst_buffer_new (); len = strlen (text) + 1; gst_buffer_take_memory (buf, -1, - gst_memory_new_wrapped (0, text, NULL, len, 0, len)); + gst_memory_new_wrapped (0, text, len, 0, len, NULL, NULL)); list = gst_tag_list_from_xmp_buffer (buf); if (test_data[i].result_size >= 0) { diff --git a/tests/examples/app/appsrc-ra.c b/tests/examples/app/appsrc-ra.c index deb20ef42a..a33ab0332d 100644 --- a/tests/examples/app/appsrc-ra.c +++ b/tests/examples/app/appsrc-ra.c @@ -85,7 +85,7 @@ feed_data (GstElement * appsrc, guint size, App * app) gst_buffer_take_memory (buffer, -1, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, - app->data, NULL, app->length, app->offset, size)); + app->data, app->length, app->offset, size, NULL, NULL)); /* we need to set an offset for random access */ GST_BUFFER_OFFSET (buffer) = app->offset; diff --git a/tests/examples/app/appsrc-seekable.c b/tests/examples/app/appsrc-seekable.c index 0da6e763d9..24b9ba5089 100644 --- a/tests/examples/app/appsrc-seekable.c +++ b/tests/examples/app/appsrc-seekable.c @@ -91,7 +91,7 @@ feed_data (GstElement * appsrc, guint size, App * app) gst_buffer_take_memory (buffer, -1, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, - app->data, NULL, app->length, app->offset, len)); + app->data, app->length, app->offset, len, NULL, NULL)); GST_DEBUG ("feed buffer %p, offset %" G_GUINT64_FORMAT "-%u", buffer, app->offset, len); diff --git a/tests/examples/app/appsrc-stream.c b/tests/examples/app/appsrc-stream.c index 75ecf77e5e..51398d7e12 100644 --- a/tests/examples/app/appsrc-stream.c +++ b/tests/examples/app/appsrc-stream.c @@ -98,7 +98,7 @@ read_data (App * app) gst_buffer_take_memory (buffer, -1, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, - app->data, NULL, app->length, app->offset, len)); + app->data, app->length, app->offset, len, NULL, NULL)); GST_DEBUG ("feed buffer %p, offset %" G_GUINT64_FORMAT "-%u", buffer, app->offset, len); diff --git a/tests/examples/app/appsrc-stream2.c b/tests/examples/app/appsrc-stream2.c index b92259e9f4..618fd11901 100644 --- a/tests/examples/app/appsrc-stream2.c +++ b/tests/examples/app/appsrc-stream2.c @@ -98,7 +98,7 @@ feed_data (GstElement * appsrc, guint size, App * app) gst_buffer_take_memory (buffer, -1, gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, - app->data, NULL, app->length, app->offset, len)); + app->data, app->length, app->offset, len, NULL, NULL)); GST_DEBUG ("feed buffer %p, offset %" G_GUINT64_FORMAT "-%u", buffer, app->offset, len);