[Ffmpeg-devel] patch for AVI files

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* dv_demux;
> } AVIContext;
> 
>-static int avi_load_index(AVFormatContext *s);
>+static int avi_read_idx1(AVFormatContext *s, int size);
>+static int avi_load_index(AVFormatContext *s);                                   
>  
>
Trailing spaces.

>+static int guess_ni_flag(AVFormatContext *s);
> 
> #ifdef DEBUG
> static void print_tag(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 "LIST<size>INFO" part.
>+ at return int 0 if successful, -ve otherwise.
>+*/
>+static int read_info_tags(AVFormatContext *s, ByteIOContext *pb, int size)
>+{
>+ 	uint32_t tag;
>+	offset_t info_end = url_ftell(pb) + size;
>+	while(url_ftell(pb)<info_end)
>+	{
>+        tag = get_le32(pb);
>+        size = get_le32(pb);
>+#ifdef DEBUG
>+        print_tag("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
>+				get_buffer(pb, s->title, size);
>+	    	}
>+	    break;
>+		case MKTAG('I','C','O','P'):
>+	    	{
>+				//Coptright
>  
>
Spelling

>[...]
>@@ -96,19 +183,30 @@
>     AVStream *st;
>     AVIStream *ast;
>     int xan_video = 0;  /* hack to support Xan A/V */
>-
>+    int movie_tag_found=0;
>+    offset_t mov_pos=0;
>+    
>  
>
Trailing spaces

>     avi->stream_index= -1;
> 
>     if (get_riff(avi, pb) < 0)
>         return -1;
>-
>+        
>  
>
Trailing spaces

>[...]
>@@ -495,9 +596,11 @@
>              put_le32(pb, 0);
>         end_tag(pb, avi->odml_list);
>     }
>-
>+    
>  
>
Trailing spaces

>     end_tag(pb, list1);
> 
>+    write_info_tags(pb,s);
>+    
>  
>
Trailing space

>     avi->movi_list = start_tag(pb, "LIST");
>     put_tag(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