Hi!<br><br>As I have played with it, it seams it does not work properly all the time. Can you, please, check my source code in Python? There are TODOs which tag lines with possible wrong gstreamer handling (as I suppose). I will appreciate any suggestions.<br>

<br>the file (pipelineholder.py): <a href="http://cesta.pastebin.com/m3b0c7ad">http://cesta.pastebin.com/m3b0c7ad</a><br>other two files witch work together: <a href="http://cesta.pastebin.com/m46860962">http://cesta.pastebin.com/m46860962</a> <a href="http://cesta.pastebin.com/m5afca033">http://cesta.pastebin.com/m5afca033</a><br>

full sourcecode (3 files, run ./pipelinemanager.py, pipelineholder.py is the main one): <a href="http://files.getdropbox.com/u/710942/audio.tar.gz">http://files.getdropbox.com/u/710942/audio.tar.gz</a><br><br>Thank you in advance.<br>

Jura<br><br><div class="gmail_quote">On Tue, Jun 23, 2009 at 4:34 PM, Juraj Kubelka <span dir="ltr">&lt;<a href="mailto:juraj.kubelka@googlemail.com">juraj.kubelka@googlemail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div><div></div><div class="h5"><div class="gmail_quote">On Thu, Jun 18, 2009 at 8:46 AM, Arnout Vandecappelle <span dir="ltr">&lt;<a href="mailto:arnout@mind.be" target="_blank">arnout@mind.be</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


<div>On Wednesday 17 June 2009 10:29:43 Viraj Karandikar wrote:<br>
&gt; And after every hour you will have to: pause the pipeline, create new<br>
&gt; filesink, disconnect old filesink, connect new filesink and close old<br>
&gt; filesink.<br>
<br>
</div> Actually, no.  Pausing the pipeline will not (immediately) stop the threads<br>
in the source and queues.  In addition, once it&#39;s paused any new data coming<br>
in on the live source will be dropped until it plays again, which probably is<br>
not the intention.<br>
<br>
 Instead, you have to use blocking.  Below there&#39;s a piece of code that I use.<br>
See also docs/design/part-block.txt.  There should be high-level API for<br>
that, but nobody has bothered up to now to write it.<br>
<br>
 You need to replace the decoder and muxer as well, so the proper headers are<br>
created in the new file.  To simplify all that I put it in a bin (which can<br>
be unreffed as a whole).<br>
<div><br>
&gt; You can do above things in another independent thread which will<br>
&gt; just wait till 1 hour is complete.<br>
<br>
</div> Or you can use g_timeout_add_seconds (3600, ...) in your main loop.<br>
<br>
 Regards,<br>
 Arnout<br>
<br>
--<br>
<br>
static gboolean destroy_bin_cb (gpointer user_data)<br>
{<br>
    GstElement *oldbin = user_data;<br>
<br>
    log_message(&quot;Destroying old bin.\n&quot;);<br>
    if (pipeline)<br>
    {<br>
        gst_element_set_state (oldbin, GST_STATE_NULL);<br>
        gst_bin_remove (GST_BIN(pipeline), oldbin);<br>
    }<br>
    return FALSE;<br>
}<br>
<br>
<br>
static void replace_filesink_blocked_cb (GstPad *pad, gboolean blocked,<br>
gpointer user_data)<br>
{<br>
    if (blocked)<br>
    {<br>
        GstElement *oldbin;<br>
        GstPad *sinkpad;<br>
<br>
        log_message(&quot;Blocked filesink queue.\n&quot;);<br>
        g_static_rec_mutex_lock(&amp;mutex);<br>
        log_message(&quot;Locked.\n&quot;);<br>
        oldbin = filesinkbin;<br>
        sinkpad = gst_element_get_static_pad(oldbin, &quot;sink&quot;);<br>
        if (!sinkpad)<br>
        {<br>
            log_message(&quot;replace_filesink_blocked_cb: oldbin doesn&#39;t have sink<br>
pad.\n&quot;);<br>
            goto fail;<br>
        }<br>
        gst_pad_unlink(queuesrcpad, sinkpad);<br>
        log_message(&quot;Unlinked.\n&quot;);<br>
<br>
        /* Finalize the old tail. */<br>
        /* Sending EOS should be done from here (we&#39;re in the queue thread).<br>
*/<br>
        gst_pad_send_event(sinkpad, gst_event_new_eos());<br>
        log_message(&quot;Sent event.\n&quot;);<br>
<br>
        log_message(&quot;Checked sinks.\n&quot;);<br>
        /* Setting state should be done from the main thread. Do it before the<br>
           pipeline has been set to PLAYING - implicitly, because that is also<br>
           done in an idle callback, but one that is started after this one.<br>
        */<br>
        g_idle_add(destroy_bin_cb, oldbin);<br>
<br>
        create_filesink_tail();<br>
        log_message(&quot;Created filesink.\n&quot;);<br>
        g_static_rec_mutex_unlock(&amp;mutex);<br>
        log_message(&quot;Unlocked mutex.\n&quot;);<br>
<br>
        /* And unblock again. */<br>
        gst_pad_set_blocked_async(queuesrcpad, FALSE,<br>
replace_filesink_blocked_cb, NULL);<br>
<br>
        log_message(&quot;Done replacing filesink.\n&quot;);<br>
    }<br>
    else<br>
    {<br>
        log_message(&quot;Unblocked filesink queue.\n&quot;);<br>
    }<br>
    return;<br>
<br>
fail:<br>
    pipeline_terminate_async();<br>
    g_static_rec_mutex_unlock(&amp;mutex);<br>
}<br>
<br>
static void replace_filesink()<br>
{<br>
    if (queuesrcpad == NULL)<br>
        log_message(&quot;replace_filesink while no queuesrcpad yet, waiting for it<br>
to appear.\n&quot;);<br>
    else<br>
        gst_pad_set_blocked_async(queuesrcpad, TRUE,<br>
replace_filesink_blocked_cb, NULL);<br>
}<br>
<font color="#888888"><br>
</font></blockquote></div><br></div></div>Hi, <br>
<br>
thank you a lot for your help. I did it in Python and it seams it
works. Source code is on pastebin: <a href="http://pastebin.com/f3a80ed09%28pipelineholder.py" target="_blank">http://pastebin.com/f3a80ed09
(pipelineholder.py</a>) and <a href="http://pastebin.com/f4ee27d6d" target="_blank">http://pastebin.com/f4ee27d6d</a>
(pipelinemanager). Any comments are appreciated.<br>
<br>
Best regards,<br>
Jura<br>
</blockquote></div><br>