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 | API changes, most recent first: | 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 | 2010-01-30 - r21545 - lavu 50.8.0 - av_get_pix_fmt() | 19 | 2010-01-30 - r21545 - lavu 50.8.0 - av_get_pix_fmt() |
| 16 | Add av_get_pix_fmt(). | 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 | const AVMetadataConv ff_asf_metadata_conv[] = { | 131 | const AVMetadataConv ff_asf_metadata_conv[] = { |
| 132 | { "AlbumArtist", "artist" }, | 132 | { "AlbumArtist", "album_artist"}, |
| 133 | { "AlbumTitle" , "album" }, | 133 | { "AlbumTitle" , "album" }, |
| 134 | { "Author" , "author" }, | 134 | { "Author" , "artist" }, |
| 135 | { "Genre" , "genre" }, | ||
| 136 | { "Copyright" , "copyright" }, | ||
| 137 | { "TrackNumber", "track" }, | 135 | { "TrackNumber", "track" }, |
| 138 | { "Year" , "year" }, | 136 | // { "Year" , "date" }, TODO: conversion year<->date |
| 139 | { 0 } | 137 | { 0 } |
| 140 | }; | 138 | }; |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | #define AVFORMAT_AVFORMAT_H | 22 | #define AVFORMAT_AVFORMAT_H |
| 23 | 23 | ||
| 24 | #define LIBAVFORMAT_VERSION_MAJOR 52 | 24 | #define LIBAVFORMAT_VERSION_MAJOR 52 |
| 25 | #define LIBAVFORMAT_VERSION_MINOR 49 | 25 | #define LIBAVFORMAT_VERSION_MINOR 50 |
| 26 | #define LIBAVFORMAT_VERSION_MICRO 0 | 26 | #define LIBAVFORMAT_VERSION_MICRO 0 |
| 27 | 27 | ||
| 28 | #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ | 28 | #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |
| @@ -73,11 +73,44 @@ struct AVFormatContext; · 44 unmodified lines | |||
| 73 | * 2. Metadata is flat, not hierarchical; there are no subtags. If you | 73 | * 2. Metadata is flat, not hierarchical; there are no subtags. If you |
| 74 | * want to store, e.g., the email address of the child of producer Alice | 74 | * want to store, e.g., the email address of the child of producer Alice |
| 75 | * and actor Bob, that could have key=alice_and_bobs_childs_email_address. | 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 | 76 | * 3. Several modifiers can be applied to the tag name. This is done by |
| 77 | * with a dash character ('-') and the ISO 639-2/B 3-letter language code. | 77 | * appending a dash character ('-') and the modifier name in the order |
| 78 | * For example: Author-ger=Michael, Author-eng=Mike | 78 | * they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng. |
| 79 | * The original/default language is in the unqualified "Author" tag. | 79 | * a) language -- a tag whose value is localized for a particular language |
| 80 | * A demuxer should set a default if it sets any translated tag. | 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 | #define AV_METADATA_MATCH_CASE 1 | 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 | * Converts all the metadata sets from ctx according to the source and | 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 | * @param d_conv destination tags format conversion table | 160 | * @param d_conv destination tags format conversion table |
| 127 | * @param s_conv source tags format conversion table | 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 | get_string(s, "title", buf + 3, 30); | 211 | get_string(s, "title", buf + 3, 30); |
| 212 | get_string(s, "artist", buf + 33, 30); | 212 | get_string(s, "artist", buf + 33, 30); |
| 213 | get_string(s, "album", buf + 63, 30); | 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 | get_string(s, "comment", buf + 97, 30); | 215 | get_string(s, "comment", buf + 97, 30); |
| 216 | if (buf[125] == 0 && buf[126] != 0) | 216 | if (buf[125] == 0 && buf[126] != 0) |
| 217 | av_metadata_set2(&s->metadata, "track", av_d2str(buf[126]), AV_METADATA_DONT_STRDUP_VAL); | 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 | { "TCO", "genre"}, | 240 | { "TCO", "genre"}, |
| 241 | { "TCOP", "copyright"}, | 241 | { "TCOP", "copyright"}, |
| 242 | { "TDRL", "date"}, | 242 | { "TDRL", "date"}, |
| 243 | { "TENC", "encoder"}, | 243 | { "TDRC", "date"}, |
| 244 | { "TEN", "encoder"}, | 244 | { "TENC", "encoded_by"}, |
| 245 | { "TEN", "encoded_by"}, | ||
| 245 | { "TIT2", "title"}, | 246 | { "TIT2", "title"}, |
| 246 | { "TT2", "title"}, | 247 | { "TT2", "title"}, |
| 247 | { "TLAN", "language"}, | 248 | { "TLAN", "language"}, |
| 248 | { "TPE1", "artist"}, | 249 | { "TPE1", "artist"}, |
| 249 | { "TP1", "artist"}, | 250 | { "TP1", "artist"}, |
| 251 | { "TPE2", "album_artist"}, | ||
| 252 | { "TP2", "album_artist"}, | ||
| 253 | { "TPE3", "performer"}, | ||
| 254 | { "TP3", "performer"}, | ||
| 250 | { "TPOS", "disc"}, | 255 | { "TPOS", "disc"}, |
| 251 | { "TPUB", "publisher"}, | 256 | { "TPUB", "publisher"}, |
| 252 | { "TRCK", "track"}, | 257 | { "TRCK", "track"}, |
| 253 | { "TRK", "track"}, | 258 | { "TRK", "track"}, |
| 254 | { "TSOA", "albumsort"}, | 259 | { "TSOA", "album-sort"}, |
| 255 | { "TSOP", "authorsort"}, | 260 | { "TSOP", "artist-sort"}, |
| 256 | { "TSOT", "titlesort"}, | 261 | { "TSOT", "title-sort"}, |
| 262 | { "TSSE", "encoder"}, | ||
| 257 | { 0 } | 263 | { 0 } |
| 258 | }; | 264 | }; |
| 259 | 265 | ||
| @@ -93,8 +93,7 @@ const CodecMime ff_mkv_mime_tags[] = { · 92 unmodified lines | |||
| 93 | }; | 93 | }; |
| 94 | 94 | ||
| 95 | const AVMetadataConv ff_mkv_metadata_conv[] = { | 95 | const AVMetadataConv ff_mkv_metadata_conv[] = { |
| 96 | { "ARTIST" , "artist" }, | 96 | { "LEAD_PERFORMER", "performer" }, |
| 97 | { "LEAD_PERFORMER", "artist" }, | ||
| 98 | { "PART_NUMBER" , "track" }, | 97 | { "PART_NUMBER" , "track" }, |
| 99 | { 0 } | 98 | { 0 } |
| 100 | }; | 99 | }; |
| @@ -1342,7 +1342,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1341 unmodified lines | |||
| 1342 | st->start_time = 0; | 1342 | st->start_time = 0; |
| 1343 | if (strcmp(track->language, "und")) | 1343 | if (strcmp(track->language, "und")) |
| 1344 | av_metadata_set(&st->metadata, "language", track->language); | 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 | if (track->flag_default) | 1347 | if (track->flag_default) |
| 1348 | st->disposition |= AV_DISPOSITION_DEFAULT; | 1348 | st->disposition |= AV_DISPOSITION_DEFAULT; |
| @@ -45,8 +45,11 @@ static const struct { · 44 unmodified lines | |||
| 45 | { "creator", SIZE_OFFSET(author) }, | 45 | { "creator", SIZE_OFFSET(author) }, |
| 46 | { "written_by", SIZE_OFFSET(author) }, | 46 | { "written_by", SIZE_OFFSET(author) }, |
| 47 | { "lead_performer", SIZE_OFFSET(author) }, | 47 | { "lead_performer", SIZE_OFFSET(author) }, |
| 48 | { "composer", SIZE_OFFSET(author) }, | ||
| 49 | { "performer", SIZE_OFFSET(author) }, | ||
| 48 | { "description", SIZE_OFFSET(comment) }, | 50 | { "description", SIZE_OFFSET(comment) }, |
| 49 | { "albumtitle", SIZE_OFFSET(album) }, | 51 | { "albumtitle", SIZE_OFFSET(album) }, |
| 52 | { "date", SIZE_OFFSET(year) }, | ||
| 50 | { "date_written", SIZE_OFFSET(year) }, | 53 | { "date_written", SIZE_OFFSET(year) }, |
| 51 | { "date_released", SIZE_OFFSET(year) }, | 54 | { "date_released", SIZE_OFFSET(year) }, |
| 52 | { "tracknumber", SIZE_OFFSET(track) }, | 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 | case MKTAG(0xa9,'c','m','t'): | 113 | case MKTAG(0xa9,'c','m','t'): |
| 114 | case MKTAG(0xa9,'i','n','f'): key = "comment"; break; | 114 | case MKTAG(0xa9,'i','n','f'): key = "comment"; break; |
| 115 | case MKTAG(0xa9,'a','l','b'): key = "album"; break; | 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 | case MKTAG(0xa9,'g','e','n'): key = "genre"; break; | 117 | case MKTAG(0xa9,'g','e','n'): key = "genre"; break; |
| 118 | case MKTAG(0xa9,'t','o','o'): | 118 | case MKTAG(0xa9,'t','o','o'): |
| 119 | case MKTAG(0xa9,'e','n','c'): key = "encoder"; break; | 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 | mov_write_string_metadata(s, pb, "aART", "album_artist", 1); | 1437 | mov_write_string_metadata(s, pb, "aART", "album_artist", 1); |
| 1438 | mov_write_string_metadata(s, pb, "\251wrt", "composer" , 1); | 1438 | mov_write_string_metadata(s, pb, "\251wrt", "composer" , 1); |
| 1439 | mov_write_string_metadata(s, pb, "\251alb", "album" , 1); | 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 | mov_write_string_tag(pb, "\251too", LIBAVFORMAT_IDENT, 0, 1); | 1441 | mov_write_string_tag(pb, "\251too", LIBAVFORMAT_IDENT, 0, 1); |
| 1442 | mov_write_string_metadata(s, pb, "\251cmt", "comment" , 1); | 1442 | mov_write_string_metadata(s, pb, "\251cmt", "comment" , 1); |
| 1443 | mov_write_string_metadata(s, pb, "\251gen", "genre" , 1); | 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 | put_be16(pb, language_code("eng")); /* language */ | 1511 | put_be16(pb, language_code("eng")); /* language */ |
| 1512 | put_buffer(pb, t->value, strlen(t->value)+1); /* UTF8 string value */ | 1512 | put_buffer(pb, t->value, strlen(t->value)+1); /* UTF8 string value */ |
| 1513 | if (!strcmp(tag, "albm") && | 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 | put_byte(pb, atoi(t->value)); | 1515 | put_byte(pb, atoi(t->value)); |
| 1516 | } | 1516 | } |
| 1517 | return updateSize(pb, pos); | 1517 | return updateSize(pb, pos); |
| @@ -1540,12 +1540,12 @@ static int mov_write_udta_tag(ByteIOContext *pb, MOVMuxContext *mov, · 22 unmodified lines | |||
| 1540 | mov_write_3gp_udta_tag(pb_buf, s, "dscp", "comment"); | 1540 | mov_write_3gp_udta_tag(pb_buf, s, "dscp", "comment"); |
| 1541 | mov_write_3gp_udta_tag(pb_buf, s, "albm", "album"); | 1541 | mov_write_3gp_udta_tag(pb_buf, s, "albm", "album"); |
| 1542 | mov_write_3gp_udta_tag(pb_buf, s, "cprt", "copyright"); | 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 | } else if (mov->mode == MODE_MOV) { // the title field breaks gtkpod with mp4 and my suspicion is that stuff is not valid in mp4 | 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 | mov_write_string_metadata(s, pb_buf, "\251nam", "title" , 0); | 1545 | mov_write_string_metadata(s, pb_buf, "\251nam", "title" , 0); |
| 1546 | mov_write_string_metadata(s, pb_buf, "\251aut", "author" , 0); | 1546 | mov_write_string_metadata(s, pb_buf, "\251aut", "author" , 0); |
| 1547 | mov_write_string_metadata(s, pb_buf, "\251alb", "album" , 0); | 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 | mov_write_string_tag(pb_buf, "\251enc", LIBAVFORMAT_IDENT, 0, 0); | 1549 | mov_write_string_tag(pb_buf, "\251enc", LIBAVFORMAT_IDENT, 0, 0); |
| 1550 | mov_write_string_metadata(s, pb_buf, "\251des", "comment" , 0); | 1550 | mov_write_string_metadata(s, pb_buf, "\251des", "comment" , 0); |
| 1551 | mov_write_string_metadata(s, pb_buf, "\251gen", "genre" , 0); | 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 | count += id3v1_set_string(s, "title", buf + 3, 30); | 214 | count += id3v1_set_string(s, "title", buf + 3, 30); |
| 215 | count += id3v1_set_string(s, "author", buf + 33, 30); | 215 | count += id3v1_set_string(s, "author", buf + 33, 30); |
| 216 | count += id3v1_set_string(s, "album", buf + 63, 30); | 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 | count += id3v1_set_string(s, "comment", buf + 97, 30); | 218 | count += id3v1_set_string(s, "comment", buf + 97, 30); |
| 219 | if ((tag = av_metadata_get(s->metadata, "track", NULL, 0))) { | 219 | if ((tag = av_metadata_get(s->metadata, "track", NULL, 0))) { |
| 220 | buf[125] = 0; | 220 | buf[125] = 0; |
| @@ -36,8 +36,7 @@ · 35 unmodified lines | |||
| 36 | * http://xiph.org/vorbis/doc/v-comment.html | 36 | * http://xiph.org/vorbis/doc/v-comment.html |
| 37 | */ | 37 | */ |
| 38 | const AVMetadataConv ff_vorbiscomment_metadata_conv[] = { | 38 | const AVMetadataConv ff_vorbiscomment_metadata_conv[] = { |
| 39 | { "ARTIST" , "author" }, | 39 | { "ALBUMARTIST", "album_artist"}, |
| 40 | { "DATE" , "year" }, | ||
| 41 | { "TRACKNUMBER", "track" }, | 40 | { "TRACKNUMBER", "track" }, |
| 42 | { 0 } | 41 | { 0 } |
| 43 | }; | 42 | }; |