diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2012-01-29 19:01:10 -0500 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2012-03-20 18:46:56 -0400 |
commit | aa872af5e3993c63293bbf1e33183117112b8b7a (patch) | |
tree | 78e1df718ac816d7fc9f9a4953df4212667fa47a /libavcodec/ac3enc_template.c | |
parent | ad95307f9251aa8c0e8773727589d3c1986655fc (diff) | |
download | ffmpeg-aa872af5e3993c63293bbf1e33183117112b8b7a.tar.gz |
ac3enc: update to AVCodec.encode2()
Update FATE references due to encoder delay.
Diffstat (limited to 'libavcodec/ac3enc_template.c')
-rw-r--r-- | libavcodec/ac3enc_template.c | 18 |
1 files changed, 13 insertions, 5 deletions
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; } |