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

View file

@ -944,11 +944,12 @@ gst_va_vpp_caps_remove_fields (GstCaps * caps)
GstStructure *structure; GstStructure *structure;
GstCapsFeatures *features; GstCapsFeatures *features;
gint i, n; 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); gst_id_str_set_static_str (&sysmem, GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
dmabuf = g_quark_from_static_string (GST_CAPS_FEATURE_MEMORY_DMABUF); gst_id_str_set_static_str (&dmabuf, GST_CAPS_FEATURE_MEMORY_DMABUF);
va = g_quark_from_static_string (GST_CAPS_FEATURE_MEMORY_VA); gst_id_str_set_static_str (&va, GST_CAPS_FEATURE_MEMORY_VA);
ret = gst_caps_new_empty (); ret = gst_caps_new_empty ();
@ -964,9 +965,9 @@ gst_va_vpp_caps_remove_fields (GstCaps * caps)
structure = gst_structure_copy (structure); structure = gst_structure_copy (structure);
if (gst_caps_features_contains_id (features, sysmem) if (gst_caps_features_contains_id_str (features, &sysmem)
|| gst_caps_features_contains_id (features, dmabuf) || gst_caps_features_contains_id_str (features, &dmabuf)
|| gst_caps_features_contains_id (features, va)) { || gst_caps_features_contains_id_str (features, &va)) {
/* rangify frame size */ /* rangify frame size */
gst_structure_set (structure, "width", GST_TYPE_INT_RANGE, 1, G_MAXINT, gst_structure_set (structure, "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
"height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); "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) G_GNUC_UNUSED GstStructure * structure, gpointer user_data)
{ {
const GstCapsFeatures *user_features = user_data; const GstCapsFeatures *user_features = user_data;
GQuark feature; const GstIdStr *feature;
guint i, num; guint i, num;
if (gst_caps_features_is_any (features)) if (gst_caps_features_is_any (features))
@ -139,8 +139,8 @@ filter_features (GstCapsFeatures * features,
num = gst_caps_features_get_size (user_features); num = gst_caps_features_get_size (user_features);
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
feature = gst_caps_features_get_nth_id (user_features, i); feature = gst_caps_features_get_nth_id_str (user_features, i);
if (gst_caps_features_contains_id (features, feature)) if (gst_caps_features_contains_id_str (features, feature))
return TRUE; return TRUE;
} }