1 /////////////////////////////////////////////////////////////////////////////// 2 // 3 // The contents of this file are subject to the Mozilla Public License 4 // Version 1.1 (the "License"); you may not use this file except in 5 // compliance with the License. You may obtain a copy of the License at 6 // http://www.mozilla.org/MPL/ 7 // 8 // Software distributed under the License is distributed on an "AS IS" 9 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 10 // License for the specific language governing rights and limitations 11 // under the License. 12 // 13 // The Original Code is MP4v2. 14 // 15 // The Initial Developer of the Original Code is Kona Blend. 16 // Portions created by Kona Blend are Copyright (C) 2008. 17 // Portions created by David Byron are Copyright (C) 2011. 18 // All Rights Reserved. 19 // 20 // Contributors: 21 // Kona Blend, kona8lend@gmail.com 22 // Rouven Wessling, mp4v2@rouvenwessling.de 23 // David Byron, dbyron@dbyron.com 24 // 25 /////////////////////////////////////////////////////////////////////////////// 26 27 #ifndef MP4V2_IMPL_ITMF_TAGS_H 28 #define MP4V2_IMPL_ITMF_TAGS_H 29 30 namespace mp4v2 { namespace impl { namespace itmf { 31 32 /////////////////////////////////////////////////////////////////////////////// 33 34 class Tags 35 { 36 public: 37 static const string CODE_NAME; 38 static const string CODE_ARTIST; 39 static const string CODE_ALBUMARTIST; 40 static const string CODE_ALBUM; 41 static const string CODE_GROUPING; 42 static const string CODE_COMPOSER; 43 static const string CODE_COMMENTS; 44 static const string CODE_GENRE; 45 static const string CODE_GENRETYPE; 46 static const string CODE_RELEASEDATE; 47 static const string CODE_TRACK; 48 static const string CODE_DISK; 49 static const string CODE_TEMPO; 50 static const string CODE_COMPILATION; 51 52 static const string CODE_TVSHOW; 53 static const string CODE_TVNETWORK; 54 static const string CODE_TVEPISODEID; 55 static const string CODE_TVSEASON; 56 static const string CODE_TVEPISODE; 57 58 static const string CODE_DESCRIPTION; 59 static const string CODE_LONGDESCRIPTION; 60 static const string CODE_LYRICS; 61 62 static const string CODE_SORTNAME; 63 static const string CODE_SORTARTIST; 64 static const string CODE_SORTALBUMARTIST; 65 static const string CODE_SORTALBUM; 66 static const string CODE_SORTCOMPOSER; 67 static const string CODE_SORTTVSHOW; 68 69 static const string CODE_COPYRIGHT; 70 static const string CODE_ENCODINGTOOL; 71 static const string CODE_ENCODEDBY; 72 static const string CODE_PURCHASEDATE; 73 74 static const string CODE_PODCAST; 75 static const string CODE_KEYWORDS; 76 static const string CODE_CATEGORY; 77 78 static const string CODE_HDVIDEO; 79 static const string CODE_MEDIATYPE; 80 static const string CODE_CONTENTRATING; 81 static const string CODE_GAPLESS; 82 83 static const string CODE_ITUNESACCOUNT; 84 static const string CODE_ITUNESACCOUNTTYPE; 85 static const string CODE_ITUNESCOUNTRY; 86 static const string CODE_CONTENTID; 87 static const string CODE_ARTISTID; 88 static const string CODE_PLAYLISTID; 89 static const string CODE_GENREID; 90 static const string CODE_COMPOSERID; 91 static const string CODE_XID; 92 93 public: 94 string name; 95 string artist; 96 string albumArtist; 97 string album; 98 string grouping; 99 string composer; 100 string comments; 101 string genre; 102 uint16_t genreType; 103 string releaseDate; 104 MP4TagTrack track; 105 MP4TagDisk disk; 106 uint16_t tempo; 107 uint8_t compilation; 108 109 string tvShow; 110 string tvEpisodeID; 111 uint32_t tvSeason; 112 uint32_t tvEpisode; 113 string tvNetwork; 114 115 string description; 116 string longDescription; 117 string lyrics; 118 119 string sortName; 120 string sortArtist; 121 string sortAlbumArtist; 122 string sortAlbum; 123 string sortComposer; 124 string sortTVShow; 125 126 CoverArtBox::ItemList artwork; 127 128 string copyright; 129 string encodingTool; 130 string encodedBy; 131 string purchaseDate; 132 133 uint8_t podcast; 134 string keywords; 135 string category; 136 137 uint8_t hdVideo; 138 uint8_t mediaType; 139 uint8_t contentRating; 140 uint8_t gapless; 141 142 string iTunesAccount; 143 uint8_t iTunesAccountType; 144 uint32_t iTunesCountry; 145 uint32_t contentID; 146 uint32_t artistID; 147 uint64_t playlistID; 148 uint32_t genreID; 149 uint32_t composerID; 150 string xid; 151 152 bool hasMetadata; 153 154 public: 155 Tags(); 156 ~Tags(); 157 158 void c_alloc ( MP4Tags*& ); 159 void c_fetch ( MP4Tags*&, MP4FileHandle ); 160 void c_store ( MP4Tags*&, MP4FileHandle ); 161 void c_free ( MP4Tags*& ); 162 163 void c_addArtwork ( MP4Tags*&, MP4TagArtwork& ); 164 void c_setArtwork ( MP4Tags*&, uint32_t, MP4TagArtwork& ); 165 void c_removeArtwork ( MP4Tags*&, uint32_t ); 166 167 void c_setString ( const char*, string&, const char*& ); 168 void c_setInteger ( const uint8_t*, uint8_t&, const uint8_t*& ); 169 void c_setInteger ( const uint16_t*, uint16_t&, const uint16_t*& ); 170 void c_setInteger ( const uint32_t*, uint32_t&, const uint32_t*& ); 171 void c_setInteger ( const uint64_t*, uint64_t&, const uint64_t*& ); 172 173 void c_setTrack ( const MP4TagTrack*, MP4TagTrack&, const MP4TagTrack*& ); 174 void c_setDisk ( const MP4TagDisk*, MP4TagDisk&, const MP4TagDisk*& ); 175 176 private: 177 typedef map<string,MP4ItmfItem*> CodeItemMap; 178 179 private: 180 void fetchString ( const CodeItemMap&, const string&, string&, const char*& ); 181 void fetchInteger ( const CodeItemMap&, const string&, uint8_t&, const uint8_t*& ); 182 void fetchInteger ( const CodeItemMap&, const string&, uint16_t&, const uint16_t*& ); 183 void fetchInteger ( const CodeItemMap&, const string&, uint32_t&, const uint32_t*& ); 184 void fetchInteger ( const CodeItemMap&, const string&, uint64_t&, const uint64_t*& ); 185 186 void fetchGenre ( const CodeItemMap&, uint16_t&, const uint16_t*& ); 187 void fetchTrack ( const CodeItemMap&, MP4TagTrack&, const MP4TagTrack*& ); 188 void fetchDisk ( const CodeItemMap&, MP4TagDisk&, const MP4TagDisk*& ); 189 190 void storeString ( MP4File&, const string&, const string&, const char* ); 191 void storeInteger ( MP4File&, const string&, uint8_t, const uint8_t* ); 192 void storeInteger ( MP4File&, const string&, uint16_t, const uint16_t* ); 193 void storeInteger ( MP4File&, const string&, uint32_t, const uint32_t* ); 194 void storeInteger ( MP4File&, const string&, uint64_t, const uint64_t* ); 195 196 void storeGenre ( MP4File&, uint16_t, const uint16_t* ); 197 void storeTrack ( MP4File&, const MP4TagTrack&, const MP4TagTrack* ); 198 void storeDisk ( MP4File&, const MP4TagDisk&, const MP4TagDisk* ); 199 200 void remove ( MP4File&, const string& ); 201 void store ( MP4File&, const string&, MP4ItmfBasicType, const void*, uint32_t ); 202 203 void updateArtworkShadow( MP4Tags*& ); 204 }; 205 206 /////////////////////////////////////////////////////////////////////////////// 207 208 }}} // namespace mp4v2::impl::itmf 209 210 #endif // MP4V2_IMPL_ITMF_TAGS_H 211