[gst-devel] How to correctly reuse elements?

wl2776 wl2776 at gmail.com
Wed Apr 21 11:58:12 CEST 2010



wl2776 wrote:
> 
> And the playbin2 didn't want to leave the videosink alone.
> How can I make  to remove the videosink?
> 

Continuing.
I've developed the following code.

*DO NOT* send the m_player to the NULL state.

gboolean rb;
GstElement *bin=gst_bin_get_by_name(GST_BIN(m_player),"playsink0");
if(bin){
  rb=gst_bin_remove(GST_BIN(bin),GST_ELEMENT(m_videosink));
  bin=gst_bin_get_by_name(GST_BIN(bin),"vbin");
  if(bin){
    rb=gst_bin_remove(GST_BIN(bin),GST_ELEMENT(m_videosink));
  }
}

I am getting the following output during this.

0:00:19.367850000  3828   04114C38 INFO           GST_PARENTAGE
gstbin.c:3589:gst_bin_get_by_name: [playbin0]: looking up child element
playsink0
The thread 'Win32 Thread' (0x758) has exited with code 0 (0x0).
0:00:27.579658000  3828   04114C38 DEBUG          GST_PARENTAGE
gstbin.c:1447:gst_bin_remove: removing element videosink from bin playsink0
(null) log_level Element videosink is not in bin playsink0
0:00:44.113432000  3828   04114C38 INFO           GST_PARENTAGE
gstbin.c:3589:gst_bin_get_by_name: [playsink0]: looking up child element
vbin
0:00:55.920410000  3828   04114C38 DEBUG          GST_PARENTAGE
gstbin.c:1447:gst_bin_remove: removing element videosink from bin vbin
0:00:55.920410000  3828   04114C38 INFO           GST_PARENTAGE
gstbin.c:1406:gst_bin_remove_func:<vbin> already removing child

However, rb is always 0 - the bin doesn't want to remove a child. 
These calls return immediately. 
Is the removing takes place in the separate thread?
Should I wait for this thread to finish?
How can I detect the child was removed?
-- 
View this message in context: http://n4.nabble.com/How-to-correctly-reuse-elements-tp2017352p2018680.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.




More information about the gstreamer-devel mailing list