[Ffmpeg-devel] [PATCH] Read AVI tags
David Conrad
umovimus
Tue Aug 15 07:53:20 CEST 2006
On Aug 15, 2006, at 1:39 AM, David Conrad wrote:
> Hi,
> The following patch adds some read support for metadata tags in AVI
> files. One note: the artist tag is put in the author field since
> there is no AVI tag for author, but this seems to be the same
> behavior as the mp3 parser's id3 tag reader.
My apologies, please ignore that last patch. The correct one follows.
-David
Index: libavformat/avidec.c
===================================================================
--- libavformat/avidec.c (revision 5999)
+++ libavformat/avidec.c (working copy)
@@ -180,6 +180,15 @@
}
}
+static int avi_read_tag(ByteIOContext *pb, char *buf, int maxlen,
unsigned int size)
+{
+ offset_t i = url_ftell(pb);
+ size += (size & 1);
+ get_strz(pb, buf, maxlen);
+ url_fseek(pb, i+size, SEEK_SET);
+ return 0;
+}
+
static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
AVIContext *avi = s->priv_data;
@@ -438,6 +447,21 @@
}
url_fseek(pb, i+size, SEEK_SET);
break;
+ case MKTAG('I', 'N', 'A', 'M'):
+ avi_read_tag(pb, s->title, sizeof(s->title), size);
+ break;
+ case MKTAG('I', 'A', 'R', 'T'):
+ avi_read_tag(pb, s->author, sizeof(s->author), size);
+ break;
+ case MKTAG('I', 'C', 'O', 'P'):
+ avi_read_tag(pb, s->copyright, sizeof(s->copyright), size);
+ break;
+ case MKTAG('I', 'C', 'M', 'T'):
+ avi_read_tag(pb, s->comment, sizeof(s->comment), size);
+ break;
+ case MKTAG('I', 'G', 'N', 'R'):
+ avi_read_tag(pb, s->genre, sizeof(s->genre), size);
+ break;
default:
/* skip tag */
size += (size & 1);
More information about the ffmpeg-devel
mailing list