problem with dynamic pipeline rebuilding

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

problem with dynamic pipeline rebuilding

marco@teknusi.org
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
dynamically.
Here is the snippet of code i use and working for audio playlists but
not for video playlist:

case GST_MESSAGE_EOS: {
        ....                      
        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_unlink(fsrc,fdec);
        gst_element_set_state(fsrc, GST_STATE_NULL);
        gst_bin_remove(GST_BIN(srcbin),fsrc);

        gst_bin_add(GST_BIN(srcbin),fsrc = get_file_source(NULL));
        gst_element_link(fsrc,fdec);
    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",
m_pl.pl[next_track]);
        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.

marco



------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel