[Ffmpeg-cvslog] Re: r5909 - trunk/libavformat/mxf.c

Michael Niedermayer michaelni
Sat Aug 5 00:17:03 CEST 2006


Hi

On Fri, Aug 04, 2006 at 03:16:09PM +0200, Baptiste Coudurier wrote:
> Hi
> 
> Michael Niedermayer wrote:
> > Hi
> > 
> > On Thu, Aug 03, 2006 at 05:06:49PM +0200, Baptiste Coudurier wrote:
> >> Hi
> >>
> >> Michael Niedermayer wrote:
> >>>> [...]
> >>>> +static offset_t mxf_header_offset = 0;
> >>> non constant global and static variables are forbidden as they break 
> >>> multithreaded apps
> >>>
> >>> [...]
> >> Hummm I was fearing something like that.
> >> What about having a priv_data field on AVProbeData which contain private
> >> demuxer context ?
> > 
> > no accpetable (see below why)
> > 
> > 
> >> Must I reparse the head of the file ?
> > 
> > yes, a application could skip the probe or even probe all files
> > in a directory and then demux them all one by one or ...
> > 
> > [...]
> > 
> 
> Is that better ? Is there a more efficient way ?
> 
> -- 
> Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
> SMARTJOG S.A.                                    http://www.smartjog.com
> Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
> Phone: +33 1 49966312

> Index: libavformat/mxf.c
> ===================================================================
> --- libavformat/mxf.c	(revision 5917)
> +++ libavformat/mxf.c	(working copy)
> @@ -878,12 +878,31 @@
>      { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, NULL },
>  };
>  
> +static int mxf_skip_run_in_sequence(ByteIOContext *pb)
> +{
> +    uint8_t buffer[65550]; /* Worst case, 64K + 14 */
> +    unsigned int i, end;
> +
> +    end = get_buffer(pb, buffer, 65550);
> +    for (i = 0; i < end - 14; i++) {
> +        if (IS_KLV_KEY(&buffer[i], mxf_header_partition_pack_key)) {
> +            url_fseek(pb, i, SEEK_SET);
> +            return 0;
> +        }
> +    }
> +    return -1;
> +}

this is unacceptable as the stream might not be seekable (for example in a
case like someprogram | ffmpeg -i - ...

    for(i=0; i<keylen && url_ftell(pb)<maxlen; i++){
        int b= get_byte(pb);
        if(b == key[0])
            i=0;
        else if(b != key[i])
            i=-1;
    }

and this should also be used during probing to avoid code duplication

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-cvslog mailing list