[Vala] GStreamer signal connection in Vala

38 views
Skip to first unread message

Thomas

unread,
Mar 5, 2012, 3:12:00 PM3/5/12
to vala...@gnome.org
Hi,

I am new to Vala. I am trying to develop a simple application using
Gstreamer and Vala, but I fail with the connection of signlas defined
within the Gstreamer Element cairoooverlay
(http://developer.gnome.org/gst-plugins-libs/unstable/gst-plugins-good-plugins-cairooverlay.html).
What i am Trying to do ist the following:

this.pipeline = (Pipeline)Gst.parse_launch("... cairooverlay
name=overlay ...");
...
Element ov = this.pipeline.get_by_name("overlay");
ov.connect("caps_changed", this.caps_changed_cb);

The code compiles fine, but I get the runtime warning and the signal
is not connected.

GLib-GObject-WARNING **: g_object_connect: invalid signal spec "caps_changed"

What is standard way to connect to this signal with a proper callback
in Vala? The function to connect the signal from C is
g_signal_connect.

Cheers
Thomas

_______________________________________________
vala-list mailing list
vala...@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Fabian Deutsch

unread,
Mar 5, 2012, 3:19:27 PM3/5/12
to Thomas, vala...@gnome.org
Hi,

Am Montag, den 05.03.2012, 20:12 +0000 schrieb Thomas:
> I am new to Vala. I am trying to develop a simple application using
> Gstreamer and Vala, but I fail with the connection of signlas defined
> within the Gstreamer Element cairoooverlay
> (http://developer.gnome.org/gst-plugins-libs/unstable/gst-plugins-good-plugins-cairooverlay.html).
> What i am Trying to do ist the following:
>
> this.pipeline = (Pipeline)Gst.parse_launch("... cairooverlay
> name=overlay ...");
> ...
> Element ov = this.pipeline.get_by_name("overlay");
> ov.connect("caps_changed", this.caps_changed_cb);

Just one hint about Gstreamer Elements: Use Vala's dynamic keyword.
Using this keyword you can access properties and signals of the lements
without using the getters or connect methods.

dynamic Element ov = ...
ov.name = "overlay";
ov.caps_changed.connect (this.caps_changed_cb);

Sorry that I can't tell you the right sinal, but the docs might help you
here (or gst-inspect cairooverlay)

Greetings
fabian

Thomas

unread,
Mar 5, 2012, 3:39:58 PM3/5/12
to vala...@gnome.org

Fabian Deutsch <fabian.deutsch@...> writes:

> > vala-list@...
> > http://mail.gnome.org/mailman/listinfo/vala-list
>

Hi,

this solved the problem. I was looking everywhere to find a solution. Thanks a
lot. The correct way to achive what i wanted was:

this.pipeline = (Pipeline)Gst.parse_launch("... cairooverlay
name=overlay ...");
...

dynamic Element ov = this.pipeline.get_by_name("overlay");
ov.caps_changed.connect(this.caps_changed_cb);
...
private void caps_changed_cb(Element element, Caps caps){
..
}

Greetings

Thomas

unread,
Mar 6, 2012, 3:33:37 AM3/6/12
to vala...@gnome.org
Thomas <thomas.mair86@...> writes:
>
> Hi,
>
> this solved the problem. I was looking everywhere to find a solution. Thanks a
> lot. The correct way to achive what i wanted was:
>
> this.pipeline = (Pipeline)Gst.parse_launch("... cairooverlay
> name=overlay ...");
> ...
> dynamic Element ov = this.pipeline.get_by_name("overlay");
> ov.caps_changed.connect(this.caps_changed_cb);
> ...
> private void caps_changed_cb(Element element, Caps caps){
> ..
> }
>
> Greetings
> Thomas
>

Hi,

by the way, where do i find more information about the "dynamic" keyword?

Reply all
Reply to author
Forward
0 new messages