[FFmpeg-devel] [PATCH v3 2/2] libavformat/mxfenc: write package name metadata

tomas.hardin at codemill.se tomas.hardin at codemill.se
Wed Mar 4 13:07:31 CET 2015


On 2015-03-03 05:06, Mark Reid wrote:
> +/*
> + * Returns the calculated length a local tag containing an utf-8
> string as utf-16
> + */
> +static uint64_t mxf_utf16_local_tag_length(const char *utf8_str)
> +{
> +    return utf8_str? 4 + mxf_utf16len(utf8_str) * 2: 0;

Should return zero if mxf_utf16len()*2 > 65535.

> +}
> +
> +/*
> + * Write a local tag containing an utf-8 string as utf-16
>   */
>  static void mxf_write_local_tag_utf16(AVIOContext *pb, int tag, const
> char *value)
>  {
> -    int i, size = strlen(value);
> +    int size = mxf_utf16len(value);
>      mxf_write_local_tag(pb, size*2, tag);

Same here. Check that size*2 < 65536. I don't want us outputting illegal 
MXFs.

> -    for (i = 0; i < size; i++)
> -        avio_wb16(pb, value[i]);
> +    avio_put_str16be(pb, value);
>  }

/Tomas


More information about the ffmpeg-devel mailing list