diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-03-22 19:27:19 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-03-22 20:44:24 +0100 |
commit | b1a0d694ea973c4de91fbb1fb46858cff6f6e91b (patch) | |
tree | c61b41ec556f1dc4912e48b72d10d14d20b5b621 /libavcodec/dcaenc.c | |
parent | ffa28da180113b53bcb32ed38e913ad27c0cde24 (diff) | |
download | ffmpeg-b1a0d694ea973c4de91fbb1fb46858cff6f6e91b.tar.gz |
dcaenc: switch to encode2()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dcaenc.c')
-rw-r--r-- | libavcodec/dcaenc.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c index 72ea16f6d5..71106d7e36 100644 --- a/libavcodec/dcaenc.c +++ b/libavcodec/dcaenc.c @@ -26,6 +26,7 @@ #include "libavutil/audioconvert.h" #include "avcodec.h" #include "get_bits.h" +#include "internal.h" #include "put_bits.h" #include "dcaenc.h" #include "dcadata.h" @@ -488,14 +489,18 @@ static void put_frame(DCAContext *c, flush_put_bits(&c->pb); } -static int encode_frame(AVCodecContext *avctx, uint8_t *frame, - int buf_size, void *data) +static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr) { int i, k, channel; DCAContext *c = avctx->priv_data; - int16_t *samples = data; - int real_channel = 0; + const int16_t *samples; + int ret, real_channel = 0; + if ((ret = ff_alloc_packet2(avctx, avpkt, DCA_MAX_FRAME_SIZE + DCA_HEADER_SIZE))) + return ret; + + samples = (const int16_t *)frame->data[0]; for (i = 0; i < PCM_SAMPLES; i ++) { /* i is the decimated sample number */ for (channel = 0; channel < c->prim_channels + 1; channel++) { /* Get 32 PCM samples */ @@ -518,9 +523,11 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *frame, } } - put_frame(c, c->subband, frame); + put_frame(c, c->subband, avpkt->data); - return c->frame_size; + avpkt->size = c->frame_size; + *got_packet_ptr = 1; + return 0; } static int encode_init(AVCodecContext *avctx) @@ -580,7 +587,7 @@ AVCodec ff_dca_encoder = { .id = CODEC_ID_DTS, .priv_data_size = sizeof(DCAContext), .init = encode_init, - .encode = encode_frame, + .encode2 = encode_frame, .capabilities = CODEC_CAP_EXPERIMENTAL, .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"), |