summaryrefslogtreecommitdiff
path: root/libavcodec/g723_1.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-13 11:59:51 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-13 11:59:51 +0100
commitd88e674a15dc23ca6bb68173dbb7c12e5d668bb5 (patch)
tree0a7d58e61ea7e3e3e692731f7a4e1e119f197689 /libavcodec/g723_1.c
parent0a5138695aa441ab341b2f00d946c239db69edbf (diff)
parentcb7b47a61dba0b9329ecede5dd3211dc0662dc05 (diff)
Merge commit 'cb7b47a61dba0b9329ecede5dd3211dc0662dc05'
* commit 'cb7b47a61dba0b9329ecede5dd3211dc0662dc05': g726: decode directly to the user-provided AVFrame g723.1: decode directly to the user-provided AVFrame g722: decode directly to the user-provided AVFrame flac: decode directly to the user-provided AVFrame cinaudio: decode directly to the user-provided AVFrame Conflicts: libavcodec/g723_1.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/g723_1.c')
-rw-r--r--libavcodec/g723_1.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c
index c2e86d96d3..1af29921c2 100644
--- a/libavcodec/g723_1.c
+++ b/libavcodec/g723_1.c
@@ -42,7 +42,6 @@
typedef struct g723_1_context {
AVClass *class;
- AVFrame frame;
G723_1_Subframe subframe[4];
enum FrameType cur_frame_type;
@@ -93,9 +92,6 @@ static av_cold int g723_1_decode_init(AVCodecContext *avctx)
avctx->channels = 1;
p->pf_gain = 1 << 12;
- avcodec_get_frame_defaults(&p->frame);
- avctx->coded_frame = &p->frame;
-
memcpy(p->prev_lsp, dc_lsp, LPC_ORDER * sizeof(*p->prev_lsp));
memcpy(p->sid_lsp, dc_lsp, LPC_ORDER * sizeof(*p->sid_lsp));
@@ -1158,6 +1154,7 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
G723_1_Context *p = avctx->priv_data;
+ AVFrame *frame = data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
int dec_mode = buf[0] & 3;
@@ -1187,13 +1184,13 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
p->cur_frame_type = UNTRANSMITTED_FRAME;
}
- p->frame.nb_samples = FRAME_LEN;
- if ((ret = ff_get_buffer(avctx, &p->frame)) < 0) {
+ frame->nb_samples = FRAME_LEN;
+ if ((ret = ff_get_buffer(avctx, frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- out = (int16_t *)p->frame.data[0];
+ out = (int16_t *)frame->data[0];
if (p->cur_frame_type == ACTIVE_FRAME) {
if (!bad_frame)
@@ -1264,7 +1261,7 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
(FRAME_LEN + PITCH_MAX) * sizeof(*p->excitation));
memset(p->prev_excitation, 0,
PITCH_MAX * sizeof(*p->excitation));
- memset(p->frame.data[0], 0,
+ memset(frame->data[0], 0,
(FRAME_LEN + LPC_ORDER) * sizeof(int16_t));
} else {
int16_t *buf = p->audio + LPC_ORDER;
@@ -1313,8 +1310,7 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
out[i] = av_clip_int16(p->audio[LPC_ORDER + i] << 1);
}
- *got_frame_ptr = 1;
- *(AVFrame *)data = p->frame;
+ *got_frame_ptr = 1;
return frame_size[dec_mode];
}