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 #include "itunesilstatom.h"
19 #include "atomdefs.h"
20 #include "atomutils.h"
21 #include "oscl_int64_utils.h"
22 #include "oscl_utf8conv.h"
23
24 typedef Oscl_Vector<ItunesMeaningAtom*, OsclMemAllocator> ItunesMeaningAtomVecType;
25 typedef Oscl_Vector<ItunesNameAtom*, OsclMemAllocator> ItunesNameAtomVecType;
26
27 //************************************MeaningAtom Class Starts **********************************
ItunesMeaningAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)28 ItunesMeaningAtom::ItunesMeaningAtom(MP4_FF_FILE *fp,
29 uint32 size,
30 uint32 type)
31 : FullAtom(fp, size, type)
32 {
33 int32 nSize = (int32)(size - DEFAULT_FULL_ATOM_SIZE);
34 if (nSize > 0)
35 {
36 uint8* buf = NULL;
37 uint8* outbuf = NULL;
38 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
39 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
40 if (buf && outbuf)
41 {
42 if (!AtomUtils::readByteData(fp, nSize, buf))
43 {
44 _success = false;
45 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
46
47
48 }
49 else
50 {
51 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
52 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
53 _meaningString = temp;
54 }
55 }
56 else
57 {
58 _success = false;
59 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
60
61
62 }
63
64 /*Delete the buffers*/
65 if (buf)
66 {
67 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
68 buf = NULL;
69 }
70 if (outbuf)
71 {
72 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
73 outbuf = NULL;
74 }
75 }
76 else
77 {
78 _success = false;
79 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
80
81 }
82
83 }
84
85
~ItunesMeaningAtom()86 ItunesMeaningAtom::~ItunesMeaningAtom()
87 {
88
89
90 }
91
92 //************************************NameAtom Class Starts **********************************
ItunesNameAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)93 ItunesNameAtom::ItunesNameAtom(MP4_FF_FILE *fp,
94 uint32 size,
95 uint32 type)
96 : FullAtom(fp, size, type)
97 {
98
99 int32 nSize = (int32)(size - DEFAULT_FULL_ATOM_SIZE);
100 if (nSize > 0)
101 {
102 uint8* buf = NULL;
103 uint8* outbuf = NULL;
104 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
105 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
106 if (buf && outbuf)
107 {
108 if (!AtomUtils::readByteData(fp, nSize, buf))
109 {
110 _success = false;
111 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
112
113 }
114 else
115 {
116 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
117 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
118 _nameString = temp;
119 }
120 }
121 else
122 {
123 _success = false;
124 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
125
126 }
127
128 /*Delete the buffers*/
129 if (buf)
130 {
131 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
132 buf = NULL;
133 }
134 if (outbuf)
135 {
136 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
137 outbuf = NULL;
138 }
139 }
140 else
141 {
142 _success = false;
143 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
144
145 }
146
147 }
148
149
~ItunesNameAtom()150 ItunesNameAtom::~ItunesNameAtom()
151 {
152 }
153
154 //************************************BaseTypes for the MetaData **********************************
ITunesMetaDataAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)155 ITunesMetaDataAtom::ITunesMetaDataAtom(MP4_FF_FILE *fp, uint32 size, uint32 type): Atom(fp, size, type)
156 {
157
158 iLogger = PVLogger::GetLoggerObject("mp4ffparser");
159 Oscl_Int64_Utils::set_uint64(STRING_PREFIX, 0x00000001, 0);
160 Oscl_Int64_Utils::set_uint64(INTEGER_PREFIX, 0x00000000, 0);
161 Oscl_Int64_Utils::set_uint64(OTHER_PREFIX, 0x00000015, 0);
162 Oscl_Int64_Utils::set_uint64(IMAGE_PREFIX_JFIF, 0x0000000D, 0);
163 Oscl_Int64_Utils::set_uint64(IMAGE_PREFIX_PNG, 0x0000000E, 0);
164 }
165
~ITunesMetaDataAtom()166 ITunesMetaDataAtom::~ITunesMetaDataAtom()
167 {
168
169 }
170
171 //************************************ Title Class Starts **********************************
ITunesTitleAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)172 ITunesTitleAtom::ITunesTitleAtom(MP4_FF_FILE *fp,
173 uint32 size,
174 uint32 type)
175 : ITunesMetaDataAtom(fp, size, type)
176 {
177 uint32 atomType = UNKNOWN_ATOM, atomSize = 0;
178 int32 nSize = 0;
179 AtomUtils::getNextAtomType(fp, atomSize, atomType);
180 nSize = (int32)(atomSize - PREFIX_SIZE);
181 if (nSize > 0)
182 {
183 uint8* buf = NULL;
184 uint8* outbuf = NULL;
185 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
186 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
187 if (buf && outbuf)
188 {
189 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
190 {
191 if (_prefix == STRING_PREFIX)
192 {
193 if (!AtomUtils::readByteData(fp, nSize, buf))
194 {
195 _success = false;
196 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
197 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesTitleAtom::ITunesTitleAtom READ_ITUNES_ILST_META_DATA_FAILED"));
198 }
199 else
200 {
201 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
202 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
203 _name = temp;
204 }
205 }
206 else //if atomType is not "DataAtom" and/or _prefix is not "string"
207 {
208
209 _success = false;
210 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
211 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesTitleAtom::ITunesTitleAtom READ_ITUNES_ILST_META_DATA_FAILED"));
212 }
213
214 }
215 }
216 else
217 {
218 _success = false;
219 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
220 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesTitleAtom::ITunesTitleAtom READ_ITUNES_ILST_META_DATA_FAILED"));
221
222 }
223 /*Deleting the buffers*/
224 if (buf)
225 {
226 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
227 buf = NULL;
228 }
229 if (outbuf)
230 {
231 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
232 outbuf = NULL;
233 }
234 }
235 else
236 {
237 _success = false;
238 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
239 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesTitleAtom::ITunesTitleAtom READ_ITUNES_ILST_META_DATA_FAILED"));
240
241 }
242
243 }
244
245
~ITunesTitleAtom()246 ITunesTitleAtom::~ITunesTitleAtom()
247 {
248 }
249
250 //************************************ Track's Subtitle Class Starts **********************************
251
ITunesTrackSubTitleAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)252 ITunesTrackSubTitleAtom::ITunesTrackSubTitleAtom(MP4_FF_FILE *fp,
253 uint32 size,
254 uint32 type)
255 : ITunesMetaDataAtom(fp, size, type)
256 {
257 uint32 atomType = UNKNOWN_ATOM, atomSize = 0;
258 int32 nSize = 0;
259 AtomUtils::getNextAtomType(fp, atomSize, atomType);
260 nSize = (int32)(atomSize - PREFIX_SIZE);
261 if (nSize > 0)
262 {
263 uint8* buf = NULL;
264 uint8* outbuf = NULL;
265 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
266 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
267 if (buf && outbuf)
268 {
269 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
270 {
271 if (_prefix == STRING_PREFIX)
272 {
273 if (!AtomUtils::readByteData(fp, nSize, buf))
274 {
275 _success = false;
276 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
277 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesTrackSubTitleAtom::ITunesTrackSubTitleAtom READ_ITUNES_ILST_META_DATA_FAILED"));
278 }
279 else
280 {
281 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
282 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
283 _trackTitle = temp;
284 }
285 }
286 else //if atomType is not "DataAtom" and/or _prefix is not "string"
287 {
288
289 _success = false;
290 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
291 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesTrackSubTitleAtom::ITunesTrackSubTitleAtom READ_ITUNES_ILST_META_DATA_FAILED"));
292 }
293
294
295 }
296 }
297 else
298 {
299 _success = false;
300 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
301 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesTrackSubTitleAtom::ITunesTrackSubTitleAtom READ_ITUNES_ILST_META_DATA_FAILED"));
302
303 }
304 /*Deleting the buffers*/
305 if (buf)
306 {
307 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
308 buf = NULL;
309 }
310 if (outbuf)
311 {
312 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
313 outbuf = NULL;
314 }
315 }
316 else
317 {
318 _success = false;
319 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
320 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesTrackSubTitleAtom::ITunesTrackSubTitleAtom READ_ITUNES_ILST_META_DATA_FAILED"));
321
322 }
323 }
324
325
~ITunesTrackSubTitleAtom()326 ITunesTrackSubTitleAtom::~ITunesTrackSubTitleAtom()
327 {
328 }
329
330
331 //************************************ Artist / Performer Class Starts **********************************
ITunesArtistAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)332 ITunesArtistAtom::ITunesArtistAtom(MP4_FF_FILE *fp,
333 uint32 size,
334 uint32 type)
335 : ITunesMetaDataAtom(fp, size, type)
336 {
337 uint32 atomType = UNKNOWN_ATOM, atomSize = 0;
338 int32 nSize = 0;
339 AtomUtils::getNextAtomType(fp, atomSize, atomType);
340 nSize = (int32)(atomSize - PREFIX_SIZE);
341 if (nSize > 0)
342 {
343 uint8* buf = NULL;
344 uint8* outbuf = NULL;
345 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
346 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
347 if (buf && outbuf)
348 {
349 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
350 {
351 if (_prefix == STRING_PREFIX)
352 {
353 if (!AtomUtils::readByteData(fp, nSize, buf))
354 {
355 _success = false;
356 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
357 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesArtistAtom::ITunesArtistAtom READ_ITUNES_ILST_META_DATA_FAILED"));
358 }
359 else
360 {
361 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
362 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
363 _artist = temp;
364 }
365 }
366 else //if atomType is not "DataAtom" and/or _prefix is not "string"
367 {
368
369 _success = false;
370 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
371 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesArtistAtom::ITunesArtistAtom READ_ITUNES_ILST_META_DATA_FAILED"));
372 }
373
374 }
375 }
376 else
377 {
378 _success = false;
379 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
380 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesArtistAtom::ITunesArtistAtom READ_ITUNES_ILST_META_DATA_FAILED"));
381
382 }
383 /*Deleting the buffers*/
384 if (buf)
385 {
386 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
387 buf = NULL;
388 }
389 if (outbuf)
390 {
391 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
392 outbuf = NULL;
393 }
394 }
395 else
396 {
397 _success = false;
398 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
399 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesArtistAtom::ITunesArtistAtom READ_ITUNES_ILST_META_DATA_FAILED"));
400
401 }
402 }
403
404
~ITunesArtistAtom()405 ITunesArtistAtom::~ITunesArtistAtom()
406 {
407 }
408
409 //************************************AlbumArtist Class Starts **********************************
ITunesAlbumArtistAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)410 ITunesAlbumArtistAtom::ITunesAlbumArtistAtom(MP4_FF_FILE *fp,
411 uint32 size,
412 uint32 type)
413 : ITunesMetaDataAtom(fp, size, type)
414 {
415 uint32 atomType = UNKNOWN_ATOM, atomSize = 0;
416 int32 nSize = 0;
417 AtomUtils::getNextAtomType(fp, atomSize, atomType);
418 nSize = (int32)(atomSize - PREFIX_SIZE);
419 if (nSize > 0)
420 {
421 uint8* buf = NULL;
422 uint8* outbuf = NULL;
423 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
424 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
425 if (buf && outbuf)
426 {
427 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
428 {
429 if (_prefix == STRING_PREFIX)
430 {
431 if (!AtomUtils::readByteData(fp, nSize, buf))
432 {
433 _success = false;
434 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
435 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesAlbumArtistAtom::ITunesAlbumArtistAtom READ_ITUNES_ILST_META_DATA_FAILED"));
436 }
437 else
438 {
439 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
440 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
441 _albumArtist = temp;
442 }
443 }
444 else //if atomType is not "DataAtom" and/or _prefix is not "string"
445 {
446
447 _success = false;
448 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
449 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesAlbumArtistAtom::ITunesAlbumArtistAtom READ_ITUNES_ILST_META_DATA_FAILED"));
450 }
451
452 }
453 }
454 else
455 {
456 _success = false;
457 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
458 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesAlbumArtistAtom::ITunesAlbumArtistAtom READ_ITUNES_ILST_META_DATA_FAILED"));
459
460 }
461 /*Deleting the buffers*/
462 if (buf)
463 {
464 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
465 buf = NULL;
466 }
467 if (outbuf)
468 {
469 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
470 outbuf = NULL;
471 }
472 }
473 else
474 {
475 _success = false;
476 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
477 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesAlbumArtistAtom::ITunesAlbumArtistAtom READ_ITUNES_ILST_META_DATA_FAILED"));
478
479 }
480 }
481
482
~ITunesAlbumArtistAtom()483 ITunesAlbumArtistAtom::~ITunesAlbumArtistAtom()
484 {
485 }
486
487 //************************************ Album Class Starts **********************************
ITunesAlbumAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)488 ITunesAlbumAtom::ITunesAlbumAtom(MP4_FF_FILE *fp,
489 uint32 size,
490 uint32 type)
491 : ITunesMetaDataAtom(fp, size, type)
492 {
493 uint32 atomType = UNKNOWN_ATOM, atomSize = 0;
494 int32 nSize = 0;
495 AtomUtils::getNextAtomType(fp, atomSize, atomType);
496 nSize = (int32)(atomSize - PREFIX_SIZE);
497 if (nSize > 0)
498 {
499 uint8* buf = NULL;
500 uint8* outbuf = NULL;
501 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
502 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
503 if (buf && outbuf)
504 {
505 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
506 {
507 if (_prefix == STRING_PREFIX)
508 {
509 if (!AtomUtils::readByteData(fp, nSize, buf))
510 {
511 _success = false;
512 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
513 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesAlbumAtom::ITunesAlbumAtom READ_ITUNES_ILST_META_DATA_FAILED"));
514 }
515 else
516 {
517 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
518 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
519 _album = temp;
520 }
521 }
522 else //if atomType is not "DataAtom" and/or _prefix is not "string"
523 {
524
525 _success = false;
526 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
527 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesAlbumAtom::ITunesAlbumAtom READ_ITUNES_ILST_META_DATA_FAILED"));
528 }
529
530
531 }
532 }
533 else
534 {
535 _success = false;
536 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
537 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesAlbumAtom::ITunesAlbumAtom READ_ITUNES_ILST_META_DATA_FAILED"));
538
539 }
540 /*Deleting the buffers*/
541 if (buf)
542 {
543 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
544 buf = NULL;
545 }
546 if (outbuf)
547 {
548 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
549 outbuf = NULL;
550 }
551 }
552 else
553 {
554 _success = false;
555 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
556 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesAlbumAtom::ITunesAlbumAtom READ_ITUNES_ILST_META_DATA_FAILED"));
557
558 }
559 }
560
561
~ITunesAlbumAtom()562 ITunesAlbumAtom::~ITunesAlbumAtom()
563 {
564 }
565
566 //************************************ Genre Class Starts **********************************
ITunesGenreAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)567 ITunesGenreAtom::ITunesGenreAtom(MP4_FF_FILE *fp,
568 uint32 size,
569 uint32 type)
570 : ITunesMetaDataAtom(fp, size, type)
571 {
572 uint32 atomType = UNKNOWN_ATOM, atomSize = 0;
573 int32 nSize = 0;
574 AtomUtils::getNextAtomType(fp, atomSize, atomType);
575 _gnreString = NULL;
576 nSize = (int32)(atomSize - PREFIX_SIZE);
577 if (nSize > 0)
578 {
579 uint8* buf = NULL;
580 uint8* outbuf = NULL;
581 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
582 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
583 if (buf && outbuf)
584 {
585 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
586 {
587 _gnreVersion = STRING_GENRE;
588 if (_prefix == STRING_PREFIX)
589 {
590 if (!AtomUtils::readByteData(fp, nSize, buf))
591 {
592 _success = false;
593 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
594 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesGenreAtom::ITunesGenreAtom READ_ITUNES_ILST_META_DATA_FAILED"));
595 }
596 else
597 {
598 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
599 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
600 _gnreString = temp;
601 }
602 }
603 else if (_prefix == INTEGER_PREFIX)
604 {
605 _gnreVersion = INTEGER_GENRE;
606 if (!AtomUtils::read16(fp, _gnreID))
607 {
608 _success = false;
609 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
610 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesGenreAtom::ITunesGenreAtom READ_ITUNES_ILST_META_DATA_FAILED _prefix == INTEGER_PREFIX"));
611 }
612 }
613 else //if atomType is not "DataAtom" and/or _prefix is not "string/Integer"
614 {
615
616 _success = false;
617 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
618 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesGenreAtom::ITunesGenreAtom READ_ITUNES_ILST_META_DATA_FAILED"));
619 }
620
621 }
622 }
623 else
624 {
625 _success = false;
626 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
627 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesGenreAtom::ITunesGenreAtom READ_ITUNES_ILST_META_DATA_FAILED"));
628
629 }
630 /*Deleting the buffers*/
631 if (buf)
632 {
633 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
634 buf = NULL;
635 }
636 if (outbuf)
637 {
638 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
639 outbuf = NULL;
640 }
641 }
642 else
643 {
644 _success = false;
645 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
646 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesGenreAtom::ITunesGenreAtom READ_ITUNES_ILST_META_DATA_FAILED"));
647
648 }
649 }
650
651
~ITunesGenreAtom()652 ITunesGenreAtom::~ITunesGenreAtom()
653 {
654 }
655
656 //************************************ Day Class Starts **********************************
ITunesYearAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)657 ITunesYearAtom::ITunesYearAtom(MP4_FF_FILE *fp,
658 uint32 size,
659 uint32 type)
660 : ITunesMetaDataAtom(fp, size, type)
661 {
662 uint32 atomType = UNKNOWN_ATOM, atomSize = 0;
663 int32 nSize = 0;
664 AtomUtils::getNextAtomType(fp, atomSize, atomType);
665 nSize = (int32)(atomSize - PREFIX_SIZE);
666 if (nSize > 0)
667 {
668 uint8* buf = NULL;
669 uint8* outbuf = NULL;
670 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
671 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
672 if (buf && outbuf)
673 {
674 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
675 {
676 if (_prefix == STRING_PREFIX)
677 {
678 if (!AtomUtils::readByteData(fp, nSize, buf))
679 {
680 _success = false;
681 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
682 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesYearAtom::ITunesYearAtom READ_ITUNES_ILST_META_DATA_FAILED"));
683 }
684 else
685 {
686 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
687 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
688 _day = temp;
689 }
690 }
691 else //if atomType is not "DataAtom" and/or _prefix is not "string"
692 {
693
694 _success = false;
695 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
696 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesTitleAtom::ITunesTitleAtom READ_ITUNES_ILST_META_DATA_FAILED"));
697 }
698 }
699 }
700 else
701 {
702 _success = false;
703 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
704 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesYearAtom::ITunesYearAtom READ_ITUNES_ILST_META_DATA_FAILED"));
705
706 }
707 /*Deleting the buffers*/
708 if (buf)
709 {
710 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
711 buf = NULL;
712 }
713 if (outbuf)
714 {
715 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
716 outbuf = NULL;
717 }
718 }
719 else
720 {
721 _success = false;
722 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
723 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesYearAtom::ITunesYearAtom READ_ITUNES_ILST_META_DATA_FAILED"));
724
725 }
726 }
727
728
~ITunesYearAtom()729 ITunesYearAtom::~ITunesYearAtom()
730 {
731 }
732
733 //************************************ Tool Class Starts **********************************
ITunesToolAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)734 ITunesToolAtom::ITunesToolAtom(MP4_FF_FILE *fp,
735 uint32 size,
736 uint32 type)
737 : ITunesMetaDataAtom(fp, size, type)
738 {
739 uint32 atomType = UNKNOWN_ATOM, atomSize = 0;
740 int32 nSize = 0;
741 AtomUtils::getNextAtomType(fp, atomSize, atomType);
742 nSize = (int32)(atomSize - PREFIX_SIZE);
743 if (nSize > 0)
744 {
745 uint8* buf = NULL;
746 uint8* outbuf = NULL;
747 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
748 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
749 if (buf && outbuf)
750 {
751 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
752 {
753 if (_prefix == STRING_PREFIX)
754 {
755 if (!AtomUtils::readByteData(fp, nSize, buf))
756 {
757 _success = false;
758 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
759 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesToolAtom::ITunesToolAtom READ_ITUNES_ILST_META_DATA_FAILED"));
760 }
761 else
762 {
763 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
764 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
765 _tool = temp;
766 }
767 }
768 else //if atomType is not "DataAtom" and/or _prefix is not "string"
769 {
770
771 _success = false;
772 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
773 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesToolAtom::ITunesToolAtom READ_ITUNES_ILST_META_DATA_FAILED"));
774 }
775 }
776 }
777 else
778 {
779 _success = false;
780 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
781 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesToolAtom::ITunesToolAtom READ_ITUNES_ILST_META_DATA_FAILED"));
782
783 }
784 /*Deleting the buffers*/
785 if (buf)
786 {
787 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
788 buf = NULL;
789 }
790 if (outbuf)
791 {
792 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
793 outbuf = NULL;
794 }
795 }
796 else
797 {
798 _success = false;
799 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
800 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesToolAtom::ITunesToolAtom READ_ITUNES_ILST_META_DATA_FAILED"));
801
802 }
803 }
804
805
~ITunesToolAtom()806 ITunesToolAtom::~ITunesToolAtom()
807 {
808 }
809
810 //************************************ EncodedBy Class Starts **********************************
ITunesEncodedByAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)811 ITunesEncodedByAtom::ITunesEncodedByAtom(MP4_FF_FILE *fp,
812 uint32 size,
813 uint32 type)
814 : ITunesMetaDataAtom(fp, size, type)
815 {
816 uint32 atomType = UNKNOWN_ATOM, atomSize = 0;
817 int32 nSize = 0;
818 AtomUtils::getNextAtomType(fp, atomSize, atomType);
819 nSize = (int32)(atomSize - PREFIX_SIZE);
820 if (nSize > 0)
821 {
822 uint8* buf = NULL;
823 uint8* outbuf = NULL;
824 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
825 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
826 if (buf && outbuf)
827 {
828 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
829 {
830 if (_prefix == STRING_PREFIX)
831 {
832 if (!AtomUtils::readByteData(fp, nSize, buf))
833 {
834 _success = false;
835 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
836 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesEncodedByAtom::ITunesEncodedByAtom READ_ITUNES_ILST_META_DATA_FAILED"));
837 }
838 else
839 {
840 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
841 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
842 _encodedBy = temp;
843 }
844 }
845 else //if atomType is not "DataAtom" and/or _prefix is not "string"
846 {
847
848 _success = false;
849 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
850 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesEncodedByAtom::ITunesEncodedByAtom READ_ITUNES_ILST_META_DATA_FAILED"));
851 }
852 }
853 }
854 else
855 {
856 _success = false;
857 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
858 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesEncodedByAtom::ITunesEncodedByAtom READ_ITUNES_ILST_META_DATA_FAILED"));
859
860 }
861 /*Deleting the buffers*/
862 if (buf)
863 {
864 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
865 buf = NULL;
866 }
867 if (outbuf)
868 {
869 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
870 outbuf = NULL;
871 }
872 }
873 else
874 {
875 _success = false;
876 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
877 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesEncodedByAtom::ITunesEncodedByAtom READ_ITUNES_ILST_META_DATA_FAILED"));
878
879 }
880
881 }
882
~ITunesEncodedByAtom()883 ITunesEncodedByAtom::~ITunesEncodedByAtom()
884 {
885 }
886
887 //************************************ Writer Class Starts **********************************
ITunesWriterAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)888 ITunesWriterAtom::ITunesWriterAtom(MP4_FF_FILE *fp,
889 uint32 size,
890 uint32 type)
891 : ITunesMetaDataAtom(fp, size, type)
892 {
893 uint32 atomType = UNKNOWN_ATOM, atomSize = 0;
894 int32 nSize = 0;
895 AtomUtils::getNextAtomType(fp, atomSize, atomType);
896 nSize = (int32)(atomSize - PREFIX_SIZE);
897 if (nSize > 0)
898 {
899 uint8* buf = NULL;
900 uint8* outbuf = NULL;
901 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
902 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
903 if (buf && outbuf)
904 {
905 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
906 {
907 if (_prefix == STRING_PREFIX)
908 {
909 if (!AtomUtils::readByteData(fp, nSize, buf))
910 {
911 _success = false;
912 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
913 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesWriterAtom::ITunesWriterAtom READ_ITUNES_ILST_META_DATA_FAILED"));
914 }
915 else
916 {
917 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
918 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
919 _writer = temp;
920 }
921 }
922 else //if atomType is not "DataAtom" and/or _prefix is not "string"
923 {
924
925 _success = false;
926 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
927 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesWriterAtom::ITunesWriterAtom READ_ITUNES_ILST_META_DATA_FAILED"));
928 }
929 }
930 }
931 else
932 {
933 _success = false;
934 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
935 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesWriterAtom::ITunesWriterAtom READ_ITUNES_ILST_META_DATA_FAILED"));
936
937 }
938 /*Deleting the buffers*/
939 if (buf)
940 {
941 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
942 buf = NULL;
943 }
944 if (outbuf)
945 {
946 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
947 outbuf = NULL;
948 }
949 }
950 else
951 {
952 _success = false;
953 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
954 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesWriterAtom::ITunesWriterAtom READ_ITUNES_ILST_META_DATA_FAILED"));
955
956 }
957 }
958
959
~ITunesWriterAtom()960 ITunesWriterAtom::~ITunesWriterAtom()
961 {
962 }
963
964 //************************************ Group Class Starts **********************************
ITunesGroupAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)965 ITunesGroupAtom::ITunesGroupAtom(MP4_FF_FILE *fp,
966 uint32 size,
967 uint32 type)
968 : ITunesMetaDataAtom(fp, size, type)
969 {
970 uint32 atomType = UNKNOWN_ATOM, atomSize = 0;
971 int32 nSize = 0;
972 AtomUtils::getNextAtomType(fp, atomSize, atomType);
973 nSize = (int32)(atomSize - PREFIX_SIZE);
974 if (nSize > 0)
975 {
976 uint8* buf = NULL;
977 uint8* outbuf = NULL;
978 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
979 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
980 if (buf && outbuf)
981 {
982 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
983 {
984 if (_prefix == STRING_PREFIX)
985 {
986 if (!AtomUtils::readByteData(fp, nSize, buf))
987 {
988 _success = false;
989 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
990 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesGroupAtom::ITunesGroupAtom READ_ITUNES_ILST_META_DATA_FAILED"));
991 }
992 else
993 {
994 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
995 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
996 _group = temp;
997 }
998 }
999 else //if atomType is not "DataAtom" and/or _prefix is not "string"
1000 {
1001
1002 _success = false;
1003 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1004 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesGroupAtom::ITunesGroupAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1005 }
1006 }
1007 }
1008 else
1009 {
1010 _success = false;
1011 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1012 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesGroupAtom::ITunesGroupAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1013
1014 }
1015 /*Deleting the buffers*/
1016 if (buf)
1017 {
1018 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
1019 buf = NULL;
1020 }
1021 if (outbuf)
1022 {
1023 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
1024 outbuf = NULL;
1025 }
1026 }
1027 else
1028 {
1029 _success = false;
1030 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1031 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesGroupAtom::ITunesGroupAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1032
1033 }
1034
1035 }
1036
1037
~ITunesGroupAtom()1038 ITunesGroupAtom::~ITunesGroupAtom()
1039 {
1040 }
1041
1042 //************************************ Comment Class Starts **********************************
ITunesCommentAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)1043 ITunesCommentAtom::ITunesCommentAtom(MP4_FF_FILE *fp,
1044 uint32 size,
1045 uint32 type)
1046 : ITunesMetaDataAtom(fp, size, type)
1047 {
1048 uint32 atomType = UNKNOWN_ATOM, atomSize = 0;
1049 int32 nSize = 0;
1050 AtomUtils::getNextAtomType(fp, atomSize, atomType);
1051 nSize = (int32)(atomSize - PREFIX_SIZE);
1052 if (nSize > 0)
1053 {
1054 uint8* buf = NULL;
1055 uint8* outbuf = NULL;
1056 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
1057 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
1058 if (buf && outbuf)
1059 {
1060 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
1061 {
1062 if (_prefix == STRING_PREFIX)
1063 {
1064 if (!AtomUtils::readByteData(fp, nSize, buf))
1065 {
1066 _success = false;
1067 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1068 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesCommentAtom::ITunesCommentAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1069 }
1070 else
1071 {
1072 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
1073 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
1074 _comment = temp;
1075 }
1076 }
1077 else //if atomType is not "DataAtom" and/or _prefix is not "string"
1078 {
1079
1080 _success = false;
1081 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1082 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesCommentAtom::ITunesCommentAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1083 }
1084 }
1085 }
1086 else
1087 {
1088 _success = false;
1089 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1090 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesCommentAtom::ITunesCommentAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1091
1092 }
1093 /*Deleting the buffers*/
1094 if (buf)
1095 {
1096 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
1097 buf = NULL;
1098 }
1099 if (outbuf)
1100 {
1101 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
1102 outbuf = NULL;
1103 }
1104 }
1105 else
1106 {
1107 _success = false;
1108 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1109 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesCommentAtom::ITunesCommentAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1110
1111 }
1112
1113 }
1114
1115
~ITunesCommentAtom()1116 ITunesCommentAtom::~ITunesCommentAtom()
1117 {
1118
1119 }
1120
1121
1122 //************************************ Track Class Starts **********************************
ITunesTracktAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)1123 ITunesTracktAtom::ITunesTracktAtom(MP4_FF_FILE *fp,
1124 uint32 size,
1125 uint32 type)
1126 : ITunesMetaDataAtom(fp, size, type)
1127 {
1128 uint32 atomType;
1129 uint32 atomSize;
1130 AtomUtils::getNextAtomType(fp, atomSize, atomType);
1131
1132 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
1133 {
1134 if (_prefix == INTEGER_PREFIX)
1135 {
1136 uint16 junk; // 2- Bytes representing 0x0000
1137
1138 if (!AtomUtils::read16(fp, junk))
1139 {
1140 _success = false;
1141 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1142 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesTracktAtom::ITunesTracktAtom READ_ITUNES_ILST_META_DATA_FAILED !AtomUtils::read16(fp,junk)"));
1143 return;
1144 }
1145
1146 if (!AtomUtils::read16read16(fp, _thisTrackNo, _totalTracks))
1147 {
1148 _success = false;
1149 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1150 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesTracktAtom::ITunesTracktAtom READ_ITUNES_ILST_META_DATA_FAILED !AtomUtils::read16read16(fp, _thisTrackNo, _totalTracks)"));
1151 return;
1152 }
1153
1154 if (!AtomUtils::read16(fp, junk))
1155 {
1156 _success = false;
1157 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1158 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesTracktAtom::ITunesTracktAtom READ_ITUNES_ILST_META_DATA_FAILED !AtomUtils::read16(fp,junk)"));
1159 return;
1160 }
1161 }
1162 else
1163 {
1164 _success = false;
1165 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1166 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesTracktAtom::ITunesTracktAtom READ_ITUNES_ILST_META_DATA_FAILED else "));
1167
1168
1169 }
1170
1171
1172 }
1173 }
1174
~ITunesTracktAtom()1175 ITunesTracktAtom::~ITunesTracktAtom()
1176 {
1177 }
1178
1179 //************************************ Compile Part Class Starts **********************************
ITunesCompileAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)1180 ITunesCompileAtom::ITunesCompileAtom(MP4_FF_FILE *fp,
1181 uint32 size,
1182 uint32 type)
1183 : ITunesMetaDataAtom(fp, size, type)
1184 {
1185 uint32 atomType, atomSize;
1186 AtomUtils::getNextAtomType(fp, atomSize, atomType);
1187 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
1188 {
1189 if (_prefix == OTHER_PREFIX)
1190 {
1191 uint8 cplData;
1192 if (!AtomUtils::read8(fp, cplData))
1193 {
1194 _success = false;
1195 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1196 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesCompileAtom::ITunesCompileAtom READ_ITUNES_ILST_META_DATA_FAILED if(_prefix == OTHER_PREFIX)"));
1197 return;
1198 }
1199 if (cplData)
1200 _compilationPart = true;
1201 else
1202 _compilationPart = false;
1203 }
1204 else
1205 {
1206 _success = false;
1207 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1208 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesCompileAtom::ITunesCompileAtom READ_ITUNES_ILST_META_DATA_FAILED else"));
1209 }
1210 }
1211 else
1212 {
1213 _success = false;
1214 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1215 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesCompileAtom::ITunesCompileAtom READ_ITUNES_ILST_META_DATA_FAILED if(_prefix == OTHER_PREFIX)"));
1216 return;
1217
1218 }
1219 }
1220
1221
~ITunesCompileAtom()1222 ITunesCompileAtom::~ITunesCompileAtom()
1223 {
1224 }
1225
1226 //********************************* Content Rating Class Starts ********************************
ITunesContentRatingAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)1227 ITunesContentRatingAtom::ITunesContentRatingAtom(MP4_FF_FILE *fp,
1228 uint32 size,
1229 uint32 type)
1230 : ITunesMetaDataAtom(fp, size, type)
1231 {
1232 uint32 atomType, atomSize;
1233 AtomUtils::getNextAtomType(fp, atomSize, atomType);
1234 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
1235 {
1236 if (_prefix == OTHER_PREFIX)
1237 {
1238 uint8 ratingData;
1239 if (!AtomUtils::read8(fp, ratingData))
1240 {
1241 _success = false;
1242 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1243 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesContentRatingAtom::ITunesContentRatingAtom READ_ITUNES_ILST_META_DATA_FAILED if(_prefix == OTHER_PREFIX)"));
1244 return;
1245 }
1246 if (ratingData)
1247 _contentRating = true;
1248 else
1249 _contentRating = false;
1250 }
1251 else
1252 {
1253 _success = false;
1254 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1255 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesContentRatingAtom::ITunesContentRatingAtom READ_ITUNES_ILST_META_DATA_FAILED else"));
1256 return;
1257 }
1258 }
1259 }
1260
1261
~ITunesContentRatingAtom()1262 ITunesContentRatingAtom::~ITunesContentRatingAtom()
1263 {
1264 }
1265
1266
1267
1268
1269 //************************************ Tempo Class Starts **********************************
ITunesTempoAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)1270 ITunesTempoAtom::ITunesTempoAtom(MP4_FF_FILE *fp,
1271 uint32 size,
1272 uint32 type)
1273 : ITunesMetaDataAtom(fp, size, type)
1274 {
1275 uint32 atomType, atomSize;
1276 AtomUtils::getNextAtomType(fp, atomSize, atomType);
1277 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
1278 {
1279 if (_prefix == OTHER_PREFIX)
1280 {
1281 if (!AtomUtils::read16(fp, _beatsPerMin))
1282 {
1283 _success = false;
1284 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1285 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesTempoAtom::ITunesTempoAtom READ_ITUNES_ILST_META_DATA_FAILED if(_prefix == OTHER_PREFIX)"));
1286 return;
1287 }
1288 }
1289 else
1290 {
1291 _success = false;
1292 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1293 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesTempoAtom::ITunesTempoAtom READ_ITUNES_ILST_META_DATA_FAILED else"));
1294 return;
1295 }
1296 }
1297 }
1298
1299
~ITunesTempoAtom()1300 ITunesTempoAtom::~ITunesTempoAtom()
1301 {
1302
1303 }
1304
1305 //************************************ Copyright Class Starts **********************************
ITunesCopyrightAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)1306 ITunesCopyrightAtom::ITunesCopyrightAtom(MP4_FF_FILE *fp,
1307 uint32 size,
1308 uint32 type)
1309 : ITunesMetaDataAtom(fp, size, type)
1310 {
1311 uint32 atomType = UNKNOWN_ATOM, atomSize = 0;
1312 int32 nSize = 0;
1313 AtomUtils::getNextAtomType(fp, atomSize, atomType);
1314 nSize = (int32)(atomSize - PREFIX_SIZE);
1315 if (nSize > 0)
1316 {
1317 uint8* buf = NULL;
1318 uint8* outbuf = NULL;
1319 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
1320 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
1321 if (buf && outbuf)
1322 {
1323 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
1324 {
1325 if (_prefix == STRING_PREFIX)
1326 {
1327 if (!AtomUtils::readByteData(fp, nSize, buf))
1328 {
1329 _success = false;
1330 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1331 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesCopyrightAtom::ITunesCopyrightAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1332 }
1333 else
1334 {
1335 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
1336 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
1337 _cprt = temp;
1338 }
1339 }
1340 else //if atomType is not "DataAtom" and/or _prefix is not "string"
1341 {
1342
1343 _success = false;
1344 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1345 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesCopyrightAtom::ITunesCopyrightAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1346 }
1347 }
1348 }
1349 else
1350 {
1351 _success = false;
1352 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1353 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesCopyrightAtom::ITunesCopyrightAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1354
1355 }
1356 /*Deleting the buffers*/
1357 if (buf)
1358 {
1359 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
1360 buf = NULL;
1361 }
1362 if (outbuf)
1363 {
1364 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
1365 outbuf = NULL;
1366 }
1367 }
1368 else
1369 {
1370 _success = false;
1371 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1372 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesCopyrightAtom::ITunesCopyrightAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1373
1374 }
1375
1376 }
1377
1378
~ITunesCopyrightAtom()1379 ITunesCopyrightAtom::~ITunesCopyrightAtom()
1380 {
1381
1382 }
1383
1384 //************************************ Description Class Starts **********************************
ITunesDescriptionAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)1385 ITunesDescriptionAtom::ITunesDescriptionAtom(MP4_FF_FILE *fp,
1386 uint32 size,
1387 uint32 type)
1388 : ITunesMetaDataAtom(fp, size, type)
1389 {
1390 uint32 atomType = UNKNOWN_ATOM, atomSize = 0;
1391 int32 nSize = 0;
1392 AtomUtils::getNextAtomType(fp, atomSize, atomType);
1393 nSize = (int32)(atomSize - PREFIX_SIZE);
1394 if (nSize > 0)
1395 {
1396 uint8* buf = NULL;
1397 uint8* outbuf = NULL;
1398 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
1399 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
1400 if (buf && outbuf)
1401 {
1402 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
1403 {
1404 if (_prefix == STRING_PREFIX)
1405 {
1406 if (!AtomUtils::readByteData(fp, nSize, buf))
1407 {
1408 _success = false;
1409 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1410 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesDescriptionAtom::ITunesDescriptionAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1411 }
1412 else
1413 {
1414 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
1415 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
1416 _desc = temp;
1417 }
1418 }
1419 else //if atomType is not "DataAtom" and/or _prefix is not "string"
1420 {
1421
1422 _success = false;
1423 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1424 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesDescriptionAtom::ITunesDescriptionAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1425 }
1426 }
1427 }
1428 else
1429 {
1430 _success = false;
1431 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1432 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesDescriptionAtom::ITunesDescriptionAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1433
1434 }
1435 /*Deleting the buffers*/
1436 if (buf)
1437 {
1438 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
1439 buf = NULL;
1440 }
1441 if (outbuf)
1442 {
1443 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
1444 outbuf = NULL;
1445 }
1446 }
1447 else
1448 {
1449 _success = false;
1450 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1451 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesDescriptionAtom::ITunesDescriptionAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1452
1453 }
1454
1455 }
1456
1457
~ITunesDescriptionAtom()1458 ITunesDescriptionAtom::~ITunesDescriptionAtom()
1459 {
1460 }
1461
1462 //************************************ Disk Data Starts **********************************
ITunesDiskDatatAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)1463 ITunesDiskDatatAtom::ITunesDiskDatatAtom(MP4_FF_FILE *fp,
1464 uint32 size,
1465 uint32 type)
1466 : ITunesMetaDataAtom(fp, size, type)
1467 {
1468 uint32 atomType;
1469 uint32 atomSize;
1470 AtomUtils::getNextAtomType(fp, atomSize, atomType);
1471
1472 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
1473 {
1474 if (_prefix == INTEGER_PREFIX)
1475 {
1476 uint16 junk; // 2- Bytes representing 0x0000
1477
1478 if (!AtomUtils::read16(fp, junk))
1479 {
1480 _success = false;
1481 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1482 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesDiskDatatAtom::ITunesDiskDatatAtom READ_ITUNES_ILST_META_DATA_FAILED if(!AtomUtils::read16(fp,junk))"));
1483 return;
1484 }
1485
1486 if (!AtomUtils::read16read16(fp, _thisDiskNo, _totalDisks))
1487 {
1488 _success = false;
1489 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1490 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesDiskDatatAtm::ITunesDiskDatatAtom READ_ITUNES_ILST_META_DATA_FAILED if(!AtomUtils::read16read16(fp, _thisDiskNo, _totalDisks))"));
1491 return;
1492 }
1493 }
1494 else
1495 {
1496 _success = false;
1497 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1498 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesDiskDatatAtm::ITunesDiskDatatAtom READ_ITUNES_ILST_META_DATA_FAILED else"));
1499 return;
1500 }
1501 }
1502 }
1503
1504
~ITunesDiskDatatAtom()1505 ITunesDiskDatatAtom::~ITunesDiskDatatAtom()
1506 {
1507
1508 }
1509
1510 //************************************ Free Form Data Class Starts **********************************
ITunesFreeFormDataAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)1511 ITunesFreeFormDataAtom::ITunesFreeFormDataAtom(MP4_FF_FILE *fp,
1512 uint32 size,
1513 uint32 type)
1514 : ITunesMetaDataAtom(fp, size, type)
1515 {
1516 uint32 atomType = type;
1517 int32 nSize = 0;
1518 nSize = (int32)(size - PREFIX_SIZE);
1519 if (nSize > 0)
1520 {
1521 uint8* buf = NULL;
1522 uint8* outbuf = NULL;
1523 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
1524 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
1525 if (buf && outbuf)
1526 {
1527 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
1528 {
1529 if (_prefix == STRING_PREFIX)
1530 {
1531 if (!AtomUtils::readByteData(fp, nSize, buf))
1532 {
1533 _success = false;
1534 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1535 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesFreeFormDataAtom::ITunesFreeFormDataAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1536 }
1537 else
1538 {
1539 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
1540 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
1541 _StringData = temp;
1542 }
1543 }
1544 else if (_prefix == OTHER_PREFIX)
1545 {
1546 // reading the data to keep atom alignment
1547 uint32 readData;
1548 if (!AtomUtils::read32(fp, readData))
1549 {
1550 _success = false;
1551 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1552 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesFreeFormDataAtom::ITunesFreeFormDataAtom Read four bytes (%d) in OTHER_PREFIX", readData));
1553 }
1554 }
1555 else //if atomType is not "DataAtom" and/or _prefix doesnt match.
1556 {
1557
1558 _success = false;
1559 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1560 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesFreeFormDataAtom::ITunesFreeFormDataAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1561 }
1562
1563
1564
1565
1566 }
1567 }
1568 else
1569 {
1570 _success = false;
1571 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1572 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesFreeFormDataAtom::ITunesFreeFormDataAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1573
1574 }
1575 /*Deleting the buffers*/
1576 if (buf)
1577 {
1578 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
1579 buf = NULL;
1580 }
1581 if (outbuf)
1582 {
1583 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
1584 outbuf = NULL;
1585 }
1586 }
1587 else
1588 {
1589 _success = false;
1590 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1591 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesFreeFormDataAtom::ITunesFreeFormDataAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1592
1593 }
1594
1595
1596 }
1597
1598
~ITunesFreeFormDataAtom()1599 ITunesFreeFormDataAtom::~ITunesFreeFormDataAtom()
1600 {
1601
1602 }
1603
1604 //************************************ Lyrics Class Starts **********************************
ITunesLyricsAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)1605 ITunesLyricsAtom::ITunesLyricsAtom(MP4_FF_FILE *fp,
1606 uint32 size,
1607 uint32 type)
1608 : ITunesMetaDataAtom(fp, size, type)
1609 {
1610 uint32 atomType = UNKNOWN_ATOM, atomSize = 0;
1611 int32 nSize = 0;
1612 AtomUtils::getNextAtomType(fp, atomSize, atomType);
1613 nSize = (int32)(atomSize - PREFIX_SIZE);
1614 if (nSize > 0)
1615 {
1616 uint8* buf = NULL;
1617 uint8* outbuf = NULL;
1618 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, nSize, buf);
1619 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, ((nSize + 1)*sizeof(oscl_wchar)), outbuf);
1620 if (buf && outbuf)
1621 {
1622 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
1623 {
1624 if (_prefix == STRING_PREFIX)
1625 {
1626 if (!AtomUtils::readByteData(fp, nSize, buf))
1627 {
1628 _success = false;
1629 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1630 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesLyricsAtom::ITunesLyricsAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1631 }
1632 else
1633 {
1634 oscl_UTF8ToUnicode((const char *)buf, nSize, (oscl_wchar*)outbuf, nSize + 1);
1635 OSCL_wHeapString<OsclMemAllocator> temp((const oscl_wchar *)outbuf);
1636 _lyrics = temp;
1637 }
1638 }
1639 else //if atomType is not "DataAtom" and/or _prefix is not "string"
1640 {
1641
1642 _success = false;
1643 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1644 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesLyricsAtom::ITunesLyricsAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1645 }
1646
1647
1648
1649 }
1650 }
1651 else
1652 {
1653 _success = false;
1654 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1655 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesLyricsAtom::ITunesLyricsAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1656
1657 }
1658 /*Deleting the buffers*/
1659 if (buf)
1660 {
1661 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
1662 buf = NULL;
1663 }
1664 if (outbuf)
1665 {
1666 PV_MP4_ARRAY_FREE(fp->auditCB, outbuf);
1667 outbuf = NULL;
1668 }
1669 }
1670 else
1671 {
1672 _success = false;
1673 _mp4ErrorCode = READ_ITUNES_ILST_META_DATA_FAILED;
1674 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesLyricsAtom::ITunesLyricsAtom READ_ITUNES_ILST_META_DATA_FAILED"));
1675
1676 }
1677 }
1678
1679
~ITunesLyricsAtom()1680 ITunesLyricsAtom::~ITunesLyricsAtom()
1681 {
1682 }
1683
1684 //************************************ CoverImage Class Starts **********************************
ITunesCoverImageAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)1685 ITunesCoverImageAtom::ITunesCoverImageAtom(MP4_FF_FILE *fp,
1686 uint32 size,
1687 uint32 type)
1688 : ITunesMetaDataAtom(fp, size, type)
1689 {
1690 uint32 atomType = UNKNOWN_ATOM;
1691 uint32 atomSize = 0;
1692 _ImageData = NULL;
1693 AtomUtils::getNextAtomType(fp, atomSize, atomType);
1694 int32 count = (int32)(atomSize - DEFAULT_ATOM_SIZE);
1695 if (count > 0)
1696 {
1697
1698 if (atomType == ITUNES_ILST_DATA_ATOM && AtomUtils::read64(fp, _prefix))
1699 {
1700 count -= 8;
1701 if (count < ITUNES_MAX_COVER_IMAGE_SIZE)
1702 {
1703 //treat rest of the atom as image
1704 PV_MP4_FF_NEW(fp->auditCB, PvmfApicStruct, (), _ImageData);
1705 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, uint8, count, _ImageData->iGraphicData);
1706 AtomUtils::readByteData(fp, count, _ImageData->iGraphicData);
1707 _ImageData->iGraphicDataLen = count;
1708 }
1709 else
1710 {
1711 _success = false;
1712 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesCoverImageAtom::ITunesCoverImageAtom READ_ITUNES_ILST_META_DATA_FAILED else[if (_prefix == IMAGE_PREFIX_PNG)] )"));
1713 }
1714 }
1715
1716 }
1717 else
1718 {
1719 _success = false;
1720 PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>ITunesCoverImageAtom::ITunesCoverImageAtom READ_ITUNES_ILST_META_DATA_FAILED else[if (_prefix == IMAGE_PREFIX_PNG)] )"));
1721
1722 }
1723
1724 }
1725
1726
~ITunesCoverImageAtom()1727 ITunesCoverImageAtom::~ITunesCoverImageAtom()
1728 {
1729 if (_ImageData != NULL)
1730 {
1731 if (_ImageData->iGraphicData != NULL)
1732 {
1733 PV_MP4_ARRAY_FREE(fp->auditCB, _ImageData->iGraphicData);
1734
1735 }
1736 PV_MP4_FF_DELETE(fp->auditCB, PvmfApicStruct, _ImageData);
1737 _ImageData = NULL;
1738 }
1739 }
1740 //************************************ Lyrics Class Ends **********************************
ITunesILSTAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)1741 ITunesILSTAtom::ITunesILSTAtom(MP4_FF_FILE *fp, uint32 size, uint32 type): Atom(fp, size, type)
1742 {
1743 _success = true;
1744
1745 _pITunesMeaningAtom = NULL;
1746 _pITunesNameAtom = NULL;
1747 _pMeaningAtomVec = NULL;
1748 _pNameAtomVec = NULL;
1749 _pITunesTitleAtom = NULL;
1750 _pITunesTrackSubTitleAtom = NULL;
1751 _pITunesCompileAtom = NULL;
1752 _pITunesContentRatingAtom = NULL;
1753 _pITunesTempoAtom = NULL;
1754 _pITunesCopyrightAtom = NULL;
1755 _pITunesDescriptionAtom = NULL;
1756 _pITunesToolAtom = NULL;
1757 _pITunesEncodedByAtom = NULL;
1758 _pITunesNormalizationFreeFormDataAtom = NULL;
1759 _pITunesNormalizationFreeFormDataToolAtom = NULL;
1760 _iITunesCDIdentifierFreeFormDataAtomNum = 0;
1761 for (uint8 i = 0; i < MAX_CD_IDENTIFIER_FREE_DATA_ATOM; i++)
1762 {
1763 _pITunesCDIdentifierFreeFormDataAtom[i] = NULL;
1764 }
1765 //Create the vectors
1766 PV_MP4_FF_NEW(fp->auditCB, ItunesMeaningAtomVecType, (), _pMeaningAtomVec);
1767 PV_MP4_FF_NEW(fp->auditCB, ItunesNameAtomVecType, (), _pNameAtomVec);
1768
1769
1770 _pITunesCDTrackNumberFreeFormDataAtom = NULL;
1771 _pITunesCDDB1FreeFormDataAtom = NULL;
1772 _pITunesAlbumAtom = NULL;
1773 _pITunesArtistAtom = NULL;
1774 _pITunesAlbumArtistAtom = NULL;
1775 _pITunesGenreAtom = NULL;
1776 _pITunesYearAtom = NULL;
1777 _pITunesWriterAtom = NULL;
1778 _pITunesGroupAtom = NULL;
1779 _pITunesCommentAtom = NULL;
1780 _pITunesTracktAtom = NULL;
1781 _pITunesDiskDatatAtom = NULL;
1782 _pITunesLyricsAtom = NULL;
1783 _pITunesCoverImageAtom = NULL;
1784
1785 uint32 count = _size - DEFAULT_ATOM_SIZE;
1786
1787 iLogger = PVLogger::GetLoggerObject("mp4ffparser");
1788 while (count > 0)
1789 {
1790 uint32 atomsize = 0;
1791 uint32 atomType = 0;
1792 uint32 currPtr = AtomUtils::getCurrentFilePosition(fp);
1793 AtomUtils::getNextAtomType(fp, atomsize, atomType);
1794
1795 if (count < atomsize)
1796 {
1797 AtomUtils::seekFromStart(fp, currPtr);
1798 AtomUtils::seekFromCurrPos(fp, count);
1799 count = 0;
1800 return;
1801 }
1802
1803 if (atomType == ITUNES_SONG_TITLE_ATOM)
1804 {
1805 PV_MP4_FF_NEW(fp->auditCB, ITunesTitleAtom, (fp, atomsize, atomType), _pITunesTitleAtom);
1806
1807 if (!_pITunesTitleAtom->MP4Success())
1808 {
1809 AtomUtils::seekFromStart(fp, currPtr);
1810 AtomUtils::seekFromCurrPos(fp, atomsize);
1811 PV_MP4_FF_DELETE(NULL, ITunesTitleAtom, _pITunesTitleAtom);
1812 _pITunesTitleAtom = NULL;
1813 count -= atomsize;
1814 }
1815 else
1816 count -= _pITunesTitleAtom->getSize();
1817 }
1818 else if (atomType == ITUNES_TRACK_SUBTITLE_ATOM)
1819 {
1820 PV_MP4_FF_NEW(fp->auditCB, ITunesTrackSubTitleAtom, (fp, atomsize, atomType), _pITunesTrackSubTitleAtom);
1821
1822 if (!_pITunesTrackSubTitleAtom->MP4Success())
1823 {
1824 AtomUtils::seekFromStart(fp, currPtr);
1825 AtomUtils::seekFromCurrPos(fp, atomsize);
1826 PV_MP4_FF_DELETE(NULL, ITunesTrackSubTitleAtom, _pITunesTrackSubTitleAtom);
1827 _pITunesTrackSubTitleAtom = NULL;
1828 count -= atomsize;
1829 }
1830 else
1831 count -= _pITunesTrackSubTitleAtom->getSize();
1832 }
1833 else if (atomType == ITUNES_COMPILATION_ATOM)
1834 {
1835 PV_MP4_FF_NEW(fp->auditCB, ITunesCompileAtom, (fp, atomsize, atomType), _pITunesCompileAtom);
1836
1837 if (!_pITunesCompileAtom->MP4Success())
1838 {
1839 AtomUtils::seekFromStart(fp, currPtr);
1840 AtomUtils::seekFromCurrPos(fp, atomsize);
1841 PV_MP4_FF_DELETE(NULL, ITunesCompileAtom, _pITunesCompileAtom);
1842 _pITunesCompileAtom = NULL;
1843 count -= atomsize;
1844 }
1845 else
1846 count -= _pITunesCompileAtom->getSize();
1847 }
1848 else if (atomType == ITUNES_CONTENT_RATING_ATOM)
1849 {
1850 PV_MP4_FF_NEW(fp->auditCB, ITunesContentRatingAtom, (fp, atomsize, atomType), _pITunesContentRatingAtom);
1851
1852 if (!_pITunesContentRatingAtom->MP4Success())
1853 {
1854 AtomUtils::seekFromStart(fp, currPtr);
1855 AtomUtils::seekFromCurrPos(fp, atomsize);
1856 PV_MP4_FF_DELETE(NULL, ITunesContentRatingAtom, _pITunesContentRatingAtom);
1857 _pITunesContentRatingAtom = NULL;
1858 count -= atomsize;
1859 }
1860 else
1861 count -= _pITunesContentRatingAtom->getSize();
1862 }
1863 else if (atomType == ITUNES_BPM_ATOM)
1864 {
1865 PV_MP4_FF_NEW(fp->auditCB, ITunesTempoAtom, (fp, atomsize, atomType), _pITunesTempoAtom);
1866
1867 if (!_pITunesTempoAtom->MP4Success())
1868 {
1869 AtomUtils::seekFromStart(fp, currPtr);
1870 AtomUtils::seekFromCurrPos(fp, atomsize);
1871 if (_pITunesTempoAtom != NULL)
1872 {
1873 PV_MP4_FF_DELETE(NULL, ITunesTempoAtom, _pITunesTempoAtom);
1874 _pITunesTempoAtom = NULL;
1875 }
1876 count -= atomsize;
1877 }
1878 else
1879 count -= _pITunesTempoAtom->getSize();
1880 }
1881 else if (atomType == ITUNES_COPYRIGHT_ATOM)
1882 {
1883 PV_MP4_FF_NEW(fp->auditCB, ITunesCopyrightAtom, (fp, atomsize, atomType), _pITunesCopyrightAtom);
1884
1885 if (!_pITunesCopyrightAtom->MP4Success())
1886 {
1887 AtomUtils::seekFromStart(fp, currPtr);
1888 AtomUtils::seekFromCurrPos(fp, atomsize);
1889 PV_MP4_FF_DELETE(NULL, ITunesCopyrightAtom, _pITunesCopyrightAtom);
1890 _pITunesCopyrightAtom = NULL;
1891 count -= atomsize;
1892 }
1893 else
1894 count -= _pITunesCopyrightAtom->getSize();
1895 }
1896 else if (atomType == ITUNES_DESCRIPTION_ATOM)
1897 {
1898 PV_MP4_FF_NEW(fp->auditCB, ITunesDescriptionAtom, (fp, atomsize, atomType), _pITunesDescriptionAtom);
1899
1900 if (!_pITunesDescriptionAtom->MP4Success())
1901 {
1902 AtomUtils::seekFromStart(fp, currPtr);
1903 AtomUtils::seekFromCurrPos(fp, atomsize);
1904 PV_MP4_FF_DELETE(NULL, ITunesDescriptionAtom, _pITunesDescriptionAtom);
1905 _pITunesDescriptionAtom = NULL;
1906 count -= atomsize;
1907 }
1908 else
1909 count -= _pITunesDescriptionAtom->getSize();
1910 }
1911 else if (atomType == ITUNES_ENCODER_TOOL_ATOM)
1912 {
1913 //Software(tool) which encoded the recording.
1914 PV_MP4_FF_NEW(fp->auditCB, ITunesToolAtom, (fp, atomsize, atomType), _pITunesToolAtom);
1915
1916 if (!_pITunesToolAtom->MP4Success())
1917 {
1918 AtomUtils::seekFromStart(fp, currPtr);
1919 AtomUtils::seekFromCurrPos(fp, atomsize);
1920 PV_MP4_FF_DELETE(NULL, ITunesToolAtom, _pITunesToolAtom);
1921 _pITunesToolAtom = NULL;
1922 count -= atomsize;
1923 }
1924 else
1925 count -= _pITunesToolAtom->getSize();
1926 }
1927 else if (atomType == ITUNES_ENCODEDBY_ATOM)
1928 {
1929 //Person or company that encoded the recording.
1930 PV_MP4_FF_NEW(fp->auditCB, ITunesEncodedByAtom, (fp, atomsize, atomType), _pITunesEncodedByAtom);
1931
1932 if (!_pITunesEncodedByAtom->MP4Success())
1933 {
1934 AtomUtils::seekFromStart(fp, currPtr);
1935 AtomUtils::seekFromCurrPos(fp, atomsize);
1936 PV_MP4_FF_DELETE(NULL, ITunesEncodedByAtom, _pITunesEncodedByAtom);
1937 _pITunesEncodedByAtom = NULL;
1938 count -= atomsize;
1939 }
1940 else
1941 count -= _pITunesEncodedByAtom->getSize();
1942 }
1943
1944 #if 0
1945 /* Disable this code for now, as there is an off-by-X bug in the free form atom
1946 * parsing that causes subsequent atoms to be misparsed, which makes us not see
1947 * metadata for some files purchased from the itunes music store
1948 */
1949 else if (atomType == ITUNES_FREE_FORM_ATOM)
1950 {
1951
1952 uint32 FreeFormAtomType = UNKNOWN_ATOM;
1953 uint32 FreeFormAtomSize = 0;
1954 count -= DEFAULT_ATOM_SIZE;
1955 atomsize -= DEFAULT_ATOM_SIZE;
1956
1957 while (((FreeFormAtomType == ITUNES_MEAN_ATOM) ||
1958 (FreeFormAtomType == ITUNES_FREE_FORM_DATA_NAME_ATOM) ||
1959 (FreeFormAtomType == ITUNES_ILST_DATA_ATOM) ||
1960 (FreeFormAtomType == UNKNOWN_ATOM)) &&
1961 (atomsize > 0))
1962 {
1963
1964 uint32 currPos = AtomUtils::getCurrentFilePosition(fp);
1965 AtomUtils::getNextAtomType(fp, FreeFormAtomSize, FreeFormAtomType);
1966 if (FreeFormAtomType == ITUNES_MEAN_ATOM)
1967 {
1968 PV_MP4_FF_NEW(fp->auditCB, ItunesMeaningAtom, (fp, FreeFormAtomSize, FreeFormAtomType), _pITunesMeaningAtom);
1969 if (!_pITunesMeaningAtom->MP4Success())
1970 {
1971 AtomUtils::seekFromStart(fp, currPos);
1972 AtomUtils::seekFromCurrPos(fp, FreeFormAtomSize);
1973 PV_MP4_FF_DELETE(NULL, ItunesMeaningAtom, _pITunesMeaningAtom);
1974 _pITunesMeaningAtom = NULL;
1975 count -= FreeFormAtomSize;
1976 }
1977 else
1978 {
1979 count -= _pITunesMeaningAtom->getSize();
1980 }
1981 atomsize -= FreeFormAtomSize;
1982 (*_pMeaningAtomVec).push_back(_pITunesMeaningAtom);
1983
1984 }
1985 else if (FreeFormAtomType == ITUNES_FREE_FORM_DATA_NAME_ATOM)
1986 {
1987 PV_MP4_FF_NEW(fp->auditCB, ItunesNameAtom, (fp, FreeFormAtomSize, FreeFormAtomType), _pITunesNameAtom);
1988 if (!_pITunesNameAtom->MP4Success())
1989 {
1990 AtomUtils::seekFromStart(fp, currPos);
1991 AtomUtils::seekFromCurrPos(fp, FreeFormAtomSize);
1992 PV_MP4_FF_DELETE(NULL, ItunesNameAtom, _pITunesNameAtom);
1993 _pITunesNameAtom = NULL;
1994 count -= FreeFormAtomSize;
1995 }
1996 else
1997 {
1998 count -= _pITunesNameAtom->getSize();
1999 }
2000 atomsize -= FreeFormAtomSize;
2001 (*_pNameAtomVec).push_back(_pITunesNameAtom);
2002
2003 }
2004 else if (FreeFormAtomType == ITUNES_ILST_DATA_ATOM)
2005 {
2006 OSCL_wHeapString<OsclMemAllocator> tempNameString = NULL;
2007 if (_pITunesNameAtom)
2008 tempNameString = _pITunesNameAtom->getNameString();
2009 const oscl_wchar *wStringPtr = tempNameString.get_cstr();
2010 uint32 nameStringLen = tempNameString.get_size();
2011 if (nameStringLen > 0)
2012 {
2013 char* buf = NULL;
2014 PV_MP4_FF_ARRAY_MALLOC(fp->auditCB, char, (nameStringLen + 1), buf);
2015 if (buf)
2016 {
2017
2018 oscl_UnicodeToUTF8(wStringPtr, nameStringLen, buf, nameStringLen + 1);
2019 if (!(oscl_strcmp(buf, ITUNES_FREE_FORM_DATA_ATOM_TYPE_NORM)))
2020 {
2021 if (_pITunesNormalizationFreeFormDataAtom == NULL)
2022 {
2023 PV_MP4_FF_NEW(fp->auditCB,
2024 ITunesFreeFormDataAtom,
2025 (fp, FreeFormAtomSize, FreeFormAtomType),
2026 _pITunesNormalizationFreeFormDataAtom);
2027 if (!_pITunesNormalizationFreeFormDataAtom->MP4Success())
2028 {
2029 AtomUtils::seekFromStart(fp, currPos);
2030 AtomUtils::seekFromCurrPos(fp, FreeFormAtomSize);
2031
2032 }
2033 count -= _pITunesNormalizationFreeFormDataAtom->getSize();
2034 atomsize -= _pITunesNormalizationFreeFormDataAtom->getSize();
2035 }
2036 else //Duplicate atom
2037 {
2038 AtomUtils::seekFromStart(fp, currPos);
2039 AtomUtils::seekFromCurrPos(fp, FreeFormAtomSize);
2040 count -= FreeFormAtomSize;
2041 atomsize -= FreeFormAtomSize;
2042
2043 }
2044
2045 }
2046 else if (!(oscl_strcmp(buf, ITUNES_FREE_FORM_DATA_ATOM_TYPE_TOOL)))
2047 {
2048 if (_pITunesNormalizationFreeFormDataToolAtom == NULL)
2049 {
2050 PV_MP4_FF_NEW(fp->auditCB,
2051 ITunesFreeFormDataAtom,
2052 (fp, FreeFormAtomSize, FreeFormAtomType),
2053 _pITunesNormalizationFreeFormDataToolAtom);
2054 if (!_pITunesNormalizationFreeFormDataToolAtom->MP4Success())
2055 {
2056 AtomUtils::seekFromStart(fp, currPos);
2057 AtomUtils::seekFromCurrPos(fp, FreeFormAtomSize);
2058
2059 }
2060 count -= _pITunesNormalizationFreeFormDataToolAtom->getSize();
2061 atomsize -= _pITunesNormalizationFreeFormDataToolAtom->getSize();
2062 }
2063 else //Duplicate atom
2064 {
2065 AtomUtils::seekFromStart(fp, currPos);
2066 AtomUtils::seekFromCurrPos(fp, FreeFormAtomSize);
2067 count -= FreeFormAtomSize;
2068 atomsize -= FreeFormAtomSize;
2069 }
2070 }
2071 else if (!(oscl_strcmp(buf, ITUNES_FREE_FORM_DATA_ATOM_TYPE_CDDB1)))
2072 {
2073 if (_pITunesCDDB1FreeFormDataAtom == NULL)
2074 {
2075 PV_MP4_FF_NEW(fp->auditCB,
2076 ITunesFreeFormDataAtom,
2077 (fp, FreeFormAtomSize, FreeFormAtomType),
2078 _pITunesCDDB1FreeFormDataAtom);
2079 if (!_pITunesCDDB1FreeFormDataAtom->MP4Success())
2080 {
2081 AtomUtils::seekFromStart(fp, currPos);
2082 AtomUtils::seekFromCurrPos(fp, FreeFormAtomSize);
2083
2084 }
2085 count -= _pITunesCDDB1FreeFormDataAtom->getSize();
2086 atomsize -= _pITunesCDDB1FreeFormDataAtom->getSize();
2087 }
2088 else //Duplicate atom
2089 {
2090 AtomUtils::seekFromStart(fp, currPos);
2091 AtomUtils::seekFromCurrPos(fp, FreeFormAtomSize);
2092 count -= FreeFormAtomSize;
2093 atomsize -= FreeFormAtomSize;
2094
2095 }
2096 }
2097 else if (!(oscl_strcmp(buf, ITUNES_FREE_FORM_DATA_ATOM_TYPE_CDDB_TRACKNUMBER)))
2098 {
2099 if (_pITunesCDTrackNumberFreeFormDataAtom == NULL)
2100 {
2101 PV_MP4_FF_NEW(fp->auditCB,
2102 ITunesFreeFormDataAtom,
2103 (fp, FreeFormAtomSize, FreeFormAtomType),
2104 _pITunesCDTrackNumberFreeFormDataAtom);
2105 if (!_pITunesCDTrackNumberFreeFormDataAtom->MP4Success())
2106 {
2107 AtomUtils::seekFromStart(fp, currPos);
2108 AtomUtils::seekFromCurrPos(fp, FreeFormAtomSize);
2109 }
2110 count -= _pITunesCDTrackNumberFreeFormDataAtom->getSize();
2111 atomsize -= _pITunesCDTrackNumberFreeFormDataAtom->getSize();
2112 }
2113 else //Duplicate atom
2114 {
2115 AtomUtils::seekFromStart(fp, currPos);
2116 AtomUtils::seekFromCurrPos(fp, FreeFormAtomSize);
2117 count -= FreeFormAtomSize;
2118 atomsize -= FreeFormAtomSize;
2119
2120 }
2121 }
2122 else if (!(oscl_strcmp(buf, ITUNES_FREE_FORM_DATA_ATOM_TYPE_CDDB_IDS)))
2123 {
2124
2125 PV_MP4_FF_NEW(fp->auditCB,
2126 ITunesFreeFormDataAtom,
2127 (fp, FreeFormAtomSize, FreeFormAtomType),
2128 _pITunesCDIdentifierFreeFormDataAtom[_iITunesCDIdentifierFreeFormDataAtomNum]);
2129
2130 if (!_pITunesCDIdentifierFreeFormDataAtom[_iITunesCDIdentifierFreeFormDataAtomNum]->MP4Success())
2131 {
2132 AtomUtils::seekFromStart(fp, currPos);
2133 AtomUtils::seekFromCurrPos(fp, FreeFormAtomSize);
2134
2135 }
2136 count -= _pITunesCDIdentifierFreeFormDataAtom[_iITunesCDIdentifierFreeFormDataAtomNum]->getSize();
2137 atomsize -= _pITunesCDIdentifierFreeFormDataAtom[_iITunesCDIdentifierFreeFormDataAtomNum]->getSize();
2138 _iITunesCDIdentifierFreeFormDataAtomNum++;
2139
2140 }
2141 else /*Ignore the DataAtom */
2142 {
2143 atomsize -= FreeFormAtomSize;
2144 count -= FreeFormAtomSize;
2145 AtomUtils::seekFromStart(fp, currPos);
2146 AtomUtils::seekFromCurrPos(fp, FreeFormAtomSize);
2147
2148 }
2149 }
2150 else
2151 {
2152 /*Skip the DataAtom when there is memory error*/
2153 atomsize -= FreeFormAtomSize;
2154 count -= FreeFormAtomSize;
2155 AtomUtils::seekFromStart(fp, currPos);
2156 AtomUtils::seekFromCurrPos(fp, FreeFormAtomSize);
2157
2158 }
2159 /*Delete the buffer */
2160 if (buf)
2161 {
2162 PV_MP4_ARRAY_FREE(fp->auditCB, buf);
2163 buf = NULL;
2164 }
2165
2166 }
2167 else
2168 {
2169 /*Skip the DataAtom when there is no NameAtom*/
2170 atomsize -= FreeFormAtomSize;
2171 count -= FreeFormAtomSize;
2172 AtomUtils::seekFromStart(fp, currPos);
2173 AtomUtils::seekFromCurrPos(fp, FreeFormAtomSize);
2174
2175 }
2176 }
2177 else /*Ignore the unrecognized atom */
2178 {
2179 atomsize -= FreeFormAtomSize;
2180 count -= FreeFormAtomSize;
2181 AtomUtils::seekFromStart(fp, currPos);
2182 AtomUtils::seekFromCurrPos(fp, FreeFormAtomSize);
2183 }
2184
2185 } //End of While
2186
2187 }
2188 #endif
2189 else if (atomType == ITUNES_ALBUM_ATOM)
2190 {
2191 PV_MP4_FF_NEW(fp->auditCB, ITunesAlbumAtom, (fp, atomsize, atomType), _pITunesAlbumAtom);
2192
2193 if (!_pITunesAlbumAtom->MP4Success())
2194 {
2195 AtomUtils::seekFromStart(fp, currPtr);
2196 AtomUtils::seekFromCurrPos(fp, atomsize);
2197 PV_MP4_FF_DELETE(NULL, ITunesAlbumAtom, _pITunesAlbumAtom);
2198 _pITunesAlbumAtom = NULL;
2199 count -= atomsize;
2200 }
2201 else
2202 count -= _pITunesAlbumAtom->getSize();
2203 }
2204 else if ((atomType == ITUNES_ARTIST1_ATOM) || (atomType == ITUNES_ARTIST2_ATOM))
2205 {
2206 if (_pITunesArtistAtom == NULL)
2207 {
2208 PV_MP4_FF_NEW(fp->auditCB, ITunesArtistAtom, (fp, atomsize, atomType), _pITunesArtistAtom);
2209
2210 if (!_pITunesArtistAtom->MP4Success())
2211 {
2212 AtomUtils::seekFromStart(fp, currPtr);
2213 AtomUtils::seekFromCurrPos(fp, atomsize);
2214 PV_MP4_FF_DELETE(NULL, ITunesArtistAtom, _pITunesArtistAtom);
2215 _pITunesArtistAtom = NULL;
2216 count -= atomsize;
2217 }
2218 else
2219 count -= _pITunesArtistAtom->getSize();
2220 }
2221 else //Skip it
2222 {
2223 count -= atomsize;
2224 atomsize -= DEFAULT_ATOM_SIZE;
2225 AtomUtils::seekFromCurrPos(fp, atomsize);
2226
2227 }
2228 }
2229 else if (atomType == ITUNES_ALBUM_ARTIST_ATOM)
2230 {
2231 PV_MP4_FF_NEW(fp->auditCB, ITunesAlbumArtistAtom, (fp, atomsize, atomType), _pITunesAlbumArtistAtom);
2232
2233 if (!_pITunesAlbumArtistAtom->MP4Success())
2234 {
2235 AtomUtils::seekFromStart(fp, currPtr);
2236 AtomUtils::seekFromCurrPos(fp, atomsize);
2237 PV_MP4_FF_DELETE(NULL, ITunesAlbumArtistAtom, _pITunesAlbumArtistAtom);
2238 _pITunesAlbumArtistAtom = NULL;
2239 count -= atomsize;
2240 }
2241 else
2242 count -= _pITunesAlbumArtistAtom->getSize();
2243 }
2244 else if (atomType == ITUNES_GENRE1_ATOM || atomType == ITUNES_GENRE2_ATOM)
2245 {
2246 if (_pITunesGenreAtom == NULL)
2247 {
2248 PV_MP4_FF_NEW(fp->auditCB, ITunesGenreAtom, (fp, atomsize, atomType), _pITunesGenreAtom);
2249 if (!_pITunesGenreAtom->MP4Success())
2250 {
2251 AtomUtils::seekFromStart(fp, currPtr);
2252 AtomUtils::seekFromCurrPos(fp, atomsize);
2253 PV_MP4_FF_DELETE(NULL, ITunesGenreAtom, _pITunesGenreAtom);
2254 _pITunesGenreAtom = NULL;
2255 count -= atomsize;
2256 }
2257 else
2258 count -= _pITunesGenreAtom->getSize();
2259 }
2260 else
2261 {
2262 count -= atomsize;
2263 atomsize -= DEFAULT_ATOM_SIZE;
2264 AtomUtils::seekFromCurrPos(fp, atomsize);
2265 }
2266 }
2267 else if (atomType == ITUNES_YEAR_ATOM)
2268 {
2269 PV_MP4_FF_NEW(fp->auditCB, ITunesYearAtom, (fp, atomsize, atomType), _pITunesYearAtom);
2270
2271 if (!_pITunesYearAtom->MP4Success())
2272 {
2273 AtomUtils::seekFromStart(fp, currPtr);
2274 AtomUtils::seekFromCurrPos(fp, atomsize);
2275 PV_MP4_FF_DELETE(NULL, ITunesYearAtom, _pITunesYearAtom);
2276 _pITunesYearAtom = NULL;
2277 count -= atomsize;
2278 }
2279 else
2280 count -= _pITunesYearAtom->getSize();
2281 }
2282 else if (atomType == ITUNES_COMPOSER_ATOM)
2283 {
2284 PV_MP4_FF_NEW(fp->auditCB, ITunesWriterAtom, (fp, atomsize, atomType), _pITunesWriterAtom);
2285
2286 if (!_pITunesWriterAtom->MP4Success())
2287 {
2288 AtomUtils::seekFromStart(fp, currPtr);
2289 AtomUtils::seekFromCurrPos(fp, atomsize);
2290 PV_MP4_FF_DELETE(NULL, ITunesWriterAtom, _pITunesWriterAtom);
2291 _pITunesWriterAtom = NULL;
2292 count -= atomsize;
2293 }
2294 else
2295 count -= _pITunesWriterAtom->getSize();
2296 }
2297 else if ((atomType == ITUNES_GROUPING1_ATOM) || (atomType == ITUNES_GROUPING2_ATOM))
2298 {
2299 if (_pITunesGroupAtom == NULL)
2300 {
2301 PV_MP4_FF_NEW(fp->auditCB, ITunesGroupAtom, (fp, atomsize, atomType), _pITunesGroupAtom);
2302
2303 if (!_pITunesGroupAtom->MP4Success())
2304 {
2305 AtomUtils::seekFromStart(fp, currPtr);
2306 AtomUtils::seekFromCurrPos(fp, atomsize);
2307 PV_MP4_FF_DELETE(NULL, ITunesGroupAtom, _pITunesGroupAtom);
2308 _pITunesGroupAtom = NULL;
2309 count -= atomsize;
2310 }
2311 else
2312 count -= _pITunesGroupAtom->getSize();
2313 }
2314 else
2315 {
2316 count -= atomsize;
2317 atomsize -= DEFAULT_ATOM_SIZE;
2318 AtomUtils::seekFromCurrPos(fp, atomsize);
2319 }
2320 }
2321 else if (atomType == ITUNES_COMMENT_ATOM)
2322 {
2323 PV_MP4_FF_NEW(fp->auditCB, ITunesCommentAtom, (fp, atomsize, atomType), _pITunesCommentAtom);
2324
2325 if (!_pITunesCommentAtom->MP4Success())
2326 {
2327 AtomUtils::seekFromStart(fp, currPtr);
2328 AtomUtils::seekFromCurrPos(fp, atomsize);
2329 PV_MP4_FF_DELETE(NULL, ITunesCommentAtom, _pITunesCommentAtom);
2330 _pITunesCommentAtom = NULL;
2331 count -= atomsize;
2332 }
2333 else
2334 count -= _pITunesCommentAtom->getSize();
2335 }
2336 else if (atomType == ITUNES_TRACK_NUMBER_ATOM)
2337 {
2338 PV_MP4_FF_NEW(fp->auditCB, ITunesTracktAtom, (fp, atomsize, atomType), _pITunesTracktAtom);
2339
2340 if (!_pITunesTracktAtom->MP4Success())
2341 {
2342 AtomUtils::seekFromStart(fp, currPtr);
2343 AtomUtils::seekFromCurrPos(fp, atomsize);
2344 PV_MP4_FF_DELETE(NULL, ITunesTracktAtom, _pITunesTracktAtom);
2345 _pITunesTracktAtom = NULL;
2346 count -= atomsize;
2347 }
2348 else
2349 count -= _pITunesTracktAtom->getSize();
2350 }
2351 else if (atomType == ITUNES_ART_WORK_ATOM)
2352 {
2353 PV_MP4_FF_NEW(fp->auditCB, ITunesCoverImageAtom, (fp, atomsize, atomType), _pITunesCoverImageAtom);
2354
2355 if (!_pITunesCoverImageAtom->MP4Success())
2356 {
2357 AtomUtils::seekFromStart(fp, currPtr);
2358 AtomUtils::seekFromCurrPos(fp, atomsize);
2359 PV_MP4_FF_DELETE(NULL, ITunesCoverImageAtom, _pITunesCoverImageAtom);
2360 _pITunesCoverImageAtom = NULL;
2361 count -= atomsize;
2362 }
2363 else
2364 count -= _pITunesCoverImageAtom->getSize();
2365 }
2366 else if (atomType == ITUNES_DISK_NUMBER_ATOM)
2367 {
2368 PV_MP4_FF_NEW(fp->auditCB, ITunesDiskDatatAtom, (fp, atomsize, atomType), _pITunesDiskDatatAtom);
2369
2370 if (!_pITunesDiskDatatAtom->MP4Success())
2371 {
2372 AtomUtils::seekFromStart(fp, currPtr);
2373 AtomUtils::seekFromCurrPos(fp, atomsize);
2374 PV_MP4_FF_DELETE(NULL, ITunesDiskDatatAtom, _pITunesDiskDatatAtom);
2375 _pITunesDiskDatatAtom = NULL;
2376 count -= atomsize;
2377 }
2378 else
2379 count -= _pITunesDiskDatatAtom->getSize();
2380 }
2381 else if (atomType == ITUNES_LYRICS_ATOM)
2382 {
2383 PV_MP4_FF_NEW(fp->auditCB, ITunesLyricsAtom, (fp, atomsize, atomType), _pITunesLyricsAtom);
2384
2385 if (!_pITunesLyricsAtom->MP4Success())
2386 {
2387 AtomUtils::seekFromStart(fp, currPtr);
2388 AtomUtils::seekFromCurrPos(fp, atomsize);
2389 PV_MP4_FF_DELETE(NULL, ITunesLyricsAtom, _pITunesLyricsAtom);
2390 _pITunesLyricsAtom = NULL;
2391 count -= atomsize;
2392 }
2393 else
2394 count -= _pITunesLyricsAtom->getSize();
2395 }
2396 else
2397 {
2398 if (atomsize > DEFAULT_ATOM_SIZE)
2399 {
2400 count -= atomsize;
2401 atomsize -= DEFAULT_ATOM_SIZE;
2402 AtomUtils::seekFromCurrPos(fp, atomsize);
2403 }
2404 else
2405 {
2406 // skip rest of the atom
2407 AtomUtils::seekFromCurrPos(fp, atomsize);
2408 count = 0;
2409 }
2410 }
2411 }
2412 }
2413
~ITunesILSTAtom()2414 ITunesILSTAtom::~ITunesILSTAtom()
2415 {
2416
2417 if (_pMeaningAtomVec != NULL)
2418 {
2419 for (uint32 i = 0; i < _pMeaningAtomVec->size(); i++)
2420 {
2421 ItunesMeaningAtom *ptr = (ItunesMeaningAtom *)(*_pMeaningAtomVec)[i];
2422 PV_MP4_FF_DELETE(NULL, ItunesMeaningAtom, ptr);
2423
2424 }
2425 }
2426 if (_pNameAtomVec != NULL)
2427 {
2428 for (uint32 i = 0; i < _pNameAtomVec->size(); i++)
2429 {
2430 ItunesNameAtom *ptr = (ItunesNameAtom *)(*_pNameAtomVec)[i];
2431 PV_MP4_FF_DELETE(NULL, ItunesNameAtom, ptr);
2432
2433 }
2434 }
2435 //Delete the vectors
2436 PV_MP4_FF_TEMPLATED_DELETE(NULL, ItunesNameAtomVecType, Oscl_Vector, _pNameAtomVec);
2437 PV_MP4_FF_TEMPLATED_DELETE(NULL, ItunesMeaningAtomVecType, Oscl_Vector, _pMeaningAtomVec);
2438
2439 if (_pITunesTitleAtom != NULL)
2440 {
2441 PV_MP4_FF_DELETE(NULL, ITunesTitleAtom, _pITunesTitleAtom);
2442 }
2443 if (_pITunesTrackSubTitleAtom != NULL)
2444 {
2445 PV_MP4_FF_DELETE(NULL, ITunesTrackSubTitleAtom, _pITunesTrackSubTitleAtom);
2446 }
2447
2448 if (_pITunesCompileAtom != NULL)
2449 {
2450 PV_MP4_FF_DELETE(NULL, ITunesCompileAtom, _pITunesCompileAtom);
2451 }
2452 if (_pITunesContentRatingAtom != NULL)
2453 {
2454 PV_MP4_FF_DELETE(NULL, ITunesContentRatingAtom, _pITunesContentRatingAtom);
2455 }
2456 if (_pITunesTempoAtom != NULL)
2457 {
2458 PV_MP4_FF_DELETE(NULL, ITunesTempoAtom, _pITunesTempoAtom);
2459 }
2460 if (_pITunesCopyrightAtom != NULL)
2461 {
2462 PV_MP4_FF_DELETE(NULL, ITunesCopyrightAtom, _pITunesCopyrightAtom);
2463 }
2464 if (_pITunesDescriptionAtom != NULL)
2465 {
2466 PV_MP4_FF_DELETE(NULL, ITunesDescriptionAtom, _pITunesDescriptionAtom);
2467 }
2468 if (_pITunesToolAtom != NULL)
2469 {
2470 PV_MP4_FF_DELETE(NULL, ITunesToolAtom, _pITunesToolAtom);
2471 }
2472 if (_pITunesEncodedByAtom != NULL)
2473 {
2474 PV_MP4_FF_DELETE(NULL, ITunesEncodedByAtom, _pITunesEncodedByAtom);
2475 }
2476 if (_pITunesNormalizationFreeFormDataAtom != NULL)
2477 {
2478 PV_MP4_FF_DELETE(NULL, ITunesFreeFormDataAtom, _pITunesNormalizationFreeFormDataAtom);
2479 }
2480 if (_pITunesNormalizationFreeFormDataToolAtom != NULL)
2481 {
2482 PV_MP4_FF_DELETE(NULL, ITunesFreeFormDataAtom, _pITunesNormalizationFreeFormDataToolAtom);
2483 }
2484 for (uint8 ii = 0; ii < _iITunesCDIdentifierFreeFormDataAtomNum; ii++)
2485 {
2486 if (_pITunesCDIdentifierFreeFormDataAtom[ii] != NULL)
2487 {
2488 PV_MP4_FF_DELETE(NULL, ITunesFreeFormDataAtom, _pITunesCDIdentifierFreeFormDataAtom[ii]);
2489 }
2490 }
2491
2492 if (_pITunesCDDB1FreeFormDataAtom != NULL)
2493 {
2494 PV_MP4_FF_DELETE(NULL, ITunesFreeFormDataAtom, _pITunesCDDB1FreeFormDataAtom);
2495 }
2496 if (_pITunesCDTrackNumberFreeFormDataAtom != NULL)
2497 {
2498 PV_MP4_FF_DELETE(NULL, ITunesFreeFormDataAtom, _pITunesCDTrackNumberFreeFormDataAtom);
2499 }
2500 if (_pITunesAlbumAtom != NULL)
2501 {
2502 PV_MP4_FF_DELETE(NULL, ITunesAlbumAtom, _pITunesAlbumAtom);
2503 }
2504 if (_pITunesArtistAtom != NULL)
2505 {
2506 PV_MP4_FF_DELETE(NULL, ITunesArtistAtom, _pITunesArtistAtom);
2507 }
2508 if (_pITunesAlbumArtistAtom != NULL)
2509 {
2510 PV_MP4_FF_DELETE(NULL, ITunesAlbumArtistAtom, _pITunesAlbumArtistAtom);
2511 }
2512 if (_pITunesGenreAtom != NULL)
2513 {
2514 PV_MP4_FF_DELETE(NULL, ITunesGenreAtom, _pITunesGenreAtom);
2515 }
2516 if (_pITunesYearAtom != NULL)
2517 {
2518 PV_MP4_FF_DELETE(NULL, ITunesYearAtom, _pITunesYearAtom);
2519 }
2520 if (_pITunesWriterAtom != NULL)
2521 {
2522 PV_MP4_FF_DELETE(NULL, ITunesWriterAtom, _pITunesWriterAtom);
2523 }
2524 if (_pITunesGroupAtom != NULL)
2525 {
2526 PV_MP4_FF_DELETE(NULL, ITunesGroupAtom, _pITunesGroupAtom);
2527 }
2528 if (_pITunesCommentAtom != NULL)
2529 {
2530 PV_MP4_FF_DELETE(NULL, ITunesCommentAtom, _pITunesCommentAtom);
2531 }
2532 if (_pITunesTracktAtom != NULL)
2533 {
2534 PV_MP4_FF_DELETE(NULL, ITunesTracktAtom, _pITunesTracktAtom);
2535 }
2536 if (_pITunesDiskDatatAtom != NULL)
2537 {
2538 PV_MP4_FF_DELETE(NULL, ITunesDiskDatatAtom, _pITunesDiskDatatAtom);
2539 }
2540 if (_pITunesLyricsAtom != NULL)
2541 {
2542 PV_MP4_FF_DELETE(NULL, ITunesLyricsAtom, _pITunesLyricsAtom);
2543 }
2544 if (_pITunesCoverImageAtom != NULL)
2545 {
2546 PV_MP4_FF_DELETE(NULL, ITunesCoverImageAtom, _pITunesCoverImageAtom);
2547 }
2548 }
2549
2550
2551