common: Stop using GQuark-based GstCapsFeatures API

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432>
This commit is contained in:
Sebastian Dröge 2024-08-30 18:57:03 +03:00
parent eed7c9c66a
commit 3b9f050600
3 changed files with 20 additions and 19 deletions

View file

@ -848,13 +848,13 @@ gst_va_base_dec_get_preferred_format_and_caps_features (GstVaBaseDec * base,
GstCapsFeatures *features;
guint num_structures, i, j;
gboolean is_any;
/* array designators might not be supported by some compilers */
const GQuark feats[] = {
/* [VA] = */ g_quark_from_string (GST_CAPS_FEATURE_MEMORY_VA),
/* [DMABUF] = */ g_quark_from_string (GST_CAPS_FEATURE_MEMORY_DMABUF),
/* [SYSMEM] = */
g_quark_from_string (GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY),
};
GstIdStr sysmem = GST_ID_STR_INIT, dmabuf = GST_ID_STR_INIT, va =
GST_ID_STR_INIT;
const GstIdStr *feats[] = { &va, &dmabuf, &sysmem };
gst_id_str_set_static_str (&sysmem, GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
gst_id_str_set_static_str (&dmabuf, GST_CAPS_FEATURE_MEMORY_DMABUF);
gst_id_str_set_static_str (&va, GST_CAPS_FEATURE_MEMORY_VA);
g_return_if_fail (base);
@ -897,7 +897,7 @@ gst_va_base_dec_get_preferred_format_and_caps_features (GstVaBaseDec * base,
guint64 mod = 0;
features = gst_caps_get_features (allowed_caps, j);
if (!gst_caps_features_contains_id (features, feats[i]))
if (!gst_caps_features_contains_id_str (features, feats[i]))
continue;
structure = gst_caps_get_structure (allowed_caps, j);
@ -918,7 +918,7 @@ gst_va_base_dec_get_preferred_format_and_caps_features (GstVaBaseDec * base,
if (i == DMABUF && modifier)
*modifier = mod;
if (capsfeatures)
*capsfeatures = gst_caps_features_new_id (feats[i], NULL);
*capsfeatures = gst_caps_features_new_id_str (feats[i], NULL);
goto bail;
}

View file

@ -944,11 +944,12 @@ gst_va_vpp_caps_remove_fields (GstCaps * caps)
GstStructure *structure;
GstCapsFeatures *features;
gint i, n;
guint sysmem, dmabuf, va;
GstIdStr sysmem = GST_ID_STR_INIT, dmabuf = GST_ID_STR_INIT, va =
GST_ID_STR_INIT;
sysmem = g_quark_from_static_string (GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
dmabuf = g_quark_from_static_string (GST_CAPS_FEATURE_MEMORY_DMABUF);
va = g_quark_from_static_string (GST_CAPS_FEATURE_MEMORY_VA);
gst_id_str_set_static_str (&sysmem, GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
gst_id_str_set_static_str (&dmabuf, GST_CAPS_FEATURE_MEMORY_DMABUF);
gst_id_str_set_static_str (&va, GST_CAPS_FEATURE_MEMORY_VA);
ret = gst_caps_new_empty ();
@ -964,9 +965,9 @@ gst_va_vpp_caps_remove_fields (GstCaps * caps)
structure = gst_structure_copy (structure);
if (gst_caps_features_contains_id (features, sysmem)
|| gst_caps_features_contains_id (features, dmabuf)
|| gst_caps_features_contains_id (features, va)) {
if (gst_caps_features_contains_id_str (features, &sysmem)
|| gst_caps_features_contains_id_str (features, &dmabuf)
|| gst_caps_features_contains_id_str (features, &va)) {
/* rangify frame size */
gst_structure_set (structure, "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
"height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);

View file

@ -131,7 +131,7 @@ filter_features (GstCapsFeatures * features,
G_GNUC_UNUSED GstStructure * structure, gpointer user_data)
{
const GstCapsFeatures *user_features = user_data;
GQuark feature;
const GstIdStr *feature;
guint i, num;
if (gst_caps_features_is_any (features))
@ -139,8 +139,8 @@ filter_features (GstCapsFeatures * features,
num = gst_caps_features_get_size (user_features);
for (i = 0; i < num; i++) {
feature = gst_caps_features_get_nth_id (user_features, i);
if (gst_caps_features_contains_id (features, feature))
feature = gst_caps_features_get_nth_id_str (user_features, i);
if (gst_caps_features_contains_id_str (features, feature))
return TRUE;
}