From 6cbb84038589d8b1086ef6c498c0402f13a83ce4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 15 Mar 2012 13:37:36 +0100 Subject: [PATCH] update for memory api changes --- ext/faad/gstfaad.c | 2 +- ext/kate/gstkateenc.c | 2 +- ext/modplug/gstmodplug.cc | 2 +- ext/rtmp/gstrtmpsrc.c | 2 +- gst-libs/gst/signalprocessor/gstsignalprocessor.c | 2 +- gst/dtmf/gstdtmfsrc.c | 3 ++- gst/dtmf/gstrtpdtmfdepay.c | 3 ++- gst/jpegformat/gstjifmux.c | 2 +- gst/mpegdemux/gstpesfilter.c | 2 +- gst/videoparsers/gsth264parse.c | 6 +++--- sys/pvr2d/gstpvrbufferpool.c | 5 +++-- sys/pvr2d/gstpvrbufferpool.h | 3 ++- tests/check/elements/schroenc.c | 2 +- 13 files changed, 20 insertions(+), 16 deletions(-) diff --git a/ext/faad/gstfaad.c b/ext/faad/gstfaad.c index 94ac0a781d..54a14f38e7 100644 --- a/ext/faad/gstfaad.c +++ b/ext/faad/gstfaad.c @@ -755,7 +755,7 @@ init: /* note: info.samples is total samples, not per channel */ /* FIXME, add bufferpool and allocator support to the base class */ - outbuf = gst_buffer_new_allocate (NULL, info.samples * faad->bps, 0); + outbuf = gst_buffer_new_allocate (NULL, info.samples * faad->bps, NULL); gst_buffer_fill (outbuf, 0, out, info.samples * faad->bps); gst_audio_buffer_reorder_channels (outbuf, GST_AUDIO_FORMAT_S16, faad->channels, faad->aac_positions, faad->gst_positions); diff --git a/ext/kate/gstkateenc.c b/ext/kate/gstkateenc.c index db365691c2..1e03c35993 100644 --- a/ext/kate/gstkateenc.c +++ b/ext/kate/gstkateenc.c @@ -391,7 +391,7 @@ gst_kate_enc_create_buffer (GstKateEnc * ke, kate_packet * kp, g_return_val_if_fail (kp != NULL, NULL); g_return_val_if_fail (kp->data != NULL, NULL); - buffer = gst_buffer_new_allocate (NULL, kp->nbytes, 0); + buffer = gst_buffer_new_allocate (NULL, kp->nbytes, NULL); if (G_UNLIKELY (!buffer)) { GST_WARNING_OBJECT (ke, "Failed to allocate buffer for %u bytes", (guint) kp->nbytes); diff --git a/ext/modplug/gstmodplug.cc b/ext/modplug/gstmodplug.cc index 5e1d176fe0..d849a44e12 100644 --- a/ext/modplug/gstmodplug.cc +++ b/ext/modplug/gstmodplug.cc @@ -722,7 +722,7 @@ gst_modplug_loop (GstModPlug * modplug) } /* read and output a buffer */ - out = gst_buffer_new_allocate (NULL, modplug->read_bytes, 0); + out = gst_buffer_new_allocate (NULL, modplug->read_bytes, NULL); gst_buffer_map (out, &map, GST_MAP_WRITE); if (!modplug->mSoundFile->Read (map.data, modplug->read_bytes)) { diff --git a/ext/rtmp/gstrtmpsrc.c b/ext/rtmp/gstrtmpsrc.c index 0103cad5ef..be94bae7d1 100644 --- a/ext/rtmp/gstrtmpsrc.c +++ b/ext/rtmp/gstrtmpsrc.c @@ -316,7 +316,7 @@ gst_rtmp_src_create (GstPushSrc * pushsrc, GstBuffer ** buffer) GST_DEBUG ("reading from %" G_GUINT64_FORMAT ", size %u", src->cur_offset, size); - buf = gst_buffer_new_allocate (NULL, size, 0); + buf = gst_buffer_new_allocate (NULL, size, NULL); if (G_UNLIKELY (buf == NULL)) { GST_ERROR_OBJECT (src, "Failed to allocate %u bytes", size); return GST_FLOW_ERROR; diff --git a/gst-libs/gst/signalprocessor/gstsignalprocessor.c b/gst-libs/gst/signalprocessor/gstsignalprocessor.c index 2e3290df27..380b2f5405 100644 --- a/gst-libs/gst/signalprocessor/gstsignalprocessor.c +++ b/gst-libs/gst/signalprocessor/gstsignalprocessor.c @@ -740,7 +740,7 @@ gst_signal_processor_prepare (GstSignalProcessor * self, guint nframes) srcpad->pen = gst_buffer_new_allocate (NULL, - samples_avail * srcpad->channels * sizeof (gfloat), 0); + samples_avail * srcpad->channels * sizeof (gfloat), NULL); if (srcpad->channels > 1) { GstSignalProcessorGroup *group = &self->group_out[out_group_index++]; diff --git a/gst/dtmf/gstdtmfsrc.c b/gst/dtmf/gstdtmfsrc.c index b3f24ffda1..60bc8a5e92 100644 --- a/gst/dtmf/gstdtmfsrc.c +++ b/gst/dtmf/gstdtmfsrc.c @@ -547,11 +547,12 @@ gst_dtmf_src_generate_tone (GstDTMFSrcEvent * event, DTMF_KEY key, double i = 0; double amplitude, f1, f2; double volume_factor; + static GstAllocationParams params = { 0, 0, 0, 1, }; /* Create a buffer for the tone */ tone_size = ((duration / 1000) * sample_rate * SAMPLE_SIZE * CHANNELS) / 8; - buffer = gst_buffer_new_allocate (NULL, tone_size, 1); + buffer = gst_buffer_new_allocate (NULL, tone_size, ¶ms); gst_buffer_map (buffer, &map, GST_MAP_READWRITE); p = (gint16 *) map.data; diff --git a/gst/dtmf/gstrtpdtmfdepay.c b/gst/dtmf/gstrtpdtmfdepay.c index db4d6fb324..0dda885013 100644 --- a/gst/dtmf/gstrtpdtmfdepay.c +++ b/gst/dtmf/gstrtpdtmfdepay.c @@ -342,12 +342,13 @@ gst_dtmf_src_generate_tone (GstRtpDTMFDepay * rtpdtmfdepay, guint32 clock_rate = 8000 /* default */ ; GstRTPBaseDepayload *depayload = GST_RTP_BASE_DEPAYLOAD (rtpdtmfdepay); gint volume; + static GstAllocationParams params = { 0, 0, 0, 1, }; clock_rate = depayload->clock_rate; /* Create a buffer for the tone */ tone_size = (payload.duration * SAMPLE_SIZE * CHANNELS) / 8; - buf = gst_buffer_new_allocate (NULL, tone_size, 1); + buf = gst_buffer_new_allocate (NULL, tone_size, ¶ms); GST_BUFFER_DURATION (buf) = payload.duration * GST_SECOND / clock_rate; volume = payload.volume; diff --git a/gst/jpegformat/gstjifmux.c b/gst/jpegformat/gstjifmux.c index b9552b18ac..82cd18a4ea 100644 --- a/gst/jpegformat/gstjifmux.c +++ b/gst/jpegformat/gstjifmux.c @@ -670,7 +670,7 @@ gst_jif_mux_recombine_image (GstJifMux * self, GstBuffer ** new_buf, gst_buffer_get_size (old_buf), size); /* allocate new buffer */ - buf = gst_buffer_new_allocate (NULL, size, 0); + buf = gst_buffer_new_allocate (NULL, size, NULL); /* copy buffer metadata */ gst_buffer_copy_into (buf, old_buf, diff --git a/gst/mpegdemux/gstpesfilter.c b/gst/mpegdemux/gstpesfilter.c index abf5e57581..f728e4b9c6 100644 --- a/gst/mpegdemux/gstpesfilter.c +++ b/gst/mpegdemux/gstpesfilter.c @@ -472,7 +472,7 @@ push_out: } if (datalen > 0) { - out = gst_buffer_new_allocate (NULL, datalen, 0); + out = gst_buffer_new_allocate (NULL, datalen, NULL); gst_buffer_fill (out, 0, data, datalen); ret = gst_pes_filter_data_push (filter, TRUE, out); filter->first = FALSE; diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c index 58264d59e8..420394f690 100644 --- a/gst/videoparsers/gsth264parse.c +++ b/gst/videoparsers/gsth264parse.c @@ -375,7 +375,7 @@ gst_h264_parse_wrap_nal (GstH264Parse * h264parse, guint format, guint8 * data, GST_DEBUG_OBJECT (h264parse, "nal length %d", size); - buf = gst_buffer_new_allocate (NULL, nl + size, 0); + buf = gst_buffer_new_allocate (NULL, nl + size, NULL); if (format == GST_H264_PARSE_FORMAT_AVC) { tmp = GUINT32_TO_BE (size << (32 - 8 * nl)); } else { @@ -415,7 +415,7 @@ gst_h264_parser_store_nal (GstH264Parse * h264parse, guint id, return; } - buf = gst_buffer_new_allocate (NULL, size, 0); + buf = gst_buffer_new_allocate (NULL, size, NULL); gst_buffer_fill (buf, 0, nalu->data + nalu->offset, size); if (store[id]) @@ -953,7 +953,7 @@ gst_h264_parse_make_codec_data (GstH264Parse * h264parse) if (!found || !num_pps) return NULL; - buf = gst_buffer_new_allocate (NULL, 5 + 1 + sps_size + 1 + pps_size, 0); + buf = gst_buffer_new_allocate (NULL, 5 + 1 + sps_size + 1 + pps_size, NULL); gst_buffer_map (buf, &map, GST_MAP_WRITE); data = map.data; diff --git a/sys/pvr2d/gstpvrbufferpool.c b/sys/pvr2d/gstpvrbufferpool.c index 7c269dbd3f..03e229c334 100644 --- a/sys/pvr2d/gstpvrbufferpool.c +++ b/sys/pvr2d/gstpvrbufferpool.c @@ -186,7 +186,8 @@ pvr_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config) pvrpool->caps = gst_caps_copy (caps); pvrpool->info = info; pvrpool->size = size; - pvrpool->align = align; + gst_allocation_params_init (&pvrpool->params); + pvrpool->params.align = align; pvrpool->padded_width = GST_VIDEO_INFO_WIDTH (&info); pvrpool->padded_height = GST_VIDEO_INFO_HEIGHT (&info); @@ -259,7 +260,7 @@ pvr_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer, info = &pvrpool->info; - pvr = gst_buffer_new_allocate (NULL, pvrpool->size, pvrpool->align); + pvr = gst_buffer_new_allocate (NULL, pvrpool->size, &pvrpool->params); meta = gst_buffer_add_pvr_meta (pvr, pvrpool->pvrsink); if (meta == NULL) { gst_buffer_unref (pvr); diff --git a/sys/pvr2d/gstpvrbufferpool.h b/sys/pvr2d/gstpvrbufferpool.h index c34504d7f9..b749b7cf89 100644 --- a/sys/pvr2d/gstpvrbufferpool.h +++ b/sys/pvr2d/gstpvrbufferpool.h @@ -60,7 +60,8 @@ struct _GstPVRBufferPool /* output (padded) size including any codec padding: */ gint padded_width, padded_height; - guint size, align; + guint size; + GstAllocationParams params; GstElement *pvrsink; diff --git a/tests/check/elements/schroenc.c b/tests/check/elements/schroenc.c index 463447b6a4..00afa1831e 100644 --- a/tests/check/elements/schroenc.c +++ b/tests/check/elements/schroenc.c @@ -112,7 +112,7 @@ GST_START_TEST (test_encode_simple) fail_unless (gst_pad_push_event (srcpad, gst_event_new_segment (&seg))); - buffer = gst_buffer_new_allocate (NULL, 320 * 240 + 2 * 160 * 120, 0); + buffer = gst_buffer_new_allocate (NULL, 320 * 240 + 2 * 160 * 120, NULL); gst_buffer_memset (buffer, 0, 0, -1); for (i = 0; i < 20; i++) { -- 2.34.1