From df5253b22c5a423ecade22ea8aa9d46186e2f87a Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 15 Mar 2012 13:32:08 +0100 Subject: [PATCH] update for memory api changes --- ext/vorbis/gstvorbisdec.c | 2 +- gst-libs/gst/rtp/gstrtpbuffer.c | 2 +- gst-libs/gst/video/gstvideopool.c | 23 ++++++++--------------- gst/gdp/dataprotocol.c | 2 +- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/ext/vorbis/gstvorbisdec.c b/ext/vorbis/gstvorbisdec.c index 7a301904ea..b5bcc58276 100644 --- a/ext/vorbis/gstvorbisdec.c +++ b/ext/vorbis/gstvorbisdec.c @@ -478,7 +478,7 @@ vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet, sample_count, size); /* alloc buffer for it */ - out = gst_buffer_new_allocate (NULL, size, 0); + out = gst_buffer_new_allocate (NULL, size, NULL); gst_buffer_map (out, &map, GST_MAP_WRITE); /* get samples ready for reading now, should be sample_count */ diff --git a/gst-libs/gst/rtp/gstrtpbuffer.c b/gst-libs/gst/rtp/gstrtpbuffer.c index 16d0515da6..cc7bef7ad2 100644 --- a/gst-libs/gst/rtp/gstrtpbuffer.c +++ b/gst-libs/gst/rtp/gstrtpbuffer.c @@ -109,7 +109,7 @@ gst_rtp_buffer_allocate_data (GstBuffer * buffer, guint payload_len, len = GST_RTP_HEADER_LEN + csrc_count * sizeof (guint32) + payload_len + pad_len; - mem = gst_allocator_alloc (NULL, 0, len, 0, len, 0); + mem = gst_allocator_alloc (NULL, len, NULL); gst_memory_map (mem, &map, GST_MAP_WRITE); /* fill in defaults */ diff --git a/gst-libs/gst/video/gstvideopool.c b/gst-libs/gst/video/gstvideopool.c index e9fbb5a10b..c547a801e9 100644 --- a/gst-libs/gst/video/gstvideopool.c +++ b/gst-libs/gst/video/gstvideopool.c @@ -144,9 +144,7 @@ struct _GstVideoBufferPoolPrivate GstVideoAlignment video_align; gboolean add_videometa; gboolean need_alignment; - guint prefix; - guint padding; - guint align; + GstAllocationParams params; }; static void gst_video_buffer_pool_finalize (GObject * object); @@ -195,9 +193,10 @@ video_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config) if (priv->caps) gst_caps_unref (priv->caps); priv->caps = gst_caps_copy (caps); - priv->prefix = prefix; - priv->padding = padding; - priv->align = align; + gst_allocation_params_init (&priv->params); + priv->params.prefix = prefix; + priv->params.padding = padding; + priv->params.align = align; /* enable metadata based on config of the pool */ priv->add_videometa = @@ -243,22 +242,16 @@ video_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer, GstVideoBufferPool *vpool = GST_VIDEO_BUFFER_POOL_CAST (pool); GstVideoBufferPoolPrivate *priv = vpool->priv; GstVideoInfo *info; - GstMemory *mem; - gint maxsize; info = &priv->info; GST_DEBUG_OBJECT (pool, "alloc %" G_GSIZE_FORMAT, info->size); - maxsize = info->size + priv->prefix + priv->padding; - mem = gst_allocator_alloc (priv->allocator, 0, maxsize, priv->prefix, - info->size, priv->align); - if (mem == NULL) + *buffer = + gst_buffer_new_allocate (priv->allocator, info->size, &priv->params); + if (*buffer == NULL) goto no_memory; - *buffer = gst_buffer_new (); - gst_buffer_take_memory (*buffer, -1, mem); - if (priv->add_videometa) { GST_DEBUG_OBJECT (pool, "adding GstVideoMeta"); diff --git a/gst/gdp/dataprotocol.c b/gst/gdp/dataprotocol.c index c85952ad53..c602ba2baf 100644 --- a/gst/gdp/dataprotocol.c +++ b/gst/gdp/dataprotocol.c @@ -459,7 +459,7 @@ gst_dp_buffer_from_header (guint header_length, const guint8 * header) buffer = gst_buffer_new_allocate (NULL, - (guint) GST_DP_HEADER_PAYLOAD_LENGTH (header), 0); + (guint) GST_DP_HEADER_PAYLOAD_LENGTH (header), NULL); GST_BUFFER_TIMESTAMP (buffer) = GST_DP_HEADER_TIMESTAMP (header); GST_BUFFER_DURATION (buffer) = GST_DP_HEADER_DURATION (header);