Dynamically updating filesink location at run-time, on the fly

lsmithso at hare.demon.co.uk lsmithso at hare.demon.co.uk
Fri Jun 14 14:18:25 PDT 2013


I've seen this asked lots of times but have never found a direct
answer. I hope you don't mind my  asking the question  again.

I want to programatically change the file location that filesink
writes to as the program runs. I an saving an audio stream as a series
of short flac files. A new file is written after 30 seconds, or a
period of silence, whichever comes first. The source is any one of
mmssrc, souphttpsrc or pulsesrc. Ideally no src data will be lost
while switching files. The silence detector is either level or cutter
- I'm not sure yet.

I have tried naively setting the filesink location attribute but get
the 'cannot change the open file' error. multifilesink won't help
because it writes to a sequence of fixed length files, and my files
will be of varying lengths. I haven't tried fdsink but I suspect I'll
get the same error as for filesink.


I suspect the answer involved sending an eos and changing the state of
the file sink, and would have to be controlled by bus messages, but
I'm not sure what the sequence of operations should be.


This seems such a simple and obvious things to want to do. Is there a
reason I shouldn't do it, and should the answer to this be in the FAQ?


Thanks for any insights.




-- 
Les Smithson


More information about the gstreamer-devel mailing list