[gst-devel] Adding new tee src%d to a running pipeline...
Nathanael D. Noblet
nathanael at gnat.ca
Wed Jul 28 08:31:25 CEST 2010
Hello everyone I'm having some issues getting a new src pad from a tee
on a running pipeline. It's nearly working but I can't get it past that
last step...
So here's the deal, I have a simple queue that goes to an xvimagesink.
When I click a gtk button it calls a function that is setup to create
queue/filesrc pipe and request another src pad from the tee element
already in the running pipeline. Hook it all up to the running pipe and
let it save to a file as it is viewed... The file is created, but size
0, and my xvsink continues to play on... From some debugging print
statements I've added it looks like the pipeline comes into my button
callback in the PLAYING state, but then says it is the PAUSED state as I
start adding things to it, which seems odd as it is still playing...
Here is the relevant code:
GstElement *bin = gst_bin_new ("recording_bin");
g_print("BIN: %d PIPELINE %d\n",GST_STATE(bin),GST_STATE(pipeline));
GstPad *srcpad = NULL;
GstPad *sinkpad = NULL;
filesink = gst_element_factory_make ("filesink", "filesink");
filequeue = gst_element_factory_make ("queue2", "filequeue");
g_object_set (G_OBJECT (filesink), "location", current_dir, NULL);
gst_bin_add_many(GST_BIN(bin),filequeue,filesink,NULL);
gst_element_link(filequeue,filesink);
sinkpad = gst_element_get_static_pad(filequeue,"sink");
gst_element_add_pad(bin,gst_ghost_pad_new("sink",sinkpad));
gst_object_unref(GST_OBJECT(sinkpad));
GstStateChangeReturn ret = gst_element_set_state(bin, GST_STATE_PAUSED);
g_print("STATE CHANGED TO PAUSED: %d\n",ret);
gst_bin_add(GST_BIN(pipeline), bin);
GstElement *tee = gst_bin_get_by_name (GST_BIN(pipeline),"tee");
sinkpad = gst_element_get_pad(filequeue,"sink");
srcpad = gst_element_get_request_pad(tee,"src2");
gst_pad_set_blocked(srcpad,TRUE);
gst_pad_set_active(srcpad,TRUE);
ret = gst_element_set_state(bin, GST_STATE_PLAYING);
g_print("STATE CHANGED TO PLAYING: %d BIN: %d PIPELINE
%d\n",ret,GST_STATE(bin),GST_STATE(pipeline));
gst_pad_link(srcpad,sinkpad);
gst_pad_set_active(srcpad,TRUE);
gst_pad_set_blocked(srcpad,FALSE);
g_print("STATE CHANGED TO PLAYING: %d BIN: %d PIPELINE
%d\n",ret,GST_STATE(bin),GST_STATE(pipeline));
Can anyone help me out with this?
Thanks,
--
Nathanael d. Noblet
More information about the gstreamer-devel
mailing list