[gst-devel] dynamically remove custom branch from tee and videomixer

kaija kaija at ms2.hinet.net
Sat Dec 25 15:35:15 CET 2010


I try to create a picture in picture channel to the main pipeline.
I read this post and succeeded to create PIP channel dynamically.
(http://gstreamer-devel.966125.n4.nabble.com/Dynamically-adding-and-removing-branches-of-a-tee-td973635.html#a973637)
However, while I attempt to release the PIP channel while the main pipeline
is still running, the main pipeline stops to refresh video frames.
I cannot figure out the reason why main pipeline stops.
Could anyone help me to solve the problem?

Here is my pipeline looks like:


   / (main pipeline)queue - videomixer - videoscale - videocrop - caps -
videosink
tee                                                                                                                                      
/
   \ (pip branch )  queue - videoscale - videocrop - caps ------ mix -----/


the following code shows how I unlink pip branch from tee and videomixer

void CPiPChannel::Unlink(void) {
	gst_pad_set_blocked_async(m_pVideoTeeSrcPad, TRUE, (GstPadBlockCallback)
PadBlockHandler, m_pVideoTee);
	gst_element_remove_pad(m_pVideoMixer, m_pVideoMixerSinkPad);
}

void CPiPChannel::PadBlockHandler(GstPad* pPad, gboolean bBlocked, gpointer
pData)
{
	GstPad* pPeer = NULL;
	GstEvent* pEvent = NULL;
	GstElement* pTee = NULL;

	if(bBlocked) {
		pPeer = gst_pad_get_peer(pPad);
		pEvent = gst_event_new_eos();
		pTee = (CPiPChannel*) pData;

		if(gst_pad_unlink(pPad, pPeer);
			dprintf("unlink pad success");
		else
			dprintf("unlink pad failed");

		gst_element_set_state(pBin, GST_STATE_READY);
		gst_element_set_state(pBin, GST_STATE_NULL);

		gst_pad_push_event(pPeer, pEvent);
		gst_pad_set_blocked_async(pPad, FALSE, (GstPadBlockCallback)
PadBlockHandler, pData);
		gst_element_remove_pad(pTee, pPad);
		gst_object_unref(pPad);
	} else {
		dprintf("unblocked");
	}
}
-- 
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/dynamically-remove-custom-branch-from-tee-and-videomixer-tp3163782p3163782.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.




More information about the gstreamer-devel mailing list