From c64c58bd118a6341bfeabf5ee28de2359574ce9b Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Tue, 10 Jun 2003 16:22:41 +0000 Subject: [PATCH] Backport of #109069 Original commit message from CVS: Backport of #109069 --- gst/videotestsrc/gstvideotestsrc.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c index 6dd7908..a9f71b5 100644 --- a/gst/videotestsrc/gstvideotestsrc.c +++ b/gst/videotestsrc/gstvideotestsrc.c @@ -193,9 +193,33 @@ gst_videotestsrc_srcconnect (GstPad * pad, GstCaps * caps) GST_DEBUG (0, "gst_videotestsrc_srcconnect"); videotestsrc = GST_VIDEOTESTSRC (gst_pad_get_parent (pad)); - videotestsrc->fourcc = paintinfo_find_by_caps(caps); - if(!videotestsrc->fourcc){ - return GST_PAD_LINK_DELAYED; + for ( ; caps != NULL; caps = caps->next) { + GstCaps *caps1 = gst_caps_copy_1(caps); + GstPadLinkReturn ret; + + ret = gst_pad_try_set_caps(pad, caps1); + + if (ret != GST_PAD_LINK_OK && + ret != GST_PAD_LINK_DONE) { + gst_caps_unref(caps1); + continue; + } + + videotestsrc->fourcc = paintinfo_find_by_caps(caps1); + if (!videotestsrc->fourcc) { + gst_caps_unref(caps1); + continue; + } + + /* if we get here, it's allright */ + gst_caps_unref(caps1); + break; + } + + if (caps == NULL) { + GST_DEBUG (GST_CAT_PLUGIN_ERRORS, + "videotestsrc: no suitable opposite-side caps found"); + return GST_PAD_LINK_REFUSED; } GST_DEBUG (0,"videotestsrc: using fourcc element %p %s\n", @@ -208,7 +232,7 @@ gst_videotestsrc_srcconnect (GstPad * pad, GstCaps * caps) GST_DEBUG (0, "size %d x %d", videotestsrc->width, videotestsrc->height); - return GST_PAD_LINK_OK; + return GST_PAD_LINK_DONE; } static GstElementStateReturn -- 2.7.4