summaryrefslogtreecommitdiff
path: root/libavcodec/gsmdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-13 12:05:00 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-13 12:05:00 +0100
commit5459cf411412c7a1d2da7ce6a6955c7d57490a55 (patch)
tree18117251ae2ca34fd6895998f9699ef09855427a /libavcodec/gsmdec.c
parentd88e674a15dc23ca6bb68173dbb7c12e5d668bb5 (diff)
parenta8ea936a0a00570f61a16a588821b52f6a3115c2 (diff)
Merge commit 'a8ea936a0a00570f61a16a588821b52f6a3115c2'
* commit 'a8ea936a0a00570f61a16a588821b52f6a3115c2': libilbc: decode directly to the user-provided AVFrame dpcm: decode directly to the user-provided AVFrame imc/iac: decode directly to the user-provided AVFrame gsm: decode directly to the user-provided AVFrame Conflicts: libavcodec/dpcm.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/gsmdec.c')
-rw-r--r--libavcodec/gsmdec.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/libavcodec/gsmdec.c b/libavcodec/gsmdec.c
index 71127c71a1..f20ef9a20e 100644
--- a/libavcodec/gsmdec.c
+++ b/libavcodec/gsmdec.c
@@ -34,8 +34,6 @@
static av_cold int gsm_init(AVCodecContext *avctx)
{
- GSMContext *s = avctx->priv_data;
-
avctx->channels = 1;
avctx->channel_layout = AV_CH_LAYOUT_MONO;
if (!avctx->sample_rate)
@@ -52,16 +50,13 @@ static av_cold int gsm_init(AVCodecContext *avctx)
avctx->block_align = GSM_MS_BLOCK_SIZE;
}
- avcodec_get_frame_defaults(&s->frame);
- avctx->coded_frame = &s->frame;
-
return 0;
}
static int gsm_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
- GSMContext *s = avctx->priv_data;
+ AVFrame *frame = data;
int res;
GetBitContext gb;
const uint8_t *buf = avpkt->data;
@@ -74,12 +69,12 @@ static int gsm_decode_frame(AVCodecContext *avctx, void *data,
}
/* get output buffer */
- s->frame.nb_samples = avctx->frame_size;
- if ((res = ff_get_buffer(avctx, &s->frame)) < 0) {
+ frame->nb_samples = avctx->frame_size;
+ if ((res = ff_get_buffer(avctx, frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return res;
}
- samples = (int16_t *)s->frame.data[0];
+ samples = (int16_t *)frame->data[0];
switch (avctx->codec_id) {
case AV_CODEC_ID_GSM:
@@ -96,8 +91,7 @@ static int gsm_decode_frame(AVCodecContext *avctx, void *data,
return res;
}
- *got_frame_ptr = 1;
- *(AVFrame *)data = s->frame;
+ *got_frame_ptr = 1;
return avctx->block_align;
}