How can I know that playbin2 has created rtspsrc element, as soon as possible?

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

How can I know that playbin2 has created rtspsrc element, as soon as possible?

wl2776
Administrator
I am developing a universal video player, which should be capable to play RTSP streams also.
I use playbin2.

I am also doing some coding to the RTSPSrc element to make it able to play Kasenna streams (it sends x-rtsp-mh messages instead of SDP).

How can I know that playbin2 has created rtspsrc element, as soon as possible?

I need this because I want to set some properties on this element.
Reply | Threaded
Open this post in threaded view
|

Re: How can I know that playbin2 has created rtspsrc element, as soon as possible?

Tim-Philipp Müller-2
On Wed, 2010-09-08 at 00:09 -0700, wl2776 wrote:

> I am developing a universal video player, which should be capable to play
> RTSP streams also.
> I use playbin2.
>
> I am also doing some coding to the RTSPSrc element to make it able to play
> Kasenna streams (it sends x-rtsp-mh messages instead of SDP).
>
> How can I know that playbin2 has created rtspsrc element, as soon as
> possible?
>
> I need this because I want to set some properties on this element.

  g_signal_connect (playbin2, "notify::source",
      G_CALLBACK (configure_source), NULL);

will make sure your callback gets called as soon as the source element
has been created. There you can then get the source element from
playbin2 via g_object_get() and set properties on it as needed.

Cheers
 -Tim


------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How can I know that playbin2 has created rtspsrc element, as soon as possible?

wl2776
Administrator
Tim-Philipp Müller-2 wrote
> How can I know that playbin2 has created rtspsrc element, as soon as
> possible?
>
  g_signal_connect (playbin2, "notify::source",
      G_CALLBACK (configure_source), NULL);
Great! Thanks!

Till now I was experimenting with the element-added signal.
Just for the information - how can I catch all "element-added" signals non-depending of their source?
And more specific - what is the GType of the GstBin? (wonder if this my question is correct at all :)) )

I've found g_signal_add_emission_hook() function.
It requires signal-ID and signal-details Quark.
I could get them from g_signal_parse_name, but its second parameter is
"GType itype - The interface/instance type that introduced "signal-name".
So, how should I fill this parameter?
Reply | Threaded
Open this post in threaded view
|

Re: How can I know that playbin2 has created rtspsrc element, as soon as possible?

Tim-Philipp Müller-2
On Wed, 2010-09-08 at 02:52 -0700, wl2776 wrote:

> Till now I was experimenting with the element-added signal.
> Just for the information - how can I catch all "element-added" signals
> non-depending of their source?

What's wrong with g_signal_connect (obj, "element-added", ...) ?

Not sure if there's a good way to get element-added signals from
grand-children though (maybe deep-notify::parent works, maybe not).

> And more specific - what is the GType of the GstBin? (wonder if this my
> question is correct at all :)) )

GST_TYPE_BIN is the GType of a generic bin. You shouldn't rely on the
GType name of any element though, it sometimes changes.

In the notify::source callback it's best to check if the source element
has certain properties by name and then set them, and not check the
GType.

> I've found g_signal_add_emission_hook() function.
> It requires signal-ID and signal-details Quark.
> I could get them from g_signal_parse_name, but its second parameter is
> "GType itype - The interface/instance type that introduced "signal-name".
> So, how should I fill this parameter?

Not sure what you are asking here, or what the context is.

Cheers
 -Tim




------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How can I know that playbin2 has created rtspsrc element, as soon as possible?

wl2776
Administrator
Tim-Philipp Müller-2 wrote
> Till now I was experimenting with the element-added signal.
> Just for the information - how can I catch all "element-added" signals
> non-depending of their source?

What's wrong with g_signal_connect (obj, "element-added", ...) ?

Not sure if there's a good way to get element-added signals from
grand-children though (maybe deep-notify::parent works, maybe not).
That was exactly that, rtspsrc is added to the bin somewhere in playbin2's depth.

That said, I can only do
  g_signal_connect(m_player,"element-added",...)
where m_player is my instance of the playbin2.

And all I'll receive is a notification, that the playbin2 has added uridecodebin, playsink and something else.
I tried checking elements' names in the signal-added callback and connect this callback to them, but it didn't work for some reason.

BTW, is it correct? Can I connect the callback to the signals from the same callback?

Is the code correct?
static void element_added(GstBin *bin, GstElement *element, gpointer user_data)
{
  ....
  if( < we have proper element >){
    g_signal_connect(element,"element-added",GCallback(element_added),NULL);
  }
  ...
}

....
g_signal_connect(m_player,"element-added",GCallback(element_added),NULL);
...

Tim-Philipp Müller-2 wrote
> I've found g_signal_add_emission_hook() function.
> It requires signal-ID and signal-details Quark.
> I could get them from g_signal_parse_name, but its second parameter is
> "GType itype - The interface/instance type that introduced "signal-name".
> So, how should I fill this parameter?

Not sure what you are asking here, or what the context is.
This is a question about GLib and GObject, not GStreamer.
I had problems making a call to g_signal_parse_name(), because didn't know how to fill the second parameter.
Not sure it is needed now, after I know about "notify::source".
Just for information.