Emit a signal to an element

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Emit a signal to an element

ivan-perez
Hello, good morning

I have a pipeline written into a C program which redirects a video stream from stdin to multiple UDP clients. I want those clients to be added or removed dynamically, so it's not possible to define at compile time which of them and how many there will be. This is my pipeline (if I add a fixed clients parameter it works fine):

    fdsrc name=origin \
    ! video/x-h264,width=320,height=240,framerate=30/1,profile=baseline,stream-    format=avc,alignment=au \
    ! h264parse \
    ! rtph264pay \
        config-interval=1 \
        pt=96 \
    ! multiudpsink name=dest \
         sync=false

According to the GStreamer docs, I can achieve it by sending a signal in order to add or remove clients dynamically. In this case, it should be the add signal - https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-multiudpsink.html#GstMultiUDPSink-add

But I can't find any information about sending a signal to an element (in this case, to the multiudpsink element). It's easy to get the reference to my element:

    GstElement *sink = gst_bin_get_by_name(GST_BIN(pipeline), "dest");
    /* TODO: send a signal to add a client */
    g_object_unref(sink);

But now how can I emit a signal to that element?

Thanks in advance! Kind regards,
Reply | Threaded
Open this post in threaded view
|

Re: Emit a signal to an element

Tim Müller
On Thu, 2017-01-26 at 01:59 -0800, ivan-perez wrote:

Hi,

According to the GStreamer docs, I can achieve it by sending a signal
in order to add or remove clients dynamically. In this case, it should be the add signal -
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-multiudpsink.html#GstMultiUDPSink-add

But I can't find any information about sending a signal to an element (in this case, to the multiudpsink element). It's easy to get the reference to my element:

    GstElement *sink = gst_bin_get_by_name(GST_BIN(pipeline), "dest");
    /* TODO: send a signal to add a client */
    g_object_unref(sink);

But now how can I emit a signal to that element?

Thanks in advance! Kind regards,

Here are some examples:

Cheers
-Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Emit a signal to an element

ivan-perez
Tim Müller wrote
On Thu, 2017-01-26 at 01:59 -0800, ivan-perez wrote:

Hi,

> According to the GStreamer docs, I can achieve it by sending a signal
> in order to add or remove clients dynamically. In this case, it
> should be the add signal -
> https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins
> -good-plugins/html/gst-plugins-good-plugins-
> multiudpsink.html#GstMultiUDPSink-add
>
> But I can't find any information about sending a signal to an element
> (in this case, to the multiudpsink element). It's easy to get the
> reference to my element:
>
>     GstElement *sink = gst_bin_get_by_name(GST_BIN(pipeline),
> "dest");
>     /* TODO: send a signal to add a client */
>     g_object_unref(sink);
>
> But now how can I emit a signal to that element?
>
> Thanks in advance! Kind regards,

Here are some examples:
https://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/tests/chec
k/elements/udpsink.c#n158

Cheers
 -Tim


-- 
Tim Müller, Centricular Ltd - http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Thank you very much, Tim.

Those examples allowed me to get fixed my problem. It was as simple as `g_signal_emit_by_name(upd_sink, "add", client_ip, client_port, NULL);`

Thanks again!