summaryrefslogtreecommitdiff
path: root/libavcodec/mpc8.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-03 02:08:55 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-03 03:00:30 +0100
commite4de71677f3adeac0f74b89ac8df5d417364df2c (patch)
tree4792dd8d85d24f0f4eaddabb65f6044727907daa /libavcodec/mpc8.c
parent12804348f5babf56a315fa01751eea1ffdddf98a (diff)
parentd268b79e3436107c11ee8bcdf9f3645368bb3fcd (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: aac_latm: reconfigure decoder on audio specific config changes latmdec: fix audio specific config parsing Add avcodec_decode_audio4(). avcodec: change number of plane pointers from 4 to 8 at next major bump. Update developers documentation with coding conventions. svq1dec: avoid undefined get_bits(0) call ARM: h264dsp_neon cosmetics ARM: make some NEON macros reusable Do not memcpy raw video frames when using null muxer fate: update asf seektest vp8: flush buffers on size changes. doc: improve general documentation for MacOSX asf: use packet dts as approximation of pts asf: do not call av_read_frame rtsp: Initialize the media_type_mask in the rtp guessing demuxer Cleaned up alacenc.c Conflicts: doc/APIchanges doc/developer.texi libavcodec/8svx.c libavcodec/aacdec.c libavcodec/ac3dec.c libavcodec/avcodec.h libavcodec/nellymoserdec.c libavcodec/tta.c libavcodec/utils.c libavcodec/version.h libavcodec/wmadec.c libavformat/asfdec.c tests/ref/seek/lavf_asf Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpc8.c')
-rw-r--r--libavcodec/mpc8.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c
index 2f6bde3231..a4750ad961 100644
--- a/libavcodec/mpc8.c
+++ b/libavcodec/mpc8.c
@@ -230,12 +230,15 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx)
&mpc8_q8_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
}
vlc_initialized = 1;
+
+ avcodec_get_frame_defaults(&c->frame);
+ avctx->coded_frame = &c->frame;
+
return 0;
}
-static int mpc8_decode_frame(AVCodecContext * avctx,
- void *data, int *data_size,
- AVPacket *avpkt)
+static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
+ int *got_frame_ptr, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
@@ -243,14 +246,15 @@ static int mpc8_decode_frame(AVCodecContext * avctx,
GetBitContext gb2, *gb = &gb2;
int i, j, k, ch, cnt, res, t;
Band *bands = c->bands;
- int off, out_size;
+ int off;
int maxband, keyframe;
int last[2];
- out_size = MPC_FRAME_SIZE * 2 * avctx->channels;
- if (*data_size < out_size) {
- av_log(avctx, AV_LOG_ERROR, "Output buffer is too small\n");
- return AVERROR(EINVAL);
+ /* get output buffer */
+ c->frame.nb_samples = MPC_FRAME_SIZE;
+ if ((res = avctx->get_buffer(avctx, &c->frame)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return res;
}
keyframe = c->cur_frame == 0;
@@ -403,14 +407,16 @@ static int mpc8_decode_frame(AVCodecContext * avctx,
}
}
- ff_mpc_dequantize_and_synth(c, maxband, data, avctx->channels);
+ ff_mpc_dequantize_and_synth(c, maxband, c->frame.data[0], avctx->channels);
c->cur_frame++;
c->last_bits_used = get_bits_count(gb);
if(c->cur_frame >= c->frames)
c->cur_frame = 0;
- *data_size = out_size;
+
+ *got_frame_ptr = 1;
+ *(AVFrame *)data = c->frame;
return c->cur_frame ? c->last_bits_used >> 3 : buf_size;
}
@@ -422,5 +428,6 @@ AVCodec ff_mpc8_decoder = {
.priv_data_size = sizeof(MPCContext),
.init = mpc8_decode_init,
.decode = mpc8_decode_frame,
+ .capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Musepack SV8"),
};