[gst-devel] How to flush a bus when removing an element from a pipeline?
wl2776
wl2776 at gmail.com
Fri Apr 23 12:38:56 CEST 2010
wl2776 wrote:
>
> Then, the application run successfully two times, and I've got an Error
> message box from GLib, saying it has "recursed", on the third run.
>
Looks like I have won :)
The problem was a bit earlier, related to the similar memory freeing.
My application created playbin2 instance, then looked at its n-video and
n-audio properties, and depending on them, destroyed playbin2 and created a
pipeline with two uridecodebins and two playing chains for video and audio.
However, I wanted to save the video-sink, since it was created separately,
as my player is embedded.
Currently the code is the following, seems it's stable.
GstElement *m_player;
GstBus *m_bus;
GstElement *m_videosink;
m_player=gst_element_factory_make("playbin2","player");
m_bus = gst_pipeline_get_bus(GST_PIPELINE(m_player));
gst_bus_enable_sync_message_emission(m_bus);
gst_bus_set_sync_handler (m_bus, (GstBusSyncHandler)gst_bus_sync_handler,
this);
gst_bus_add_watch (m_bus, bus_call, this);
if(!m_videosink){
m_videosink = gst_element_factory_make("directdrawsink","videosink");
if(m_videosink){
gst_object_ref(m_videosink);
g_object_set(m_videosink,"sync",TRUE,"force-aspect-ratio",TRUE,"preroll-queue-len",1,NULL);
if(!m_hwnd && m_parent)
m_hwnd=m_parent->hwnd();
if(m_hwnd)
gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (m_videosink),m_hwnd);
g_object_set(G_OBJECT(m_player),"video-sink",m_videosink,NULL);
}
}
.....
rs=gst_element_set_state(GST_ELEMENT(m_player),GST_STATE_NULL);
GstElement *bin=(GstElement *)gst_element_get_parent(m_videosink);
if(bin){
rb=gst_bin_remove(GST_BIN(bin),GST_ELEMENT(m_videosink));
}
gst_object_unref(GST_OBJECT(m_player));
gst_object_unref(GST_OBJECT(m_bus));
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/How-to-flush-a-bus-when-removing-an-element-from-a-pipeline-tp2027847p2045628.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list