/fileformats/mp4/parser/src/textsamplemodifiers.cpp

https://github.com/liudidi/android_external_opencore · C++ · 825 lines · 701 code · 106 blank · 18 comment · 153 complexity · 8b275369d659d32dd881e2c2bdbec24e MD5 · raw file

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