mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
update for new memory api
This commit is contained in:
parent
df11b1a5d1
commit
63f3f27164
16 changed files with 49 additions and 43 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue