History

Add a list of generic tags and change demuxers to follow it. Patch by Anton Khirnov, wyskas at gmail dot com

Originally committed as revision 21587 to svn://svn.ffmpeg.org/ffmpeg/trunk

Anton Khirnov committed 16 years ago

Commit ca76a111 parent b8bb39812 files · +72 −29Browse files

Unified · Split

12 files
  1. doc/APIchanges +4 −0
  2. libavformat/asf.c +3 −5
  3. libavformat/avformat.h +41 −7
  4. libavformat/id3v1.c +1 −1
  5. libavformat/id3v2.c +11 −5
  6. libavformat/matroska.c +1 −2
  7. libavformat/matroskadec.c +1 −1
  8. libavformat/metadata_compat.c +3 −0
  9. libavformat/mov.c +1 −1
  10. libavformat/movenc.c +4 −4
  11. libavformat/mp3.c +1 −1
  12. libavformat/oggparsevorbis.c +1 −2
doc/APIchanges+4−0
@@ -12,6 +12,10 @@ libavutil: 2009-03-08 · 11 unmodified lines
1212
1313 API changes, most recent first:
1414
15+2010-02-01 - r21587 - lavf 52.50.0 - metadata API
16+ Add a list of generic tag names, change 'author' -> 'artist',
17+ 'year' -> 'date'.
18+
1519 2010-01-30 - r21545 - lavu 50.8.0 - av_get_pix_fmt()
1620 Add av_get_pix_fmt().
1721
libavformat/asf.c+3−5
@@ -129,12 +129,10 @@ const ff_asf_guid ff_asf_digital_signature = { · 128 unmodified lines
129129 };
130130
131131 const AVMetadataConv ff_asf_metadata_conv[] = {
132− { "AlbumArtist", "artist" },
132+ { "AlbumArtist", "album_artist"},
133133 { "AlbumTitle" , "album" },
134− { "Author" , "author" },
135− { "Genre" , "genre" },
136− { "Copyright" , "copyright" },
134+ { "Author" , "artist" },
137135 { "TrackNumber", "track" },
138− { "Year" , "year" },
136+// { "Year" , "date" }, TODO: conversion year<->date
139137 { 0 }
140138 };
libavformat/avformat.h+41−7
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222 #define AVFORMAT_AVFORMAT_H
2323
2424 #define LIBAVFORMAT_VERSION_MAJOR 52
25−#define LIBAVFORMAT_VERSION_MINOR 49
25+#define LIBAVFORMAT_VERSION_MINOR 50
2626 #define LIBAVFORMAT_VERSION_MICRO 0
2727
2828 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
@@ -73,11 +73,44 @@ struct AVFormatContext; · 44 unmodified lines
7373 * 2. Metadata is flat, not hierarchical; there are no subtags. If you
7474 * want to store, e.g., the email address of the child of producer Alice
7575 * and actor Bob, that could have key=alice_and_bobs_childs_email_address.
76− * 3. A tag whose value is localized for a particular language is appended
77− * with a dash character ('-') and the ISO 639-2/B 3-letter language code.
78− * For example: Author-ger=Michael, Author-eng=Mike
79− * The original/default language is in the unqualified "Author" tag.
80− * A demuxer should set a default if it sets any translated tag.
76+ * 3. Several modifiers can be applied to the tag name. This is done by
77+ * appending a dash character ('-') and the modifier name in the order
78+ * they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng.
79+ * a) language -- a tag whose value is localized for a particular language
80+ * is appended with the ISO 639-2/B 3-letter language code.
81+ * For example: Author-ger=Michael, Author-eng=Mike
82+ * The original/default language is in the unqualified "Author" tag.
83+ * A demuxer should set a default if it sets any translated tag.
84+ * b) sorting -- a modified version of a tag that should be used for
85+ * sorting will have '-sort' appended. E.g. artist="The Beatles",
86+ * artist-sort="Beatles, The".
87+ *
88+ * 4. Tag names are normally exported exactly as stored in the container to
89+ * allow lossless remuxing to the same format. For container-independent
90+ * handling of metadata, av_metadata_conv() can convert it to ffmpeg generic
91+ * format. Follows a list of generic tag names:
92+ *
93+ * album -- name of the set this work belongs to
94+ * album_artist -- main creator of the set/album, if different from artist.
95+ * e.g. "Various Artists" for compilation albums.
96+ * artist -- main creator of the work
97+ * comment -- any additional description of the file.
98+ * composer -- who composed the work, if different from artist.
99+ * copyright -- name of copyright holder.
100+ * date -- date when the work was created, preferably in ISO 8601.
101+ * disc -- number of a subset, e.g. disc in a multi-disc collection.
102+ * encoder -- name/settings of the software/hardware that produced the file.
103+ * encoded_by -- person/group who created the file.
104+ * filename -- original name of the file.
105+ * genre -- <self-evident>.
106+ * language -- main language in which the work is performed, preferably
107+ * in ISO 639-2 format.
108+ * performer -- artist who performed the work, if different from artist.
109+ * E.g for "Also sprach Zarathustra", artist would be "Richard
110+ * Strauss" and performer "London Philharmonic Orchestra".
111+ * publisher -- name of the label/publisher.
112+ * title -- name of the work.
113+ * track -- number of this work in the set, can be in form current/total.
81114 */
82115
83116 #define AV_METADATA_MATCH_CASE 1
@@ -122,7 +155,8 @@ int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int fl · 38 unmodified lines
122155
123156 /**
124157 * Converts all the metadata sets from ctx according to the source and
125− * destination conversion tables.
158+ * destination conversion tables. If one of the tables is NULL, then
159+ * tags are converted to/from ffmpeg generic tag names.
126160 * @param d_conv destination tags format conversion table
127161 * @param s_conv source tags format conversion table
128162 */
libavformat/id3v1.c+1−1
@@ -211,7 +211,7 @@ static int parse_tag(AVFormatContext *s, const uint8_t *buf) · 210 unmodified lines
211211 get_string(s, "title", buf + 3, 30);
212212 get_string(s, "artist", buf + 33, 30);
213213 get_string(s, "album", buf + 63, 30);
214− get_string(s, "year", buf + 93, 4);
214+ get_string(s, "date", buf + 93, 4);
215215 get_string(s, "comment", buf + 97, 30);
216216 if (buf[125] == 0 && buf[126] != 0)
217217 av_metadata_set2(&s->metadata, "track", av_d2str(buf[126]), AV_METADATA_DONT_STRDUP_VAL);
libavformat/id3v2.c+11−5
@@ -240,20 +240,26 @@ const AVMetadataConv ff_id3v2_metadata_conv[] = { · 239 unmodified lines
240240 { "TCO", "genre"},
241241 { "TCOP", "copyright"},
242242 { "TDRL", "date"},
243− { "TENC", "encoder"},
244− { "TEN", "encoder"},
243+ { "TDRC", "date"},
244+ { "TENC", "encoded_by"},
245+ { "TEN", "encoded_by"},
245246 { "TIT2", "title"},
246247 { "TT2", "title"},
247248 { "TLAN", "language"},
248249 { "TPE1", "artist"},
249250 { "TP1", "artist"},
251+ { "TPE2", "album_artist"},
252+ { "TP2", "album_artist"},
253+ { "TPE3", "performer"},
254+ { "TP3", "performer"},
250255 { "TPOS", "disc"},
251256 { "TPUB", "publisher"},
252257 { "TRCK", "track"},
253258 { "TRK", "track"},
254− { "TSOA", "albumsort"},
255− { "TSOP", "authorsort"},
256− { "TSOT", "titlesort"},
259+ { "TSOA", "album-sort"},
260+ { "TSOP", "artist-sort"},
261+ { "TSOT", "title-sort"},
262+ { "TSSE", "encoder"},
257263 { 0 }
258264 };
259265
libavformat/matroska.c+1−2
@@ -93,8 +93,7 @@ const CodecMime ff_mkv_mime_tags[] = { · 92 unmodified lines
9393 };
9494
9595 const AVMetadataConv ff_mkv_metadata_conv[] = {
96− { "ARTIST" , "artist" },
97− { "LEAD_PERFORMER", "artist" },
96+ { "LEAD_PERFORMER", "performer" },
9897 { "PART_NUMBER" , "track" },
9998 { 0 }
10099 };
libavformat/matroskadec.c+1−1
@@ -1342,7 +1342,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1341 unmodified lines
13421342 st->start_time = 0;
13431343 if (strcmp(track->language, "und"))
13441344 av_metadata_set(&st->metadata, "language", track->language);
1345− av_metadata_set(&st->metadata, "description", track->name);
1345+ av_metadata_set(&st->metadata, "title", track->name);
13461346
13471347 if (track->flag_default)
13481348 st->disposition |= AV_DISPOSITION_DEFAULT;
libavformat/metadata_compat.c+3−0
@@ -45,8 +45,11 @@ static const struct { · 44 unmodified lines
4545 { "creator", SIZE_OFFSET(author) },
4646 { "written_by", SIZE_OFFSET(author) },
4747 { "lead_performer", SIZE_OFFSET(author) },
48+ { "composer", SIZE_OFFSET(author) },
49+ { "performer", SIZE_OFFSET(author) },
4850 { "description", SIZE_OFFSET(comment) },
4951 { "albumtitle", SIZE_OFFSET(album) },
52+ { "date", SIZE_OFFSET(year) },
5053 { "date_written", SIZE_OFFSET(year) },
5154 { "date_released", SIZE_OFFSET(year) },
5255 { "tracknumber", SIZE_OFFSET(track) },
libavformat/mov.c+1−1
@@ -113,7 +113,7 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom) · 112 unmodified lines
113113 case MKTAG(0xa9,'c','m','t'):
114114 case MKTAG(0xa9,'i','n','f'): key = "comment"; break;
115115 case MKTAG(0xa9,'a','l','b'): key = "album"; break;
116− case MKTAG(0xa9,'d','a','y'): key = "year"; break;
116+ case MKTAG(0xa9,'d','a','y'): key = "date"; break;
117117 case MKTAG(0xa9,'g','e','n'): key = "genre"; break;
118118 case MKTAG(0xa9,'t','o','o'):
119119 case MKTAG(0xa9,'e','n','c'): key = "encoder"; break;
libavformat/movenc.c+4−4
@@ -1437,7 +1437,7 @@ static int mov_write_ilst_tag(ByteIOContext *pb, MOVMuxContext *mov, · 1436 unmodified lines
14371437 mov_write_string_metadata(s, pb, "aART", "album_artist", 1);
14381438 mov_write_string_metadata(s, pb, "\251wrt", "composer" , 1);
14391439 mov_write_string_metadata(s, pb, "\251alb", "album" , 1);
1440− mov_write_string_metadata(s, pb, "\251day", "year" , 1);
1440+ mov_write_string_metadata(s, pb, "\251day", "date" , 1);
14411441 mov_write_string_tag(pb, "\251too", LIBAVFORMAT_IDENT, 0, 1);
14421442 mov_write_string_metadata(s, pb, "\251cmt", "comment" , 1);
14431443 mov_write_string_metadata(s, pb, "\251gen", "genre" , 1);
@@ -1511,7 +1511,7 @@ static int mov_write_3gp_udta_tag(ByteIOContext *pb, AVFormatContext *s, · 67 unmodified lines
15111511 put_be16(pb, language_code("eng")); /* language */
15121512 put_buffer(pb, t->value, strlen(t->value)+1); /* UTF8 string value */
15131513 if (!strcmp(tag, "albm") &&
1514− (t = av_metadata_get(s->metadata, "year", NULL, 0)))
1514+ (t = av_metadata_get(s->metadata, "date", NULL, 0)))
15151515 put_byte(pb, atoi(t->value));
15161516 }
15171517 return updateSize(pb, pos);
@@ -1540,12 +1540,12 @@ static int mov_write_udta_tag(ByteIOContext *pb, MOVMuxContext *mov, · 22 unmodified lines
15401540 mov_write_3gp_udta_tag(pb_buf, s, "dscp", "comment");
15411541 mov_write_3gp_udta_tag(pb_buf, s, "albm", "album");
15421542 mov_write_3gp_udta_tag(pb_buf, s, "cprt", "copyright");
1543− mov_write_3gp_udta_tag(pb_buf, s, "yrrc", "year");
1543+ mov_write_3gp_udta_tag(pb_buf, s, "yrrc", "date");
15441544 } else if (mov->mode == MODE_MOV) { // the title field breaks gtkpod with mp4 and my suspicion is that stuff is not valid in mp4
15451545 mov_write_string_metadata(s, pb_buf, "\251nam", "title" , 0);
15461546 mov_write_string_metadata(s, pb_buf, "\251aut", "author" , 0);
15471547 mov_write_string_metadata(s, pb_buf, "\251alb", "album" , 0);
1548− mov_write_string_metadata(s, pb_buf, "\251day", "year" , 0);
1548+ mov_write_string_metadata(s, pb_buf, "\251day", "date" , 0);
15491549 mov_write_string_tag(pb_buf, "\251enc", LIBAVFORMAT_IDENT, 0, 0);
15501550 mov_write_string_metadata(s, pb_buf, "\251des", "comment" , 0);
15511551 mov_write_string_metadata(s, pb_buf, "\251gen", "genre" , 0);
libavformat/mp3.c+1−1
@@ -214,7 +214,7 @@ static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf) · 213 unmodified lines
214214 count += id3v1_set_string(s, "title", buf + 3, 30);
215215 count += id3v1_set_string(s, "author", buf + 33, 30);
216216 count += id3v1_set_string(s, "album", buf + 63, 30);
217− count += id3v1_set_string(s, "year", buf + 93, 4);
217+ count += id3v1_set_string(s, "date", buf + 93, 4);
218218 count += id3v1_set_string(s, "comment", buf + 97, 30);
219219 if ((tag = av_metadata_get(s->metadata, "track", NULL, 0))) {
220220 buf[125] = 0;
libavformat/oggparsevorbis.c+1−2
@@ -36,8 +36,7 @@ · 35 unmodified lines
3636 * http://xiph.org/vorbis/doc/v-comment.html
3737 */
3838 const AVMetadataConv ff_vorbiscomment_metadata_conv[] = {
39− { "ARTIST" , "author" },
40− { "DATE" , "year" },
39+ { "ALBUMARTIST", "album_artist"},
4140 { "TRACKNUMBER", "track" },
4241 { 0 }
4342 };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t