summaryrefslogtreecommitdiff
path: root/gst/adpcmdec
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-01-26 23:28:28 +0100
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-01-26 23:28:28 +0100
commit498e4df9d9d6bb0643b0669dbfb013944645cbf9 (patch)
tree066428fef4308fa959112fa93a7738860f3f5a41 /gst/adpcmdec
parent936bee00f49673764b54372a38fcfe42e0cfbed7 (diff)
adpcmdec: port to 0.11
Diffstat (limited to 'gst/adpcmdec')
-rw-r--r--gst/adpcmdec/adpcmdec.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/gst/adpcmdec/adpcmdec.c b/gst/adpcmdec/adpcmdec.c
index 3e22b51f6..3f5824c7b 100644
--- a/gst/adpcmdec/adpcmdec.c
+++ b/gst/adpcmdec/adpcmdec.c
@@ -336,6 +336,7 @@ adpcmdec_decode_block (ADPCMDec * dec, const guint8 * data, int blocksize)
GstBuffer *outbuf = NULL;
int outsize;
int samples;
+ GstMapInfo omap;
if (dec->layout == LAYOUT_ADPCM_MICROSOFT) {
/* Each block has a 3 byte header per channel, plus 4 bytes per channel to
@@ -347,8 +348,9 @@ adpcmdec_decode_block (ADPCMDec * dec, const guint8 * data, int blocksize)
outsize = 2 * samples;
outbuf = gst_buffer_new_and_alloc (outsize);
- res = adpcmdec_decode_ms_block (dec, samples, data,
- (gint16 *) (GST_BUFFER_DATA (outbuf)));
+ gst_buffer_map (outbuf, &omap, GST_MAP_WRITE);
+ res = adpcmdec_decode_ms_block (dec, samples, data, (gint16 *) omap.data);
+ gst_buffer_unmap (outbuf, &omap);
} else if (dec->layout == LAYOUT_ADPCM_DVI) {
/* Each block has a 4 byte header per channel, include an initial sample.
Then the remainder gives two samples per byte */
@@ -358,8 +360,9 @@ adpcmdec_decode_block (ADPCMDec * dec, const guint8 * data, int blocksize)
outsize = 2 * samples;
outbuf = gst_buffer_new_and_alloc (outsize);
- res = adpcmdec_decode_ima_block (dec, samples, data,
- (gint16 *) (GST_BUFFER_DATA (outbuf)));
+ gst_buffer_map (outbuf, &omap, GST_MAP_WRITE);
+ res = adpcmdec_decode_ima_block (dec, samples, data, (gint16 *) omap.data);
+ gst_buffer_unmap (outbuf, &omap);
} else {
GST_WARNING_OBJECT (dec, "Unknown layout");
}
@@ -394,7 +397,7 @@ adpcmdec_parse (GstAudioDecoder * bdec, GstAdapter * adapter,
*offset = 0;
*length = dec->blocksize;
} else {
- return GST_FLOW_UNEXPECTED;
+ return GST_FLOW_EOS;
}
}
@@ -406,7 +409,7 @@ adpcmdec_handle_frame (GstAudioDecoder * bdec, GstBuffer * buffer)
{
ADPCMDec *dec = (ADPCMDec *) (bdec);
GstFlowReturn ret = GST_FLOW_OK;
- guint8 *data;
+ GstMapInfo map;
GstBuffer *outbuf = NULL;
/* no fancy draining */
@@ -416,8 +419,9 @@ adpcmdec_handle_frame (GstAudioDecoder * bdec, GstBuffer * buffer)
if (!dec->blocksize)
return GST_FLOW_NOT_NEGOTIATED;
- data = GST_BUFFER_DATA (buffer);
- outbuf = adpcmdec_decode_block (dec, data, dec->blocksize);
+ gst_buffer_map (buffer, &map, GST_MAP_READ);
+ outbuf = adpcmdec_decode_block (dec, map.data, dec->blocksize);
+ gst_buffer_unmap (buffer, &map);
if (outbuf == NULL) {
GST_AUDIO_DECODER_ERROR (bdec, 1, STREAM, DECODE, (NULL),