[FFmpeg-cvslog] r20092 - trunk/libavformat/mov.c

Baptiste Coudurier baptiste.coudurier
Wed Sep 30 20:08:08 CEST 2009


On 9/30/09 2:43 AM, reimar wrote:
> Author: reimar
> Date: Wed Sep 30 11:43:56 2009
> New Revision: 20092
>
> Log:
> Convert latin1 codec_name in mov to UTF-8, since all strings in FFmpeg
> must be valid UTF-8.
>
> Modified:
>     trunk/libavformat/mov.c
>
> Modified: trunk/libavformat/mov.c
> ==============================================================================
> --- trunk/libavformat/mov.c	Wed Sep 30 07:49:18 2009	(r20091)
> +++ trunk/libavformat/mov.c	Wed Sep 30 11:43:56 2009	(r20092)
> @@ -909,8 +909,13 @@ static int mov_read_stsd(MOVContext *c,
>
>               get_buffer(pb, codec_name, 32); /* codec name, pascal string */
>               if (codec_name[0]<= 31) {
> -                memcpy(st->codec->codec_name,&codec_name[1],codec_name[0]);
> -                st->codec->codec_name[codec_name[0]] = 0;
> +                int i;
> +                int pos = 0;
> +                for (i = 0; i<  codec_name[0]&&  pos<  sizeof(st->codec->codec_name) - 3; i++) {
> +                    uint8_t tmp;
> +                    PUT_UTF8(codec_name[i], tmp, st->codec->codec_name[pos++] = tmp;)
> +                }

Shouldn't the copy skip the size first byte ?

-- 
Baptiste COUDURIER
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org



More information about the ffmpeg-cvslog mailing list