va: Use GST_CAPS_FEATURE_MEMORY_VA to replace "memory:VAMemory".

"memory:VAMemory" is a commonly used string which notates our VA-kind
memory type. We now used a definition in va lib to replace the simply
string usage.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2466>
This commit is contained in:
He Junyan 2021-08-16 13:45:39 +08:00
parent d14e8055ad
commit fbf6bfd4d8
11 changed files with 42 additions and 22 deletions

View file

@ -55,6 +55,13 @@ typedef enum
*/
#define GST_VA_DISPLAY_HANDLE_CONTEXT_TYPE_STR "gst.va.display.handle"
/**
* GST_CAPS_FEATURE_MEMORY_VA:
*
* Since: 1.20
*/
#define GST_CAPS_FEATURE_MEMORY_VA "memory:VAMemory"
/**
* GST_VA_DISPLAY_IS_IMPLEMENTATION: (skip)
*

View file

@ -81,8 +81,10 @@ struct _GstVaAV1Dec
};
/* *INDENT-OFF* */
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
"{ NV12, P010_10LE }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12, P010_10LE }");
static const gchar *src_caps_str =
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VA,
"{ NV12, P010_10LE }") " ;"
GST_VIDEO_CAPS_MAKE ("{ NV12, P010_10LE }");
/* *INDENT-ON* */
static const gchar *sink_caps_str = "video/x-av1";

View file

@ -344,7 +344,7 @@ _decide_allocation_for_video_crop (GstVideoDecoder * decoder,
va_caps = gst_caps_copy (caps);
gst_caps_set_features_simple (va_caps,
gst_caps_features_from_string ("memory:VAMemory"));
gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_VA));
if (!(allocator = _create_allocator (base, va_caps))) {
ret = FALSE;
@ -749,7 +749,7 @@ gst_va_base_dec_get_preferred_format_and_caps_features (GstVaBaseDec * base,
if (gst_caps_features_is_any (features))
continue;
if (gst_caps_features_contains (features, "memory:VAMemory")) {
if (gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_VA)) {
preferred_caps = gst_caps_new_full (gst_structure_copy (structure), NULL);
gst_caps_set_features_simple (preferred_caps,
gst_caps_features_copy (features));

View file

@ -209,7 +209,7 @@ gst_va_create_raw_caps_from_config (GstVaDisplay * display, VAConfigID config)
if (mem_type & VA_SURFACE_ATTRIB_MEM_TYPE_VA) {
feature_caps = gst_caps_copy (base_caps);
features = gst_caps_features_from_string ("memory:VAMemory");
features = gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_VA);
gst_caps_set_features_simple (feature_caps, features);
caps = gst_caps_merge (caps, feature_caps);
}
@ -409,7 +409,7 @@ _regroup_raw_caps (GstCaps * caps)
ft = gst_caps_get_features (tmp, 0);
if (gst_caps_features_contains (ft, GST_CAPS_FEATURE_MEMORY_DMABUF)) {
dma_caps = gst_caps_merge (dma_caps, tmp);
} else if (gst_caps_features_contains (ft, "memory:VAMemory")) {
} else if (gst_caps_features_contains (ft, GST_CAPS_FEATURE_MEMORY_VA)) {
va_caps = gst_caps_merge (va_caps, tmp);
} else {
sys_caps = gst_caps_merge (sys_caps, tmp);
@ -553,7 +553,7 @@ gst_caps_is_dmabuf (GstCaps * caps)
gboolean
gst_caps_is_vamemory (GstCaps * caps)
{
return _caps_is (caps, "memory:VAMemory");
return _caps_is (caps, GST_CAPS_FEATURE_MEMORY_VA);
}
gboolean

View file

@ -938,7 +938,7 @@ gst_va_filter_get_caps (GstVaFilter * self)
if (mem_types & VA_SURFACE_ATTRIB_MEM_TYPE_VA) {
feature_caps = gst_caps_copy (base_caps);
features = gst_caps_features_from_string ("memory:VAMemory");
features = gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_VA);
gst_caps_set_features_simple (feature_caps, features);
caps = gst_caps_merge (caps, feature_caps);
}

View file

@ -90,8 +90,10 @@ struct _GstVaH264Dec
};
/* *INDENT-OFF* */
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
"{ NV12, P010_10LE }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12, P010_10LE }");
static const gchar *src_caps_str =
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VA,
"{ NV12, P010_10LE }") " ;"
GST_VIDEO_CAPS_MAKE ("{ NV12, P010_10LE }");
/* *INDENT-ON* */
static const gchar *sink_caps_str = "video/x-h264";

View file

@ -104,8 +104,10 @@ struct _GstVaH265Dec
};
/* *INDENT-OFF* */
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
"{ NV12, P010_10LE }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12, P010_10LE }");
static const gchar *src_caps_str =
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VA,
"{ NV12, P010_10LE }") " ;"
GST_VIDEO_CAPS_MAKE ("{ NV12, P010_10LE }");
/* *INDENT-ON* */
static const gchar *sink_caps_str = "video/x-h265";

View file

@ -77,8 +77,10 @@ struct _GstVaMpeg2Dec
};
/* *INDENT-OFF* */
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
"{ NV12 }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12 }");
static const gchar *src_caps_str =
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VA,
"{ NV12 }") " ;"
GST_VIDEO_CAPS_MAKE ("{ NV12 }");
/* *INDENT-ON* */
static const gchar *sink_caps_str = "video/x-mpeg2";

View file

@ -76,8 +76,10 @@ struct _GstVaVp8Dec
};
/* *INDENT-OFF* */
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
"{ NV12 }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12 }");
static const gchar *src_caps_str =
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VA,
"{ NV12 }") " ;"
GST_VIDEO_CAPS_MAKE ("{ NV12 }");
/* *INDENT-ON* */
static const gchar *sink_caps_str = "video/x-vp8";

View file

@ -75,8 +75,10 @@ struct _GstVaVp9Dec
};
/* *INDENT-OFF* */
static const gchar *src_caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
"{ NV12 }") " ;" GST_VIDEO_CAPS_MAKE ("{ NV12 }");
static const gchar *src_caps_str =
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VA,
"{ NV12 }") " ;"
GST_VIDEO_CAPS_MAKE ("{ NV12 }");
/* *INDENT-ON* */
static const gchar *sink_caps_str = "video/x-vp9";

View file

@ -147,10 +147,11 @@ enum
};
/* *INDENT-OFF* */
static const gchar *caps_str = GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory",
"{ NV12, I420, YV12, YUY2, RGBA, BGRA, P010_10LE, ARGB, ABGR }") " ;"
GST_VIDEO_CAPS_MAKE ("{ VUYA, GRAY8, NV12, NV21, YUY2, UYVY, YV12, "
"I420, P010_10LE, RGBA, BGRA, ARGB, ABGR }");
static const gchar *caps_str =
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VA,
"{ NV12, I420, YV12, YUY2, RGBA, BGRA, P010_10LE, ARGB, ABGR }") " ;"
GST_VIDEO_CAPS_MAKE ("{ VUYA, GRAY8, NV12, NV21, YUY2, UYVY, YV12, "
"I420, P010_10LE, RGBA, BGRA, ARGB, ABGR }");
/* *INDENT-ON* */
#define META_TAG_COLORSPACE meta_tag_colorspace_quark