[Ffmpeg-devel] [PATCH] ASF Stream bitrate GUID parsing....
Michael Niedermayer
michaelni
Fri Jan 5 01:59:34 CET 2007
Hi
On Thu, Jan 04, 2007 at 04:45:22PM -0600, Ryan Martell wrote:
> Hi--
>
> To support my native mms code, I need to parse the bitrate GUID
> header of the ASF file if it's present. This small patch adds that
> information to the ASFContext.
>
> A couple of quick notes:
>
> 1) The indentation is actually correct now (the block below is
> indented incorrectly) on the lines:
> - } else if (!memcmp(&g, &extended_content_header, sizeof
> (GUID))) {
> + } else if (!memcmp(&g, &stream_bitrate_guid, sizeof(GUID))) {
>
> 2) I removed:
> ASFStream streams[128]; /* it's max number and it's not that
> big */
> >from the ASFContext, as it was unused (and big). I replaced it with
> a 128 uint32_t array, which seems fair.
[...]
> + } else if (!memcmp(&g, &stream_bitrate_guid, sizeof(GUID))) {
> + uint16_t streams = get_le16(pb);
> + int j;
> +
> +#ifdef DEBUG
> + av_log(NULL, AV_LOG_ERROR, "stream bitrate properties\n");
> + av_log(NULL, AV_LOG_ERROR, "streams %d\n", streams);
> +#endif
> +
> + for(j = 0; j < streams; j++) {
> + uint16_t flags;
> + uint32_t bitrate;
> + int stream_id;
> +
> + flags= get_le16(pb);
> + bitrate= get_le32(pb);
> + stream_id= (flags & 0x7f);
> +#ifdef DEBUG
> + av_log(NULL, AV_LOG_ERROR, "flags: 0x%x stream id %d, bitrate %d\n", flags, stream_id, bitrate);
> +#endif
> + asf->stream_bitrates[stream_id-1]= bitrate;
the -1 causes a possible write prior to the array
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070105/55d22f5b/attachment.pgp>
More information about the ffmpeg-devel
mailing list