diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-02-13 12:14:46 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-02-13 12:14:46 +0100 |
commit | afe30fe0600824b0dcda8318f09a5a4e376b99c3 (patch) | |
tree | 06921b98421767cea958eed3943b10fb71e4997d /libavcodec/libopencore-amr.c | |
parent | 5459cf411412c7a1d2da7ce6a6955c7d57490a55 (diff) | |
parent | 86bfcfcf2364bc837b7bb582c66a8a15a332414f (diff) | |
download | ffmpeg-afe30fe0600824b0dcda8318f09a5a4e376b99c3.tar.gz |
Merge commit '86bfcfcf2364bc837b7bb582c66a8a15a332414f'
* commit '86bfcfcf2364bc837b7bb582c66a8a15a332414f':
mace: decode directly to the user-provided AVFrame
libspeex: decode directly to the user-provided AVFrame
libopus: decode directly to the user-provided AVFrame
libopencore-amr: decode directly to the user-provided AVFrame
libgsm: decode directly to the user-provided AVFrame
Conflicts:
libavcodec/libopusdec.c
libavcodec/mace.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libopencore-amr.c')
-rw-r--r-- | libavcodec/libopencore-amr.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index 0d78035e27..b53a3455cb 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -87,7 +87,6 @@ static int get_bitrate_mode(int bitrate, void *log_ctx) typedef struct AMRContext { AVClass *av_class; - AVFrame frame; void *dec_state; void *enc_state; int enc_bitrate; @@ -120,9 +119,6 @@ static av_cold int amr_nb_decode_init(AVCodecContext *avctx) return -1; } - avcodec_get_frame_defaults(&s->frame); - avctx->coded_frame = &s->frame; - return 0; } @@ -138,6 +134,7 @@ static av_cold int amr_nb_decode_close(AVCodecContext *avctx) static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { + AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AMRContext *s = avctx->priv_data; @@ -149,8 +146,8 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, buf, buf_size, avctx->frame_number); /* get output buffer */ - s->frame.nb_samples = 160; - if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { + frame->nb_samples = 160; + if ((ret = ff_get_buffer(avctx, frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } @@ -167,10 +164,9 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, av_dlog(avctx, "packet_size=%d buf= 0x%X %X %X %X\n", packet_size, buf[0], buf[1], buf[2], buf[3]); /* call decoder */ - Decoder_Interface_Decode(s->dec_state, buf, (short *)s->frame.data[0], 0); + Decoder_Interface_Decode(s->dec_state, buf, (short *)frame->data[0], 0); - *got_frame_ptr = 1; - *(AVFrame *)data = s->frame; + *got_frame_ptr = 1; return packet_size; } @@ -314,7 +310,6 @@ AVCodec ff_libopencore_amrnb_encoder = { #include <opencore-amrwb/if_rom.h> typedef struct AMRWBContext { - AVFrame frame; void *state; } AMRWBContext; @@ -328,15 +323,13 @@ static av_cold int amr_wb_decode_init(AVCodecContext *avctx) s->state = D_IF_init(); - avcodec_get_frame_defaults(&s->frame); - avctx->coded_frame = &s->frame; - return 0; } static int amr_wb_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { + AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AMRWBContext *s = avctx->priv_data; @@ -345,8 +338,8 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data, static const uint8_t block_size[16] = {18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1}; /* get output buffer */ - s->frame.nb_samples = 320; - if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { + frame->nb_samples = 320; + if ((ret = ff_get_buffer(avctx, frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } @@ -364,10 +357,9 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } - D_IF_decode(s->state, buf, (short *)s->frame.data[0], _good_frame); + D_IF_decode(s->state, buf, (short *)frame->data[0], _good_frame); - *got_frame_ptr = 1; - *(AVFrame *)data = s->frame; + *got_frame_ptr = 1; return packet_size; } |