[FFmpeg-devel] [patch]add a guid for asf header parser

Ronald S. Bultje rsbultje
Wed Jul 14 23:35:55 CEST 2010


Hi,

On Mon, Jul 5, 2010 at 1:01 PM, zhentan feng <spyfeng at gmail.com> wrote:
> The fist patch handle more guid when parse the asf header.
[..]
> @@ -417,22 +419,21 @@
>  {
>      uint8_t *p = mms->asf_header;
>      uint8_t *end;
> -    int flags, stream_id, real_header_size;
> +    int flags, stream_id, is_stream_num_known = 0;
>      mms->stream_num = 0;
[..]
> @@ -453,11 +454,38 @@
>              if (mms->stream_num < MAX_STREAMS &&
>                      46 + mms->stream_num * 6 < sizeof(mms->out_buffer)) {
>                  mms->streams[mms->stream_num].id = stream_id;
> -                mms->stream_num++;
> +                if (!is_stream_num_known)
> +                    mms->stream_num++;
>              } else {

You can't use mms->stream_num as an array index if it's already
increased elsewhere (further down in this patch). I would leave this
as-is.

> +            while(record_cnt > 0) {
> +                flags = AV_RL16(pos);
> +                pos += 2;
> +                stream_id = flags & 0x7F;
> +                mms->streams[stream_id].rate = AV_RL32(pos);
> +                pos += 4;
> +                record_cnt--;
> +            }

This is almost certainly wrong. stream_id isn't an array index, it's
an ASF stream ID, which starts at once, as written in
mms->streams[x].id. You need to either compare them to stream[x].id,
or set stream[x].id accordingly (and then disregard the stream chunk
above altogether).

Ronald



More information about the ffmpeg-devel mailing list