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 #ifndef __TextSampleModifiers_H__ 19 #define __TextSampleModifiers_H__ 20 21 #include "oscl_file_io.h" 22 #include "atom.h" 23 #include "atomutils.h" 24 #include "atomdefs.h" 25 #include "boxrecord.h" 26 #include "stylerecord.h" 27 28 29 class TextStyleBox : public Atom 30 { 31 32 public: 33 TextStyleBox(uint8 *buf); // Default constructor 34 virtual ~TextStyleBox(); // Destructor 35 getNumStyleRecordEntries()36 int32 getNumStyleRecordEntries() 37 { 38 return ((int32)(_entryCount)); 39 } 40 getStyleRecordAt(int32 index)41 StyleRecord* getStyleRecordAt(int32 index) 42 { 43 if ((_pStyleRecordVec->size() == 0) || 44 ((uint32)index >= (_pStyleRecordVec->size()))) 45 { 46 return NULL; 47 } 48 49 return (*_pStyleRecordVec)[index]; 50 } 51 52 private: 53 uint16 _entryCount; 54 Oscl_Vector<StyleRecord *, OsclMemAllocator> *_pStyleRecordVec; 55 }; 56 57 class TextHighlightBox : public Atom 58 { 59 60 public: 61 TextHighlightBox(uint8 *buf); 62 ~TextHighlightBox()63 virtual ~TextHighlightBox() {}; 64 getStartCharOffset()65 uint16 getStartCharOffset() 66 { 67 return (_startCharOffset); 68 } 69 getEndCharOffset()70 uint16 getEndCharOffset() 71 { 72 return (_endCharOffset); 73 } 74 75 private: 76 uint16 _startCharOffset; 77 uint16 _endCharOffset; 78 }; 79 80 class TextHilightColorBox : public Atom 81 { 82 public: 83 TextHilightColorBox(uint8 *buf); 84 85 virtual ~TextHilightColorBox(); 86 getHighLightColorRGBA()87 uint8 *getHighLightColorRGBA() 88 { 89 return (_pHighlightColorRGBA); 90 } 91 92 private: 93 uint8 *_pHighlightColorRGBA; 94 }; 95 96 97 class TextKaraokeBox : public Atom 98 { 99 public: 100 TextKaraokeBox(uint8 *buf); 101 102 virtual ~TextKaraokeBox(); 103 getHighLightStartTime()104 uint32 getHighLightStartTime() 105 { 106 return (_highLightStartTime); 107 } 108 getNumKaraokeEntries()109 uint16 getNumKaraokeEntries() 110 { 111 return (_entryCount); 112 } 113 getHighLightEndTimeVec()114 uint32 *getHighLightEndTimeVec() 115 { 116 return (_pHighLightEndTimeVec); 117 } 118 getStartCharOffsetVec()119 uint16 *getStartCharOffsetVec() 120 { 121 return (_pStartCharOffsetVec); 122 } 123 getEndCharOffsetVec()124 uint16 *getEndCharOffsetVec() 125 { 126 return (_pEndCharOffsetVec); 127 } 128 129 private: 130 uint32 _highLightStartTime; 131 uint16 _entryCount; 132 133 uint32 *_pHighLightEndTimeVec; 134 uint16 *_pStartCharOffsetVec; 135 uint16 *_pEndCharOffsetVec; 136 137 }; 138 139 class TextScrollDelay : public Atom 140 { 141 public: 142 TextScrollDelay(uint8 *buf); 143 ~TextScrollDelay()144 virtual ~TextScrollDelay() {}; 145 getScrollDelay()146 uint32 getScrollDelay() 147 { 148 return (_scrollDelay); 149 } 150 151 private: 152 uint32 _scrollDelay; 153 }; 154 155 class TextHyperTextBox : public Atom 156 { 157 public: 158 TextHyperTextBox(uint8 *buf); 159 160 virtual ~TextHyperTextBox(); 161 getStartCharOffset()162 uint16 getStartCharOffset() 163 { 164 return (_startCharOffset); 165 } 166 getEndCharOffset()167 uint16 getEndCharOffset() 168 { 169 return (_endCharOffset); 170 } 171 getUrlLength()172 uint8 getUrlLength() 173 { 174 return (_urlLength); 175 } 176 getURL()177 uint8* getURL() 178 { 179 return (_pURL); 180 } 181 getAltStringLength()182 uint8 getAltStringLength() 183 { 184 return (_altLength); 185 } 186 getAltString()187 uint8* getAltString() 188 { 189 return (_pAltString); 190 } 191 192 private: 193 uint16 _startCharOffset; 194 uint16 _endCharOffset; 195 uint8 _urlLength; 196 uint8 *_pURL; 197 uint8 _altLength; 198 uint8 *_pAltString; 199 }; 200 201 202 class TextBoxBox : public Atom 203 { 204 public: 205 TextBoxBox(uint8 *buf); 206 207 virtual ~TextBoxBox(); 208 getBoxRecord()209 BoxRecord* getBoxRecord() 210 { 211 return (_pBoxRecord); 212 } 213 214 private: 215 BoxRecord* _pBoxRecord; 216 }; 217 218 class BlinkBox : public Atom 219 { 220 public: 221 BlinkBox(uint8 *buf); 222 ~BlinkBox()223 virtual ~BlinkBox() {}; 224 getStartCharOffset()225 uint16 getStartCharOffset() 226 { 227 return (_startCharOffset); 228 } getEndCharOffset()229 uint16 getEndCharOffset() 230 { 231 return (_endCharOffset); 232 } 233 234 private: 235 uint16 _startCharOffset; 236 uint16 _endCharOffset; 237 }; 238 239 enum TimedTextModifierType 240 { 241 TEXT_STYLE, 242 TEXT_HIGHLIGHT, 243 TEXT_KARAOKE, 244 TEXT_HYPERTEXT, 245 TEXT_BLINK, 246 TEXT_WRAP, 247 TEXT_SCROLL_DELAY, 248 TEXT_BOX 249 }; 250 251 union TimedTextModUnion 252 { 253 TextStyleBox *_pTextStyleBox; 254 TextHighlightBox *_pTextHighlightBox; 255 TextKaraokeBox *_pTextKaraokeBox; 256 TextHyperTextBox *_pTextHyperTextBox; 257 BlinkBox *_pBlinkBox; 258 TextHilightColorBox *_pTextHilightColorBox; 259 TextScrollDelay *_pTextScrollDelay; 260 TextBoxBox *_pTextBoxBox; 261 262 }; 263 264 struct TimedTextModifiers 265 { 266 267 TimedTextModifierType type; 268 TimedTextModUnion *value; 269 }; 270 271 class TextSampleModifiers : public ISucceedFail 272 { 273 public: 274 static TextSampleModifiers* parseTextModifiers(uint8* buf, uint32 size); 275 276 TextSampleModifiers(uint8* buf, uint32 size); 277 virtual ~TextSampleModifiers(); 278 279 int32 getNumTextStyleBoxes(); 280 TextStyleBox* getTextStyleBoxAt(int32 index); 281 int32 getNumTextHighlightBoxes(); 282 TextHighlightBox* getTextHighlightBoxAt(int32 index); 283 int32 getNumTextKaraokeBoxes(); 284 TextKaraokeBox* getTextKaraokeBoxAt(int32 index); 285 int32 getNumTextHyperTextBoxes(); 286 TextHyperTextBox* getTextHyperTextBoxAt(int32 index); 287 int32 getNumTextBlinkBoxes(); 288 BlinkBox* getTextBlinkBoxAt(int32 index); 289 TextHilightColorBox* getTextHilightColorBox(); 290 TextScrollDelay* getTextScrollDelayBox(); 291 TextBoxBox* getTextOverideBox(); PopulateTextSampleModifierParams()292 bool PopulateTextSampleModifierParams() 293 { 294 return 0; 295 }; 296 297 private: 298 299 Oscl_Vector<TimedTextModifiers* , OsclMemAllocator> *_pTimedTextModifiersVec; 300 301 302 303 304 }; 305 306 #endif 307