diff options
author | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | 2012-01-25 18:49:58 +0100 |
---|---|---|
committer | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | 2012-01-25 18:50:40 +0100 |
commit | 12ee41829c4e1d350adeb898c721724550620260 (patch) | |
tree | fa2f03da024198b1207562f09e82c96f2858ac8b /ext/voamrwbenc | |
parent | 7aead77649ed8c1531d4e969651452dcb40f8c70 (diff) | |
download | gstreamer-plugins-bad-12ee41829c4e1d350adeb898c721724550620260.tar.gz |
port some more to new memory API
Fixes #668677.
Diffstat (limited to 'ext/voamrwbenc')
-rw-r--r-- | ext/voamrwbenc/gstvoamrwbenc.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ext/voamrwbenc/gstvoamrwbenc.c b/ext/voamrwbenc/gstvoamrwbenc.c index 0721c87f1..304ef1d3e 100644 --- a/ext/voamrwbenc/gstvoamrwbenc.c +++ b/ext/voamrwbenc/gstvoamrwbenc.c @@ -268,8 +268,7 @@ gst_voamrwbenc_handle_frame (GstAudioEncoder * benc, GstBuffer * buffer) const int buffer_size = sizeof (short) * L_FRAME16k; GstBuffer *out; gint outsize; - gsize size; - guint8 *data, *outdata; + GstMapInfo map, omap; amrwbenc = GST_VOAMRWBENC (benc); @@ -281,24 +280,25 @@ gst_voamrwbenc_handle_frame (GstAudioEncoder * benc, GstBuffer * buffer) goto done; } - data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ); + gst_buffer_map (buffer, &map, GST_MAP_READ); - if (G_UNLIKELY (size < buffer_size)) { - GST_DEBUG_OBJECT (amrwbenc, "discarding trailing data %d", (gint) size); - gst_buffer_unmap (buffer, data, -1); + if (G_UNLIKELY (map.size < buffer_size)) { + GST_DEBUG_OBJECT (amrwbenc, "discarding trailing data %d", (gint) map.size); + gst_buffer_unmap (buffer, &map); ret = gst_audio_encoder_finish_frame (benc, NULL, -1); goto done; } out = gst_buffer_new_and_alloc (buffer_size); - outdata = gst_buffer_map (out, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (out, &omap, GST_MAP_WRITE); /* encode */ outsize = E_IF_encode (amrwbenc->handle, amrwbenc->bandmode, - (const short *) data, (unsigned char *) outdata, 0); + (const short *) map.data, (unsigned char *) omap.data, 0); GST_LOG_OBJECT (amrwbenc, "encoded to %d bytes", outsize); - gst_buffer_unmap (out, outdata, outsize); - gst_buffer_unmap (buffer, data, -1); + gst_buffer_unmap (out, &omap); + gst_buffer_unmap (buffer, &map); + gst_buffer_resize (out, 0, outsize); ret = gst_audio_encoder_finish_frame (benc, out, L_FRAME16k); |