diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-05-11 20:52:13 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-08-27 02:23:43 +0200 |
commit | a499b4345b2dbc731d6c24aa6a9b319d4c3a0d4c (patch) | |
tree | b16216ae64dedbc5fdb499f9817dcc50c32bc3a4 /libavcodec/aacenc.c | |
parent | 7360e97e4beec13ef5aa87657490d8f272be9f26 (diff) |
avcodec: Make ff_alloc_packet() based encoders accept user buffers
Up until now, these encoders received non-refcounted packets
(whose data was owned by the corresponding AVCodecContext)
from ff_alloc_packet(); these packets were made refcounted lateron
by av_packet_make_refcounted() generically.
This commit makes these encoders accept user-supplied buffers by
replacing av_packet_make_refcounted() with an equivalent function
that is based upon get_encode_buffer().
(I am pretty certain that one can also set the flag for mpegvideo-
based encoders, but I want to double-check this later. What is certain
is that it reallocates the buffer owned by the AVCodecContext
which should maybe be moved to encode.c, so that proresenc_kostya.c
and ttaenc.c can make use of it, too.)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/aacenc.c')
-rw-r--r-- | libavcodec/aacenc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 4f51485fc4..a0e5d2942e 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -1417,6 +1417,8 @@ const FFCodec ff_aac_encoder = { .p.long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"), .p.type = AVMEDIA_TYPE_AUDIO, .p.id = AV_CODEC_ID_AAC, + .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | + AV_CODEC_CAP_SMALL_LAST_FRAME, .priv_data_size = sizeof(AACEncContext), .init = aac_encode_init, FF_CODEC_ENCODE_CB(aac_encode_frame), @@ -1424,7 +1426,6 @@ const FFCodec ff_aac_encoder = { .defaults = aac_encode_defaults, .p.supported_samplerates = ff_mpeg4audio_sample_rates, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, - .p.capabilities = AV_CODEC_CAP_SMALL_LAST_FRAME | AV_CODEC_CAP_DELAY, .p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }, .p.priv_class = &aacenc_class, |