[FFmpeg-devel] [PATCH] avi metadata conv table
Michael Niedermayer
michaelni
Fri Feb 5 19:43:22 CET 2010
On Fri, Feb 05, 2010 at 05:29:24PM +0100, Anton Khirnov wrote:
> Hi,
> attached patch adds $subj. As a side effect, AVI demuxer now reads all
> metadata in the INFO chunk, not just selected few; and AVI muxer writes
> more tags.
[...]
> @@ -242,12 +242,25 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, const char *key, unsig
> get_buffer(pb, value, size);
> value[size]=0;
>
> + if(!(key = av_mallocz(5)))
> + return AVERROR(ENOMEM);
> + AV_WL32(key, tag);
> +
> if(st)
> return av_metadata_set2(&st->metadata, key, value,
> - AV_METADATA_DONT_STRDUP_VAL);
> + AV_METADATA_DONT_STRDUP_VAL | AV_METADATA_DONT_STRDUP_KEY);
> else
> - return av_metadata_set2(&s->metadata, key, value,
> - AV_METADATA_DONT_STRDUP_VAL);
> + return av_metadata_set2(&s->metadata, key, value,
> + AV_METADATA_DONT_STRDUP_VAL | AV_METADATA_DONT_STRDUP_KEY);
char key[5]={0}
AV_WL32(key, tag);
(simpler IMHO)
[...]
> @@ -101,35 +102,18 @@ static char* avi_stream2fourcc(char* tag, int index, enum CodecType type)
> return tag;
> }
>
> -static void avi_write_info_tag(ByteIOContext *pb, const char *tag, const char *str)
> +static void avi_write_info_tag(AVFormatContext *s, AVMetadataTag *t)
> {
> - int len = strlen(str);
> - if (len > 0) {
> - len++;
> - put_tag(pb, tag);
> - put_le32(pb, len);
> - put_strz(pb, str);
> + int len = strlen(t->value);
> + if (len++ > 0) {
> + put_le32(s->pb, AV_RL32(t->key));
> + put_le32(s->pb, len);
> + put_strz(s->pb, t->value);
> if (len & 1)
> - put_byte(pb, 0);
> + put_byte(s->pb, 0);
> }
> }
nothing in there uses AVFormatContext thus the changes is pointless
[...]
> @@ -378,15 +366,13 @@ static int avi_write_header(AVFormatContext *s)
>
> list2 = ff_start_tag(pb, "LIST");
> put_tag(pb, "INFO");
> - avi_write_info_tag2(s, NULL, "INAM", "Title", NULL);
> - avi_write_info_tag2(s, NULL, "IART", "Artist", "Author");
> - avi_write_info_tag2(s, NULL, "ICOP", "Copyright", NULL);
> - avi_write_info_tag2(s, NULL, "ICMT", "Comment", NULL);
> - avi_write_info_tag2(s, NULL, "IPRD", "Album", NULL);
> - avi_write_info_tag2(s, NULL, "IGNR", "Genre", NULL);
> - avi_write_info_tag2(s, NULL, "IPRT", "Track", NULL);
> - if(!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT))
> - avi_write_info_tag(pb, "ISFT", LIBAVFORMAT_IDENT);
you seem to be loosing this in your patch
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100205/0a6df3e4/attachment.pgp>
More information about the ffmpeg-devel
mailing list