vah264enc: Guard logging functions

.. and use spec for rate control rather than static switch.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2522>
This commit is contained in:
Víctor Manuel Jáquez Leal 2022-05-29 13:43:29 +02:00 committed by GStreamer Marge Bot
parent 261714e25d
commit 045b6f5ea3

View file

@ -326,6 +326,7 @@ static const GstVaH264LevelLimits _va_h264_level_limits[] = {
}; };
/* *INDENT-ON* */ /* *INDENT-ON* */
#ifndef GST_DISABLE_GST_DEBUG
static const gchar * static const gchar *
_slice_type_name (GstH264SliceType type) _slice_type_name (GstH264SliceType type)
{ {
@ -346,22 +347,22 @@ _slice_type_name (GstH264SliceType type)
static const gchar * static const gchar *
_rate_control_get_name (guint32 rc_mode) _rate_control_get_name (guint32 rc_mode)
{ {
switch (rc_mode) { GParamSpecEnum *spec;
case VA_RC_CBR: guint i;
return "cbr";
case VA_RC_VBR: if (!(properties[PROP_RATE_CONTROL]
return "vbr"; && G_IS_PARAM_SPEC_ENUM (properties[PROP_RATE_CONTROL])))
case VA_RC_VCM: return NULL;
return "vcm";
case VA_RC_CQP: spec = G_PARAM_SPEC_ENUM (properties[PROP_RATE_CONTROL]);
return "cqp"; for (i = 0; i < spec->enum_class->n_values; i++) {
default: if (spec->enum_class->values[i].value == rc_mode)
return "unknown"; return spec->enum_class->values[i].value_nick;
} }
g_assert_not_reached ();
return NULL; return NULL;
} }
#endif
static GstVaH264EncFrame * static GstVaH264EncFrame *
gst_va_enc_frame_new (void) gst_va_enc_frame_new (void)