diff options
author | Haihao Xiang <haihao.xiang@intel.com> | 2018-05-03 13:51:48 +0800 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2018-05-03 23:11:23 +0100 |
commit | 314994051b3d10dc17ed0c8f5669cc20450cd413 (patch) | |
tree | 93f1d9cbf04ec016e3f44ea1728811b26d67f45f /libavcodec | |
parent | f43fd68f28079c49e9237894a294968d841babc7 (diff) | |
download | ffmpeg-streaming-314994051b3d10dc17ed0c8f5669cc20450cd413.zip ffmpeg-streaming-314994051b3d10dc17ed0c8f5669cc20450cd413.tar.gz |
vaapi_encode_h264: Take VAAPIEncodeH264Context::sei_needed as an ORed value
We may check priv->sei_needed only when writing SEI messages.
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/vaapi_encode_h264.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c index 56ad217..905c507 100644 --- a/libavcodec/vaapi_encode_h264.c +++ b/libavcodec/vaapi_encode_h264.c @@ -208,7 +208,6 @@ static int vaapi_encode_h264_write_extra_header(AVCodecContext *avctx, { VAAPIEncodeContext *ctx = avctx->priv_data; VAAPIEncodeH264Context *priv = ctx->priv_data; - VAAPIEncodeH264Options *opt = ctx->codec_options; CodedBitstreamFragment *au = &priv->current_access_unit; int err, i; @@ -224,12 +223,12 @@ static int vaapi_encode_h264_write_extra_header(AVCodecContext *avctx, priv->sei.nal_unit_header.nal_unit_type = H264_NAL_SEI; i = 0; - if (pic->encode_order == 0 && opt->sei & SEI_IDENTIFIER) { + if (priv->sei_needed & SEI_IDENTIFIER) { priv->sei.payload[i].payload_type = H264_SEI_TYPE_USER_DATA_UNREGISTERED; priv->sei.payload[i].payload.user_data_unregistered = priv->identifier; ++i; } - if (opt->sei & SEI_TIMING) { + if (priv->sei_needed & SEI_TIMING) { if (pic->type == PICTURE_TYPE_IDR) { priv->sei.payload[i].payload_type = H264_SEI_TYPE_BUFFERING_PERIOD; priv->sei.payload[i].payload.buffering_period = priv->buffering_period; @@ -239,7 +238,7 @@ static int vaapi_encode_h264_write_extra_header(AVCodecContext *avctx, priv->sei.payload[i].payload.pic_timing = priv->pic_timing; ++i; } - if (opt->sei & SEI_RECOVERY_POINT && pic->type == PICTURE_TYPE_I) { + if (priv->sei_needed & SEI_RECOVERY_POINT) { priv->sei.payload[i].payload_type = H264_SEI_TYPE_RECOVERY_POINT; priv->sei.payload[i].payload.recovery_point = priv->recovery_point; ++i; @@ -628,8 +627,10 @@ static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, priv->aud_needed = 0; } + priv->sei_needed = 0; + if (opt->sei & SEI_IDENTIFIER && pic->encode_order == 0) - priv->sei_needed = 1; + priv->sei_needed |= SEI_IDENTIFIER; #if !CONFIG_VAAPI_1 if (ctx->va_rc_mode == VA_RC_CBR) priv->sei_cbr_workaround_needed = 1; @@ -641,7 +642,7 @@ static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, priv->pic_timing.cpb_removal_delay = 2 * priv->cpb_delay; priv->pic_timing.dpb_output_delay = 2 * priv->dpb_delay; - priv->sei_needed = 1; + priv->sei_needed |= SEI_TIMING; } if (opt->sei & SEI_RECOVERY_POINT && pic->type == PICTURE_TYPE_I) { @@ -649,7 +650,7 @@ static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, priv->recovery_point.exact_match_flag = 1; priv->recovery_point.broken_link_flag = ctx->b_per_p > 0; - priv->sei_needed = 1; + priv->sei_needed |= SEI_RECOVERY_POINT; } vpic->CurrPic = (VAPictureH264) { |