From a499b4345b2dbc731d6c24aa6a9b319d4c3a0d4c Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Tue, 11 May 2021 20:52:13 +0200 Subject: 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 --- libavcodec/ttaenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavcodec/ttaenc.c') diff --git a/libavcodec/ttaenc.c b/libavcodec/ttaenc.c index 6a8c2b122d..20a711ede6 100644 --- a/libavcodec/ttaenc.c +++ b/libavcodec/ttaenc.c @@ -204,11 +204,11 @@ const FFCodec ff_tta_encoder = { .p.long_name = NULL_IF_CONFIG_SMALL("TTA (True Audio)"), .p.type = AVMEDIA_TYPE_AUDIO, .p.id = AV_CODEC_ID_TTA, + .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SMALL_LAST_FRAME, .priv_data_size = sizeof(TTAEncContext), .init = tta_encode_init, .close = tta_encode_close, FF_CODEC_ENCODE_CB(tta_encode_frame), - .p.capabilities = AV_CODEC_CAP_SMALL_LAST_FRAME, .p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, -- cgit v1.2.3