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 #ifndef TEXTSAMPLEDESCINFO_H
     19 #define TEXTSAMPLEDESCINFO_H
     20 
     21 
     22 #define DEFAULT_RGB_ARRAY_SIZE 10
     23 //This class is specific for the Timed text fileformat.
     24 //It stores configuration information present in the text file generated by the parser library
     25 //unittest for the timed text file format
     26 
     27 class PVA_FF_TextSampleDescInfo
     28 {
     29     public:
     30         PVA_FF_TextSampleDescInfo()
     31         {
     32             start_sample_num = 0;
     33             sdindex = 0;
     34             display_flags = 0;
     35             hJust = 0;
     36             vJust = 0;
     37             bkRgba = (uint8*) OSCL_MALLOC(DEFAULT_RGB_ARRAY_SIZE);
     38             top = 0;
     39             left = 0;
     40             bottom = 0;
     41             right = 0;
     42             startChar = 0;
     43             endChar = 0;
     44             fontID = 0;
     45             fontSizeFlags = 0;
     46             fontSize = 0;
     47             tRgba = (uint8*) OSCL_MALLOC(DEFAULT_RGB_ARRAY_SIZE);
     48             fontListSize = 0;
     49             fontListID = 0;
     50             font_id = 0;
     51             font_length = 0;
     52             font_name = NULL;
     53             end_sample_num = 0;
     54         };
     55         PVA_FF_TextSampleDescInfo(PVA_FF_TextSampleDescInfo& info)
     56         {
     57             start_sample_num = info.start_sample_num;
     58             sdindex = info.sdindex;
     59             display_flags = info.display_flags;
     60             hJust = info.hJust;
     61             vJust = info.vJust;
     62             bkRgba = (uint8*)OSCL_MALLOC(DEFAULT_RGB_ARRAY_SIZE);
     63             oscl_memcpy(bkRgba, info.bkRgba, DEFAULT_RGB_ARRAY_SIZE);
     64             top = info.top;
     65             left = info.left;
     66             bottom = info.bottom;
     67             right = info.right;
     68             startChar = info.startChar;
     69             endChar = info.endChar;
     70             fontID = info.fontID;
     71             fontSizeFlags = info.fontSizeFlags;
     72             fontSize = info.fontSize;
     73             tRgba = (uint8*)OSCL_MALLOC(DEFAULT_RGB_ARRAY_SIZE);
     74             oscl_memcpy(tRgba, info.tRgba, DEFAULT_RGB_ARRAY_SIZE);
     75             fontListSize = info.fontListSize;
     76             fontListID = info.fontListID;
     77             font_id = info.font_id;
     78             font_length = info.font_length;
     79             if (font_length > 0)
     80             {
     81                 font_name = (uint8*)OSCL_MALLOC(font_length);
     82                 oscl_memcpy(font_name, info.font_name, font_length);
     83             }
     84             else
     85             {
     86                 font_name = NULL;
     87             }
     88 
     89             end_sample_num = info.end_sample_num;
     90         };
     91 
     92 
     93         ~PVA_FF_TextSampleDescInfo()
     94         {
     95             if (bkRgba != NULL)
     96             {
     97                 OSCL_FREE(bkRgba);
     98             }
     99 
    100             if (tRgba != NULL)
    101             {
    102                 OSCL_FREE(tRgba);
    103             }
    104 
    105             if (font_length && font_name != NULL)
    106             {
    107                 OSCL_FREE(font_name);
    108                 font_length = 0;
    109             }
    110         };
    111         uint32 start_sample_num;
    112         int32 sdindex;
    113         uint32 display_flags;
    114         int8 hJust;
    115         int8 vJust;
    116         uint8 *bkRgba;
    117         int16 top;
    118         int16 left;
    119         int16 bottom;
    120         int16 right;
    121         uint16 startChar;
    122         uint16 endChar;
    123         uint16 fontID;
    124         uint8 fontSizeFlags;
    125         uint8 fontSize;
    126         uint8 *tRgba;
    127         uint16 fontListSize;
    128         uint16 fontListID;
    129         uint16 font_id;
    130         int8 font_length;
    131         uint8 *font_name;
    132         uint32 end_sample_num;
    133 };
    134 
    135 
    136 
    137 
    138 #endif
    139