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 PVPVXPARSER_H_INCLUDED
     20 #define PVPVXPARSER_H_INCLUDED
     21 
     22 #ifndef OSCL_BASE_H_INCLUDED
     23 #include "oscl_base.h"
     24 #endif
     25 #ifndef OSCLCONFIG_IO_H_INCLUDED
     26 #include "osclconfig_io.h"
     27 #endif
     28 #ifndef OSCL_FILE_IO_H_INCLUDED
     29 #include "oscl_file_io.h"
     30 #endif
     31 #ifndef OSCL_STRING_H_INCLUDED
     32 #include "oscl_string.h"
     33 #endif
     34 #ifndef OSCL_PRIQUEUE_H_INCLUDED
     35 #include "oscl_priqueue.h"
     36 #endif
     37 #ifndef OSCL_SCHEDULER_AO_H_INCLUDED
     38 #include "oscl_scheduler_ao.h"
     39 #endif
     40 #ifndef OSCL_MEM_MEMPOOL_H_INCLUDED
     41 #include "oscl_mem_mempool.h"
     42 #endif
     43 #ifndef PVLOGGER_H_INCLUDED
     44 #include "pvlogger.h"
     45 #endif
     46 
     47 #ifndef OSCL_TYPES_H_INCLUDED
     48 #include "oscl_types.h"
     49 #endif
     50 
     51 #ifndef OSCL_STRING_CONTAINERS_H_INCLUDED
     52 #include "oscl_string_containers.h"
     53 #endif
     54 
     55 #ifndef OSCL_UTF8CONV_H
     56 #include "oscl_utf8conv.h"
     57 #endif
     58 
     59 #define MAX_PVXUSERID_LEN           256
     60 #define MAX_PVXAPPSPECIFICSTRING_LEN        256
     61 #define MAX_PVXSESSIONID_LEN            36
     62 #define MAX_PVXEXPIRYTIMESTAMP_LEN      20
     63 #define MAX_PVXRANDOMFILLER_LEN         16
     64 #define MAX_PVXDIGITALSIGNATURE_LEN     40
     65 
     66 class CPVXInfo
     67 {
     68     public:
     69         OSCL_IMPORT_REF CPVXInfo(void);
     70         OSCL_IMPORT_REF ~CPVXInfo();
     71         void Reset(void);
     72         bool iSecurity;
     73         OSCL_StackString<MAX_PVXUSERID_LEN>iUserID;
     74         OSCL_StackString<MAX_PVXAPPSPECIFICSTRING_LEN>iAppSpecificString;
     75         OSCL_StackString<MAX_PVXSESSIONID_LEN>iSessionID;
     76         OSCL_StackString<MAX_PVXEXPIRYTIMESTAMP_LEN>iExpiryTimeStamp;
     77         OSCL_StackString<MAX_PVXRANDOMFILLER_LEN>iRandomFiller;
     78         OSCL_StackString<MAX_PVXDIGITALSIGNATURE_LEN>iDigitalSignature;
     79 
     80         typedef enum
     81         {
     82             ENoAction           = 0,
     83             ECloseApp,
     84             ENextUrl
     85         } TPVEndOfClipAction;
     86 
     87         typedef enum        // For Download only
     88         {
     89             ENoPlayback         = 0,
     90             EAfterDownload,
     91             EAsap,
     92             EReserve
     93         } TPVPlaybackControl;
     94 
     95         // Imperial specific data
     96         int16 iPVXVersion;
     97         int32 iStartTime;
     98         int32 iEndTime;
     99         int32 iFlags;
    100         bool iDownload;
    101         bool iPurge;
    102         bool iRandomPos;
    103         TPVPlaybackControl  iPlaybackControl;
    104         bool iUserPlayback;
    105         TPVEndOfClipAction  iEndOfClip;
    106         OSCL_wHeapStringA iLaunchURL;
    107 };
    108 
    109 
    110 class CPVXParser
    111 {
    112     public:
    113 
    114         typedef enum
    115         {
    116             CPVXParser_Success,
    117             CPVXParser_InvalidSize,
    118             CPVXParser_URLCorrupted
    119         } CPVXParserStatus;
    120         /**
    121          * This routine parses the .pvx file.
    122          * @param aPVX: (input param) .pvx file.
    123          * @param aClipURL: (output param) the target URL
    124          * @param aPVXInfo: (output param) additional information in the .pvx file
    125          * @return Error code
    126          */
    127         OSCL_IMPORT_REF CPVXParserStatus ParsePVX(OsclMemoryFragment &aPVX, OSCL_HeapString<OsclMemAllocator>& aClipURL, CPVXInfo& aPVXInfo);
    128         OSCL_IMPORT_REF CPVXParser(void);
    129 
    130     private:
    131         int16 BufToShortInt(uint8* data);
    132         int32 BufToLongInt(uint8* data);
    133         PVLogger* iLogger;
    134 };
    135 
    136 # endif
    137 
    138