From ee2aa25e0499a7cd295aa384b2881212820ecba7 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 3 Aug 2011 18:37:27 +0200 Subject: [PATCH] port to new API --- ext/pulse/pulsesink.c | 18 ++++++++++++++---- gst/audioparsers/gstac3parse.c | 3 +-- gst/rtp/gstrtph264depay.c | 3 ++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c index 7dbd3a4e1f..a96b3880da 100644 --- a/ext/pulse/pulsesink.c +++ b/ext/pulse/pulsesink.c @@ -1822,20 +1822,30 @@ gst_pulsesink_payload (GstBaseAudioSink * sink, GstBuffer * buf) /* FIXME: alloc memory from PA if possible */ gint framesize = gst_audio_iec61937_frame_size (&sink->ringbuffer->spec); GstBuffer *out; + guint8 *indata, *outdata; + gsize insize, outsize; + gboolean res; if (framesize <= 0) return NULL; out = gst_buffer_new_and_alloc (framesize); - if (!gst_audio_iec61937_payload (GST_BUFFER_DATA (buf), - GST_BUFFER_SIZE (buf), GST_BUFFER_DATA (out), - GST_BUFFER_SIZE (out), &sink->ringbuffer->spec)) { + indata = gst_buffer_map (buf, &insize, NULL, GST_MAP_READ); + outdata = gst_buffer_map (out, &outsize, NULL, GST_MAP_WRITE); + + res = gst_audio_iec61937_payload (indata, insize, + outdata, outsize, &sink->ringbuffer->spec); + + gst_buffer_unmap (buf, indata, insize); + gst_buffer_unmap (out, outdata, outsize); + + if (!res) { gst_buffer_unref (out); return NULL; } - gst_buffer_copy_metadata (out, buf, GST_BUFFER_COPY_ALL); + gst_buffer_copy_into (out, buf, GST_BUFFER_COPY_METADATA, 0, -1); return out; } diff --git a/gst/audioparsers/gstac3parse.c b/gst/audioparsers/gstac3parse.c index aa9156ec49..aa3351f49b 100644 --- a/gst/audioparsers/gstac3parse.c +++ b/gst/audioparsers/gstac3parse.c @@ -553,8 +553,7 @@ gst_ac3_parse_check_valid_frame (GstBaseParse * parse, do { *framesize += frmsiz; - if (!gst_byte_reader_skip (&reader, frmsiz) || - GST_BUFFER_SIZE (buf) < (*framesize + 6)) { + if (!gst_byte_reader_skip (&reader, frmsiz) || size < (*framesize + 6)) { more = TRUE; break; } diff --git a/gst/rtp/gstrtph264depay.c b/gst/rtp/gstrtph264depay.c index 884d1f97c1..35078f94d8 100644 --- a/gst/rtp/gstrtph264depay.c +++ b/gst/rtp/gstrtph264depay.c @@ -609,7 +609,7 @@ gst_rtp_h264_push_fragmentation_unit (GstRtpH264Depay * rtph264depay) outsize = gst_adapter_available (rtph264depay->adapter); outbuf = gst_adapter_take_buffer (rtph264depay->adapter, outsize); - outdata = GST_BUFFER_DATA (outbuf); + outdata = gst_buffer_map (outbuf, NULL, NULL, GST_MAP_WRITE); GST_DEBUG_OBJECT (rtph264depay, "output %d bytes", outsize); @@ -622,6 +622,7 @@ gst_rtp_h264_push_fragmentation_unit (GstRtpH264Depay * rtph264depay) outdata[2] = (outsize >> 8); outdata[3] = (outsize); } + gst_buffer_unmap (outbuf, outdata, -1); gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, rtph264depay->fu_timestamp, rtph264depay->fu_marker);