From: Laurent S. <lr...@us...> - 2005-03-21 23:16:02
|
Update of /cvsroot/ruby-gnome2/ruby-gnome2/gstreamer/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9809/src Modified Files: rbgstelement.c rbgstpad.c Log Message: added #link_filtered Index: rbgstelement.c =================================================================== RCS file: /cvsroot/ruby-gnome2/ruby-gnome2/gstreamer/src/rbgstelement.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- rbgstelement.c 3 Aug 2004 19:35:40 -0000 1.16 +++ rbgstelement.c 21 Mar 2005 23:15:50 -0000 1.17 @@ -381,6 +381,34 @@ return gst_element_link (element1, element2) == TRUE ? other_element : Qnil; } +/* + * Method: link_filtered(element, caps) + * element: a Gst::Element object. + * caps: a Gst::Caps object. + * + * Links this element (source) to the provided element (destination), + * filtered by the given caps. + * + * The method looks for existing pads and request pads that + * aren't linked yet. If multiple links are possible, only one + * is established. + * + * Returns: the destination element, or nil if the link failed. + */ +static VALUE +rb_gst_element_link_filtered (VALUE self, VALUE other_element, VALUE rcaps) +{ + GstElement *element1, *element2; + GstCaps *caps; + + element1 = RGST_ELEMENT (self); + element2 = RGST_ELEMENT (other_element); + caps = RGST_CAPS (rcaps); + return gst_element_link_filtered (element1, element2, caps) + ? other_element + : Qnil; +} + /* Method: requires_clock? * Returns: true if the element requires a clock, false otherwise. */ @@ -1220,6 +1248,7 @@ rb_define_method (c, "sched_interrupt", rb_gst_element_sched_interrupt, 0); rb_define_method (c, "link", rb_gst_element_link, 1); rb_define_alias (c, ">>", "link"); + rb_define_method (c, "link_filtered", rb_gst_element_link_filtered, 2); rb_define_method (c, "provides_clock?", rb_gst_element_provides_clock, 0); rb_define_method (c, "requires_clock?", rb_gst_element_requires_clock, 0); rb_define_method (c, "clock", rb_gst_element_get_clock, 0); Index: rbgstpad.c =================================================================== RCS file: /cvsroot/ruby-gnome2/ruby-gnome2/gstreamer/src/rbgstpad.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- rbgstpad.c 21 Mar 2005 22:49:50 -0000 1.16 +++ rbgstpad.c 21 Mar 2005 23:15:51 -0000 1.17 @@ -233,6 +233,25 @@ } /* + * Method: link_filtered(other_pad, caps) + * other_pad: a Gst::Pad. + * caps: a Gst::Caps. + * + * Links the current pad (source) to an other pad (sink), constrained by + * the given filter caps. + * + * Returns: true if the pads have been linked, false otherwise. + */ +static VALUE +rb_gst_pad_link_filtered (VALUE self, VALUE other_pad, VALUE rcaps) +{ + GstPad *srcpad = RGST_PAD (self); + GstPad *sinkpad = RGST_PAD (other_pad); + GstCaps *caps = RGST_CAPS (rcaps); + return CBOOL2RVAL (gst_pad_link_filtered (srcpad, sinkpad, caps)); +} + +/* * Method: unlink(other_pad) * other_pad: a Gst::Pad. * @@ -354,6 +373,7 @@ rb_define_method (c, "each_event_mask", rb_gst_pad_each_event_mask, 0); rb_define_method (c, "each_query_type", rb_gst_pad_each_query_type, 0); rb_define_method (c, "link", rb_gst_pad_link, 1); + rb_define_method (c, "link_filtered", rb_gst_pad_link_filtered, 2); rb_define_method (c, "unlink", rb_gst_pad_unlink, 1); rb_define_method (c, "disabled?", rb_gst_pad_is_disabled, 0); rb_define_method (c, "negotiating?", rb_gst_pad_is_negotiating, 0); |