How to stop and restart writing to a filesink (while the pipeline is alive).

Alexander Botero alex.botero at gmail.com
Mon Sep 10 10:48:05 PDT 2012


Hello,
I have a small audio recorder that uses Gstreamer.
I would like the recorder to pause when the signal-level drops under a
certain value,  and re-start when the level rises again.

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).
The pipeline must run all the time so the "message::element" message is
generated and level_message_cb(...) is called continually.

How can I stop (and re-start) writing to a filesink, while the pipeline is
ticking and alive?
I understand this can be difficult because container formats (like ogg)
need to write bytes to previous blocks.

Here is my test-code, a small gtk-program:
http://www.futuredesktop.org/tmp/test1.c

I have tried to stop/start the filesink with various methods.
Please see set_filesink1(...) and set_filesink2(...).

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.

Compile:
gcc -Wall test1.c -o test1 $(pkg-config --cflags --libs gtk+-3.0
gthread-2.0 gstreamer-0.10)

Run:
./test1

The recorder is open source.

Kindly
Alexander
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20120910/5656d62b/attachment.html>


More information about the gstreamer-devel mailing list