[gst-devel] Dynamically activate links?

Matthias Rahlf rahlf at fs.tum.de
Wed Sep 22 16:39:43 CEST 2010


Hi,

I want to be able to start/stop playback and start/stop recording.
I can do both if I set it all up right from the start:

| /* setup */
| GstElement *m_pipeline;
| GMainLoop *m_gloop;
| boost::thread* m_playerThread;
| gst_init(NULL,NULL);
| m_gloop = g_main_loop_new(NULL, FALSE);
| m_pipeline = gst_parse_launch("alsasrc device=hw:2 ! tee name=tee "
|    "! queue name=playqueue ! alsasink sync=false tee. "
|    "! queue name=recordqueue ! audioconvert ! audioresample ! lame "
|       "! filesink name=filesink location=recording.mp3", &0);
| m_playerThread = new boost::thread(
|    boost::bind(g_main_loop_run, m_gloop));
|
| /* my stuff here */
| /* here i want to activate playback or recording dynamically */
| gst_element_set_state(m_pipeline, GST_STATE_PLAYING);
| sleep(10);
| gst_element_set_state(m_pipeline, GST_STATE_NULL);
|
| /* clean up */
| g_main_loop_quit(m_gloop);
| m_playerThread->join();
| delete m_playerThread;
| gst_object_unref(GST_OBJECT(m_pipeline));

But I did not find a way to attach the queues dynamically to the tee.
I tried:
- gst_element_unlink(tee, recordqueue); but there was no more playback.
- not to link the queues to the tee during setup but use
   gst_element_link(tee, playqueue) later.
   No playback, gst_element_set_state reported an error.
- to get the request_pad from tee and use gst_element_link_pads().
   No playback, gst_element_set_state reported an error.

I did not find any online resources for my use case.
Do you have a hint or a useful link for me?

BTW: I could not setup this pipeline without gst_parse_launch(). How do 
you do this?

TIA, Matthias




More information about the gstreamer-devel mailing list