<div dir="ltr"><div><div>Tim,<br><br></div>Thank you very much!  That seems to have worked.  I will continue testing, the pipeline does not seem to be extremely stable just yet.  It seems to work for a few video recordings and then simply hangs.  Not sure what is hanging.  Also, the start up of the pipeline for the first time adding the recording pipeline segment seg-faults from time to time.  Any ideas on that?  I suspect that this is the same cause for the hanging mentioned earlier.<br>
<br></div>Regards,<br>Tye<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 12, 2014 at 4:08 AM, Tim Müller [via GStreamer-devel] <span dir="ltr"><<a href="/user/SendEmail.jtp?type=node&node=4668284&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>></span> wrote:<br>
<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

        On Mon, 2014-08-11 at 06:25 -0700, tnewman wrote:
<br><br>Hi,
<br><div><div class='shrinkable-quote'><br>> I have been attempting to create a complex pipeline with some success except
<br>> for how to close the video saving (avimux) portion of the stream.  Below one
<br>> will find an illustration of the pipeline.
<br>> 
<br>> 
<br>> 
<br>> Here is the story:  I have an embedded device where I need to create a video
<br>> stream to a fakesink; where the fakesink is used to hand framebuffers to a
<br>> Qt application to be displayed in a widget.  This is the primary stream
<br>> connected to the tee as seen above.  The second portion of the stream is the
<br>> connected to the tee on request (a user pushes a Qt button) and begins
<br>> recording an AVI file to disk.  The addition of this pipeline to the tee
<br>> seems to be working (most of the time, sometimes the pipeline hangs; but
<br>> that is for later).  The issue is when the user presses the Qt button again
<br>> to stop the recording.  The first time through it works, the filesink sees a
<br>> EOS event and the file terminates with an updated header.  The problem comes
<br>> the second time around.  From the g_print statements one sees this:
<br>> 
<br>> 
<br>> 
<br>> And thereafter the pipeline fails.
<br>> 
<br>> Below one will find the source code for the project.  Any help would be
<br>> greatly appreciated.
<br>> 
<br>> 
<br>> 
<br>> I have tried may variants with no success. So the real question is: how does
<br>> one unlink a section of the pipeline from the tee, terminate the avimux and
<br>> audio source elements to create a proper AVI file, remove the elements from
<br>> the pipeline and then at a later time recreate these elements, link them,
<br>> and do it all over again.
</div></div>event_probe_cb() will be called from the streaming thread, the same
<br>thread you want to shut down. This won't really work well like this.
<br>What you should work better is something like this:
<br><br> - set g_object_set (pipeline, "message-forward", TRUE, NULL)
<br>   so you get a message on the bus even if just filesink is EOS
<br>   (but not the other sink)
<br><br> - wait for an GST_MESSAGE_ELEMENT on the bus like this:
<br><br>    case GST_MESSAGE_ELEMENT:{
<br>      const GstStructure *s = gst_message_get_structure (msg);
<br><br>      if (gst_structure_has_name (s, "GstBinForwarded")) {
<br>        GstMessage *forward_msg = NULL;
<br><br>        gst_structure_get (s, "message", GST_TYPE_MESSAGE, &forward_msg,
<br>NULL);
<br>        if (GST_MESSAGE_TYPE (forward_msg) == GST_MESSAGE_EOS) {
<br>           ... shut down / remove pipeline branch ... 
<br>        }
<br>      }
<br>      break;
<br>    }
<br><br> - This assumes you unlinked the tee branch and sent an EOS
<br>   yourself on the queue's sink pad before jpegenc and
<br>   to audiotestsrc via gst_element_send_event().
<br><br> Cheers
<br>  -Tim
<br><br>-- 
<br>Tim Müller, Centricular Ltd - <a href="http://www.centricular.com" rel="nofollow" link="external" target="_blank">http://www.centricular.com</a><br><br>_______________________________________________
<br>gstreamer-devel mailing list
<br><a href="http://user/SendEmail.jtp?type=node&node=4668277&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="nofollow" link="external" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>

        
        
        
        <br>
        <br>
        <hr color="#cccccc" noshade size="1">
        <div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                <a href="http://gstreamer-devel.966125.n4.nabble.com/How-to-properly-terminate-a-complex-stream-with-tee-and-avimux-tp4668269p4668277.html" target="_blank" rel="nofollow" link="external">http://gstreamer-devel.966125.n4.nabble.com/How-to-properly-terminate-a-complex-stream-with-tee-and-avimux-tp4668269p4668277.html</a>
        </div>
        <div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
                
                To unsubscribe from How to properly terminate a complex stream with tee and avimux, <a href="" target="_blank" rel="nofollow" link="external">click here</a>.<br>

                <a href="http://gstreamer-devel.966125.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_blank" link="external">NAML</a>
        </div></blockquote></div><br></div>


        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://gstreamer-devel.966125.n4.nabble.com/How-to-properly-terminate-a-complex-stream-with-tee-and-avimux-tp4668269p4668284.html">Re: How to properly terminate a complex stream with tee and avimux</a><br/>
Sent from the <a href="http://gstreamer-devel.966125.n4.nabble.com/">GStreamer-devel mailing list archive</a> at Nabble.com.<br/>