Included by default with non-IDR intra frames.
---
libavcodec/vaapi_encode_h264.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index 66f8e2490..80476445c 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -36,6 +36,7 @@
enum {
SEI_HRD = 0x01,
SEI_IDENTIFIER = 0x02,
+ SEI_RECOVERY_POINT = 0x04,
};
// Random (version 4) ISO 11578 UUID.
@@ -60,6 +61,7 @@ typedef struct VAAPIEncodeH264Context {
H264RawSEIBufferingPeriod buffering_period;
H264RawSEIPicTiming pic_timing;
+ H264RawSEIRecoveryPoint recovery_point;
H264RawSEIUserDataUnregistered identifier;
char *identifier_string;
@@ -239,6 +241,11 @@ static int
vaapi_encode_h264_write_extra_header(AVCodecContext *avctx,
priv->sei.payload[i].pic_timing = priv->pic_timing;
++i;
}
+ if (opt->sei & SEI_RECOVERY_POINT && pic->type == PICTURE_TYPE_I) {
+ priv->sei.payload[i].payload_type = H264_SEI_TYPE_RECOVERY_POINT;
+ priv->sei.payload[i].recovery_point = priv->recovery_point;
+ ++i;
+ }
priv->sei.payload_count = i;
av_assert0(priv->sei.payload_count > 0);
@@ -620,6 +627,14 @@ static int
vaapi_encode_h264_init_picture_params(AVCodecContext *avctx,
priv->sei_needed = 1;
}
+ if (opt->sei & SEI_RECOVERY_POINT && pic->type == PICTURE_TYPE_I) {
+ priv->recovery_point.recovery_frame_cnt = 0;
+ priv->recovery_point.exact_match_flag = 1;
+ priv->recovery_point.broken_link_flag = ctx->b_per_p > 0;
+
+ priv->sei_needed = 1;
+ }
+
vpic->CurrPic = (VAPictureH264) {
.picture_id = pic->recon_surface,
.frame_idx = priv->frame_num,
@@ -968,7 +983,7 @@ static const AVOption vaapi_encode_h264_options[] = {
{ "sei", "Set SEI to include",
OFFSET(sei), AV_OPT_TYPE_FLAGS,
- { .i64 = SEI_IDENTIFIER | SEI_HRD },
+ { .i64 = SEI_IDENTIFIER | SEI_HRD | SEI_RECOVERY_POINT },
0, INT_MAX, FLAGS, "sei" },
{ "identifier", "Include encoder version identifier",
0, AV_OPT_TYPE_CONST, { .i64 = SEI_IDENTIFIER },
@@ -976,6 +991,9 @@ static const AVOption vaapi_encode_h264_options[] = {
{ "hrd", "Include HRD parameters (buffering_period and pic_timing)",
0, AV_OPT_TYPE_CONST, { .i64 = SEI_HRD },
INT_MIN, INT_MAX, FLAGS, "sei" },
+ { "recovery_point", "Include recovery points where appropriate",
+ 0, AV_OPT_TYPE_CONST, { .i64 = SEI_RECOVERY_POINT },
+ INT_MIN, INT_MAX, FLAGS, "sei" },
{ NULL },
};
--
2.11.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel