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 #define IMPLEMENT_TextSampleModifiers
19
20 #include "textsamplemodifiers.h"
21 #include "atomutils.h"
22 #include "atomdefs.h"
23
24 typedef Oscl_Vector<TimedTextModifiers*, OsclMemAllocator> timedTextModifiersVecType;
25 typedef Oscl_Vector<StyleRecord*, OsclMemAllocator> styleRecordVecType;
26
TextStyleBox(uint8 * buf)27 TextStyleBox:: TextStyleBox(uint8 *buf) : Atom(buf)
28 {
29 _pparent = NULL;
30
31 _pStyleRecordVec = NULL;
32
33 if (_success)
34 {
35
36 PV_MP4_FF_NEW(fp->auditCB, styleRecordVecType, (), _pStyleRecordVec);
37
38 if (!AtomUtils::read16(buf, _entryCount))
39 {
40 _success = false;
41 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
42 return;
43 }
44
45 for (uint16 i = 0; i < _entryCount; i++)
46 {
47 StyleRecord *pStyleRecord = NULL;
48 PV_MP4_FF_NEW(fp->auditCB, StyleRecord, (buf), pStyleRecord);
49 if (!pStyleRecord->MP4Success())
50 {
51 _success = false;
52 _mp4ErrorCode = pStyleRecord->GetMP4Error();
53 return;
54 }
55
56 _pStyleRecordVec->push_back(pStyleRecord);
57 }
58 }
59 else
60 {
61 _success = false;
62 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
63 return;
64 }
65 }
66
67 // Destructor
~TextStyleBox()68 TextStyleBox::~TextStyleBox()
69 {
70 if (_pStyleRecordVec != NULL)
71 {
72 for (uint32 i = 0; i < _pStyleRecordVec->size(); i++)
73 {
74 PV_MP4_FF_DELETE(NULL, StyleRecord, (*_pStyleRecordVec)[i]);
75 }
76 PV_MP4_FF_TEMPLATED_DELETE(NULL, styleRecordVecType, Oscl_Vector, _pStyleRecordVec);
77 }
78 }
79
TextHighlightBox(uint8 * buf)80 TextHighlightBox::TextHighlightBox(uint8 *buf) : Atom(buf)
81 {
82 _startCharOffset = 0;
83 _endCharOffset = 0;
84
85 if (_success)
86 {
87 if (!AtomUtils::read16(buf, _startCharOffset))
88 {
89 _success = false;
90 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
91 return;
92 }
93
94 if (!AtomUtils::read16(buf, _endCharOffset))
95 {
96 _success = false;
97 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
98 return;
99 }
100 }
101 else
102 {
103 _success = false;
104 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
105 return;
106 }
107 }
108
TextHilightColorBox(uint8 * buf)109 TextHilightColorBox::TextHilightColorBox(uint8 *buf) : Atom(buf)
110 {
111 _pHighlightColorRGBA = NULL;
112
113 if (_success)
114 {
115 PV_MP4_FF_ARRAY_NEW(NULL, uint8, (4), _pHighlightColorRGBA);
116
117 if (!AtomUtils::readByteData(buf, 4, _pHighlightColorRGBA))
118 {
119 _success = false;
120 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
121 return;
122 }
123 }
124 else
125 {
126 _success = false;
127 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
128 return;
129 }
130 }
131
~TextHilightColorBox()132 TextHilightColorBox::~TextHilightColorBox()
133 {
134 if (_pHighlightColorRGBA != NULL)
135 {
136 PV_MP4_ARRAY_DELETE(NULL, _pHighlightColorRGBA);
137 }
138 }
139
TextKaraokeBox(uint8 * buf)140 TextKaraokeBox::TextKaraokeBox(uint8 *buf) : Atom(buf)
141 {
142 _pHighLightEndTimeVec = NULL;
143 _pStartCharOffsetVec = NULL;
144 _pEndCharOffsetVec = NULL;
145
146 if (_success)
147 {
148 if (!AtomUtils::read32(buf, _highLightStartTime))
149 {
150 _success = false;
151 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
152 return;
153 }
154
155 if (!AtomUtils::read16(buf, _entryCount))
156 {
157 _success = false;
158 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
159 return;
160 }
161
162 uint32 endTime;
163 uint16 startOffset;
164 uint16 endOffset;
165
166 if (_entryCount > 0)
167 {
168
169 PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_entryCount), _pHighLightEndTimeVec);
170 PV_MP4_FF_ARRAY_NEW(NULL, uint16, (_entryCount), _pStartCharOffsetVec);
171 PV_MP4_FF_ARRAY_NEW(NULL, uint16, (_entryCount), _pEndCharOffsetVec);
172
173 for (uint16 i = 0; i < _entryCount; i++)
174 {
175 if (!AtomUtils::read32(buf, endTime))
176 {
177 _success = false;
178 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
179 return;
180 }
181
182 if (!AtomUtils::read16(buf, startOffset))
183 {
184 _success = false;
185 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
186 return;
187 }
188
189 if (!AtomUtils::read16(buf, endOffset))
190 {
191 _success = false;
192 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
193 return;
194 }
195
196 _pHighLightEndTimeVec[i] = endTime;
197 _pStartCharOffsetVec[i] = startOffset;
198 _pEndCharOffsetVec[i] = endOffset;
199
200 }
201 }
202 }
203 else
204 {
205 _success = false;
206 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
207 return;
208 }
209 }
210
~TextKaraokeBox()211 TextKaraokeBox::~TextKaraokeBox()
212 {
213 if (_pHighLightEndTimeVec != NULL)
214 {
215 PV_MP4_ARRAY_DELETE(NULL, _pHighLightEndTimeVec);
216 }
217
218 if (_pStartCharOffsetVec != NULL)
219 {
220 PV_MP4_ARRAY_DELETE(NULL, _pStartCharOffsetVec);
221 }
222
223 if (_pEndCharOffsetVec != NULL)
224 {
225 PV_MP4_ARRAY_DELETE(NULL, _pEndCharOffsetVec);
226 }
227
228 }
229
TextScrollDelay(uint8 * buf)230 TextScrollDelay::TextScrollDelay(uint8 *buf) : Atom(buf)
231 {
232 if (_success)
233 {
234 if (!AtomUtils::read32(buf, _scrollDelay))
235 {
236 _success = false;
237 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
238 return;
239 }
240 }
241 else
242 {
243 _success = false;
244 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
245 return;
246 }
247 }
248
TextHyperTextBox(uint8 * buf)249 TextHyperTextBox::TextHyperTextBox(uint8 *buf) : Atom(buf)
250 {
251 _startCharOffset = 0;
252 _endCharOffset = 0;
253 _urlLength = 0;
254 _pURL = NULL;
255 _altLength = 0;
256 _pAltString = NULL;
257
258 if (_success)
259 {
260 if (!AtomUtils::read16(buf, _startCharOffset))
261 {
262 _success = false;
263 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
264 return;
265 }
266
267 if (!AtomUtils::read16(buf, _endCharOffset))
268 {
269 _success = false;
270 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
271 return;
272 }
273
274 if (!AtomUtils::read8(buf, _urlLength))
275 {
276 _success = false;
277 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
278 return;
279 }
280
281 PV_MP4_FF_ARRAY_NEW(NULL, uint8, (_urlLength), _pURL);
282
283
284 if (!AtomUtils::readByteData(buf, _urlLength, _pURL))
285 {
286 _success = false;
287 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
288 return;
289 }
290
291 if (!AtomUtils::read8(buf, _altLength))
292 {
293 _success = false;
294 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
295 return;
296 }
297
298 PV_MP4_FF_ARRAY_NEW(NULL, uint8, (_altLength), _pAltString);
299
300 if (!AtomUtils::readByteData(buf, _altLength, _pAltString))
301 {
302 _success = false;
303 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
304 return;
305 }
306 }
307 else
308 {
309 _success = false;
310 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
311 return;
312 }
313 }
314
~TextHyperTextBox()315 TextHyperTextBox::~TextHyperTextBox()
316 {
317 if (_pURL != NULL)
318 {
319 PV_MP4_ARRAY_DELETE(NULL, _pURL);
320 }
321
322 if (_pAltString != NULL)
323 {
324 PV_MP4_ARRAY_DELETE(NULL, _pAltString);
325 }
326 }
327
TextBoxBox(uint8 * buf)328 TextBoxBox::TextBoxBox(uint8 *buf) : Atom(buf)
329 {
330 _pBoxRecord = NULL;
331
332 if (_success)
333 {
334 PV_MP4_FF_NEW(fp->auditCB, BoxRecord, (buf), _pBoxRecord);
335
336 if (!_pBoxRecord->MP4Success())
337 {
338 _success = false;
339 _mp4ErrorCode = _pBoxRecord->GetMP4Error();
340 return;
341 }
342 }
343 else
344 {
345 _success = false;
346 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
347 return;
348 }
349 }
350
351
352
353
~TextBoxBox()354 TextBoxBox::~TextBoxBox()
355 {
356 if (_pBoxRecord != NULL)
357 {
358 PV_MP4_FF_DELETE(NULL, BoxRecord, _pBoxRecord);
359 }
360 }
361
BlinkBox(uint8 * buf)362 BlinkBox::BlinkBox(uint8 *buf) : Atom(buf)
363 {
364 if (_success)
365 {
366 if (!AtomUtils::read16(buf, _startCharOffset))
367 {
368 _success = false;
369 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
370 return;
371 }
372
373 if (!AtomUtils::read16(buf, _endCharOffset))
374 {
375 _success = false;
376 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
377 return;
378 }
379 }
380 else
381 {
382 _success = false;
383 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
384 return;
385 }
386 }
387 #define SUPPRESS__NOT_YET_IMPLEMENTED
388
389 TextSampleModifiers*
parseTextModifiers(uint8 * buf,uint32 size)390 TextSampleModifiers::parseTextModifiers(uint8* buf, uint32 size)
391 {
392 TextSampleModifiers *pTextSampleModifiers = NULL;
393 #ifndef SUPPRESS__NOT_YET_IMPLEMENTED
394 PV_MP4_FF_NEW(fp->auditCB, TextSampleModifiers, (buf, size), pTextSampleModifiers);
395
396 if (!pTextSampleModifiers->MP4Success())
397 {
398 return NULL;
399 }
400 #else
401 OSCL_UNUSED_ARG(buf);
402 OSCL_UNUSED_ARG(size);
403 #endif
404 return (pTextSampleModifiers);
405 }
406
407 #ifndef SUPPRESS__NOT_YET_IMPLEMENTED
408
TextSampleModifiers(uint8 * buf,uint32 size)409 TextSampleModifiers:: TextSampleModifiers(uint8 *buf, uint32 size)
410 {
411 TimedTextModifiers *timedTextModifier = NULL;
412
413 timedTextModifier->value->_pBlinkBox = NULL;
414 timedTextModifier->value->_pTextBoxBox = NULL;
415 timedTextModifier->value->_pTextHighlightBox = NULL;
416 timedTextModifier->value->_pTextHilightColorBox = NULL;
417 timedTextModifier->value->_pTextHyperTextBox = NULL;
418 timedTextModifier->value->_pTextKaraokeBox = NULL;
419 timedTextModifier->value->_pTextScrollDelay = NULL;
420 timedTextModifier->value->_pTextStyleBox = NULL;
421
422 _success = true;
423
424 PV_MP4_FF_NEW(fp->auditCB, timedTextModifiersVecType, (), _pTimedTextModifiersVec);
425
426 if (_success)
427 {
428 uint32 count = 0;
429 uint32 atomType = AtomUtils::getNextAtomType(buf);
430
431 while (((atomType == TEXT_STYLE_BOX) ||
432 (atomType == TEXT_HIGHLIGHT_BOX) ||
433 (atomType == TEXT_HILIGHT_COLOR_BOX) ||
434 (atomType == TEXT_KARAOKE_BOX) ||
435 (atomType == TEXT_SCROLL_DELAY_BOX) ||
436 (atomType == TEXT_HYPER_TEXT_BOX) ||
437 (atomType == TEXT_OVER_RIDE_BOX) ||
438 (atomType == TEXT_BLINK_BOX)) &&
439 (count < size))
440 {
441 if (atomType == TEXT_STYLE_BOX)
442 {
443 TextStyleBox *pStyleBox = NULL;
444 PV_MP4_FF_NEW(fp->auditCB, TextStyleBox, (buf), pStyleBox);
445
446 if (!pStyleBox->MP4Success())
447 {
448 _success = false;
449 _mp4ErrorCode = pStyleBox->GetMP4Error();
450 PV_MP4_FF_DELETE(NULL, TextStyleBox, pStyleBox);
451 pStyleBox = NULL;
452 return;
453 }
454
455 timedTextModifier->value->_pTextStyleBox = pStyleBox;
456 timedTextModifier->type = TEXT_STYLE;
457
458 _pTimedTextModifiersVec->push_back(timedTextModifier);
459
460 count += pStyleBox->getSize();
461 buf += pStyleBox->getSize();
462 }
463 else if (atomType == TEXT_HIGHLIGHT_BOX)
464 {
465 TextHighlightBox *pHighlightBox = NULL;
466 PV_MP4_FF_NEW(fp->auditCB, TextHighlightBox, (buf), pHighlightBox);
467
468 if (!pHighlightBox->MP4Success())
469 {
470 _success = false;
471 _mp4ErrorCode = pHighlightBox->GetMP4Error();
472 PV_MP4_FF_DELETE(NULL, TextHighlightBox, pHighlightBox);
473 pHighlightBox = NULL;
474 return;
475 }
476
477 timedTextModifier->value->_pTextHighlightBox = pHighlightBox;
478 timedTextModifier->type = TEXT_HIGHLIGHT;
479 _pTimedTextModifiersVec->push_back(timedTextModifier);
480
481 count += pHighlightBox->getSize();
482 buf += pHighlightBox->getSize();
483 }
484 else if (atomType == TEXT_HILIGHT_COLOR_BOX)
485 {
486 if (timedTextModifier->value->_pTextHilightColorBox == NULL)
487 {
488 TextHilightColorBox *textHilightColorBox = NULL;
489 PV_MP4_FF_NEW(fp->auditCB, TextHilightColorBox, (buf), textHilightColorBox);
490
491 if (!textHilightColorBox->MP4Success())
492 {
493 _success = false;
494 _mp4ErrorCode = textHilightColorBox->GetMP4Error();
495 PV_MP4_FF_DELETE(NULL, TextHilightColorBox, textHilightColorBox);
496 textHilightColorBox = NULL;
497 return;
498 }
499
500 timedTextModifier->value->_pTextHilightColorBox = textHilightColorBox;
501 timedTextModifier->type = TEXT_WRAP;
502 _pTimedTextModifiersVec->push_back(timedTextModifier);
503
504 count += textHilightColorBox->getSize();
505 buf += textHilightColorBox->getSize();
506 }
507 else
508 {
509 _success = false;
510 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
511 return;
512 }
513 }
514 else if (atomType == TEXT_KARAOKE_BOX)
515 {
516 TextKaraokeBox *pKaraokeBox = NULL;
517 PV_MP4_FF_NEW(fp->auditCB, TextKaraokeBox, (buf), pKaraokeBox);
518
519 if (!pKaraokeBox->MP4Success())
520 {
521 _success = false;
522 _mp4ErrorCode = pKaraokeBox->GetMP4Error();
523 PV_MP4_FF_DELETE(NULL, TextKaraokeBox, pKaraokeBox);
524 pKaraokeBox = NULL;
525 return;
526 }
527
528 timedTextModifier->value->_pTextKaraokeBox = pKaraokeBox;
529 timedTextModifier->type = TEXT_KARAOKE;
530 _pTimedTextModifiersVec->push_back(timedTextModifier);
531
532 count += pKaraokeBox->getSize();
533 buf += pKaraokeBox->getSize();
534 }
535 else if (atomType == TEXT_SCROLL_DELAY_BOX)
536 {
537 if (timedTextModifier->value->_pTextScrollDelay == NULL)
538 {
539 TextScrollDelay *textScrollDelay = NULL;
540 PV_MP4_FF_NEW(fp->auditCB, TextScrollDelay, (buf), textScrollDelay);
541
542 if (!textScrollDelay->MP4Success())
543 {
544 _success = false;
545 _mp4ErrorCode = textScrollDelay->GetMP4Error();
546 PV_MP4_FF_DELETE(NULL, TextScrollDelay, textScrollDelay);
547 textScrollDelay = NULL;
548 return;
549 }
550 timedTextModifier->value->_pTextScrollDelay = textScrollDelay;
551 timedTextModifier->type = TEXT_SCROLL_DELAY;
552 _pTimedTextModifiersVec->push_back(timedTextModifier);
553
554 count += textScrollDelay->getSize();
555 buf += textScrollDelay->getSize();
556 }
557 else
558 {
559 _success = false;
560 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
561 return;
562 }
563 }
564 else if (atomType == TEXT_HYPER_TEXT_BOX)
565 {
566 TextHyperTextBox *pHyperTextBox = NULL;
567 PV_MP4_FF_NEW(fp->auditCB, TextHyperTextBox, (buf), pHyperTextBox);
568
569 if (!pHyperTextBox->MP4Success())
570 {
571 _success = false;
572 _mp4ErrorCode = pHyperTextBox->GetMP4Error();
573 PV_MP4_FF_DELETE(NULL, TextHyperTextBox, pHyperTextBox);
574 pHyperTextBox = NULL;
575 return;
576 }
577 timedTextModifier->value->_pTextHyperTextBox = pHyperTextBox;
578 timedTextModifier->type = TEXT_HYPERTEXT;
579 _pTimedTextModifiersVec->push_back(timedTextModifier);
580
581 count += pHyperTextBox->getSize();
582 buf += pHyperTextBox->getSize();
583 }
584 else if (atomType == TEXT_OVER_RIDE_BOX)
585 {
586 if (timedTextModifier->value->_pTextBoxBox == NULL)
587 {
588 TextBoxBox *textBoxBox = NULL;
589 PV_MP4_FF_NEW(fp->auditCB, TextBoxBox, (buf), textBoxBox);
590
591 if (!textBoxBox->MP4Success())
592 {
593 _success = false;
594 _mp4ErrorCode = textBoxBox->GetMP4Error();
595 PV_MP4_FF_DELETE(NULL, TextBoxBox, textBoxBox);
596 textBoxBox = NULL;
597 return;
598 }
599 timedTextModifier->value->_pTextBoxBox = textBoxBox;
600 timedTextModifier->type = TEXT_BOX;
601 _pTimedTextModifiersVec->push_back(timedTextModifier);
602
603 count += textBoxBox->getSize();
604 buf += textBoxBox->getSize();
605 }
606 else
607 {
608 _success = false;
609 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
610 return;
611 }
612 }
613 else if (atomType == TEXT_BLINK_BOX)
614 {
615 BlinkBox *pBlinkBox = NULL;
616 PV_MP4_FF_NEW(fp->auditCB, BlinkBox, (buf), pBlinkBox);
617
618 if (!pBlinkBox->MP4Success())
619 {
620 _success = false;
621 _mp4ErrorCode = pBlinkBox->GetMP4Error();
622 PV_MP4_FF_DELETE(NULL, BlinkBox, pBlinkBox);
623 pBlinkBox = NULL;
624 return;
625 }
626 timedTextModifier->value->_pBlinkBox = pBlinkBox;
627 timedTextModifier->type = TEXT_BLINK;
628 _pTimedTextModifiersVec->push_back(timedTextModifier);
629
630 count += pBlinkBox->getSize();
631 buf += pBlinkBox->getSize();
632 }
633 atomType = AtomUtils::getNextAtomType(buf);
634 }
635 }
636 else
637 {
638 _success = false;
639 _mp4ErrorCode = READ_TEXT_SAMPLE_MODIFIERS_FAILED;
640 return;
641 }
642 }
643
~TextSampleModifiers()644 TextSampleModifiers::~TextSampleModifiers()
645 {
646 if (_pTimedTextModifiersVec != NULL)
647 {
648 for (uint32 idx = 0; idx < _pTimedTextModifiersVec->size(); idx++)
649 {
650 PV_MP4_FF_DELETE(NULL, TimedTextModifiers, (*_pTimedTextModifiersVec)[idx]);
651 }
652 }
653 PV_MP4_FF_TEMPLATED_DELETE(NULL, timedTextModifiersVecType, Oscl_Vector, _pTimedTextModifiersVec);
654 _pTimedTextModifiersVec = NULL;
655 }
656
657
tNumTextStyleBoxes()658 int32 geTextSampleModifiers::tNumTextStyleBoxes()
659 {
660 int32 styleboxcount = 0;
661 for (uint32 idx = 0; idx < _pTimedTextModifiersVec->size(); idx++)
662 {
663 if ((*_pTimedTextModifiersVec)[idx]->type == TEXT_STYLE)
664 styleboxcount++;
665 }
666 return (styleboxcount);
667 }
668
getTextStyleBoxAt(int32 index)669 TextStyleBox* TextSampleModifiers::getTextStyleBoxAt(int32 index)
670 {
671 uint32 styleboxcount = 0;
672 for (uint32 idx = 0; idx < _pTimedTextModifiersVec->size(); idx++)
673 {
674 if ((*_pTimedTextModifiersVec)[idx]->type == TEXT_STYLE)
675 styleboxcount++;
676 if (styleboxcount == (uint32)index)
677 return (*_pTimedTextModifiersVec)[index]->value->_pTextStyleBox;
678 }
679 if ((uint32)index > styleboxcount)
680 return NULL;
681 }
682
getNumTextHighlightBoxes()683 int32 TextSampleModifiers::getNumTextHighlightBoxes()
684 {
685 int32 texthighlightboxcount = 0;
686 for (uint32 idx = 0; idx < _pTimedTextModifiersVec->size(); idx++)
687 {
688 if ((*_pTimedTextModifiersVec)[idx]->type == TEXT_HIGHLIGHT)
689 texthighlightboxcount++;
690 }
691 return (texthighlightboxcount);
692 }
693
getTextHighlightBoxAt(int32 index)694 TextHighlightBox* TextSampleModifiers::getTextHighlightBoxAt(int32 index)
695 {
696 uint32 texthighlightboxcount = 0;
697 for (uint32 idx = 0; idx < _pTimedTextModifiersVec->size(); idx++)
698 {
699 if ((*_pTimedTextModifiersVec)[idx]->type == TEXT_HIGHLIGHT)
700 texthighlightboxcount++;
701 if (texthighlightboxcount == (uint32)index)
702 return (*_pTimedTextModifiersVec)[index]->value->_pTextHighlightBox;
703 }
704 if ((uint32)index > texthighlightboxcount)
705 return NULL;
706 }
707
getNumTextKaraokeBoxes()708 int32 TextSampleModifiers::getNumTextKaraokeBoxes()
709 {
710 int32 textkoraokboxcount = 0;
711 for (uint32 idx = 0; idx < _pTimedTextModifiersVec->size(); idx++)
712 {
713 if ((*_pTimedTextModifiersVec)[idx]->type == TEXT_KARAOKE)
714 textkoraokboxcount ++;
715 }
716 return (textkoraokboxcount);
717 }
718
getTextKaraokeBoxAt(int32 index)719 TextKaraokeBox* TextSampleModifiers::getTextKaraokeBoxAt(int32 index)
720 {
721 uint32 textkoraokboxcount = 0;
722 for (uint32 idx = 0; idx < _pTimedTextModifiersVec->size(); idx++)
723 {
724 if ((*_pTimedTextModifiersVec)[idx]->type == TEXT_KARAOKE)
725 textkoraokboxcount++;
726 if (textkoraokboxcount == (uint32)index)
727 return (*_pTimedTextModifiersVec)[index]->value->_pTextKaraokeBox;
728 }
729 if ((uint32)index > textkoraokboxcount)
730 return NULL;
731 }
732
getNumTextHyperTextBoxes()733 int32 TextSampleModifiers::getNumTextHyperTextBoxes()
734 {
735 int32 texthypertextboxcount = 0;
736 for (uint32 idx = 0; idx < _pTimedTextModifiersVec->size(); idx++)
737 {
738 if ((*_pTimedTextModifiersVec)[idx]->type == TEXT_HYPERTEXT)
739 texthypertextboxcount ++;
740 }
741 return (texthypertextboxcount);
742 }
743
getTextHyperTextBoxAt(int32 index)744 TextHyperTextBox* TextSampleModifiers::getTextHyperTextBoxAt(int32 index)
745 {
746 uint32 texthypertextboxcount = 0;
747 for (uint32 idx = 0; idx < _pTimedTextModifiersVec->size(); idx++)
748 {
749 if ((*_pTimedTextModifiersVec)[idx]->type == TEXT_HYPERTEXT)
750 texthypertextboxcount++;
751 if (texthypertextboxcount == (uint32)index)
752 return (*_pTimedTextModifiersVec)[index]->value->_pTextHyperTextBox;
753 }
754 if ((uint32)index > texthypertextboxcount)
755 return NULL;
756 }
757
758
getNumTextBlinkBoxes()759 int32 TextSampleModifiers::getNumTextBlinkBoxes()
760 {
761 int32 textblinkboxcount = 0;
762 for (uint32 idx = 0; idx < _pTimedTextModifiersVec->size(); idx++)
763 {
764 if ((*_pTimedTextModifiersVec)[idx]->type == TEXT_BLINK)
765 textblinkboxcount ++;
766 }
767 return (textblinkboxcount);
768 }
769
770
getTextBlinkBoxAt(int32 index)771 BlinkBox* TextSampleModifiers::getTextBlinkBoxAt(int32 index)
772 {
773 uint32 textblinkboxcount = 0;
774 for (uint32 idx = 0; idx < _pTimedTextModifiersVec->size(); idx++)
775 {
776 if ((*_pTimedTextModifiersVec)[idx]->type == TEXT_BLINK)
777 textblinkboxcount++;
778 if (textblinkboxcount == (uint32)index)
779 return (*_pTimedTextModifiersVec)[index]->value->_pBlinkBox;
780 }
781 if ((uint32)index > textblinkboxcount)
782 return NULL;
783 }
784
getTextHilightColorBox()785 TextHilightColorBox* TextSampleModifiers::getTextHilightColorBox()
786 {
787 for (uint32 idx = 0; idx < _pTimedTextModifiersVec->size(); idx++)
788 {
789 if ((*_pTimedTextModifiersVec)[idx]->type == TEXT_WRAP)
790 {
791 return (*_pTimedTextModifiersVec)[idx]->value->_pTextHilightColorBox;
792 }
793 }
794 return NULL;
795 }
796
797 TextScrollDelay* TextSampleModifiers::getTextScrollDelayBox();
798 {
799 for (uint32 idx = 0; idx < _pTimedTextModifiersVec->size(); idx++)
800 {
801 if ((*_pTimedTextModifiersVec)[idx]->type == TEXT_SCROLL_DELAY)
802 {
803 return (*_pTimedTextModifiersVec)[idx]->value->_pTextScrollDelay;
804 }
805 }
806 return NULL;
807 }
808
809
getTextOverideBox()810 TextBoxBox* TextSampleModifiers::getTextOverideBox()
811 {
812 for (uint32 idx = 0; idx < _pTimedTextModifiersVec->size(); idx++)
813 {
814 if ((*_pTimedTextModifiersVec)[idx]->type == TEXT_BOX)
815 {
816 return (*_pTimedTextModifiersVec)[idx]->value->_pTextBoxBox;
817 }
818 }
819 return NULL;
820
821 }
822
823
824 #endif // SUPPRESS__NOT_YET_IMPLEMENTED
825
826