Originally committed as revision 21587 to svn://svn.ffmpeg.org/ffmpeg/trunk
Unified · Split
| @@ -12,6 +12,10 @@ libavutil: 2009-03-08 · 11 unmodified lines | ||
| 12 | 12 | |
| 13 | 13 | API changes, most recent first: |
| 14 | 14 | |
| 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 | + | |
| 15 | 19 | 2010-01-30 - r21545 - lavu 50.8.0 - av_get_pix_fmt() |
| 16 | 20 | Add av_get_pix_fmt(). |
| 17 | 21 | |
| @@ -129,12 +129,10 @@ const ff_asf_guid ff_asf_digital_signature = { · 128 unmodified lines | ||
| 129 | 129 | }; |
| 130 | 130 | |
| 131 | 131 | const AVMetadataConv ff_asf_metadata_conv[] = { |
| 132 | − { "AlbumArtist", "artist" }, | |
| 132 | + { "AlbumArtist", "album_artist"}, | |
| 133 | 133 | { "AlbumTitle" , "album" }, |
| 134 | − { "Author" , "author" }, | |
| 135 | − { "Genre" , "genre" }, | |
| 136 | − { "Copyright" , "copyright" }, | |
| 134 | + { "Author" , "artist" }, | |
| 137 | 135 | { "TrackNumber", "track" }, |
| 138 | − { "Year" , "year" }, | |
| 136 | +// { "Year" , "date" }, TODO: conversion year<->date | |
| 139 | 137 | { 0 } |
| 140 | 138 | }; |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #define AVFORMAT_AVFORMAT_H |
| 23 | 23 | |
| 24 | 24 | #define LIBAVFORMAT_VERSION_MAJOR 52 |
| 25 | −#define LIBAVFORMAT_VERSION_MINOR 49 | |
| 25 | +#define LIBAVFORMAT_VERSION_MINOR 50 | |
| 26 | 26 | #define LIBAVFORMAT_VERSION_MICRO 0 |
| 27 | 27 | |
| 28 | 28 | #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |
| @@ -73,11 +73,44 @@ struct AVFormatContext; · 44 unmodified lines | ||
| 73 | 73 | * 2. Metadata is flat, not hierarchical; there are no subtags. If you |
| 74 | 74 | * want to store, e.g., the email address of the child of producer Alice |
| 75 | 75 | * 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. | |
| 81 | 114 | */ |
| 82 | 115 | |
| 83 | 116 | #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 | ||
| 122 | 155 | |
| 123 | 156 | /** |
| 124 | 157 | * 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. | |
| 126 | 160 | * @param d_conv destination tags format conversion table |
| 127 | 161 | * @param s_conv source tags format conversion table |
| 128 | 162 | */ |
| @@ -211,7 +211,7 @@ static int parse_tag(AVFormatContext *s, const uint8_t *buf) · 210 unmodified lines | ||
| 211 | 211 | get_string(s, "title", buf + 3, 30); |
| 212 | 212 | get_string(s, "artist", buf + 33, 30); |
| 213 | 213 | get_string(s, "album", buf + 63, 30); |
| 214 | − get_string(s, "year", buf + 93, 4); | |
| 214 | + get_string(s, "date", buf + 93, 4); | |
| 215 | 215 | get_string(s, "comment", buf + 97, 30); |
| 216 | 216 | if (buf[125] == 0 && buf[126] != 0) |
| 217 | 217 | av_metadata_set2(&s->metadata, "track", av_d2str(buf[126]), AV_METADATA_DONT_STRDUP_VAL); |
| @@ -240,20 +240,26 @@ const AVMetadataConv ff_id3v2_metadata_conv[] = { · 239 unmodified lines | ||
| 240 | 240 | { "TCO", "genre"}, |
| 241 | 241 | { "TCOP", "copyright"}, |
| 242 | 242 | { "TDRL", "date"}, |
| 243 | − { "TENC", "encoder"}, | |
| 244 | − { "TEN", "encoder"}, | |
| 243 | + { "TDRC", "date"}, | |
| 244 | + { "TENC", "encoded_by"}, | |
| 245 | + { "TEN", "encoded_by"}, | |
| 245 | 246 | { "TIT2", "title"}, |
| 246 | 247 | { "TT2", "title"}, |
| 247 | 248 | { "TLAN", "language"}, |
| 248 | 249 | { "TPE1", "artist"}, |
| 249 | 250 | { "TP1", "artist"}, |
| 251 | + { "TPE2", "album_artist"}, | |
| 252 | + { "TP2", "album_artist"}, | |
| 253 | + { "TPE3", "performer"}, | |
| 254 | + { "TP3", "performer"}, | |
| 250 | 255 | { "TPOS", "disc"}, |
| 251 | 256 | { "TPUB", "publisher"}, |
| 252 | 257 | { "TRCK", "track"}, |
| 253 | 258 | { "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"}, | |
| 257 | 263 | { 0 } |
| 258 | 264 | }; |
| 259 | 265 | |
| @@ -93,8 +93,7 @@ const CodecMime ff_mkv_mime_tags[] = { · 92 unmodified lines | ||
| 93 | 93 | }; |
| 94 | 94 | |
| 95 | 95 | const AVMetadataConv ff_mkv_metadata_conv[] = { |
| 96 | − { "ARTIST" , "artist" }, | |
| 97 | − { "LEAD_PERFORMER", "artist" }, | |
| 96 | + { "LEAD_PERFORMER", "performer" }, | |
| 98 | 97 | { "PART_NUMBER" , "track" }, |
| 99 | 98 | { 0 } |
| 100 | 99 | }; |
| @@ -1342,7 +1342,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1341 unmodified lines | ||
| 1342 | 1342 | st->start_time = 0; |
| 1343 | 1343 | if (strcmp(track->language, "und")) |
| 1344 | 1344 | 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); | |
| 1346 | 1346 | |
| 1347 | 1347 | if (track->flag_default) |
| 1348 | 1348 | st->disposition |= AV_DISPOSITION_DEFAULT; |
| @@ -45,8 +45,11 @@ static const struct { · 44 unmodified lines | ||
| 45 | 45 | { "creator", SIZE_OFFSET(author) }, |
| 46 | 46 | { "written_by", SIZE_OFFSET(author) }, |
| 47 | 47 | { "lead_performer", SIZE_OFFSET(author) }, |
| 48 | + { "composer", SIZE_OFFSET(author) }, | |
| 49 | + { "performer", SIZE_OFFSET(author) }, | |
| 48 | 50 | { "description", SIZE_OFFSET(comment) }, |
| 49 | 51 | { "albumtitle", SIZE_OFFSET(album) }, |
| 52 | + { "date", SIZE_OFFSET(year) }, | |
| 50 | 53 | { "date_written", SIZE_OFFSET(year) }, |
| 51 | 54 | { "date_released", SIZE_OFFSET(year) }, |
| 52 | 55 | { "tracknumber", SIZE_OFFSET(track) }, |
| @@ -113,7 +113,7 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom) · 112 unmodified lines | ||
| 113 | 113 | case MKTAG(0xa9,'c','m','t'): |
| 114 | 114 | case MKTAG(0xa9,'i','n','f'): key = "comment"; break; |
| 115 | 115 | 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; | |
| 117 | 117 | case MKTAG(0xa9,'g','e','n'): key = "genre"; break; |
| 118 | 118 | case MKTAG(0xa9,'t','o','o'): |
| 119 | 119 | case MKTAG(0xa9,'e','n','c'): key = "encoder"; break; |
| @@ -1437,7 +1437,7 @@ static int mov_write_ilst_tag(ByteIOContext *pb, MOVMuxContext *mov, · 1436 unmodified lines | ||
| 1437 | 1437 | mov_write_string_metadata(s, pb, "aART", "album_artist", 1); |
| 1438 | 1438 | mov_write_string_metadata(s, pb, "\251wrt", "composer" , 1); |
| 1439 | 1439 | 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); | |
| 1441 | 1441 | mov_write_string_tag(pb, "\251too", LIBAVFORMAT_IDENT, 0, 1); |
| 1442 | 1442 | mov_write_string_metadata(s, pb, "\251cmt", "comment" , 1); |
| 1443 | 1443 | 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 | ||
| 1511 | 1511 | put_be16(pb, language_code("eng")); /* language */ |
| 1512 | 1512 | put_buffer(pb, t->value, strlen(t->value)+1); /* UTF8 string value */ |
| 1513 | 1513 | if (!strcmp(tag, "albm") && |
| 1514 | − (t = av_metadata_get(s->metadata, "year", NULL, 0))) | |
| 1514 | + (t = av_metadata_get(s->metadata, "date", NULL, 0))) | |
| 1515 | 1515 | put_byte(pb, atoi(t->value)); |
| 1516 | 1516 | } |
| 1517 | 1517 | return updateSize(pb, pos); |
| @@ -1540,12 +1540,12 @@ static int mov_write_udta_tag(ByteIOContext *pb, MOVMuxContext *mov, · 22 unmodified lines | ||
| 1540 | 1540 | mov_write_3gp_udta_tag(pb_buf, s, "dscp", "comment"); |
| 1541 | 1541 | mov_write_3gp_udta_tag(pb_buf, s, "albm", "album"); |
| 1542 | 1542 | 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"); | |
| 1544 | 1544 | } else if (mov->mode == MODE_MOV) { // the title field breaks gtkpod with mp4 and my suspicion is that stuff is not valid in mp4 |
| 1545 | 1545 | mov_write_string_metadata(s, pb_buf, "\251nam", "title" , 0); |
| 1546 | 1546 | mov_write_string_metadata(s, pb_buf, "\251aut", "author" , 0); |
| 1547 | 1547 | 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); | |
| 1549 | 1549 | mov_write_string_tag(pb_buf, "\251enc", LIBAVFORMAT_IDENT, 0, 0); |
| 1550 | 1550 | mov_write_string_metadata(s, pb_buf, "\251des", "comment" , 0); |
| 1551 | 1551 | mov_write_string_metadata(s, pb_buf, "\251gen", "genre" , 0); |
| @@ -214,7 +214,7 @@ static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf) · 213 unmodified lines | ||
| 214 | 214 | count += id3v1_set_string(s, "title", buf + 3, 30); |
| 215 | 215 | count += id3v1_set_string(s, "author", buf + 33, 30); |
| 216 | 216 | 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); | |
| 218 | 218 | count += id3v1_set_string(s, "comment", buf + 97, 30); |
| 219 | 219 | if ((tag = av_metadata_get(s->metadata, "track", NULL, 0))) { |
| 220 | 220 | buf[125] = 0; |
| @@ -36,8 +36,7 @@ · 35 unmodified lines | ||
| 36 | 36 | * http://xiph.org/vorbis/doc/v-comment.html |
| 37 | 37 | */ |
| 38 | 38 | const AVMetadataConv ff_vorbiscomment_metadata_conv[] = { |
| 39 | − { "ARTIST" , "author" }, | |
| 40 | − { "DATE" , "year" }, | |
| 39 | + { "ALBUMARTIST", "album_artist"}, | |
| 41 | 40 | { "TRACKNUMBER", "track" }, |
| 42 | 41 | { 0 } |
| 43 | 42 | }; |