[Vorbis-dev] Cover art
Tor-Einar Jarnbjo
tor-einar at jarnbjo.name
Tue Mar 31 14:08:17 PDT 2009
Ian Malone schrieb:
> Yes it's not ideal, but I'm reasoning on the basis that all the specs
> dealing with the vorbis comment headers (or its clones in other
> formats) require the comment contents to be UTF-8 encoded. This
> presumably means the picture description is UTF-8 encoded twice.
>
I was wondering about this myself, as the proposal on
http://wiki.xiph.org/index.php/VorbisComment didn't mention anything
about UTF-8 encoding the binary content of the coverart structure,
although it's done in the demo file. If not doing it, arbitrary binary
content is most likely not a valid UTF-8 sequence and may cause current
software to fail.
I'm however not sure if having a leading 0 byte in the "string" solves
too many incompatibilities with old software and if this approach is
much better than Base64-encoding the data. If the byte values in the
image structure are equally distributed (with JPEG they most likely
are), the UTF-8 encoding will add an overhead of 50%, while the Base64
encoding adds an overhead of 33%. Even if older software displays the
Base64 comment value as a string, it's unlikely that the comment is
ignored completely, as is the case with e.g. WinAmp. Not only is the
BINARY_COVERART not shown in the file info dialog, but it's removed from
the file if other comments are edited with WinAmp.
I'm also honestly not 100% sure how C/C++ is handling Unicode strings
(it was not really a topic the last time I wrote anything in C), but
0x00 is actually a valid Unicode control character and will not always
be treated as an end of string marker by current software, so using
UTF-8 encoding instead of Base64 does not guarantee, that the content is
not treated as a string and shown:
http://jarnbjo.de/screenshot.png
Tor
More information about the Vorbis-dev
mailing list