Flac and Audio CD Health Checks
In ,
Martin Gregorie wrote:
Again, if I read the manpage correctly. this should be used in a pipeline:
flac inputfile | next_program_in_the_pipeline
OR, presumably.
flac inputfile outfile
would also work.
That's a point. I could have given you much simpler advice, Jim. As
Martin has pointed out, you can pipe programs together with the shell,
so you don't need to launch flac from your C program, either using
system(), or all that stuff about exec() I told you.
You're writing it as a ROX app, I think you said, and I see "RunImage"
in what Martin quoted. I used to use ROX a long time ago. But I think if
you've followed the usual template your app should contain a shell
script called AppRun. Assuming that you run it by dragging a file onto
its icon in ROXFiler I think the filename will be available to AppRun as
$1. So you can change the line that launches your RunImage to something
like:
exec flac ... --stdout $1 | $AppDir/RunImage
where ... represents any other options you need to give to flac.
You need to change the C code too, but you'll be making it simpler, not
more complicated. Instead of repeatedly calling system() then reading a
temporary file from a ramfs in 5 second chunks, just read from stdin and
treat it as one long file. To do that use the global variable stdin in
your calls to fread() etc instead of your own FILE * variable. You could
make the fread() load 5 seconds' worth at a time in a loop if that's
what your code is designed to analyse.
Then you can use the same technique for the CD version without having to
make any changes at all to the C.
|