[BUG, PATCH] Revert broken use of ff_put_string() in vorbis_enc.c
Revert commit 20095: Don't use ff_put_string in vorbis encoder. ff_put_string() is declared in bistream.c, which uses put_bits() without BITSTREAM_WRITER_LE being defined. vorbis_enc.c on the other hand #defines BITSTREAM_WRITER_LE and thus must not use this function. Broken files contain the string "vorsib" instead of "vorbis". --- libavcodec/vorbis_enc.c (Revision 20639) +++ libavcodec/vorbis_enc.c (Arbeitskopie) @@ -530,7 +530,14 @@ // identification header init_put_bits(&pb, p, buffer_len); put_bits(&pb, 8, 1); //magic - ff_put_string(&pb, "vorbis", 0); + /* + * Do not use + * bitsream.c:void ff_put_string(PutBitContext * pbc, const char *s, int terminate_string) + * because it is Big-Endian which is incompatible with + * vorbis_enc.c:#define BITSTREAM_WRITER_LE + */ + for (i = 0; "vorbis"[i]; i++) + put_bits(&pb, 8, "vorbis"[i]); put_bits32(&pb, 0); // version put_bits(&pb, 8, venc->channels); put_bits32(&pb, venc->sample_rate); @@ -549,7 +556,8 @@ // comment header init_put_bits(&pb, p, buffer_len); put_bits(&pb, 8, 3); //magic - ff_put_string(&pb, "vorbis", 0); + for (i = 0; "vorbis"[i]; i++) + put_bits(&pb, 8, "vorbis"[i]); put_bits32(&pb, 0); // vendor length TODO put_bits32(&pb, 0); // amount of comments put_bits(&pb, 1, 1); // framing @@ -562,7 +570,8 @@ // setup header init_put_bits(&pb, p, buffer_len); put_bits(&pb, 8, 5); //magic - ff_put_string(&pb, "vorbis", 0); + for (i = 0; "vorbis"[i]; i++) + put_bits(&pb, 8, "vorbis"[i]); // codebooks put_bits(&pb, 8, venc->ncodebooks - 1); BYtE Philipp PS: I'm not subscribed, please cc: me on replies. -- / / (_)__ __ ____ __ Philipp Hahn / /__/ / _ \/ // /\ \/ / /____/_/_//_/\_,_/ /_/\_\ pmhahn at titan.lahn.de
On Sat, Nov 28, 2009 at 06:52:19PM +0100, Philipp Matthias Hahn wrote:
Revert commit 20095: Don't use ff_put_string in vorbis encoder.
ff_put_string() is declared in bistream.c, which uses put_bits() without BITSTREAM_WRITER_LE being defined. vorbis_enc.c on the other hand #defines BITSTREAM_WRITER_LE and thus must not use this function.
Broken files contain the string "vorsib" instead of "vorbis".
If this has not been fixed differently yet, patch ok [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many that live deserve death. And some that die deserve life. Can you give it to them? Then do not be too eager to deal out death in judgement. For even the very wise cannot see all ends. -- Gandalf
Michael Niedermayer <michaelni <at> gmx.at> writes:
On Sat, Nov 28, 2009 at 06:52:19PM +0100, Philipp Matthias Hahn wrote:
Revert commit 20095: Don't use ff_put_string in vorbis encoder.
[...]
Broken files contain the string "vorsib" instead of "vorbis".
If this has not been fixed differently yet, patch ok
Original commit reverted, fixes issue 1570. Thank you, Carl Eugen
On Sat, Nov 28, 2009 at 06:52:19PM +0100, Philipp Matthias Hahn wrote:
Revert commit 20095: Don't use ff_put_string in vorbis encoder.
ff_put_string() is declared in bistream.c, which uses put_bits() without BITSTREAM_WRITER_LE being defined. vorbis_enc.c on the other hand #defines BITSTREAM_WRITER_LE and thus must not use this function.
Please #define ff_put_string away in put_bits.h (similarly as for printf, ...) for the LE case so this can not happen again (and then you do not need that large comment anymore).
participants (4)
-
cehoyos@ag.or.at -
michaelni@gmx.at -
pmhahn@pmhahn.de -
Reimar.Doeffinger@gmx.de