mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
vaapipostproc: append frame size restrictions in caps
This commit is contained in:
parent
13e369aad6
commit
f88d18bebe
3 changed files with 59 additions and 3 deletions
|
@ -1699,6 +1699,43 @@ gst_vaapi_filter_set_format (GstVaapiFilter * filter, GstVideoFormat format)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_vaapi_filter_append_caps:
|
||||||
|
* @filter: a #GstVaapiFilter
|
||||||
|
* @structure: a #GstStructure from #GstCaps
|
||||||
|
*
|
||||||
|
* Extracts the config's surface attributes, from @filter's context,
|
||||||
|
* and transforms it into a caps formats and appended them into
|
||||||
|
* @structure.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if the capabilities could be extracted and appended
|
||||||
|
* into @structure; otherwise %FALSE
|
||||||
|
**/
|
||||||
|
gboolean
|
||||||
|
gst_vaapi_filter_append_caps (GstVaapiFilter * filter, GstStructure * structure)
|
||||||
|
{
|
||||||
|
GstVaapiConfigSurfaceAttributes *attribs;
|
||||||
|
|
||||||
|
g_return_val_if_fail (filter != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (structure != NULL, FALSE);
|
||||||
|
|
||||||
|
if (!ensure_attributes (filter))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
attribs = filter->attribs;
|
||||||
|
|
||||||
|
if (attribs->min_width >= attribs->max_width ||
|
||||||
|
attribs->min_height >= attribs->max_height)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
gst_structure_set (structure, "width", GST_TYPE_INT_RANGE, attribs->min_width,
|
||||||
|
attribs->max_width, "height", GST_TYPE_INT_RANGE, attribs->min_height,
|
||||||
|
attribs->max_height, NULL);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_vaapi_filter_set_cropping_rectangle:
|
* gst_vaapi_filter_set_cropping_rectangle:
|
||||||
* @filter: a #GstVaapiFilter
|
* @filter: a #GstVaapiFilter
|
||||||
|
|
|
@ -210,6 +210,9 @@ gst_vaapi_filter_get_formats (GstVaapiFilter * filter);
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_filter_set_format (GstVaapiFilter * filter, GstVideoFormat format);
|
gst_vaapi_filter_set_format (GstVaapiFilter * filter, GstVideoFormat format);
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gst_vaapi_filter_append_caps (GstVaapiFilter * filter, GstStructure * structure);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_filter_set_cropping_rectangle (GstVaapiFilter * filter,
|
gst_vaapi_filter_set_cropping_rectangle (GstVaapiFilter * filter,
|
||||||
const GstVaapiRectangle * rect);
|
const GstVaapiRectangle * rect);
|
||||||
|
|
|
@ -1103,6 +1103,7 @@ static gboolean
|
||||||
ensure_allowed_sinkpad_caps (GstVaapiPostproc * postproc)
|
ensure_allowed_sinkpad_caps (GstVaapiPostproc * postproc)
|
||||||
{
|
{
|
||||||
GstCaps *out_caps, *raw_caps;
|
GstCaps *out_caps, *raw_caps;
|
||||||
|
guint i, num_structures;
|
||||||
|
|
||||||
if (postproc->allowed_sinkpad_caps)
|
if (postproc->allowed_sinkpad_caps)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1128,6 +1129,18 @@ ensure_allowed_sinkpad_caps (GstVaapiPostproc * postproc)
|
||||||
|
|
||||||
out_caps = gst_caps_make_writable (out_caps);
|
out_caps = gst_caps_make_writable (out_caps);
|
||||||
gst_caps_append (out_caps, gst_caps_copy (raw_caps));
|
gst_caps_append (out_caps, gst_caps_copy (raw_caps));
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
gst_vaapi_filter_append_caps (postproc->filter, structure);
|
||||||
|
}
|
||||||
|
|
||||||
postproc->allowed_sinkpad_caps = out_caps;
|
postproc->allowed_sinkpad_caps = out_caps;
|
||||||
|
|
||||||
/* XXX: append VA/VPP filters */
|
/* XXX: append VA/VPP filters */
|
||||||
|
@ -1160,15 +1173,18 @@ expand_allowed_srcpad_caps (GstVaapiPostproc * postproc, GstCaps * caps)
|
||||||
GstCapsFeatures *const features = gst_caps_get_features (caps, i);
|
GstCapsFeatures *const features = gst_caps_get_features (caps, i);
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
|
|
||||||
|
structure = gst_caps_get_structure (caps, i);
|
||||||
|
if (!structure)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
gst_vaapi_filter_append_caps (postproc->filter, structure);
|
||||||
|
|
||||||
if (gst_caps_features_contains (features,
|
if (gst_caps_features_contains (features,
|
||||||
GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META)) {
|
GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META)) {
|
||||||
gl_upload_meta_idx = i;
|
gl_upload_meta_idx = i;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, i);
|
|
||||||
if (!structure)
|
|
||||||
continue;
|
|
||||||
gst_structure_set_value (structure, "format", &value);
|
gst_structure_set_value (structure, "format", &value);
|
||||||
}
|
}
|
||||||
g_value_unset (&value);
|
g_value_unset (&value);
|
||||||
|
|
Loading…
Reference in a new issue