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 #ifndef COMMONINFO_H
     20 #define COMMONINFO_H
     21 
     22 
     23 #include "rtsp_range_utils.h"
     24 #include "oscl_types.h"
     25 #include "oscl_string_containers.h"
     26 #include "sdp_memory.h"
     27 #include "pvmi_kvp.h"
     28 
     29 #define MAX_METRICS_NAME    7
     30 #define ASSET_NAME_SIZE     13
     31 #define MAX_ALTERNATIVES    16
     32 #define ALT_SIZE            128
     33 
     34 
     35 //code in basemediainfoparser.cpp depends on FIRST_STATIC_PAYLOAD == 0
     36 #define FIRST_STATIC_PAYLOAD 0
     37 #define LAST_STATIC_PAYLOAD 33
     38 
     39 #define PVMF_PCMU 0
     40 #define PVMF_PCMA 8
     41 
     42 #define PVMF_MIME_PCMU "PCMU"
     43 #define PVMF_MIME_PCMA "PCMA"
     44 
     45 
     46 
     47 struct QoEMetricsType
     48 {
     49     enum
     50     {
     51         INITIAL_BUFFERING_DURATION, REBUFFERING_DURATION,
     52         CORRUPTION_DURATION, SUCESSIVE_LOSS, FRAMERATE_DEVIATION,
     53         JITTER_DURATION, DECODED_BYTES
     54     };
     55 
     56     //if a Metrics_Name is present, corresponding array component will be true.
     57     bool name[MAX_METRICS_NAME];
     58     enum { END, VAL };
     59     int rateFmt;
     60     union
     61     {
     62         char rateEnd;
     63         int  rateVal;
     64     };
     65 
     66     RtspRangeType range;
     67 
     68     enum { STATUS, IDIGIT, FDIGIT };
     69     int paramFmt;
     70     union
     71     {
     72         bool paramExtStat;  // (true = On)/(false = Off)
     73         int paramExtIdigit;
     74         OsclFloat paramExtFdigit;
     75     };
     76 
     77 
     78 };
     79 
     80 #define MAX_ASSET_INFO_KEYWORDS 256
     81 
     82 class AssetInfoType
     83 {
     84     public:
     85         enum
     86         {
     87             TITLE = 0,
     88             DESCRIPTION = 1,
     89             COPYRIGHT = 2,
     90             PERFORMER = 3,
     91             AUTHOR = 4,
     92             GENRE = 5,
     93             RATING = 6,
     94             CLASSIFICATION = 7,
     95             KEYWORDS = 8,
     96             LOCATION = 9,
     97             ALBUM = 10,
     98             RECORDINGYEAR = 11,
     99             ASSET_EXTENTION = 12
    100         };
    101 
    102         AssetInfoType()
    103         {
    104             ResetAssetInfoType();
    105         };
    106 
    107         void ResetAssetInfoType()
    108         {
    109             URL = NULL;
    110             int ii;
    111             for (ii = 0; ii < ASSET_NAME_SIZE; ii++)
    112             {
    113                 Box[ii] = NULL;
    114             }
    115             oTitlePresent = false;
    116             oDescriptionPresent = false;
    117             oCopyRightPresent = false;
    118             oPerformerPresent = false;
    119             oAuthorPresent = false;
    120             oGenrePresent  = false;
    121             oRatingPresent  = false;
    122             oClassificationPresent = false;
    123             oKeyWordsPresent = false;
    124             iNumKeyWords = 0;
    125             for (ii = 0; ii < MAX_ASSET_INFO_KEYWORDS; ii++)
    126             {
    127                 KeyWords[ii] = NULL;
    128             }
    129             oLocationPresent = false;
    130             oAlbumPresent = false;
    131             oRecordingYearPresent = false;
    132             oAssetExtensionPresent = false;
    133             iRecordingYear = 0;
    134             CleanUp();
    135         };
    136 
    137         void CleanUp()
    138         {
    139             if (iLocationStruct._location_name != NULL)
    140             {
    141                 oscl_free(iLocationStruct._location_name);
    142                 iLocationStruct._location_name = NULL;
    143             }
    144             if (iLocationStruct._astronomical_body != NULL)
    145             {
    146                 oscl_free(iLocationStruct._astronomical_body);
    147                 iLocationStruct._astronomical_body = NULL;
    148             }
    149             if (iLocationStruct._additional_notes != NULL)
    150             {
    151                 oscl_free(iLocationStruct._additional_notes);
    152                 iLocationStruct._additional_notes = NULL;
    153             }
    154         };
    155 
    156         AssetInfoType& operator=(const AssetInfoType& a)
    157         {
    158             if (&a != this)
    159             {
    160                 MyCopy(a);
    161             }
    162             return *this;
    163         }
    164 
    165         OSCL_HeapString<SDPParserAlloc> URL;
    166         OSCL_HeapString<SDPParserAlloc> Box[ASSET_NAME_SIZE];
    167         bool oTitlePresent;
    168         bool oDescriptionPresent;
    169         bool oCopyRightPresent;
    170         bool oPerformerPresent;
    171         bool oAuthorPresent;
    172         bool oGenrePresent;
    173         bool oRatingPresent;
    174         bool oClassificationPresent;
    175         bool oKeyWordsPresent;
    176         uint32 iNumKeyWords;
    177         OSCL_HeapString<SDPParserAlloc> KeyWords[MAX_ASSET_INFO_KEYWORDS];
    178         bool oLocationPresent;
    179         bool oAlbumPresent;
    180         bool oAssetExtensionPresent;
    181         bool oRecordingYearPresent;
    182         uint16 iRecordingYear;
    183         PvmfAssetInfo3GPPLocationStruct iLocationStruct;
    184 
    185     private:
    186         void MyCopy(const AssetInfoType&a)
    187         {
    188             URL = a.URL;
    189             int ii = 0;
    190             for (ii = 0; ii < ASSET_NAME_SIZE; ii++)
    191             {
    192                 Box[ii] = a.Box[ii];
    193             }
    194             oTitlePresent = a.oTitlePresent;
    195             oDescriptionPresent = a.oDescriptionPresent;
    196             oCopyRightPresent = a.oCopyRightPresent;
    197             oPerformerPresent = a.oPerformerPresent;
    198             oAuthorPresent = a.oAuthorPresent;
    199             oGenrePresent  = a.oGenrePresent;
    200             oRatingPresent  = a.oRatingPresent;
    201             oClassificationPresent = a.oClassificationPresent;
    202             oKeyWordsPresent = a.oKeyWordsPresent;
    203             iNumKeyWords = a.iNumKeyWords;
    204             for (ii = 0; ii < MAX_ASSET_INFO_KEYWORDS; ii++)
    205             {
    206                 KeyWords[ii] = a.KeyWords[ii];
    207             }
    208             oLocationPresent = a.oLocationPresent;
    209             oAlbumPresent = a.oAlbumPresent;
    210             oRecordingYearPresent = a.oRecordingYearPresent;
    211             iRecordingYear = a.iRecordingYear;
    212             oAssetExtensionPresent = a.oAssetExtensionPresent;
    213             iLocationStruct = a.iLocationStruct;
    214         }
    215 };
    216 
    217 
    218 struct altGpBWType
    219 {
    220 
    221     uint32 group;   //4 bits represent one alt-id hence "group" can represent
    222     //a group of 8 alt-ids. e.g for a=alt-group=BW:AS:28=1,2,4,5
    223     //group represent 1,2,4,5. Hence group=0x5421
    224     uint32 val;
    225 
    226 };
    227 
    228 struct altGpLANGType
    229 {
    230 
    231     uint32 group;   //4 bits represent one alt-id hence "group" can represent
    232     //a group of 8 alt-ids. e.g for a=alt-group=LANG:RFC3066:en-US=1,2,4,5
    233     //group represent 1,2,4,5. Hence group=0x5421
    234     OSCL_HeapString<SDPParserAlloc> val;
    235 };
    236 
    237 typedef struct _connectionInfo
    238 {
    239     OSCL_HeapString<SDPParserAlloc> connectionNetworkType; //Add set and get methods.
    240     OSCL_HeapString<SDPParserAlloc> connectionAddressType;
    241     OSCL_HeapString<SDPParserAlloc> connectionAddress;
    242 
    243 
    244 } connectionInfo;
    245 
    246 #endif
    247