[Ffmpeg-devel] patch for AVI files (original) (raw)

Benjamin Larsson banan
Fri Feb 10 12:46:37 CET 2006


Hi,

Dilip Kumar Rai wrote:

Hello Developers, I am a developer working at AOL Bangalore on Audio Video search technology, I came to know about FFmpeg when I was evaluating various softwares for extracting meta data information (e.g. Title, Author, Genre etc..) from media files. I think FFmpeg is very good in handling many file formats and codecs, however we had to drop FFmpeg against native API's because it failed to extract metadata for many file formats. Nevertheless, I have decided to bridge this gap by providing missing functionality to FFmpeg. This fix is first in the series. I hope that this will add significant values to the product.

Nature of Fix: Added code for writing/reading INFO tags in AVI files. Description: With this fix it will be possible to extract and embeds INFO tags like, title, author, creation date etc... in a AVI file. With this fix generated files will be at least 28 bytes larger. Files Modified: libavformat/ avienc.c avidec.c tests/ ffmpeg.regression.ref libav.regression.ref rotozoom.regression.ref

Thanks & Regards, Dilip Kumar Rai AOL Bangalore Development Center The functionality of the code seams ok (I did not test it though) but the patch has lots of cosmetics (tabs and trailing spaces), these has to be removed before the patch can be commited.

MvH Benjamin Larsson

Index: libavformat/avidec.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/avidec.c,v retrieving revision 1.79 diff -u -r1.79 avidec.c --- libavformat/avidec.c 12 Jan 2006 22:43:22 -0000 1.79 +++ libavformat/avidec.c 10 Feb 2006 08:48:42 -0000 @@ -54,7 +54,9 @@ DVDemuxContext* dvdemux; } AVIContext;

-static int aviloadindex(AVFormatContext *s); +static int avireadidx1(AVFormatContext *s, int size); +static int aviloadindex(AVFormatContext *s); Trailing spaces.

+static int guessniflag(AVFormatContext *s);

#ifdef DEBUG static void printtag(const char *str, unsigned int tag, int size) @@ -84,6 +86,91 @@ return 0; } +/** +Reades 'LIST INFO' tags to AVI streams. +Presently supported INFO tags are INAM, ICOP, ICMS, ICMT, ICRD, IPRP, IGNR, ISFT. More tags can be added later.... + at param s [IN,OUT] AVFormatContext* + at param pb [IN, OUT] ByteIOContext* + at param size [IN] Size of LIST tag, excluding "LISTINFO" part. + at return int 0 if successful, -ve otherwise. +*/ +static int readinfotags(AVFormatContext *s, ByteIOContext *pb, int size) +{ + uint32t tag; + offsett infoend = urlftell(pb) + size; + while(urlftell(pb)<infoend)_ _+ {_ _+ tag = getle32(pb);_ _+ size = getle32(pb);_ _+#ifdef DEBUG_ _+ printtag("tag", tag, size);_ _+#endif_ _+ /*Right now handling only few tags code can be extended easily in future*/_ _+ switch(tag)_ _+ {_ _+ case MKTAG('I','N','A','M'):_ _+ {_ _+ //Process Title_ _+ getbuffer(pb, s->title, size); + } + break; + case MKTAG('I','C','O','P'): + { + //Coptright Spelling

[...] @@ -96,19 +183,30 @@ AVStream *st; AVIStream *ast; int xanvideo = 0; /* hack to support Xan A/V */ - + int movietagfound=0; + offsett movpos=0; +

Trailing spaces

avi->streamindex= -1;

if (getriff(avi, pb) < 0) return -1; - + Trailing spaces

[...] @@ -495,9 +596,11 @@ putle32(pb, 0); endtag(pb, avi->odmllist); } - +

Trailing spaces

endtag(pb, list1);

+ writeinfotags(pb,s); + Trailing space

avi->movilist = starttag(pb, "LIST"); puttag(pb, "movi");

[...] This is just a few cases, most of the code has alot of tabs also.

-- "incorrect information" is an oxymoron. Information is, by definition, factual, correct.



More information about the ffmpeg-devel mailing list