encoder_class->class_data = &g_class_data;
encoder_class->reconfigure = gst_vaapi_encoder_h264_reconfigure;
- encoder_class->get_default_properties =
- gst_vaapi_encoder_h264_get_default_properties;
encoder_class->reordering = gst_vaapi_encoder_h264_reordering;
encoder_class->encode = gst_vaapi_encoder_h264_encode;
encoder_class->flush = gst_vaapi_encoder_h264_flush;
}
/**
- * gst_vaapi_encoder_h264_get_default_properties:
- *
- * Determines the set of common and H.264 specific encoder properties.
- * The caller owns an extra reference to the resulting array of
- * #GstVaapiEncoderPropInfo elements, so it shall be released with
- * g_ptr_array_unref() after usage.
- *
- * Return value: the set of encoder properties for #GstVaapiEncoderH264,
- * or %NULL if an error occurred.
- */
-GPtrArray *
-gst_vaapi_encoder_h264_get_default_properties (void)
-{
- const GstVaapiEncoderClassData *class_data = &g_class_data;
- GPtrArray *props;
-
- props = gst_vaapi_encoder_properties_get_default (class_data);
- if (!props)
- return NULL;
-
- /**
- * GstVaapiEncoderH264:max-bframes:
- *
- * The number of B-frames between I and P.
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_MAX_BFRAMES,
- g_param_spec_uint ("max-bframes",
- "Max B-Frames", "Number of B-frames between I and P", 0, 10, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstVaapiEncoderH264:refs:
- *
- * The number of reference frames.
- * If B frame is encoded, it will add 1 reference frame more.
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_NUM_REF_FRAMES,
- g_param_spec_uint ("refs", "Number of Reference Frames",
- "Number of reference frames", 1, 8, 1,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstVaapiEncoderH264:init-qp:
- *
- * The initial quantizer value.
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_INIT_QP,
- g_param_spec_uint ("init-qp",
- "Initial QP", "Initial quantizer value", 0, 51, 26,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstVaapiEncoderH264:min-qp:
- *
- * The minimum quantizer value.
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_MIN_QP,
- g_param_spec_uint ("min-qp",
- "Minimum QP", "Minimum quantizer value", 0, 51, 1,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstVaapiEncoderH264:max-qp:
- *
- * The maximum quantizer value.
- *
- * Since: 1.18
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_MAX_QP,
- g_param_spec_uint ("max-qp",
- "Maximum QP", "Maximum quantizer value", 0, 51, 51,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstVaapiEncoderH264:qp-ip:
- *
- * The difference of QP between I and P Frame.
- * This is available only on CQP mode.
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_QP_IP,
- g_param_spec_int ("qp-ip",
- "Difference of QP between I and P frame",
- "Difference of QP between I and P frame (available only on CQP)",
- -51, 51, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstVaapiEncoderH264:qp-ib:
- *
- * The difference of QP between I and B Frame.
- * This is available only on CQP mode.
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_QP_IB,
- g_param_spec_int ("qp-ib",
- "Difference of QP between I and B frame",
- "Difference of QP between I and B frame (available only on CQP)",
- -51, 51, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstVaapiEncoderH264:num-slices:
- *
- * The number of slices per frame.
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_NUM_SLICES,
- g_param_spec_uint ("num-slices",
- "Number of Slices",
- "Number of slices per frame",
- 1, 200, 1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstVaapiEncoderH264:cabac:
- *
- * Enable CABAC entropy coding mode for improved compression ratio,
- * at the expense that the minimum target profile is Main. Default
- * is CAVLC entropy coding mode.
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_CABAC,
- g_param_spec_boolean ("cabac",
- "Enable CABAC",
- "Enable CABAC entropy coding mode",
- FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstVaapiEncoderH264:dct8x8:
- *
- * Enable adaptive use of 8x8 transforms in I-frames. This improves
- * the compression ratio by the minimum target profile is High.
- * Default is to use 4x4 DCT only.
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_DCT8X8,
- g_param_spec_boolean ("dct8x8",
- "Enable 8x8 DCT",
- "Enable adaptive use of 8x8 transforms in I-frames",
- FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstVaapiEncoderH264:mbbrc:
- *
- * Macroblock level bitrate control.
- * This is not compatible with Constant QP rate control.
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_MBBRC,
- g_param_spec_enum ("mbbrc",
- "Macroblock level Bitrate Control",
- "Macroblock level Bitrate Control",
- GST_VAAPI_TYPE_ENCODER_MBBRC, GST_VAAPI_ENCODER_MBBRC_AUTO,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstVaapiEncoderH264:temporal-levels:
- *
- * Number of temporal levels in the encoded stream.
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_TEMPORAL_LEVELS,
- g_param_spec_uint ("temporal-levels",
- "temporal levels",
- "Number of temporal levels in the encoded stream ",
- 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:
- *
- * The size of the CPB buffer in milliseconds.
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_CPB_LENGTH,
- g_param_spec_uint ("cpb-length",
- "CPB Length", "Length of the CPB buffer in milliseconds",
- 1, 10000, DEFAULT_CPB_LENGTH,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstVaapiEncoderH264:num-views:
- *
- * The number of views for MVC encoding .
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_NUM_VIEWS,
- g_param_spec_uint ("num-views",
- "Number of Views",
- "Number of Views for MVC encoding",
- 1, MAX_NUM_VIEWS, 1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstVaapiEncoderH264:view-ids:
- *
- * The view ids for MVC encoding .
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_VIEW_IDS,
- gst_param_spec_array ("view-ids",
- "View IDs", "Set of View Ids used for MVC encoding",
- g_param_spec_uint ("view-id-value", "View id value",
- "view id values used for mvc encoding", 0, MAX_VIEW_ID, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS),
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstVaapiEncoderH264:aud:
- *
- * Use AU (Access Unit) delimeter.
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_AUD,
- g_param_spec_boolean ("aud", "AU delimiter",
- "Use AU (Access Unit) delimeter", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstVaapiEncoderH264:Compliance Mode:
- *
- * Encode Tuning(Tweaking) with different compliance modes .
- *
- *
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_COMPLIANCE_MODE,
- g_param_spec_enum ("compliance-mode",
- "Spec Compliance Mode",
- "Tune Encode quality/performance by relaxing specification compliance restrictions",
- gst_vaapi_encoder_h264_compliance_mode_type (),
- GST_VAAPI_ENCODER_H264_COMPLIANCE_MODE_STRICT, G_PARAM_READWRITE));
-
- /**
- * GstVaapiEncoderH264:quality_factor:
- *
- * quality factor used under ICQ/QVBR bitrate control mode.
- */
- GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
- GST_VAAPI_ENCODER_H264_PROP_QUALITY_FACTOR,
- g_param_spec_uint ("quality-factor",
- "Quality factor for ICQ/QVBR",
- "quality factor for ICQ/QVBR bitrate control mode"
- "(low value means higher-quality, higher value means lower-quality)",
- 1, 51, 26, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- return props;
-}
-
-/**
* gst_vaapi_encoder_h264_set_max_profile:
* @encoder: a #GstVaapiEncoderH264
* @profile: an H.264 #GstVaapiProfile