videobalance: Allow ANY capsfeatures, but only in passthrough mode

When changing the properties to not be in passthrough mode anymore,
we will only accept caps we can process ourselves, potentially causing
a not-negotiated error.

https://bugzilla.gnome.org/show_bug.cgi?id=720345
This commit is contained in:
Sebastian Dröge 2014-08-13 13:04:21 +03:00
parent 9a15b976d7
commit a9eda81978

View file

@ -71,7 +71,7 @@ static GstStaticPadTemplate gst_video_balance_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ AYUV, "
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("ANY", "{ AYUV, "
"ARGB, BGRA, ABGR, RGBA, Y444, xRGB, RGBx, "
"xBGR, BGRx, RGB, BGR, Y42B, YUY2, UYVY, YVYU, "
"I420, YV12, IYUV, Y41B, NV12, NV21 }"))
@ -81,7 +81,7 @@ static GstStaticPadTemplate gst_video_balance_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ AYUV, "
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("ANY", "{ AYUV, "
"ARGB, BGRA, ABGR, RGBA, Y444, xRGB, RGBx, "
"xBGR, BGRx, RGB, BGR, Y42B, YUY2, UYVY, YVYU, "
"I420, YV12, IYUV, Y41B, NV12, NV21 }"))
@ -484,6 +484,35 @@ gst_video_balance_before_transform (GstBaseTransform * base, GstBuffer * buf)
gst_object_sync_values (GST_OBJECT (balance), stream_time);
}
static GstCaps *
gst_video_balance_transform_caps (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps, GstCaps * filter)
{
GstVideoBalance *balance = GST_VIDEO_BALANCE (trans);
GstCaps *ret;
if (!gst_video_balance_is_passthrough (balance)) {
static GstStaticCaps raw_caps = GST_STATIC_CAPS ("video/x-raw");
caps = gst_caps_intersect (caps, gst_static_caps_get (&raw_caps));
if (filter) {
ret = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (caps);
} else {
ret = caps;
}
} else {
if (filter) {
ret = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
} else {
ret = gst_caps_ref (caps);
}
}
return ret;
}
static GstFlowReturn
gst_video_balance_transform_frame_ip (GstVideoFilter * vfilter,
GstVideoFrame * frame)
@ -574,6 +603,8 @@ gst_video_balance_class_init (GstVideoBalanceClass * klass)
trans_class->before_transform =
GST_DEBUG_FUNCPTR (gst_video_balance_before_transform);
trans_class->transform_ip_on_passthrough = FALSE;
trans_class->transform_caps =
GST_DEBUG_FUNCPTR (gst_video_balance_transform_caps);
vfilter_class->set_info = GST_DEBUG_FUNCPTR (gst_video_balance_set_info);
vfilter_class->transform_frame_ip =