[gst-devel] problem with dynamic pipeline rebuilding

marco at teknusi.org marco at teknusi.org
Mon Dec 15 11:32:05 CET 2008

hi, i have a problem understending dynamic pipeline rebuilding, where
for dynamic rebuilding i mean substituting parts of the pipeline while
it is in PLAYING state.
overview of what i am trying to do:
reading file from a playlist with filesrc, i have the following setup:

a srcbin composed of filesrc->decodebin

an output bin which is composed of audioconvert->....->shout2send

srcbin and outputbin are connected srcbin->outputbin
them both are included in the general pipeline.
when an eos event is detected on the bus, what i do is:

unlinking filesrc and decodebin
removing filesrc from srcbin
allocating a new filesrc with the "location" attribute set to the next
file in the playlist
putting the new filesrc into the srcbin
linking the new filesrc to decodebin
putting the whole pipeline to READY
putting the whole pipeline to PLAYING

This is currently working ok for audio playlists, as i can switch to a
new track in the playlist without having shout2send disconnect from the
icecast server, _BUT_ i think this is not the correct way of doing
things. Tried several different sequences of steps that seemed to me
more "safe" and correct, but with no success: e.g. if i try to block the
sink pad of decodebin the application deadlocks, but having a look at
part-block.txt this should be the nice way to remove, add and substitute
Here is the snippet of code i use and working for audio playlists but
not for video playlist:

	int next_track = ++(m_pl.p_current);
        g_print("We reached an end of stream\n");
        gst_element_get_state(fsrc, &state, NULL, NULL);
        g_print("STATE fsrc: %s\n",gst_element_state_get_name (state));
        gst_element_set_state(fsrc, GST_STATE_NULL);

       	gst_bin_add(GST_BIN(srcbin),fsrc = get_file_source(NULL));
    	g_object_set(G_OBJECT(fsrc),"location", m_pl.pl[next_track], NULL);
        gst_element_set_state(pipeline, GST_STATE_READY);
 	g_print("Restarting the playback! Playing: %s\n",
        gst_element_set_state(pipeline, GST_STATE_PLAYING);
        g_print("Restart point past!\n");

I had a look at the code of other applications and at documentations but
had no luck understanding how to do it correctly. This code works ok for
audio playlists, but not for video playlists.
could you please help me?
sorry if this question has already been answered.


More information about the gstreamer-devel mailing list