vapostproc: Build classification dynamically.

By default, the classification is
"Converter/Filter/Colorspace/Scaler/Video/Hardware", but if VA
post-processor driver supports either color balance, skin tone
enhancement, sharpening or noise reduction, "Effect" is added.

Thus, if vapostproc ranking is raised, it can be chosen by
autovideosink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2066>
This commit is contained in:
Víctor Manuel Jáquez Leal 2022-03-29 20:14:40 +02:00
parent 041eee6c2e
commit 599257bf10

View file

@ -2021,6 +2021,7 @@ gst_va_vpp_class_init (gpointer g_class, gpointer class_data)
GstVaFilter *filter;
struct CData *cdata = class_data;
gchar *long_name;
GString *klass;
parent_class = g_type_class_peek_parent (g_class);
@ -2033,10 +2034,7 @@ gst_va_vpp_class_init (gpointer g_class, gpointer class_data)
long_name = g_strdup ("VA-API Video Postprocessor");
}
gst_element_class_set_metadata (element_class, long_name,
"Filter/Converter/Video/Scaler/Hardware",
"VA-API based video postprocessor",
"Víctor Jáquez <vjaquez@igalia.com>");
klass = g_string_new ("Converter/Filter/Colorspace/Scaler/Video/Hardware");
display = gst_va_display_drm_new_from_path (btrans_class->render_device_path);
filter = gst_va_filter_new (display);
@ -2050,10 +2048,32 @@ gst_va_vpp_class_init (gpointer g_class, gpointer class_data)
gst_caps_set_features_simple (any_caps, gst_caps_features_new_any ());
caps = gst_caps_merge (caps, any_caps);
}
/* add converter klass */
{
int i;
VAProcFilterType types[] = { VAProcFilterColorBalance,
VAProcFilterSkinToneEnhancement, VAProcFilterSharpening,
VAProcFilterNoiseReduction
};
for (i = 0; i < G_N_ELEMENTS (types); i++) {
if (gst_va_filter_has_filter (filter, types[i])) {
g_string_prepend (klass, "Effect/");
break;
}
}
}
} else {
caps = gst_caps_from_string (caps_str);
}
gst_element_class_set_metadata (element_class, long_name, klass->str,
"VA-API based video postprocessor",
"Víctor Jáquez <vjaquez@igalia.com>");
g_string_free (klass, TRUE);
doc_caps = gst_caps_from_string (caps_str);
sink_pad_templ = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,