[FFmpeg-soc] MXF muxer version 0.0.4
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Fri Aug 29 20:48:32 CEST 2008
Hello,
On Fri, Aug 29, 2008 at 09:47:24AM -0700, Baptiste Coudurier wrote:
> > Index: libavformat/mxfenc.c
> > ===================================================================
> > --- libavformat/mxfenc.c (revision 15018)
> > +++ libavformat/mxfenc.c (working copy)
> > @@ -32,7 +32,10 @@
> > //#define DEBUG
> >
> > #include "mxf.h"
> > +#include <wchar.h>
> >
> > +typedef wchar_t MXFUTF16String;
> > +
>
> You don't need that, you need to transform char * to utf-16.
I agree that these are not necessary, but the transform necessary
is from UTF-8 to UTF-16. But since (AFAICT) we do not have any
user-supplied strings but only hard-coded, pure-ASCII ones
that just means that you need to need a 0 byte before each character.
Also this:
> +static void mxf_write_utf16string(ByteIOContext *pb, const MXFUTF16String *value)
> +{
> + int i, size = wcslen(value) + 1;
> + for (i = 0; i < size; i++)
> + {
> + put_byte(pb, (value[i] >> 8) & 0xff);
> + put_byte(pb, value[i] & 0xff);
> + }
> +}
is just completely nonsense. This only gives UTF-16 by pure luck.
wchar_t and L"..." strings can be in any kind of encoding, but even if
you are lucky enough that they are unicode, just shifting and bit
masking does _not_ give valid UTF-16.
So as a quick solution please make it only handle ASCII but that
correctly (writing a 0 byte, then the ASCII value), and make it
clear in the documentation that it only works for ASCII (i.e. range 0
-127).
Greetings,
Reimar Döffinger
More information about the FFmpeg-soc
mailing list