<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.text-cell
        {mso-style-name:text-cell;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span class=text-cell>Here is what i have gathered is
supposed to happen to accomplish changing filesink output file locations in a
running pipeline. </span><br>
<br>
<span class=text-cell>The pipeline ends with "...! queue2
name="q1" ! matroksamux name-mux ! filesink name="fsink"
" </span><br>
<span class=text-cell>
I build mine using gst_parse_launch() </span><br>
<br>
<span class=text-cell>Status: </span><br>
<span class=text-cell> - The pipeline is in GST_STATE_PLAYING.
</span><br>
<span class=text-cell> - The g_main_loop is running. </span><br>
<span class=text-cell> - The first location output file is being
filled with data. </span><br>
<span class=text-cell> - There is a callback for bus messages. </span><br>
<br>
<br>
<span class=text-cell>When it comes time to swap output files: (for me
this is in a timer callbak) </span><br>
<span class=text-cell> - block the src pad of q1
</span><br>
<br>
<span class=text-cell> q1_srcpad =
gst_element_get_static_pad( q1, "src" ); </span><br>
<span class=text-cell> rc =
gst_pad_set_blocked_async( q1_srcpad, true, Q1Blocked, NULL ); </span><br>
<br>
<br>
<span class=text-cell>in the callback Q1Blocked() </span><br>
<span class=text-cell> - send an EOS to mux </span><br>
<span class=text-cell> - This should pass down to fsink and cause t
he mux to write its headers/trailers </span><br>
<span class=text-cell> </span><br>
<span class=text-cell> rc = gst_element_send_event(
mux, gst_event_new_eos() ); </span><br>
<br>
<br>
<span class=text-cell>in the bus messages callback handler, bus_call(): </span><br>
<span class=text-cell> - detect we got the EOS </span><br>
<span class=text-cell> - set mux and fsink to GST_STATE_NULL </span><br>
<span class=text-cell> - change the location </span><br>
<span class=text-cell> - unblock the q1 src pad </span><br>
<br>
<span class=text-cell> case GST_MESSAGE_EOS: </span><br>
<span class=text-cell> rc =
gst_element_set_state( mux, GST_STATE_NULL ); </span><br>
<span class=text-cell> rc =
gst_element_set_state( sink, GST_STATE_NULL ); </span><br>
<span class=text-cell>
g_object_set( G_OBJECT( sink ), "location", newOutFileName,
NULL ); </span><br>
<span class=text-cell>
gst_pad_set_blocked_async( that->q1src, false, Q1UnBlocked, NULL ); </span><br>
<br>
<span class=text-cell>in Q1UnBlocked() callback handler: </span><br>
<span class=text-cell> - return mux and fsink to GST_SATE_PLAYING </span><br>
<br>
<span class=text-cell> rc =
gst_element_set_state( mux, GST_STATE_PLAYING ); </span><br>
<span class=text-cell> rc =
gst_element_set_state( fsink, GST_STATE_PLAYING ); </span><br>
<br>
<br>
<span class=text-cell>And that's where I run into a brick wall. The rc
from setting fsink to GST_STATE_PLAYING is 2, GST_STATE_CHANGE_ASYNC.
</span><br>
<br>
<span class=text-cell>Why does filesink not return to playing? Does
setting it to STATE_NULL mean that it disconnects from the mux? The mux
src pad is an always pad and so is the filesink sink pad. Is the mux
unlinked from the queue? </span><br>
<br>
<span class=text-cell>Many thanks, </span><br>
<br>
<span class=text-cell>Wes</span><o:p></o:p></p>
</div>
</body>
</html>