1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 /** 19 * @file pv_id3_parcom_constants.h 20 * @brief Constant definitions for ID3 Parser-Composer 21 */ 22 23 #ifndef PV_ID3_PARCOM_CONSTANTS_H_INCLUDED 24 #define PV_ID3_PARCOM_CONSTANTS_H_INCLUDED 25 26 #ifndef OSCL_BASE_H_INCLUDED 27 #include "oscl_base.h" 28 #endif 29 #ifndef OSCL_STRING_H_INCLUDED 30 #include "oscl_string.h" 31 #endif 32 33 #define ID3V1_TAG_NUM_BYTES_HEADER 3 34 #define ID3V1_MAX_NUM_BYTES_TITLE 30 35 #define ID3V1_MAX_NUM_BYTES_ARTIST 30 36 #define ID3V1_MAX_NUM_BYTES_ALBUM 30 37 #define ID3V1_MAX_NUM_BYTES_YEAR 4 38 #define ID3V1_MAX_NUM_BYTES_COMMENT 30 39 #define ID3V1_MAX_NUM_BYTES_GENRE 1 40 #define ID3V1_MAX_NUM_BYTES_TOTAL 128 41 #define ID3V1_MAX_NUM_BYTES_FIELD_SIZE 30 42 43 #define ID3V2_NUM_BYTES_SIZE 4 44 #define ID3V2_TAG_NUM_BYTES_HEADER 10 45 #define ID3V2_TAG_NUM_BYTES_ID 3 46 #define ID3V2_TAG_NUM_BYTES_VERSION 2 47 #define ID3V2_TAG_NUM_BYTES_FLAG 1 48 #define ID3V2_TAG_NUM_BYTES_SIZE ID3V2_NUM_BYTES_SIZE 49 50 #define ID3V2_FRAME_NUM_BYTES_HEADER 10 51 52 #define ID3V2_2_FRAME_NUM_BYTES_HEADER 6 53 #define ID3V2_FRAME_NUM_BYTES_ID 4 54 55 #define ID3V2_2_FRAME_NUM_BYTES_ID 3 56 #define ID3V2_FRAME_NUM_BYTES_SIZE ID3V2_NUM_BYTES_SIZE 57 58 #define ID3V2_2_FRAME_NUM_BYTES_SIZE ID3V2_2_NUM_BYTES_SIZE 59 #define ID3V2_FRAME_NUM_BYTES_FLAG 2 60 61 #define ID3V2_TAG_EXTENDED_HEADER_TOTAL_SIZE 6 62 #define ID3V2_TAG_EXTENDED_HEADER_SIZE ID3V2_NUM_BYTES_SIZE 63 #define ID3V2_TAG_EXTENDED_HEADER_NUM 1 64 #define ID3V2_TAG_EXTENDED_HEADER_FLAG 1 65 #define ID3V2_COMMENT_LANGUAGE_SIZE 4 66 67 //text encoding(1)+ picture type(1) = 2 68 #define ID3V2_APIC_CONST_SIZE 2 69 //text encoding(1)+image format(3) + picture type(1) = 5 70 #define ID3V2_PIC_CONST_SIZE 5 71 #define ID3V2_IMAGE_FORMAT_SIZE 3 72 #define ID3V2_LANGUAGE_SIZE 3 73 #define UNICODE_LITTLE_ENDIAN 1 74 #define UNICODE_BIG_ENDIAN 0 75 #define UNICODE_BOM_SIZE 2 76 #define VERSION_SIZE 2 77 78 #define UNICODE_CHAR_SIZE 2 79 80 //Max length for null terminated strings in text frames 81 #define ID3_MAX_STRING_FRAME_LEN 256 82 83 #define MAX_SYNCSAFE_LEN 127 84 #define ID3V2_4_MASK_FRAME_FLAG_VERIFICATION 31 85 86 #define ID3V2_4_DATA_LENGTH_INDICATOR_SIZE 4 87 88 //The frame ID made out of the characters capital A-Z and 0-9. 89 #define IS_VALID_FRAME_ID_CHAR(ch) ((ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9')) 90 #define IS_POTENTIAL_FRAME_ID(id) IS_VALID_FRAME_ID_CHAR(id[0]) && \ 91 IS_VALID_FRAME_ID_CHAR(id[1]) && \ 92 IS_VALID_FRAME_ID_CHAR(id[2]) && \ 93 IS_VALID_FRAME_ID_CHAR(id[3]) 94 95 96 #define ID3V2_FLAGS 0x00 97 #define EXT_FLAGMASK 64 // 0x40 98 #define FTR_FLAGMASK 16 // 0x10 99 #define MASK127 127 // 0111 1111 100 #define EXTHDR_UPDMASK 64 // 0x40 101 #define ENCR_COMP_3_FLAGMASK 192//0xC0 102 #define ENCR_COMP_4_FLAGMASK 12 //0x0C 103 #define FRAME_LENGTH_INDICATOR_FLAGMASK 1 //0x01 104 105 #define VALID_BITS_IN_SYNC_SAFE_BYTE 7 106 #define UNICODE_LITTLE_ENDIAN_INDICATOR 255 // 0xff 107 #define UNICODE_BIG_ENDIAN_INDICATOR 254 // 0xfe 108 109 #define UNICODE_LITTLE_ENDIAN_INDICATOR_FULL 0xfffe 110 #define UNICODE_BIG_ENDIAN_INDICATOR_FULL 0xfeff 111 112 #define CRC_ON 0 113 #if CRC_ON 114 #define CRC_BYTES 5 115 #else 116 #define CRC_BYTES 0 117 #endif 118 119 #define TAG_RESTRICTION_ON 0 120 #if TAG_RESTRICTION_ON 121 #define TAG_RESTRICTION_BYTES 1 122 #else 123 #define TAG_RESTRICTION_BYTES 0 124 #endif 125 126 #define EXT_HEADER_FLAG_BYTES (1 + CRC_BYTES + TAG_RESTRICTION_BYTES) 127 128 #define EXT_FLAG_TAG_UPDATE 0x40 129 #define EXT_FLAG_CRC_DATA 0x20 130 #define EXT_FLAG_TAG_RESTRICTION 0x10 131 132 #define EXT_FLAG_TAG_SIZE_RESTRICTION 0x00 133 #define EXT_FLAG_TEXT_ENCODING_RESTRICTION 0x00 134 #define EXT_FLAG_TEXT_FEILD_SIZE_RESTRICTION 0x00 135 #define EXT_FLAG_IMAGE_ENCODING_RESTRICTION 0x00 136 #define IMAGE_SIZE_RESTRICTION 0x00 137 138 //frame status flags 139 #define FRAME_TAG_ALTER_PRESERVATION 0x00 140 #define FRAME_FILE_ALTER_PRESERVATION 0x00 141 #define FRAME_READ_ONLY 0x00 142 143 //frame format description 144 #define FRAME_GROUP_IDENTITY 0x00 145 #define FRAME_COMPRESSION 0x00 146 #define FRAME_ENCRYPTION 0x00 147 #define FRAME_UNSYNCHRONIZATION 0x00 148 #define FRAME_DATA_LENGTH_INDICATOR 0x00 149 150 #define BYTE_FOR_CHARACTERSET_FORMAT 1 151 152 //frame IDs 153 #define ID3_FRAME_ID_TITLE "TIT2" 154 #define ID3_FRAME_ID_ARTIST "TPE1" 155 #define ID3_FRAME_ID_ALBUM "TALB" 156 #define ID3_FRAME_ID_TRACK_NUMBER "TRCK" 157 #define ID3_FRAME_ID_PART_OF_SET "TPOS" 158 #define ID3_FRAME_ID_GENRE "TCON" 159 #define ID3_FRAME_ID_YEAR "TYER" 160 #define ID3_FRAME_ID_COPYRIGHT "TCOP" 161 #define ID3_FRAME_ID_COMMENT "COMM" 162 #define ID3_FRAME_ID_TRACK_LENGTH "TLEN" 163 #define ID3_FRAME_ID_DATE "TDAT" 164 #define ID3_FRAME_ID_ALBUMART "APIC" 165 #define ID3_FRAME_ID_LYRICIST "USLT" 166 #define ID3_FRAME_ID_SEEK "SEEK" 167 #define ID3_FRAME_ID_RECORDING_TIME "TDRC" 168 #define ID3_FRAME_ID_AUTHOR "TEXT" 169 #define ID3_FRAME_ID_COMPOSER "TCOM" 170 #define ID3_FRAME_ID_DESCRIPTION "TIT3" 171 #define ID3_FRAME_ID_VERSION "TENC" 172 173 /* - List of unsupported frames - */ 174 #define ID3_FRAME_ID_ENCRYPTION "AENC" 175 #define ID3_FRAME_ID_AUDIO_SEEK_POINT_INDEX "ASPI" 176 #define ID3_FRAME_ID_COMMERCIAL_FRAME "COMR" 177 #define ID3_FRAME_ID_ENCRYPTION_REGISTRATION "ENCR" 178 #define ID3_FRAME_ID_EQUALIZATION2 "EQU2" 179 #define ID3_FRAME_ID_EVENT_TIMING_CODES "ETCO" 180 #define ID3_FRAME_ID_GENERAL_ENCAPSULATED_OBJECT "GEOB" 181 #define ID3_FRAME_ID_GROUP_IDENTITY_REGISTRATION "GRID" 182 #define ID3_FRAME_ID_LINKED_INFORMATION "LINK" 183 #define ID3_FRAME_ID_MUSIC_CD_IDENTIFIER "MCDI" 184 #define ID3_FRAME_ID_MPEG_LOCATION_LOOKUP_TABLE "MLLT" 185 #define ID3_FRAME_ID_OWNERSHIP_FRAME "OWNE" 186 #define ID3_FRAME_ID_PRIVATE_FRAME "PRIV" 187 #define ID3_FRAME_ID_PLAY_COUNTER "PCNT" 188 #define ID3_FRAME_ID_POPULARIMETER "POPM" 189 #define ID3_FRAME_ID_POSITION_SYNCH_FRAME "POSS" 190 #define ID3_FRAME_ID_RECOMMENDED_BUFFER_SIZE "RBUF" 191 #define ID3_FRAME_ID_RELATIVE_VOLUME_ADJUSTMENT2 "RVA2" 192 #define ID3_FRAME_ID_REVERB "RVRB" 193 #define ID3_FRAME_ID_SYNCHRONIZED_LYRICS_TEXT "SYLT" 194 #define ID3_FRAME_ID_SYNCHRONIZED_TEMPO_CODES "SYTC" 195 #define ID3_FRAME_ID_BPM "TBPM" 196 #define ID3_FRAME_ID_PLAYLIST_DELAY "TDLY" 197 #define ID3_FRAME_ID_FILE_TYPE "TFLT" 198 #define ID3_FRAME_ID_CONTENT_GROUP_DESC "TIT1" 199 #define ID3_FRAME_ID_INITIAL_KEY "TKEY" 200 #define ID3_FRAME_ID_LANGUAGE "TLAN" 201 #define ID3_FRAME_ID_MEDIA_TYPE "TMED" 202 #define ID3_FRAME_ID_ORIGINAL_ALBUM "TOAL" 203 #define ID3_FRAME_ID_ORIGINAL_FILENAME "TOFN" 204 #define ID3_FRAME_ID_ORIGINAL_LYRICIST "TOLY" 205 #define ID3_FRAME_ID_ORIGINAL_ARTIST "TOPE" 206 #define ID3_FRAME_ID_FILE_LICENSEE "TOWN" 207 #define ID3_FRAME_ID_BAND "TPE2" 208 #define ID3_FRAME_ID_CONDUCTOR "TPE3" 209 #define ID3_FRAME_ID_MODIFIER "TPE4" 210 #define ID3_FRAME_ID_PART_OF_SET "TPOS" 211 #define ID3_FRAME_ID_PUBLISHER "TPUB" 212 #define ID3_FRAME_ID_INTERNET_RADIO_STATION_NAME "TRSN" 213 #define ID3_FRAME_ID_INTERNET_RADIO_STATION_OWNER "TRSO" 214 #define ID3_FRAME_ID_RECORDING_CODE "TSRC" 215 #define ID3_FRAME_ID_SOFTWARE_SETTING_ENCODE "TSSE" 216 #define ID3_FRAME_ID_UNIQUE_FILE_IDENTIFIER "UFID" 217 #define ID3_FRAME_ID_TERMS_OF_USE "USER" 218 #define ID3_FRAME_ID_COMMERCIAL_INFO "WCOM" 219 #define ID3_FRAME_ID_LEGAL_INFO "WCOP" 220 #define ID3_FRAME_ID_OFFICIAL_AUDIO_FILE_WEBPAGE "WOAF" 221 #define ID3_FRAME_ID_OFFICIAL_ARTIST_WEBPAGE "WOAR" 222 #define ID3_FRAME_ID_OFFICIAL_AUDIO__SOURCE_WEBPAGE "WOAS" 223 #define ID3_FRAME_ID_OFFICIAL_RADIO_STATION_WEBPAGE "WORS" 224 #define ID3_FRAME_ID_PAYMENT "WPAY" 225 #define ID3_FRAME_ID_PUBLISHER_OFFICIAL_WEBPAGE "WPUB" 226 #define ID3_FRAME_ID_SIGNATURE_FRAME "SIGN" 227 #define ID3_FRAME_ID_ENCODING_TIME "TDEN" 228 #define ID3_FRAME_ID_ORIGINAL_RELEASE_TIME "TDOR" 229 #define ID3_FRAME_ID_RELEASE_TIME "TDRL" 230 #define ID3_FRAME_ID_TAGGING_TIME "TDTG" 231 #define ID3_FRAME_ID_INVOLVED_PEOPLE_LIST "TIPL" 232 #define ID3_FRAME_ID_MUSICIAN_CREDITS_LIST "TMCL" 233 #define ID3_FRAME_ID_MOOD "TMOO" 234 #define ID3_FRAME_ID_PRODUCED_NOTICE "TPRO" 235 #define ID3_FRAME_ID_ALBUM_SORT_ORDER "TSOA" 236 #define ID3_FRAME_ID_PERFORMER_SORT_ORDER "TSOP" 237 #define ID3_FRAME_ID_TITLE_SORT_ORDER "TSOT" 238 #define ID3_FRAME_ID_SET_SUBTITLE "TSST" 239 #define ID3_FRAME_ID_USER_DEFINED_URL_LINK_FRAME "WXXX" 240 #define ID3_FRAME_ID_USER_DEFINED_TEXT_INFO "TXXX" 241 /* deprecated frames in v2.4 */ 242 //#define ID3_FRAME_ID_EQUALIZATION "EQUA" 243 //#define ID3_FRAME_ID_INVOLVED PEOPLE_LIST "IPLS" 244 //#define ID3_FRAME_ID_RELATIVE_VOLUME_ADJUSTMENT "RVAD" 245 //#define ID3_FRAME_ID_TIME "TIME" 246 //#define ID3_FRAME_ID_ORIGINAL_RELEASE_YEAR "TORY" 247 //#define ID3_FRAME_ID_RECORDING_DATES "TRDA" 248 //#define ID3_FRAME_ID_SIZE "TSIZ" 249 /* - List of unsupported frames - end here - */ 250 251 252 #define ID3_V1_IDENTIFIER "TAG" 253 #define ID3_V2_IDENTIFIER "ID3" 254 #define ID3_V2_4_SEEK_FRAME "SEEK" 255 #define ID3_V2_4_TAG_FOOTER "3DI" 256 257 //ID3V2_2 frame IDs 258 #define ID3V2_2_FRAME_ID_TITLE "TT2" 259 #define ID3V2_2_FRAME_ID_ARTIST "TP1" 260 #define ID3V2_2_FRAME_ID_ALBUM "TAL" 261 #define ID3V2_2_FRAME_ID_TRACK_NUMBER "TRK" 262 #define ID3V2_2_FRAME_ID_PART_OF_SET "TPA" 263 #define ID3V2_2_FRAME_ID_GENRE "TCO" 264 #define ID3V2_2_FRAME_ID_YEAR "TYE" 265 #define ID3V2_2_FRAME_ID_COPYRIGHT "TCR" 266 #define ID3V2_2_FRAME_ID_COMMENT "COM" 267 #define ID3V2_2_FRAME_ID_TRACK_LENGTH "TLE" 268 #define ID3V2_2_FRAME_ID_DATE "TDA" 269 #define ID3V2_2_FRAME_ID_ALBUMART "PIC" 270 #define ID3V2_2_FRAME_ID_LYRICIST "ULT" 271 #define ID3V2_2_FRAME_ID_AUTHOR "TXT" 272 #define ID3V2_2_FRAME_ID_COMPOSER "TCM" 273 #define ID3V2_2_FRAME_ID_DESCRIPTION "TT3" 274 #define ID3V2_2_FRAME_ID_VERSION "TEN" 275 276 277 #define SIZE_OF_TRACK_LENGTH 8 278 279 // ID3 meta data keys 280 #define KVP_KEY_TITLE "title" 281 #define KVP_KEY_TITLE_LEN 5 282 #define KVP_KEY_ARTIST "artist" 283 #define KVP_KEY_ARTIST_LEN 6 284 #define KVP_KEY_PART_OF_SET "set" 285 #define KVP_KEY_SET_PART_OF_SET_LEN 3 286 #define KVP_KEY_ALBUM "album" 287 #define KVP_KEY_ALBUM_LEN 5 288 #define KVP_KEY_YEAR "year" 289 #define KVP_KEY_DATE "date" 290 #define KVP_KEY_YEAR_LEN 4 291 #define KVP_KEY_COMMENT "comment" 292 #define KVP_KEY_COMMENT_LEN 7 293 #define KVP_KEY_TRACKINFO_TRACK_NUMBER "track-info/track-number" 294 #define KVP_KEY_TRACKINFO_TRACK_NUMBER_LEN 23 295 #define KVP_KEY_GENRE "genre" 296 #define KVP_KEY_GENRE_LEN 5 297 #define KVP_KEY_COPYRIGHT "copyright" 298 #define KVP_KEY_COPYRIGHT_LEN 9 299 #define KVP_KEY_ID3DURATION "duration-from-metadata" 300 #define KVP_KEY_ID3DURATION_LEN 20 301 #define KVP_KEY_RECORDING_TIME "year" 302 #define KVP_KEY_AUTHOR "author" 303 #define KVP_KEY_COMPOSER "composer" 304 #define KVP_KEY_DESCRIPTION "description" 305 #define KVP_KEY_VERSION "version" 306 307 #define KVP_KEY_LYRICS "lyrics" 308 #define KVP_KEY_LYRICS_LEN 6 309 #define KVP_KEY_ALBUMART "graphic" 310 #define KVP_KEY_ALBUMART_LEN 8 311 312 #define SEMI_COLON _STRLIT_CHAR(";") 313 #define NULL_CHARACTER _STRLIT_CHAR("\0") 314 #define FORWARD_SLASH _STRLIT_CHAR("/") 315 316 // ID3 meta data value types 317 #define KVP_VALTYPE_ISO88591_CHAR "valtype=char*" 318 #define KVP_VALTYPE_ISO88591_CHAR_LEN 13 319 #define KVP_VALTYPE_UTF8_CHAR "valtype=char*;char-encoding=UTF8" 320 #define KVP_VALTYPE_UTF8_CHAR_LEN 32 321 #define KVP_VALTYPE_UTF16_WCHAR "valtype=wchar*" 322 #define KVP_VALTYPE_UTF16_WCHAR_LEN 14 323 #define KVP_VALTYPE_UTF16BE_WCHAR "valtype=wchar*;char-encoding=UTF16BE" 324 #define KVP_VALTYPE_UTF16BE_WCHAR_LEN 36 325 #define KVP_VALTYPE_BYTEVALUE_UINT8 "valtype=uint8;format=id3v1" 326 #define KVP_VALTYPE_BYTEVALUE_UINT8_LEN 26 327 #define KVP_VALTYPE_UINT32 "valtype=uint32" 328 #define KVP_VALTYPE_UINT32_LEN 14 329 #define KVP_VALTYPE_UINT8PTR_STRING "valtype=uint8*" 330 #define KVP_VALTYPE_UINT8PTR_STRING_LEN 14 331 #define KVP_PARAM_LANGUAGE_CODE "iso-639-2-lang=" 332 #define KVP_PARAM_LANGUAGE_CODE_LEN 15 333 #define KVP_VALTYPE_DURATION "timescale=1000;valtype=uint32" 334 #define KVP_PARAM_CHAR_ENCODING_UTF16BE "char-encoding=UTF16BE" 335 #define KVP_PARAM_CHAR_ENCODING_UTF8 "char-encoding=UTF8" 336 #define KVP_FORMAT_ALBUMART "format=APIC" 337 #define KVP_FORMAT_ID3V1 "format=id3v1" 338 #define KVP_VALTYPE_ALBUMART "valtype=ksv" 339 #define KVP_ID3V2_VALUE "id3v2" 340 #define KVP_VALTYPE_LYRICS "valtype=ksv" 341 #define KVP_VALTYPE_REQSIZE "reqsize=" 342 343 static const int MAX_RANGE_INT_SIZE = 10; 344 345 #define PERIOD_CHARACTER_ASCII_VALUE 46 346 #define COMMA_CHARACTER_ASCII_VALUE 44 347 #define ZERO_CHARACTER_ASCII_VALUE 48 348 #define NINE_CHARACTER_ASCII_VALUE 57 349 350 #endif // PV_ID3_PARCOM_CONSTANTS_H_INCLUDED 351 352 353