diff options
author | David Conrad <lessen42@gmail.com> | 2006-08-18 16:48:35 +0000 |
---|---|---|
committer | Benjamin Larsson <banan@ludd.ltu.se> | 2006-08-18 16:48:35 +0000 |
commit | 57060f8936e1d28ef328ed7a3999ec478bddc2a6 (patch) | |
tree | 775ebfec008d254382689c3a4322729a0c934f64 /libavformat/avienc.c | |
parent | db3924f1fd104caa669dabdb0869677349b80f99 (diff) | |
download | ffmpeg-57060f8936e1d28ef328ed7a3999ec478bddc2a6.tar.gz |
AVI tag reading and writing patch by David Conrad.
umovimus at gmail dot com
Originally committed as revision 6022 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/avienc.c')
-rw-r--r-- | libavformat/avienc.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 98ce333cd9..fcbcd8b6a4 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -89,6 +89,19 @@ static unsigned char* avi_stream2fourcc(unsigned char* tag, int index, return tag; } +static void avi_write_info_tag(ByteIOContext *pb, const char *tag, const char *str) +{ + int len = strlen(str); + if (len > 0) { + len++; + put_tag(pb, tag); + put_le32(pb, len); + put_strz(pb, str); + if (len & 1) + put_byte(pb, 0); + } +} + static int avi_write_header(AVFormatContext *s) { AVIContext *avi = s->priv_data; @@ -258,6 +271,24 @@ static int avi_write_header(AVFormatContext *s) end_tag(pb, list1); + list2 = start_tag(pb, "LIST"); + put_tag(pb, "INFO"); + avi_write_info_tag(pb, "INAM", s->title); + avi_write_info_tag(pb, "IART", s->author); + avi_write_info_tag(pb, "ICOP", s->copyright); + avi_write_info_tag(pb, "ICMT", s->comment); + avi_write_info_tag(pb, "IPRD", s->album); + avi_write_info_tag(pb, "IGNR", s->genre); + if(!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) + avi_write_info_tag(pb, "ISFT", LIBAVFORMAT_IDENT); + end_tag(pb, list2); + + /* some padding for easier tag editing */ + list2 = start_tag(pb, "JUNK"); + for (i = 0; i < 1016; i += 4) + put_le32(pb, 0); + end_tag(pb, list2); + avi->movi_list = start_tag(pb, "LIST"); put_tag(pb, "movi"); |