From aa872af5e3993c63293bbf1e33183117112b8b7a Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sun, 29 Jan 2012 19:01:10 -0500 Subject: ac3enc: update to AVCodec.encode2() Update FATE references due to encoder delay. --- libavcodec/ac3enc_template.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'libavcodec/ac3enc_template.c') diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c index bc06c2f46f..9427cfe971 100644 --- a/libavcodec/ac3enc_template.c +++ b/libavcodec/ac3enc_template.c @@ -391,11 +391,11 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s) } -int AC3_NAME(encode_frame)(AVCodecContext *avctx, unsigned char *frame, - int buf_size, void *data) +int AC3_NAME(encode_frame)(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr) { AC3EncodeContext *s = avctx->priv_data; - const SampleType *samples = data; + const SampleType *samples = (const SampleType *)frame->data[0]; int ret; if (s->options.allow_per_frame_metadata) { @@ -442,7 +442,15 @@ int AC3_NAME(encode_frame)(AVCodecContext *avctx, unsigned char *frame, ff_ac3_quantize_mantissas(s); - ff_ac3_output_frame(s, frame); + if ((ret = ff_alloc_packet(avpkt, s->frame_size))) { + av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n"); + return ret; + } + ff_ac3_output_frame(s, avpkt->data); - return s->frame_size; + if (frame->pts != AV_NOPTS_VALUE) + avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay); + + *got_packet_ptr = 1; + return 0; } -- cgit v1.2.3