diff mbox series

[FFmpeg-devel,1/5] avcodec/amfenc: use AVCodecContext.get_encode_buffer()

Message ID 20210313001538.7240-2-jamrial@gmail.com
State Accepted
Commit b615e8a7826daf9279bff9ee0b629840f05b218c
Headers show
Series Initial usage of AVCodecContext.get_encode_buffer() | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Almer March 13, 2021, 12:15 a.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/amfenc.c      | 2 +-
 libavcodec/amfenc_h264.c | 3 ++-
 libavcodec/amfenc_hevc.c | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
index e234cfd354..fb23ed738c 100644
--- a/libavcodec/amfenc.c
+++ b/libavcodec/amfenc.c
@@ -452,7 +452,7 @@  static int amf_copy_buffer(AVCodecContext *avctx, AVPacket *pkt, AMFBuffer *buff
     int64_t          timestamp = AV_NOPTS_VALUE;
     int64_t          size = buffer->pVtbl->GetSize(buffer);
 
-    if ((ret = av_new_packet(pkt, size)) < 0) {
+    if ((ret = ff_get_encode_buffer(avctx, pkt, size, 0)) < 0) {
         return ret;
     }
     memcpy(pkt->data, buffer->pVtbl->GetNative(buffer), size);
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
index 622ee85946..fe30d7f11d 100644
--- a/libavcodec/amfenc_h264.c
+++ b/libavcodec/amfenc_h264.c
@@ -388,7 +388,8 @@  AVCodec ff_h264_amf_encoder = {
     .priv_data_size = sizeof(AmfContext),
     .priv_class     = &h264_amf_class,
     .defaults       = defaults,
-    .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE,
+    .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE |
+                      AV_CODEC_CAP_DR1,
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .pix_fmts       = ff_amf_pix_fmts,
     .wrapper_name   = "amf",
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
index a1225c09e3..b5c840e5f3 100644
--- a/libavcodec/amfenc_hevc.c
+++ b/libavcodec/amfenc_hevc.c
@@ -320,7 +320,8 @@  AVCodec ff_hevc_amf_encoder = {
     .priv_data_size = sizeof(AmfContext),
     .priv_class     = &hevc_amf_class,
     .defaults       = defaults,
-    .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE,
+    .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE |
+                      AV_CODEC_CAP_DR1,
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .pix_fmts       = ff_amf_pix_fmts,
     .wrapper_name   = "amf",