Home | History | Annotate | Download | only in include
      1 /* ------------------------------------------------------------------
      2  * Copyright (C) 1998-2009 PacketVideo
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
     13  * express or implied.
     14  * See the License for the specific language governing permissions
     15  * and limitations under the License.
     16  * -------------------------------------------------------------------
     17  */
     18 
     19 
     20 #ifndef TEXTSAMPLEMODIFIERS_H
     21 #define TEXTSAMPLEMODIFIERS_H
     22 
     23 
     24 #include "oscl_file_io.h"
     25 #include "atom.h"
     26 #include "atomutils.h"
     27 #include "a_atomdefs.h"
     28 #include "boxrecord.h"
     29 #include "stylerecord.h"
     30 
     31 //This class is specific for the Timed text fileformat.
     32 //this class handle and stores the modifier information in the related atoms.
     33 class PVA_FF_TextStyleBox : public PVA_FF_Atom
     34 {
     35 
     36     public:
     37         PVA_FF_TextStyleBox();  // Default constructor
     38         virtual ~PVA_FF_TextStyleBox();  // Destructor
     39 
     40         void setNumStyleRecordEntries(uint16 EntryCount);//entrycount
     41         void setStyleRecord(uint16 StartChar, uint16 EndChar, uint16 FontID, uint8 FontSizeFlag, uint8 FontSize, uint8* Trgba);
     42 
     43         PVA_FF_StyleRecord* getStyleRecordAt(int32 index)
     44         {
     45             if ((_pStyleRecordVec->size() == 0) ||
     46                     ((uint32)index >= (_pStyleRecordVec->size())))
     47             {
     48                 return NULL;
     49             }
     50 
     51             return (*_pStyleRecordVec)[index];
     52         }
     53         virtual bool renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP *fp);
     54         virtual void recomputeSize();
     55         virtual uint32 getSize();
     56 
     57     private:
     58         uint16  _entryCount;
     59         Oscl_Vector<PVA_FF_StyleRecord *, OsclMemAllocator> *_pStyleRecordVec;
     60 };
     61 
     62 
     63 class PVA_FF_TextHighlightBox : public PVA_FF_Atom
     64 {
     65 
     66     public:
     67         PVA_FF_TextHighlightBox();
     68 
     69         virtual ~PVA_FF_TextHighlightBox() {};
     70 
     71         uint16 setStartCharOffset(uint16 startoffset)
     72         {
     73             if (_startCharOffset == 0)
     74             {
     75                 _startCharOffset = startoffset;
     76             }
     77         }
     78 
     79         uint16 setEndCharOffset(uint16 endoffset)
     80         {
     81             if (_endCharOffset == 0)
     82             {
     83                 _endCharOffset = endoffset;
     84             }
     85         }
     86         virtual bool renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP *fp);
     87         virtual void recomputeSize();
     88         virtual uint32 getSize();
     89 
     90     private:
     91         uint16                  _startCharOffset;
     92         uint16                  _endCharOffset;
     93 };
     94 
     95 class PVA_FF_TextHilightColorBox : public PVA_FF_Atom
     96 {
     97     public:
     98         PVA_FF_TextHilightColorBox();
     99 
    100         virtual ~PVA_FF_TextHilightColorBox();
    101 
    102         uint8 *setHighLightColorRGBA(uint8* Hrgba)
    103         {
    104             if (_pHighlightColorRGBA == NULL)
    105             {
    106                 _pHighlightColorRGBA[0] = Hrgba[0];
    107                 _pHighlightColorRGBA[0] = Hrgba[1];
    108                 _pHighlightColorRGBA[0] = Hrgba[2];
    109                 _pHighlightColorRGBA[0] = Hrgba[3];
    110             }
    111         }
    112         virtual bool renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP *fp);
    113         virtual void recomputeSize();
    114         virtual uint32 getSize();
    115 
    116     private:
    117         uint8   *_pHighlightColorRGBA;
    118 };
    119 
    120 class PVA_FF_TextKaraokeBox : public PVA_FF_Atom
    121 {
    122     public:
    123         PVA_FF_TextKaraokeBox();
    124 
    125         virtual ~PVA_FF_TextKaraokeBox();
    126 
    127         void setHighLightStartTime(uint16 HilightStartTime)
    128         {
    129             if (_highLightStartTime == 0)
    130             {
    131                 _highLightStartTime = HilightStartTime;
    132             }
    133         }
    134 
    135         void setNumKaraokeEntries(uint16 EntryCount)
    136         {
    137             if (_entryCount == 0)
    138             {
    139                 _entryCount = EntryCount;
    140             }
    141         }
    142 
    143         void setKaraokeVecs(uint32* endtime, uint16* startoffset, uint16* endoffset);
    144         virtual bool renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP *fp);
    145         virtual void recomputeSize();
    146         virtual uint32 getSize();
    147 
    148     private:
    149         uint32  _highLightStartTime;
    150         uint16  _entryCount;
    151 
    152         uint32  *_pHighLightEndTimeVec;
    153         uint16  *_pStartCharOffsetVec;
    154         uint16  *_pEndCharOffsetVec;
    155 
    156 };
    157 
    158 class PVA_FF_TextScrollDelay : public PVA_FF_Atom
    159 {
    160     public:
    161         PVA_FF_TextScrollDelay();
    162         virtual ~PVA_FF_TextScrollDelay() {};
    163         void setScrollDelay(uint32 ScrollDelay);
    164         virtual bool renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP *fp);
    165         virtual void recomputeSize();
    166         virtual uint32 getSize();
    167 
    168     private:
    169         uint32  _scrollDelay;
    170 };
    171 
    172 
    173 class PVA_FF_TextHyperTextBox : public PVA_FF_Atom
    174 {
    175     public:
    176         PVA_FF_TextHyperTextBox();
    177         virtual ~PVA_FF_TextHyperTextBox();
    178         void setStartCharOffset(uint16 StartCharOffset);
    179         void setEndCharOffset(uint16 EndOffset);
    180         void setUrlLength(uint8 UrlLength);
    181         void setURL(uint8* URL);
    182         void setAltStringLength(uint8 AltLength);
    183         void setAltString(uint8* AltString);
    184         virtual bool renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP *fp);
    185         virtual void recomputeSize();
    186         virtual uint32 getSize();
    187 
    188     private:
    189         uint16  _startCharOffset;
    190         uint16  _endCharOffset;
    191         uint8   _urlLength;
    192         uint8   *_pURL;
    193         uint8   _altLength;
    194         uint8   *_pAltString;
    195 };
    196 
    197 class PVA_FF_TextBoxBox : public PVA_FF_Atom
    198 {
    199     public:
    200         PVA_FF_TextBoxBox();
    201         virtual ~PVA_FF_TextBoxBox();
    202         PVA_FF_BoxRecord* setBoxRecord(int16 Top, int16 Bottom, int16 Left, int16 Right)
    203         {
    204             PVA_FF_BoxRecord *rec = NULL;
    205             PV_MP4_FF_NEW(fp->auditCB, PVA_FF_BoxRecord, (Top, Bottom, Left, Right), rec);
    206             _pBoxRecord = rec;
    207         };
    208 
    209         virtual bool renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP *fp);
    210         virtual void recomputeSize();
    211         virtual uint32 getSize();
    212 
    213     private:
    214         PVA_FF_BoxRecord*  _pBoxRecord;
    215 };
    216 
    217 class PVA_FF_BlinkBox : public PVA_FF_Atom
    218 {
    219     public:
    220         PVA_FF_BlinkBox();
    221         virtual ~PVA_FF_BlinkBox() {};
    222         void setStartCharOffset(uint16 StartCharOffset)
    223         {
    224             if (_pstartCharOffset == 0)
    225             {
    226                 _pstartCharOffset = StartCharOffset;
    227             }
    228         };
    229         void setEndCharOffset(uint16 EndCharOffset)
    230         {
    231             if (_pendCharOffset == 0)
    232             {
    233                 _pendCharOffset = EndCharOffset;
    234             }
    235         };
    236         virtual bool renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP *fp);
    237         virtual void recomputeSize();
    238         virtual uint32 getSize();
    239 
    240     private:
    241         uint16  _pstartCharOffset;
    242         uint16  _pendCharOffset;
    243 };
    244 
    245 #endif
    246