<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 09/10/2012 07:48 PM, Alexander
Botero wrote:<br>
</div>
<blockquote
cite="mid:CA+LCXzjMXfHKerjMf6WfYN_vxZ0GrCv1LsTEqv3oRb24XoNbHw@mail.gmail.com"
type="cite">Hello,
<div>I have a small audio recorder that uses Gstreamer. </div>
<div>I would like the recorder to pause when the signal-level
drops under a certain value, and re-start when the level rises
again.</div>
<div><br>
</div>
<div>I cannot simply set the pipeline or filesink to
GST_STATE_PAUSED or NULL because my code needs to check the
level-value all the time (so it can determine when to stop or
re-start writing to a sink file). </div>
<div>The pipeline must run all the time so the "message::element"
message is generated and level_message_cb(...) is called
continually.</div>
<div><br>
</div>
<div>How can I stop (and re-start) writing to a filesink, while
the pipeline is ticking and alive?</div>
<div>I understand this can be difficult because container formats
(like ogg) need to write bytes to previous blocks.</div>
</blockquote>
<br>
You could do something like this:<br>
autoaudiosrc ! level ! tee name=t ! queue ! autoaudiosink t. ! queue
! valve ! encodebin ! filesink<br>
<br>
when the level drops below a threshold, you close the valve and
remember the position. When the level gets above the threshold
again, you open he valve (and eventually push a newsegment event).<br>
<br>
Stefan<br>
<br>
<blockquote
cite="mid:CA+LCXzjMXfHKerjMf6WfYN_vxZ0GrCv1LsTEqv3oRb24XoNbHw@mail.gmail.com"
type="cite">
<div><br>
</div>
<div>Here is my test-code, a small gtk-program:</div>
<div>
<div><a moz-do-not-send="true"
href="http://www.futuredesktop.org/tmp/test1.c">http://www.futuredesktop.org/tmp/test1.c</a></div>
<div><br>
</div>
<div>I have tried to stop/start the filesink with various
methods. </div>
<div>Please see set_filesink1(...) and set_filesink2(...).</div>
<div><br>
</div>
<div>For example, I tried to set the filesink to READY-state,
then setting its location to NULL, and later back to
"test1.ogg" But this is not allowed.</div>
<div><br>
</div>
<div>Compile:</div>
<div>
<div>gcc -Wall test1.c -o test1 $(pkg-config --cflags --libs
gtk+-3.0 gthread-2.0 gstreamer-0.10)</div>
<div><br>
</div>
<div>Run:</div>
<div>./test1</div>
</div>
<div><br>
</div>
</div>
<div>
The recorder is open source.</div>
<div><br>
</div>
<div>Kindly</div>
<div>Alexander</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
gstreamer-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a>
</pre>
</blockquote>
<br>
</body>
</html>