[linux-audio-dev] libsndfile: type combinations and string data

Erik de Castro Lopo erikd-lad at mega-nerd.com
Mon Aug 30 21:54:58 UTC 2004


On Mon, 30 Aug 2004 21:58:32 +0200
martin rumori <lists at rumori.de> wrote:

> hi erik,
> 
> i've got a question regarding type combinations in libsndfile:
> 
> SF_FORMAT_FLOAT | SF_ENDIAN_CPU works with SF_FORMAT_AU on any
> platform, which is great.  but it doesn't work with neither aiff nor
> wav. 

AIFF amd WAV only allows one endian-ness for float data, while AU
allows both. AIFF is a little strange in that it does allow both
endian-nesses for PCM ints.

> i expected that it would work with one of the both formats,
> depending on the host endianess.

SF_ENDIAN_CPU really only makes sense when the file format allows
bot endian-nesses.

> some other questions regarding string data:
> 
> snd does not explicitly allow using string data in the file format.
> however, i remember that it was done in the old NeXT days by
> increasing the data offset and using the space in between for a
> comment.  do you think this could be implemented in libsndfile for the
> SF_STR_COMMENT thing or is that just too non-standard?

Do you mean for the AU file format?

> with SF_FORMAT_AIFF, i can't write string data to the file in SFM_RDWR
> mode.  

There are good reasons for this. Say you already have a comment in
the head which is 10 bytes long. You now open the file in RDWR mode
and change that comment header to be 16 bytes long. Fixing that is
completely non-trivial.

> the call to sf_set_string() succeeds, but the actual data in
> the file is not changed.  the call to sf_set_string() succeeds even
> when the file is in SFM_READ mode.

Thats probably a bug.

> with SF_FORMAT_WAV, a file with string data can't be opened with
> SFM_RDWR anymore.  this means there is no way to change the audio data
> or the comment of the file without copying it?  i guess there is a
> special reason for that...

As above.

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo  nospam at mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
"What lawyers call 'intellectual property' is -- as every Latin student
knows -- no more than theft from the public domain."
  -- Andy Mueller-Maguhn, newly elected ICANN board member for Europe.



More information about the Linux-audio-dev mailing list