glfilter: only allow the same src/sink caps when we are in passthrough mode

If we are given caps with extra features (like the overlay composition
features), we can only deal with that when we are in passthrough mode.

Previously we were bailing entirely and not allowing passthrough filter elements
with things like textoverlay.

Fixes the following pipeline (assuming glfilter supports passthrough):
gl ! textoverlay ! glfilter ! ... ! glimagesinkelement

https://bugzilla.gnome.org/show_bug.cgi?id=763756
This commit is contained in:
Matthew Waters 2016-03-17 01:52:00 +11:00 committed by Tim-Philipp Müller
parent 356494d967
commit d5cc277601

View file

@ -41,6 +41,12 @@ GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_SRC,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), " GST_STATIC_CAPS ("video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), "
"format = (string) RGBA, "
"width = " GST_VIDEO_SIZE_RANGE ", "
"height = " GST_VIDEO_SIZE_RANGE ", "
"framerate = " GST_VIDEO_FPS_RANGE ","
"texture-target = (string) 2D ; "
"video/x-raw(ANY), "
"format = (string) RGBA, " "format = (string) RGBA, "
"width = " GST_VIDEO_SIZE_RANGE ", " "width = " GST_VIDEO_SIZE_RANGE ", "
"height = " GST_VIDEO_SIZE_RANGE ", " "height = " GST_VIDEO_SIZE_RANGE ", "
@ -52,7 +58,13 @@ static GstStaticPadTemplate gst_gl_filter_sink_pad_template =
GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK, GST_PAD_SINK,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), " GST_STATIC_CAPS ("video/x-raw(ANY), "
"format = (string) RGBA, "
"width = " GST_VIDEO_SIZE_RANGE ", "
"height = " GST_VIDEO_SIZE_RANGE ", "
"framerate = " GST_VIDEO_FPS_RANGE ","
"texture-target = (string) 2D ; "
"video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), "
"format = (string) RGBA, " "format = (string) RGBA, "
"width = " GST_VIDEO_SIZE_RANGE ", " "width = " GST_VIDEO_SIZE_RANGE ", "
"height = " GST_VIDEO_SIZE_RANGE ", " "height = " GST_VIDEO_SIZE_RANGE ", "
@ -70,8 +82,7 @@ enum
#define gst_gl_filter_parent_class parent_class #define gst_gl_filter_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstGLFilter, gst_gl_filter, GST_TYPE_GL_BASE_FILTER, G_DEFINE_TYPE_WITH_CODE (GstGLFilter, gst_gl_filter, GST_TYPE_GL_BASE_FILTER,
GST_DEBUG_CATEGORY_INIT (gst_gl_filter_debug, "glfilter", 0, GST_DEBUG_CATEGORY_INIT (gst_gl_filter_debug, "glfilter", 0,
"glfilter element"); "glfilter element"););
);
static void gst_gl_filter_set_property (GObject * object, guint prop_id, static void gst_gl_filter_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
@ -631,13 +642,18 @@ gst_gl_filter_transform_caps (GstBaseTransform * bt,
GstCaps *tmp = NULL; GstCaps *tmp = NULL;
GstCaps *result = NULL; GstCaps *result = NULL;
tmp = GST_GL_FILTER_GET_CLASS (filter)->transform_internal_caps (filter, if (gst_base_transform_is_passthrough (bt)) {
direction, caps, NULL); tmp = gst_caps_ref (caps);
} else {
tmp = GST_GL_FILTER_GET_CLASS (filter)->transform_internal_caps (filter,
direction, caps, NULL);
result = result =
gst_gl_filter_set_caps_features (tmp, GST_CAPS_FEATURE_MEMORY_GL_MEMORY); gst_gl_filter_set_caps_features (tmp,
gst_caps_unref (tmp); GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
tmp = result; gst_caps_unref (tmp);
tmp = result;
}
if (filter_caps) { if (filter_caps) {
result = result =