1
votes

I want to listen to an audiostream from alsasrc continuously, and at the same time be able to save snippets to file. I will push a button with 'record' or 'stop'.

I think I need the following gst-launch-0.10 command to work: gst-launch-0.10 alsasrc do-timestamp=true ! tee name=t ! queue ! alsasink t. ! queue ! audioconvert ! wavenc ! output-selector name=s s. ! filesink location=test1.wav s. ! fakesink

Where I program the output-selector to switch between the filesink and the fakesink when I push the record/stop-button, I know gst-plugins-bad/tests/icles/output-selector-test.c example in the plugins, and want to hack that a bit.

Now the problem arises in the outputselector, it creates the file test1.wav but does not write to it. To focus on this problem I created:

gst-launch-0.10 audiotestsrc is-live=true do-timestamp=true ! wavenc ! output-selector name=s s. ! filesink location=test1.wav s. ! filesink location=test2.wav

and this also does not work (while gst-launch-0.10 audiotestsrc is-live=true do-timestamp=true ! wavenc ! filesink location=test1.wav works as expected). The 2 files are created but not written to. Can anybody point me in the right direction?

In posting "[gst-devel] how to link multiple filesinks to a output-selector before playing pipeline" I read that the 2nd sink is blocking on preroll. That why the example in output-selector-test.c uses a live-src as a trick, I also do that with audiotestsrc but it does not do the trick for me.

2

2 Answers

3
votes

Prerolling is not your friend here, so set async=0 on both filesink and fakesink:

gst-launch-0.10 command to work: gst-launch-0.10 alsasrc do-timestamp=true ! tee name=t ! queue ! alsasink t. ! queue ! audioconvert ! wavenc ! output-selector name=s s. ! filesink location=test1.wav async=0 s. ! fakesink async=0
0
votes

What about putting the wavenc element into the s. ! filesink location=test1.wav branch? wavenc will do some work when the stream starts and stops. output-selector can only ensures that this work if the elements sits behind it.