[Flac-dev] flac in the filesystem?

Joshua Haberman jhaberman at ups.edu
Wed Oct 31 12:15:19 PST 2001

Hi Matt, thanks for the reply.

* Matt Zimmerman (mdz at debian.org) wrote:
> On Tue, Oct 30, 2001 at 11:39:11PM -0800, Joshua Haberman wrote:
> > So I was wondering if flac could be incorporated into the filesystem
> > driver so that any file ending in .wav would be transparently encoded
> > into flac. I don't know if this could be done at the vfs level so that
> > it could be done to all filesystems simultaneously, or if individual
> > filesystems would need to be modified.
> If you really want this, the right place to implement it is in
> userspace, not in the kernel.  Take a look at libbz2 and zlib for
> examples of how this can be done.  You could write a FLACopen routine
> like gzopen, which would transparently encode/decode from/to WAV format.
> This would probably go in the FLAC library, and make it trivial to add
> FLAC support to many WAV-supporting programs (those which don't use
> mmap).

This doesn't give me the transparency I desire.

> If you wanted transparency, you would write a shared library which would
> override open(), and perhaps read(), etc. and do its magic there.
> fakeroot, esddsp, and dmalloc are examples of how this is done.
> However, in this case, you'd want to name all of your FLAC files with a
> .wav extension so that the programs in question would open them.  The
> right thing to do is to add FLAC support to these programs, and the
> above technique might make that easier.

I hadn't thought of that. I like how this lifts me of the burden of
having to muck around in kernel code. However I dislike how flacs are
deceptively given .wav extensions, which will mess up programs that are
linked statically or somehow run without LD_PRELOAD set correctly.

I disagree that adding flac support to all programs is "the right thing
to do," simply because it's not necessary or realistic. In my scenerio,
people will be accessing the music using many different programs and OSs,
and there's no reason why each one should be required to learn about a
different format when it's conceptually identical to reading a straight
wav file. As someone who's doing development on an application involving
digital audio, I can tell you that it's a pain spending time supporting
umpteen different formats when each of them has a command-line encoder
that understands wav just fine (but alas, that's what users want...).

I really appreciate the suggestion to LD_PRELOAD, thanks.


Joshua Haberman  <joshua at haberman.com>

More information about the Flac-dev mailing list