[FFmpeg-soc] [soc]: r2836 - mxf/mxfenc.c

Michael Niedermayer michaelni at gmx.at
Tue Jul 22 19:22:00 CEST 2008


On Tue, Jul 22, 2008 at 06:29:03PM +0200, spyfeng wrote:
> Author: spyfeng
> Date: Tue Jul 22 18:29:03 2008
> New Revision: 2836
> 
> Log:
> fix bug in klv_encode_ber_length()
> write len as Big Endian
> 
> 
> Modified:
>    mxf/mxfenc.c
> 
> Modified: mxf/mxfenc.c
> ==============================================================================
> --- mxf/mxfenc.c	(original)
> +++ mxf/mxfenc.c	Tue Jul 22 18:29:03 2008
> @@ -229,6 +229,7 @@ static int klv_encode_ber_length(ByteIOC
>  {
>      // Determine the best BER size
>      int size = 0, i;
> +    uint8_t *tmp_buf;
>      uint64_t tmp = len;
>      if (len < 128) {
>          //short form
> @@ -245,12 +246,17 @@ static int klv_encode_ber_length(ByteIOC
>      // long form
>      put_byte(pb, 0x80 + size);
>      i = size;
> +    tmp_buf = av_mallocz(size);
> +    if (!tmp_buf)
> +        return -1;
>      while(i) {
> -        put_byte(pb, len & 0xff);
> +        tmp_buf[i - 1] = len & 0xff;
>          len >>= 8;
>          i--;
>      }
> -    return size;
> +    put_buffer(pb, tmp_buf, size);
> +    av_freep(&tmp_buf);

This can be done without malloc/free


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-soc/attachments/20080722/5dedaee3/attachment.pgp>


More information about the FFmpeg-soc mailing list