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 /* ------------------------------------------------------------------- */ 20 /* MPEG-4 UserDataAtom Class */ 21 /* ------------------------------------------------------------------- */ 22 /*********************************************************************************/ 23 /* 24 This UserDataAtom Class is a container atom for informative user-data. 25 */ 26 27 28 #ifndef USERDATAATOM_H_INCLUDED 29 #define USERDATAATOM_H_INCLUDED 30 31 #ifndef OSCL_FILE_IO_H_INCLUDED 32 #include "oscl_file_io.h" 33 #endif 34 35 #ifndef ATOM_H_INCLUDED 36 #include "atom.h" 37 #endif 38 39 #ifndef ATOMUTILS_H_INCLUDED 40 #include "atomutils.h" 41 #endif 42 43 #ifndef PVUSERDATAATOM_H_INCLUDED 44 #include "pvuserdataatom.h" 45 #endif 46 47 #ifndef COPYRIGHTATOM_H_INCLUDED 48 #include "copyrightatom.h" 49 #endif 50 51 #ifndef ASSETINFOATOMS_H_INCLUDED 52 #include "assetinfoatoms.h" 53 #endif 54 55 56 #ifndef ITUNESILSTATOM_H_INCLUDED 57 #include "itunesilstatom.h" 58 #endif 59 60 61 #ifndef OSCL_VECTOR_H_INCLUDED 62 #include "oscl_vector.h" 63 #endif 64 65 66 67 #include "metadataatom.h" 68 69 70 #include "atomdefs.h" 71 72 class UserDataAtom : public Atom 73 { 74 75 public: 76 UserDataAtom(MP4_FF_FILE *fp, uint32 size, uint32 type); // Constructor 77 virtual ~UserDataAtom(); 78 79 uint8 randomAccessDenied(); 80 Atom *getAtomOfType(uint32 fourCC); 81 getNumAssetInfoTitleAtoms()82 int32 getNumAssetInfoTitleAtoms() 83 { 84 if (_pAssetInfoTitleAtomArray != NULL) 85 { 86 return (_pAssetInfoTitleAtomArray->size()); 87 } 88 else 89 { 90 return 0; 91 } 92 } getNumAssetInfoDescAtoms()93 int32 getNumAssetInfoDescAtoms() 94 { 95 if (_pAssetInfoDescAtomArray != NULL) 96 { 97 return (_pAssetInfoDescAtomArray->size()); 98 } 99 else 100 { 101 return 0; 102 } 103 } getNumCopyRightAtoms()104 int32 getNumCopyRightAtoms() 105 { 106 if (_pCopyRightAtomArray != NULL) 107 { 108 return (_pCopyRightAtomArray->size()); 109 } 110 else 111 { 112 return 0; 113 } 114 } getNumAssetInfoPerformerAtoms()115 int32 getNumAssetInfoPerformerAtoms() 116 { 117 if (_pAssetInfoPerformerAtomArray != NULL) 118 { 119 return (_pAssetInfoPerformerAtomArray->size()); 120 } 121 else 122 { 123 return 0; 124 } 125 } getNumAssetInfoAuthorAtoms()126 int32 getNumAssetInfoAuthorAtoms() 127 { 128 if (_pAssetInfoAuthorAtomArray != NULL) 129 { 130 return (_pAssetInfoAuthorAtomArray->size()); 131 } 132 else 133 { 134 return 0; 135 } 136 } getNumAssetInfoGenreAtoms()137 int32 getNumAssetInfoGenreAtoms() 138 { 139 if (_pAssetInfoGenreAtomArray != NULL) 140 { 141 return (_pAssetInfoGenreAtomArray->size()); 142 } 143 else 144 { 145 return 0; 146 } 147 } getNumAssetInfoRatingAtoms()148 int32 getNumAssetInfoRatingAtoms() 149 { 150 if (_pAssetInfoRatingAtomArray != NULL) 151 { 152 return (_pAssetInfoRatingAtomArray->size()); 153 } 154 else 155 { 156 return 0; 157 } 158 } getNumAssetInfoClassificationAtoms()159 int32 getNumAssetInfoClassificationAtoms() 160 { 161 if (_pAssetInfoClassificationAtomArray != NULL) 162 { 163 return (_pAssetInfoClassificationAtomArray->size()); 164 } 165 else 166 { 167 return 0; 168 } 169 } getNumAssetInfoKeyWordAtoms()170 int32 getNumAssetInfoKeyWordAtoms() 171 { 172 if (_pAssetInfoKeyWordAtomArray != NULL) 173 { 174 return (_pAssetInfoKeyWordAtomArray->size()); 175 } 176 else 177 { 178 return 0; 179 } 180 } 181 getNumAssetInfoLocationAtoms()182 int32 getNumAssetInfoLocationAtoms() 183 { 184 if (_pAssetInfoLocationAtomArray != NULL) 185 { 186 return (_pAssetInfoLocationAtomArray->size()); 187 } 188 else 189 { 190 return 0; 191 } 192 } 193 getNumAssetInfoAlbumAtoms()194 int32 getNumAssetInfoAlbumAtoms() 195 { 196 if (_pAssetInfoAlbumAtomArray != NULL) 197 { 198 return (_pAssetInfoAlbumAtomArray->size()); 199 } 200 else 201 { 202 return 0; 203 } 204 } 205 getNumAssetInfoRecordingYearAtoms()206 int32 getNumAssetInfoRecordingYearAtoms() 207 { 208 if (_pAssetInfoRecordingYearArray != NULL) 209 { 210 return (_pAssetInfoRecordingYearArray->size()); 211 } 212 else 213 { 214 return 0; 215 } 216 } 217 getITunesTitle()218 OSCL_wHeapString<OsclMemAllocator> getITunesTitle() const 219 { 220 OSCL_wHeapString<OsclMemAllocator> temp; 221 if (_pMetaDataAtom) 222 return _pMetaDataAtom->getITunesTitle(); 223 else 224 return temp; 225 } 226 getITunesTrackSubTitle()227 OSCL_wHeapString<OsclMemAllocator> getITunesTrackSubTitle() const 228 { 229 OSCL_wHeapString<OsclMemAllocator> temp; 230 if (_pMetaDataAtom) 231 return _pMetaDataAtom->getITunesTrackSubTitle(); 232 else 233 return temp; 234 } 235 getITunesArtist()236 OSCL_wHeapString<OsclMemAllocator> getITunesArtist() const 237 { 238 OSCL_wHeapString<OsclMemAllocator> temp; 239 if (_pMetaDataAtom) 240 return _pMetaDataAtom->getITunesArtist(); 241 else 242 return temp; 243 } 244 getITunesAlbumArtist()245 OSCL_wHeapString<OsclMemAllocator> getITunesAlbumArtist() const 246 { 247 OSCL_wHeapString<OsclMemAllocator> temp; 248 if (_pMetaDataAtom) 249 return _pMetaDataAtom->getITunesAlbumArtist(); 250 else 251 return temp; 252 } 253 getITunesAlbum()254 OSCL_wHeapString<OsclMemAllocator> getITunesAlbum() const 255 { 256 OSCL_wHeapString<OsclMemAllocator> temp; 257 if (_pMetaDataAtom) 258 return _pMetaDataAtom->getITunesAlbum(); 259 else 260 return temp; 261 } 262 263 // Gnre ** Starts ** getITunesGnreID()264 uint16 getITunesGnreID() const 265 { 266 if (_pMetaDataAtom) 267 { 268 if (_pMetaDataAtom->getITunesGnreVersion() == INTEGER_GENRE) 269 { 270 return _pMetaDataAtom->getITunesGnreID(); 271 } 272 else 273 return 0; 274 } 275 else 276 return 0; 277 } 278 279 getITunesGnreString()280 OSCL_wHeapString<OsclMemAllocator> getITunesGnreString() const 281 { 282 OSCL_wHeapString<OsclMemAllocator> temp; 283 if (_pMetaDataAtom) 284 { 285 if (_pMetaDataAtom->getITunesGnreVersion() == STRING_GENRE) 286 { 287 return _pMetaDataAtom->getITunesGnreString(); 288 } 289 else 290 return temp; 291 } 292 else 293 return temp; 294 } 295 296 //This function will tell the type of Genre-- getITunesGnreVersion()297 GnreVersion getITunesGnreVersion() const 298 { 299 if (_pMetaDataAtom) 300 { 301 return _pMetaDataAtom->getITunesGnreVersion(); 302 } 303 else 304 // By-default return INTEGER_GENRE 305 return INTEGER_GENRE; 306 } 307 // Gnre ** Ends ** 308 309 310 // Returns the 4-byte YEAR when the song was recorded getITunesYear()311 OSCL_wHeapString<OsclMemAllocator> getITunesYear() const 312 { 313 OSCL_wHeapString<OsclMemAllocator> temp; 314 if (_pMetaDataAtom) 315 return _pMetaDataAtom->getITunesYear(); 316 else 317 return temp; 318 } 319 320 getITunesTool()321 OSCL_wHeapString<OsclMemAllocator> getITunesTool() const 322 { 323 OSCL_wHeapString<OsclMemAllocator> temp; 324 if (_pMetaDataAtom) 325 { 326 return _pMetaDataAtom->getITunesTool(); 327 } 328 else 329 return temp; 330 } 331 getITunesEncodedBy()332 OSCL_wHeapString<OsclMemAllocator> getITunesEncodedBy() const 333 { 334 OSCL_wHeapString<OsclMemAllocator> temp; 335 if (_pMetaDataAtom) 336 { 337 return _pMetaDataAtom->getITunesEncodedBy(); 338 } 339 else 340 return temp; 341 } 342 getITunesWriter()343 OSCL_wHeapString<OsclMemAllocator> getITunesWriter() const 344 { 345 OSCL_wHeapString<OsclMemAllocator> temp; 346 if (_pMetaDataAtom) 347 return _pMetaDataAtom->getITunesWriter(); 348 else 349 return temp; 350 } 351 getITunesGroup()352 OSCL_wHeapString<OsclMemAllocator> getITunesGroup() const 353 { 354 OSCL_wHeapString<OsclMemAllocator> temp; 355 if (_pMetaDataAtom) 356 return _pMetaDataAtom->getITunesGroup(); 357 else 358 return temp; 359 } 360 getITunesComment()361 OSCL_wHeapString<OsclMemAllocator> getITunesComment() const 362 { 363 OSCL_wHeapString<OsclMemAllocator> temp; 364 if (_pMetaDataAtom) 365 return _pMetaDataAtom->getITunesComment(); 366 else 367 return temp; 368 } 369 getITunesCopyright()370 OSCL_wHeapString<OsclMemAllocator> getITunesCopyright() const 371 { 372 OSCL_wHeapString<OsclMemAllocator> temp; 373 if (_pMetaDataAtom) 374 return _pMetaDataAtom->getITunesCopyright(); 375 else 376 return temp; 377 } 378 getITunesDescription()379 OSCL_wHeapString<OsclMemAllocator> getITunesDescription() const 380 { 381 OSCL_wHeapString<OsclMemAllocator> temp; 382 if (_pMetaDataAtom) 383 return _pMetaDataAtom->getITunesDescription(); 384 else 385 return temp; 386 } 387 getITunesThisTrackNo()388 uint16 getITunesThisTrackNo() const 389 { 390 if (_pMetaDataAtom) 391 return _pMetaDataAtom->getITunesThisTrackNo(); 392 else 393 return 0; 394 } 395 getITunesTotalTracks()396 uint16 getITunesTotalTracks() const 397 { 398 if (_pMetaDataAtom) 399 return _pMetaDataAtom->getITunesTotalTracks(); 400 else 401 return 0; 402 } 403 IsITunesCompilationPart()404 bool IsITunesCompilationPart() const 405 { 406 if (_pMetaDataAtom) 407 return _pMetaDataAtom->IsITunesCompilationPart(); 408 else 409 return false; 410 } 411 IsITunesContentRating()412 bool IsITunesContentRating() const 413 { 414 if (_pMetaDataAtom) 415 return _pMetaDataAtom->IsITunesContentRating(); 416 else 417 return false; 418 } 419 getITunesBeatsPerMinute()420 uint16 getITunesBeatsPerMinute() const 421 { 422 if (_pMetaDataAtom) 423 return _pMetaDataAtom->getITunesBeatsPerMinute(); 424 else 425 return 0; 426 } 427 getITunesImageData()428 PvmfApicStruct* getITunesImageData() const 429 { 430 if (_pMetaDataAtom) 431 return _pMetaDataAtom->getITunesImageData(); 432 else 433 return NULL; 434 } 435 getITunesThisDiskNo()436 uint16 getITunesThisDiskNo() const 437 { 438 if (_pMetaDataAtom) 439 return _pMetaDataAtom->getITunesThisDiskNo(); 440 else 441 return 0; 442 } 443 getITunesTotalDisks()444 uint16 getITunesTotalDisks() const 445 { 446 if (_pMetaDataAtom) 447 return _pMetaDataAtom->getITunesTotalDisks(); 448 else 449 return 0; 450 } 451 452 453 getITunesNormalizationData()454 OSCL_wHeapString<OsclMemAllocator> getITunesNormalizationData() const 455 { 456 OSCL_wHeapString<OsclMemAllocator> temp; 457 if (_pMetaDataAtom) 458 return _pMetaDataAtom->getITunesNormalizationData(); 459 else 460 return temp; 461 } 462 getITunesCDIdentifierData(uint8 index)463 OSCL_wHeapString<OsclMemAllocator> getITunesCDIdentifierData(uint8 index) const 464 { 465 OSCL_wHeapString<OsclMemAllocator> temp; 466 if (_pMetaDataAtom) 467 return _pMetaDataAtom->getITunesCDIdentifierData(index); 468 else 469 return temp; 470 } 471 getITunesTotalCDIdentifierData()472 uint8 getITunesTotalCDIdentifierData() const 473 { 474 475 if (_pMetaDataAtom) 476 return _pMetaDataAtom->getITunesTotalCDIdentifierData(); 477 else 478 return 0; 479 } 480 getITunesCDTrackNumberData()481 OSCL_wHeapString<OsclMemAllocator> getITunesCDTrackNumberData() const 482 { 483 OSCL_wHeapString<OsclMemAllocator> temp; 484 if (_pMetaDataAtom) 485 return _pMetaDataAtom->getITunesCDTrackNumberData(); 486 else 487 return temp; 488 } 489 getITunesCDDB1Data()490 OSCL_wHeapString<OsclMemAllocator> getITunesCDDB1Data() const 491 { 492 OSCL_wHeapString<OsclMemAllocator> temp; 493 if (_pMetaDataAtom) 494 return _pMetaDataAtom->getITunesCDDB1Data(); 495 else 496 return temp; 497 } 498 getITunesLyrics()499 OSCL_wHeapString<OsclMemAllocator> getITunesLyrics() const 500 { 501 OSCL_wHeapString<OsclMemAllocator> temp; 502 if (_pMetaDataAtom) 503 return _pMetaDataAtom->getITunesLyrics(); 504 else 505 return temp; 506 } 507 508 509 510 AssetInfoTitleAtom *getAssetInfoTitleAtomAt(int32 index); 511 AssetInfoDescAtom *getAssetInfoDescAtomAt(int32 index); 512 CopyRightAtom *getCopyRightAtomAt(int32 index); 513 AssetInfoPerformerAtom *getAssetInfoPerformerAtomAt(int32 index); 514 AssetInfoAuthorAtom *getAssetInfoAuthorAtomAt(int32 index); 515 AssetInfoGenreAtom *getAssetInfoGenreAtomAt(int32 index); 516 AssetInfoRatingAtom *getAssetInfoRatingAtomAt(int32 index); 517 AssetInfoClassificationAtom *getAssetInfoClassificationAtomAt(int32 index); 518 AssetInfoKeyWordAtom *getAssetInfoKeyWordAtomAt(int32 index); 519 AssetInfoLocationAtom *getAssetInfoLocationAtomAt(int32 index); 520 AssetInfoAlbumAtom *getAssetInfoAlbumAtomAt(int32 index); 521 AssetInfoRecordingYearAtom *getAssetInfoRecordingYearAtomAt(int32 index); 522 523 private: 524 PVUserDataAtom* _pPVUserDataAtom; 525 526 527 MetaDataAtom* _pMetaDataAtom; 528 529 530 PVContentTypeAtom* _pPVContentTypeAtom; 531 532 533 Oscl_Vector<AssetInfoTitleAtom*, OsclMemAllocator> *_pAssetInfoTitleAtomArray; 534 Oscl_Vector<AssetInfoDescAtom*, OsclMemAllocator> *_pAssetInfoDescAtomArray; 535 Oscl_Vector<CopyRightAtom*, OsclMemAllocator> *_pCopyRightAtomArray; 536 Oscl_Vector<AssetInfoPerformerAtom*, OsclMemAllocator> *_pAssetInfoPerformerAtomArray; 537 Oscl_Vector<AssetInfoAuthorAtom*, OsclMemAllocator> *_pAssetInfoAuthorAtomArray; 538 Oscl_Vector<AssetInfoGenreAtom*, OsclMemAllocator> *_pAssetInfoGenreAtomArray; 539 Oscl_Vector<AssetInfoRatingAtom*, OsclMemAllocator> *_pAssetInfoRatingAtomArray; 540 Oscl_Vector<AssetInfoClassificationAtom*, OsclMemAllocator> *_pAssetInfoClassificationAtomArray; 541 Oscl_Vector<AssetInfoKeyWordAtom*, OsclMemAllocator> *_pAssetInfoKeyWordAtomArray; 542 Oscl_Vector<AssetInfoLocationAtom*, OsclMemAllocator> *_pAssetInfoLocationAtomArray; 543 Oscl_Vector<AssetInfoAlbumAtom*, OsclMemAllocator> *_pAssetInfoAlbumAtomArray; 544 Oscl_Vector<AssetInfoRecordingYearAtom*, OsclMemAllocator> *_pAssetInfoRecordingYearArray; 545 }; 546 547 #endif // USERDATAATOM_H_INCLUDED 548 549