[Ffmpeg-devel] ffmpeg file info as XML

Michael Niedermayer michaelni
Sun Feb 11 17:46:16 CET 2007


Hi

On Sun, Feb 11, 2007 at 01:31:49PM +0100, Luca Barbato wrote:
> Michael Niedermayer wrote:
> > 
> > umm
> > i was more thinking of 
> > 
> > filename= file name with weird symbols!"'=@^$%&.avi
> > streamid= 0
> >  streamtype= video
> >  codec= mpeg4
> >  width= 123
> >  height= 234
> > streamid= 1
> >  streamtype= audio
> >  codec= mp3
> >  samperate= 44100
> > ...
> > 
> 
> YAML or shell-like probably would be the simplest to implement and
> sanest to use.

iam not sure what you mean with shell like but simple
name= value\n
without any escaping, extra whitespace or comments allowed should be
simpler, the space after the = in my example above should also be removed

this can be parsed with a simple parser like

while(not end){
    char name[101], value[101];
    int depth; //unused in a "flat" parser
    double v;
    if( fscanf(" %n%100[^=]=%100[^\n]\n", &depth, name, value) != 3)
        return -1;
    v= atof(value);

    if(!strcmp(name, "streamid")){
        if(v >= 0 && v<MAX_STREAMS)
            current_stream_id= v;
    }else if(!strcmp(name, "width")){
        streams[current_stream_id].width= v;
    }
    ...
}


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- 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/20070211/17ff8fac/attachment.pgp>



More information about the ffmpeg-devel mailing list