[FFmpeg-devel] [PATCH] avcodec/amfenc: adapt to the new internal encode API
James Almer
jamrial at gmail.com
Sat Apr 4 22:59:22 EEST 2020
On 4/4/2020 1:59 PM, Fu, Linjie wrote:
>> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
>> James Almer
>> Sent: Saturday, April 4, 2020 06:19
>> To: ffmpeg-devel at ffmpeg.org
>> Subject: [FFmpeg-devel] [PATCH] avcodec/amfenc: adapt to the new
>> internal encode API
>>
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>> libavcodec/amfenc.c | 45 ++++++++++++++++++++--------------------
>> libavcodec/amfenc.h | 2 ++
>> libavcodec/amfenc_h264.c | 1 -
>> libavcodec/amfenc_hevc.c | 1 -
>> 4 files changed, 25 insertions(+), 24 deletions(-)
>>
>> diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
>> index 876fddd2b6..d318c21978 100644
>> --- a/libavcodec/amfenc.c
>> +++ b/libavcodec/amfenc.c
>> @@ -33,6 +33,7 @@
>> #include "libavutil/time.h"
>>
>> #include "amfenc.h"
>> +#include "encode.h"
>> #include "internal.h"
>>
>> #if CONFIG_D3D11VA
>> @@ -112,6 +113,10 @@ static int amf_load_library(AVCodecContext *avctx)
>> AMFQueryVersion_Fn version_fun;
>> AMF_RESULT res;
>>
>> + ctx->frame = av_frame_alloc();
>> + if (!ctx->frame) {
>> + return AVERROR(ENOMEM);
>> + }
>> ctx->delayed_frame = av_frame_alloc();
>> if (!ctx->delayed_frame) {
>> return AVERROR(ENOMEM);
>> @@ -401,6 +406,7 @@ int av_cold ff_amf_encode_close(AVCodecContext
>> *avctx)
>> ctx->factory = NULL;
>> ctx->version = 0;
>> ctx->delayed_drain = 0;
>> + av_frame_free(&ctx->frame);
>> av_frame_free(&ctx->delayed_frame);
>> av_fifo_freep(&ctx->timestamp_list);
>>
>> @@ -588,17 +594,27 @@ static void
>> amf_release_buffer_with_frame_ref(AMFBuffer
>> *frame_ref_storage_buffe
>> frame_ref_storage_buffer->pVtbl->Release(frame_ref_storage_buffer);
>> }
>>
>> -int ff_amf_send_frame(AVCodecContext *avctx, const AVFrame *frame)
>> +int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
> Would be better to remove the declaration in amfenc.h as well since the function
> has been removed already?
>
> - Linjie
Yeah, missed that. Will send an updated patch with some other changes.
More information about the ffmpeg-devel
mailing list