mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
vah264enc: Move rate-control enum to encoder class helper.
Since it's a common enumeration used, as user setting property, for most of codecs. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2169>
This commit is contained in:
parent
81951c59ef
commit
3a7c1ddb3c
3 changed files with 38 additions and 30 deletions
|
@ -1141,3 +1141,36 @@ gst_va_encode_picture_free (GstVaEncodePicture * pic)
|
||||||
|
|
||||||
g_slice_free (GstVaEncodePicture, pic);
|
g_slice_free (GstVaEncodePicture, pic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstVaEncoderRateControl:
|
||||||
|
*
|
||||||
|
* Since: 1.22
|
||||||
|
*/
|
||||||
|
GType
|
||||||
|
gst_va_encoder_rate_control_get_type (void)
|
||||||
|
{
|
||||||
|
static gsize type = 0;
|
||||||
|
static const GEnumValue values[] = {
|
||||||
|
{VA_RC_CBR, "Constant Bitrate", "cbr"},
|
||||||
|
{VA_RC_VBR, "Variable Bitrate", "vbr"},
|
||||||
|
{VA_RC_VCM, "Video Conferencing Mode (Non HRD compliant)", "vcm"},
|
||||||
|
{VA_RC_CQP, "Constant Quantizer", "cqp"},
|
||||||
|
/* {VA_RC_VBR_CONSTRAINED, "VBR with peak rate higher than average bitrate", */
|
||||||
|
/* "vbr-constrained"}, */
|
||||||
|
/* {VA_RC_ICQ, "Intelligent Constant Quality", "icq"}, */
|
||||||
|
/* {VA_RC_MB, "Macroblock based rate control", "mb"}, */
|
||||||
|
/* {VA_RC_CFS, "Constant Frame Size", "cfs"}, */
|
||||||
|
/* {VA_RC_PARALLEL, "Parallel BRC", "parallel"}, */
|
||||||
|
/* {VA_RC_QVBR, "Quality defined VBR", "qvbr"}, */
|
||||||
|
/* {VA_RC_AVBR, "Average VBR", "avbr"}, */
|
||||||
|
{0, NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (g_once_init_enter (&type)) {
|
||||||
|
GType _type = g_enum_register_static ("GstVaEncoderRateControl", values);
|
||||||
|
g_once_init_leave (&type, _type);
|
||||||
|
}
|
||||||
|
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
|
@ -44,6 +44,9 @@ struct _GstVaEncodePicture
|
||||||
VABufferID coded_buffer;
|
VABufferID coded_buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define GST_TYPE_VA_ENCODER_RATE_CONTROL (gst_va_encoder_rate_control_get_type())
|
||||||
|
GType gst_va_encoder_rate_control_get_type (void);
|
||||||
|
|
||||||
gboolean gst_va_encoder_is_open (GstVaEncoder * self);
|
gboolean gst_va_encoder_is_open (GstVaEncoder * self);
|
||||||
gboolean gst_va_encoder_open (GstVaEncoder * self,
|
gboolean gst_va_encoder_open (GstVaEncoder * self,
|
||||||
VAProfile profile,
|
VAProfile profile,
|
||||||
|
|
|
@ -402,34 +402,6 @@ _rate_control_get_name (guint32 rc_mode)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* GstVaH264EncRateControl:
|
|
||||||
*
|
|
||||||
* Since: 1.22
|
|
||||||
*/
|
|
||||||
static GType
|
|
||||||
gst_va_h264_enc_rate_control_get_type (void)
|
|
||||||
{
|
|
||||||
static gsize type = 0;
|
|
||||||
|
|
||||||
static const GEnumValue values[] = {
|
|
||||||
{VA_RC_CBR, "Constant Bitrate", "cbr"},
|
|
||||||
{VA_RC_VBR, "Variable Bitrate", "vbr"},
|
|
||||||
{VA_RC_VCM, "Video Conferencing Mode (Non HRD compliant)", "vcm"},
|
|
||||||
{VA_RC_CQP, "Constant Quantizer", "cqp"},
|
|
||||||
{0, NULL, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (g_once_init_enter (&type)) {
|
|
||||||
GType _type;
|
|
||||||
|
|
||||||
_type = g_enum_register_static ("GstVaH264EncRateControl", values);
|
|
||||||
g_once_init_leave (&type, _type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstVaH264Mbbrc:
|
* GstVaH264Mbbrc:
|
||||||
*
|
*
|
||||||
|
@ -4464,7 +4436,7 @@ gst_va_h264_enc_class_init (gpointer g_klass, gpointer class_data)
|
||||||
*/
|
*/
|
||||||
properties[PROP_RATE_CONTROL] = g_param_spec_enum ("rate-control",
|
properties[PROP_RATE_CONTROL] = g_param_spec_enum ("rate-control",
|
||||||
"rate control mode", "The desired rate control mode for the encoder",
|
"rate control mode", "The desired rate control mode for the encoder",
|
||||||
gst_va_h264_enc_rate_control_get_type (), VA_RC_CBR,
|
GST_TYPE_VA_ENCODER_RATE_CONTROL, VA_RC_CBR,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
|
||||||
|
|
||||||
properties[PROP_DEVICE_PATH] = g_param_spec_string ("device-path",
|
properties[PROP_DEVICE_PATH] = g_param_spec_string ("device-path",
|
||||||
|
@ -4473,7 +4445,7 @@ gst_va_h264_enc_class_init (gpointer g_klass, gpointer class_data)
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
|
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
|
||||||
|
|
||||||
gst_type_mark_as_plugin_api (gst_va_h264_enc_rate_control_get_type (), 0);
|
gst_type_mark_as_plugin_api (gst_va_encoder_rate_control_get_type (), 0);
|
||||||
gst_type_mark_as_plugin_api (gst_va_h264_enc_mbbrc_get_type (), 0);
|
gst_type_mark_as_plugin_api (gst_va_h264_enc_mbbrc_get_type (), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue