diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c index d6e1638694..4af46e9f7f 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c @@ -109,6 +109,38 @@ gst_vaapi_encoder_h264_compliance_mode_type (void) return gtype; } +typedef enum +{ + GST_VAAPI_ENCODER_H264_PREDICTION_DEFAULT, + GST_VAAPI_ENCODER_H264_PREDICTION_HIERARCHICAL_P, + GST_VAAPI_ENCODER_H264_PREDICTION_HIERARCHICAL_B +} GstVaapiEnoderH264PredictionType; + +static GType +gst_vaapi_encoder_h264_prediction_type (void) +{ + static GType gtype = 0; + + if (gtype == 0) { + static const GEnumValue values[] = { + {GST_VAAPI_ENCODER_H264_PREDICTION_DEFAULT, + "Default encode, prev/next frame as ref ", + "default"}, + {GST_VAAPI_ENCODER_H264_PREDICTION_HIERARCHICAL_P, + "Hierarchical P frame encode", + "hierarchical-p"}, + {GST_VAAPI_ENCODER_H264_PREDICTION_HIERARCHICAL_B, + "Hierarchical B frame encode", + "hierarchical-b"}, + {0, NULL, NULL}, + }; + + gtype = + g_enum_register_static ("GstVaapiEncoderH264PredictionType", values); + } + return gtype; +} + /* only for internal usage, values won't be equal to actual payload type */ typedef enum { @@ -724,6 +756,7 @@ struct _GstVaapiEncoderH264 gboolean use_dct8x8; guint temporal_levels; /* Number of temporal levels */ guint temporal_level_div[MAX_TEMPORAL_LEVELS]; /* to find the temporal id */ + guint prediction_type; GstClockTime cts_offset; gboolean config_changed; @@ -3168,6 +3201,9 @@ gst_vaapi_encoder_h264_set_property (GstVaapiEncoder * base_encoder, case GST_VAAPI_ENCODER_H264_PROP_TEMPORAL_LEVELS: encoder->temporal_levels = g_value_get_uint (value); break; + case GST_VAAPI_ENCODER_H264_PROP_PREDICTION_TYPE: + encoder->prediction_type = g_value_get_enum (value); + break; default: return GST_VAAPI_ENCODER_STATUS_ERROR_INVALID_PARAMETER; @@ -3362,6 +3398,20 @@ gst_vaapi_encoder_h264_get_default_properties (void) MIN_TEMPORAL_LEVELS, MAX_TEMPORAL_LEVELS, MIN_TEMPORAL_LEVELS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * GstVaapiEncoderH264:prediction-type: + * + * Select the referece picture selection modes + */ + GST_VAAPI_ENCODER_PROPERTIES_APPEND (props, + GST_VAAPI_ENCODER_H264_PROP_PREDICTION_TYPE, + g_param_spec_enum ("prediction-type", + "RefPic Selection", + "Reference Picture Selection Modes", + gst_vaapi_encoder_h264_prediction_type (), + GST_VAAPI_ENCODER_H264_PREDICTION_DEFAULT, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** * GstVaapiEncoderH264:cpb-length: * diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264.h b/gst-libs/gst/vaapi/gstvaapiencoder_h264.h index 7b38e76327..eb262783a7 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_h264.h +++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264.h @@ -55,6 +55,7 @@ typedef struct _GstVaapiEncoderH264 GstVaapiEncoderH264; * @GST_VAAPI_ENCODER_H264_PROP_QP_IP: Difference of QP between I and P frame. * @GST_VAAPI_ENCODER_H264_PROP_QP_IB: Difference of QP between I and B frame. * @GST_VAAPI_ENCODER_H264_PROP_TEMPORAL_LEVELS: Number of temporal levels + * @GST_VAAPI_ENCODER_H264_PROP_PREDICTION_TYPE: Reference picture selection modes * * The set of H.264 encoder specific configurable properties. */ @@ -75,6 +76,7 @@ typedef enum { GST_VAAPI_ENCODER_H264_PROP_QP_IP = -14, GST_VAAPI_ENCODER_H264_PROP_QP_IB = -15, GST_VAAPI_ENCODER_H264_PROP_TEMPORAL_LEVELS = -16, + GST_VAAPI_ENCODER_H264_PROP_PREDICTION_TYPE = -17, } GstVaapiEncoderH264Prop; GstVaapiEncoder *