/**
* gst_vaapi_filter_get_formats:
* @filter: a #GstVaapiFilter
+ * @min_width: the min width can be supported.
+ * @min_height: the min height can be supported.
+ * @max_width: the max width can be supported.
+ * @max_height: the max height can be supported.
*
* Determines the set of supported source or target formats for video
* processing. The caller owns an extra reference to the resulting
* Return value: the set of supported target formats for video processing.
*/
GArray *
-gst_vaapi_filter_get_formats (GstVaapiFilter * filter)
+gst_vaapi_filter_get_formats (GstVaapiFilter * filter, gint * min_width,
+ gint * min_height, gint * max_width, gint * max_height)
{
+ GstVaapiConfigSurfaceAttributes *attribs;
+
g_return_val_if_fail (filter != NULL, NULL);
if (!ensure_attributes (filter))
return NULL;
+
+ attribs = filter->attribs;
+
+ if (attribs->min_width >= attribs->max_width ||
+ attribs->min_height >= attribs->max_height)
+ return NULL;
+
+ if (min_width)
+ *min_width = attribs->min_width;
+ if (min_height)
+ *min_height = attribs->min_height;
+ if (max_width)
+ *max_width = attribs->max_width;
+ if (max_height)
+ *max_height = attribs->max_height;
+
if (filter->attribs->formats)
return g_array_ref (filter->attribs->formats);
return NULL;
GST_VAAPI_MAKE_SURFACE_CAPS ", "
GST_CAPS_INTERLACED_MODES "; "
GST_VIDEO_CAPS_MAKE (GST_VAAPI_FORMATS_ALL) ", "
- GST_CAPS_INTERLACED_MODES;
+ GST_CAPS_INTERLACED_MODES "; "
+ GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_DMABUF,
+ GST_VAAPI_FORMATS_ALL) ", "
+ GST_CAPS_INTERLACED_MODES;
/* *INDENT-ON* */
/* *INDENT-OFF* */
#endif
GST_VIDEO_CAPS_MAKE (GST_VAAPI_FORMATS_ALL) ", "
GST_CAPS_INTERLACED_MODES "; "
- GST_VAAPI_MAKE_DMABUF_CAPS;
+ GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_DMABUF,
+ GST_VAAPI_FORMATS_ALL);
/* *INDENT-ON* */
/* *INDENT-OFF* */
}
if (!postproc->filter_formats) {
- postproc->filter_formats = gst_vaapi_filter_get_formats (postproc->filter);
+ postproc->filter_formats = gst_vaapi_filter_get_formats
+ (postproc->filter, NULL, NULL, NULL, NULL);
if (!postproc->filter_formats)
return FALSE;
}
static gboolean
ensure_allowed_sinkpad_caps (GstVaapiPostproc * postproc)
{
- GstCaps *out_caps, *raw_caps;
- guint i, num_structures;
-
- if (postproc->allowed_sinkpad_caps)
- return TRUE;
-
- if (!GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc))
- return FALSE;
+ GstCaps *out_caps = NULL;
+ guint mem_types;
+ gint min_width, min_height, max_width, max_height;
+ GArray *mem_formats = NULL;
+ gboolean ret = TRUE;
- /* Create VA caps */
- out_caps = gst_caps_from_string (GST_VAAPI_MAKE_SURFACE_CAPS ", "
- GST_CAPS_INTERLACED_MODES);
- if (!out_caps) {
- GST_WARNING_OBJECT (postproc, "failed to create VA sink caps");
- return FALSE;
+ if (postproc->allowed_sinkpad_caps) {
+ ret = TRUE;
+ goto out;
}
- raw_caps = gst_vaapi_plugin_base_get_allowed_sinkpad_raw_caps
- (GST_VAAPI_PLUGIN_BASE (postproc));
- if (!raw_caps) {
- gst_caps_unref (out_caps);
- GST_WARNING_OBJECT (postproc, "failed to create YUV sink caps");
- return FALSE;
+ if (!GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc) ||
+ !gst_vaapipostproc_ensure_filter_caps (postproc)) {
+ ret = FALSE;
+ goto out;
}
- out_caps = gst_caps_make_writable (out_caps);
- gst_caps_append (out_caps, gst_caps_copy (raw_caps));
+ mem_types = gst_vaapi_filter_get_memory_types (postproc->filter);
+ mem_formats = gst_vaapi_filter_get_formats (postproc->filter, &min_width,
+ &min_height, &max_width, &max_height);
- num_structures = gst_caps_get_size (out_caps);
- for (i = 0; i < num_structures; i++) {
- GstStructure *structure;
-
- structure = gst_caps_get_structure (out_caps, i);
- if (!structure)
- continue;
-
- if (postproc->filter)
- gst_vaapi_filter_append_caps (postproc->filter, structure);
+ out_caps = gst_vaapi_build_caps_from_formats (mem_formats, min_width,
+ min_height, max_width, max_height, mem_types);
+ if (!out_caps) {
+ GST_WARNING_OBJECT (postproc, "failed to create VA sink caps");
+ ret = FALSE;
+ goto out;
}
postproc->allowed_sinkpad_caps = out_caps;
+ out_caps = NULL;
+ GST_INFO_OBJECT (postproc, "postproc sink allowed caps is %" GST_PTR_FORMAT,
+ postproc->allowed_sinkpad_caps);
+out:
+ if (out_caps)
+ gst_caps_unref (out_caps);
+ if (mem_formats)
+ g_array_unref (mem_formats);
- /* XXX: append VA/VPP filters */
- return TRUE;
+ return ret;
}
/* Fixup output caps so that to reflect the supported set of pixel formats */