On 26/07/2020 13:26, Jun Zhao wrote:
From: Jun Zhao <barryjz...@tencent.com>
Export choosen pict_type.
Signed-off-by: Jun Zhao <barryjz...@tencent.com>
---
libavcodec/vaapi_encode.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 6766641..2352fdd 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -24,6 +24,7 @@
#include "libavutil/log.h"
#include "libavutil/pixdesc.h"
+#include "packet_internal.h"
#include "vaapi_encode.h"
#include "encode.h"
#include "avcodec.h"
@@ -633,6 +634,7 @@ static int vaapi_encode_output(AVCodecContext *avctx,
int total_size = 0;
uint8_t *ptr;
int err;
+ int pict_type;
err = vaapi_encode_wait(avctx, pic);
if (err < 0)
@@ -670,6 +672,28 @@ static int vaapi_encode_output(AVCodecContext *avctx,
pkt->pts = pic->pts;
+ switch (pic->type) {
+ case PICTURE_TYPE_IDR:
+ case PICTURE_TYPE_I:
+ pict_type = AV_PICTURE_TYPE_I;
+ break;
+ case PICTURE_TYPE_P:
+ pict_type = AV_PICTURE_TYPE_P;
+ break;
+ case PICTURE_TYPE_B:
+ pict_type = AV_PICTURE_TYPE_B;
+ break;
+ default:
+ pict_type = AV_PICTURE_TYPE_NONE;
+ break;
+ }
That's not right - the internal PICTURE_TYPE values here are reflecting what
the frame is being used as, not what it actually is. I think we want the
latter here?
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+ avctx->coded_frame->pict_type = pict_type;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+ ff_side_data_set_encoder_stats(pkt, -1, NULL, 0, pict_type);
+
vas = vaUnmapBuffer(ctx->hwctx->display, pic->output_buffer);
if (vas != VA_STATUS_SUCCESS) {
av_log(avctx, AV_LOG_ERROR, "Failed to unmap output buffers: "
- Mark
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".