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 PV_AVIFILE_STATUS
     19 #define PV_AVIFILE_STATUS
     20 
     21 #ifndef PVLOGGER_H_INCLUDED
     22 #include "pvlogger.h"
     23 #endif
     24 
     25 #define PVAVIFILE_LOGERROR(m)    PVLOGGER_LOGMSG(PVLOGMSG_INST_REL,iLogger,PVLOGMSG_ERR,m)
     26 #define PVAVIFILE_LOGINFO(m)     PVLOGGER_LOGMSG(PVLOGMSG_INST_REL,iLogger,PVLOGMSG_INFO,m)
     27 
     28 typedef enum
     29 {
     30     PV_AVI_FILE_PARSER_ERROR_UNKNOWN             = -1,
     31     PV_AVI_FILE_PARSER_SUCCESS                   = 0,
     32     PV_AVI_FILE_PARSER_FILE_OPEN_ERROR           = 1,
     33     PV_AVI_FILE_PARSER_INSUFFICIENT_MEMORY       = 2,
     34     PV_AVI_FILE_PARSER_WRONG_CHUNK               = 3,
     35     PV_AVI_FILE_PARSER_WRONG_CHUNK_SIZE          = 4,
     36     PV_AVI_FILE_PARSER_WRONG_FILE                = 5,
     37     PV_AVI_FILE_PARSER_WRONG_SIZE                = 6,
     38     PV_AVI_FILE_PARSER_READ_ERROR                = 7,
     39     PV_AVI_FILE_PARSER_ERROR_NUM_STREAM          = 8,
     40     PV_AVI_FILE_PARSER_ERROR_STREAM_TYPE_UNKNOWN = 9,
     41     PV_AVI_FILE_PARSER_NO_INDEX_CHUNK            = 10,
     42     PV_AVI_FILE_PARSER_EOF_REACHED               = 11,  //End of file
     43     PV_AVI_FILE_PARSER_EOS_REACHED               = 12,  //End of stream
     44     PV_AVI_FILE_PARSER_USE_INDX_TBL              = 13,
     45     PV_AVI_FILE_PARSER_BYTE_COUNT_ERROR          = 14,
     46     PV_AVI_FILE_PARSER_UNSUPPORTED_CHUNK         = 15,
     47     PV_AVI_FILE_PARSER_ERROR_WRONG_STREAM_NUM    = 16,
     48     PV_AVI_FILE_PARSER_WRONG_OFFSET              = 17,
     49     PV_AVI_FILE_PARSER_NO_OFFSET_FOUND           = 18,
     50     PV_AVI_FILE_PARSER_WRONG_BIT_COUNT           = 19,
     51     PV_AVI_FILE_PARSER_SEEK_ERROR                = 20
     52 
     53 } PV_AVI_FILE_PARSER_ERROR_TYPE;
     54 
     55 
     56 //stores file parser status
     57 class PVAviFileParserStatus
     58 {
     59 
     60     public:
     61         PVAviFileParserStatus()
     62         {
     63             iLogger = PVLogger::GetLoggerObject("PVAviFileParser");
     64         }
     65 
     66         ~PVAviFileParserStatus()
     67         {
     68             iLogger = NULL;
     69         }
     70 
     71         PV_AVI_FILE_PARSER_ERROR_TYPE
     72         GetStatus()
     73         {
     74             if (iError != PV_AVI_FILE_PARSER_SUCCESS)
     75             {
     76                 //Log error.
     77                 PVAVIFILE_LOGERROR((0, "Error: %d occurred while parsing", iError));
     78                 return iError;
     79             }
     80             else
     81             {
     82                 PVAVIFILE_LOGINFO((0, "SUCCESS"));
     83                 return iError;
     84             }
     85         }
     86 
     87     protected:
     88 
     89         PV_AVI_FILE_PARSER_ERROR_TYPE   iError;
     90         PVLogger*                       iLogger;
     91 
     92 };
     93 
     94 #endif  //#ifndef PV_AVIFILE_STATUS
     95 
     96