Message ID | 1559291209-17108-1-git-send-email-jing.a.sun@intel.com |
---|---|
State | New |
Headers | show |
On 5/31/2019 5:26 AM, Jing Sun wrote: > ff_alloc_packet2 should be used if encode2 API vaapi_encode seems to be using send/receive API, though, and not encode2. I see ff_vaapi_encode_receive_packet() -> vaapi_encode_output(), and the former is the callback function used in all vaapi encoders as AVCodec.receive_packet, so this patch in not needed. > > Signed-off-by: Jing Sun <jing.a.sun@intel.com> > --- > libavcodec/vaapi_encode.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c > index 2dda451..98e3176 100644 > --- a/libavcodec/vaapi_encode.c > +++ b/libavcodec/vaapi_encode.c > @@ -26,6 +26,7 @@ > > #include "vaapi_encode.h" > #include "avcodec.h" > +#include "internal.h" > > static const char * const picture_type_name[] = { "IDR", "I", "P", "B" }; > > @@ -509,7 +510,7 @@ static int vaapi_encode_output(AVCodecContext *avctx, > av_log(avctx, AV_LOG_DEBUG, "Output buffer: %u bytes " > "(status %08x).\n", buf->size, buf->status); > > - err = av_new_packet(pkt, buf->size); > + err = ff_alloc_packet2(avctx, pkt, buf->size, 0); > if (err < 0) > goto fail_mapped; > >
-----Original Message----- From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf Of James Almer Sent: Saturday, June 1, 2019 3:06 AM To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] [PATCH v1 1/1] vaapi_encode: replace av_new_packet with ff_alloc_packet2 >vaapi_encode seems to be using send/receive API, though, and not encode2. >I see ff_vaapi_encode_receive_packet() -> vaapi_encode_output(), and the former is the callback function used in all vaapi encoders as AVCodec.receive_packet, so this patch in not needed. Hi James, vaapi_encode uses encode2 API as well, such as vaapi_h264: AVCodec ff_h264_vaapi_encoder = { ... .encode2 = &ff_vaapi_encode2, ... }; Whether encoder2 or send_frame/receive_packet, the upper callers are the same avcodec_send_frame/avcodec_receive_packet pair, which calls send_frame/receive_packet if exist, or calls encode2 instead. Please correct me if I am wrong. And would you please review the other patch "[PATCH v13 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper" for another time? I have updated it again. Thanks a lot in advance! Regards, Sun, Jing
On 6/3/2019 3:39 AM, Sun, Jing A wrote: > -----Original Message----- > From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf Of James Almer > Sent: Saturday, June 1, 2019 3:06 AM > To: ffmpeg-devel@ffmpeg.org > Subject: Re: [FFmpeg-devel] [PATCH v1 1/1] vaapi_encode: replace av_new_packet with ff_alloc_packet2 > >> vaapi_encode seems to be using send/receive API, though, and not encode2. >> I see ff_vaapi_encode_receive_packet() -> vaapi_encode_output(), and the former is the callback function used in all vaapi encoders as AVCodec.receive_packet, so this patch in not needed. > > Hi James, > > vaapi_encode uses encode2 API as well, such as vaapi_h264: > > AVCodec ff_h264_vaapi_encoder = { > ... > .encode2 = &ff_vaapi_encode2, I can't find this anywhere in the tree. Are you sure you're looking at ffmpeg's libavcodec? > ... > }; > > Whether encoder2 or send_frame/receive_packet, the upper callers are the same avcodec_send_frame/avcodec_receive_packet pair, which calls send_frame/receive_packet if exist, or calls encode2 instead. Please correct me if I am wrong. > > And would you please review the other patch "[PATCH v13 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper" for another time? I have updated it again. Thanks a lot in advance! > > Regards, > Sun, Jing > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". >
-----Original Message----- From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf Of James Almer Sent: Monday, June 3, 2019 9:55 PM To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] [PATCH v1 1/1] vaapi_encode: replace av_new_packet with ff_alloc_packet2 > I can't find this anywhere in the tree. Are you sure you're looking at ffmpeg's libavcodec? I am so sorry for using out-of-date code base. Please ignore this patch. Regards, Sun, Jing
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 2dda451..98e3176 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -26,6 +26,7 @@ #include "vaapi_encode.h" #include "avcodec.h" +#include "internal.h" static const char * const picture_type_name[] = { "IDR", "I", "P", "B" }; @@ -509,7 +510,7 @@ static int vaapi_encode_output(AVCodecContext *avctx, av_log(avctx, AV_LOG_DEBUG, "Output buffer: %u bytes " "(status %08x).\n", buf->size, buf->status); - err = av_new_packet(pkt, buf->size); + err = ff_alloc_packet2(avctx, pkt, buf->size, 0); if (err < 0) goto fail_mapped;
ff_alloc_packet2 should be used if encode2 API Signed-off-by: Jing Sun <jing.a.sun@intel.com> --- libavcodec/vaapi_encode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)