• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011 The Android Open Source Project
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 express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 /**
17  ************************************************************************
18  * @file         M4OSA_Error.h
19  * @ingroup      OSAL
20  * @brief        Definition of common error types
21  * @note         This file contains macros to generate and analyze error codes.
22  ************************************************************************
23 */
24 
25 
26 #ifndef M4OSA_ERROR_H
27 #define M4OSA_ERROR_H
28 
29 #include "M4OSA_Types.h"
30 
31 /** M4OSA_ERR is a 32 bits unsigned integer.
32  * To sort returned code, a specific naming convention must be followed:
33  * - Severity (2 bits): It may br either 0b00 (no error), 0b01 (warning) or
34  *                      0b01 (fatal error)
35  * - Core ID (14 bits): It is a unique ID for each core component
36  * - ErrorID (16 bits): It is the specific error code
37 
38  * EACH CORE COMPONENT FUNCTION SHOULD RETURN AN M4OSA_ERR
39 */
40 typedef M4OSA_UInt32   M4OSA_ERR;
41 
42 #define M4_OK     0
43 #define M4_WAR    1
44 #define M4_ERR    2
45 
46 
47 /* Macro to process M4OSA_ERR */
48 
49 /** This macro tests if the provided M4OSA_ERR is a warning or not*/
50 #define M4OSA_ERR_IS_WARNING(error)   ((((error)>>30) == M4_WAR) ? 1:0)
51 
52 /** This macro tests if the provided M4OSA_ERR is a fatal error or not*/
53 #define M4OSA_ERR_IS_ERROR(error)   ((((error)>>30) == M4_ERR) ? 1:0)
54 
55 /** This macro returns an error code accroding to the 3 provided fields:
56   * @arg severity: (IN) [M4OSA_UInt32] Severity to put in the error code
57   * @arg coreID: (IN) [M4OSA_UInt32] CoreID to put in the error code
58   * @arg errorID: (IN) [M4OSA_UInt32] ErrorID to put in the error code*/
59 #define M4OSA_ERR_CREATE(severity, coreID, errorID)\
60    (M4OSA_Int32)((((M4OSA_UInt32)severity)<<30)+((((M4OSA_UInt32)coreID)&0x003FFF)<<16)+(((M4OSA_UInt32)errorID)&0x00FFFF))
61 
62 /** This macro extracts the 3 fields from the error:
63   * @arg error: (IN) [M4OSA_ERR] Error code
64   * @arg severity: (OUT) [M4OSA_UInt32] Severity to put in the error code
65   * @arg coreID: (OUT) [M4OSA_UInt32] CoreID to put in the error code
66   * @arg errorID: (OUT) [M4OSA_UInt32] ErrorID to put in the error code*/
67 #define M4OSA_ERR_SPLIT(error, severity, coreID, errorID)\
68    { severity=(M4OSA_UInt32)((error)>>30);\
69      coreID=(M4OSA_UInt32)(((error)>>16)&0x003FFF);\
70      (M4OSA_UInt32)(errorID=(error)&0x00FFFF); }
71 
72 
73 /* "fake" CoreID, is used to report an unknown CoreID. Used by the trace system
74 when the core ID macro isn't defined. Defined here instead of CoreID.h to avoid
75 introducing dependencies to common/inc. */
76 
77 #define M4UNKNOWN_COREID    0x3FFF /* max possible CoreID */
78 
79 #define M4_COMMON           0x00  /**<Common*/
80 #define M4MP4_COMMON        0x01  /**<Core MP4 (common)*/
81 #define M4MP4_WRITER        0x02  /**<Core MP4 writer*/
82 #define M4MP4_READER        0x03  /**<Core MP4 reader*/
83 #define M4RTSP_COMMON       0x11  /**<Core RTSP common*/
84 #define M4RTSP_WRITER       0x12  /**<Core RTSP transmitter*/
85 #define M4RTSP_READER       0x13  /**<Core RTSP receiver*/
86 #define M4RTP_WRITER        0x14  /**<Core RTP/RTCP receiver*/
87 #define M4RTP_READER        0x15  /**<Core RTP/RTCP transmitter*/
88 #define M4SAP_WRITER        0x16  /**<Core SAP transmitter*/
89 #define M4SAP_READER        0x17  /**<Core SAP receiver*/
90 #define M4DVBH_READER        0x18  /**<Core DVBH receiver*/
91 #define M4SDP_WRITER        0x22  /**<Core SDP writer*/
92 #define M4SDP_READER        0x31  /**<Core SDP reader*/
93 #define M4PAK_AMR           0x32  /**<Core packetizer AMR (RFC3267)*/
94 #define M4DEPAK_AMR         0x33  /**<Core de-packetizer AMR (RFC3267)*/
95 #define M4PAK_H263          0x34  /**<Core packetizer H263 (RFC2429)*/
96 #define M4DEPAK_H263        0x35  /**<Core de-packetizer H263(RFC2429)*/
97 #define M4PAK_SIMPLE        0x36  /**<Core packetizer SimpleDraft (RFC xxxx)*/
98 #define M4DEPAK_SIMPLE      0x37  /**<Core de-packetizer SimpleDraft (RFC xxxx)*/
99 #define M4PAK_3016_VIDEO    0x38  /**<Core packetizer RFC3016 video*/
100 #define M4DEPAK_3016_VIDEO  0x39  /**<Core de-packetizer RFC3016 video*/
101 #define M4PAK_3016_AUDIO    0x3A  /**<Core packetizer RFC3016 audio (LATM)*/
102 #define M4DEPAK_3016_AUDIO  0x3B  /**<Core de-packetizer RFC3016 audio (LATM)*/
103 #define M4DEPAK_H264        0x3C  /**<Core de-packetizer H264*/
104 #define M4DEPAK_REALV        0x3D  /**<Core de-packetizer Real Video */
105 #define M4DEPAK_REALA        0x3E  /**<Core de-packetizer Real Audio */
106 #define M4RDT_READER        0x3F  /**<Core RDT receiver*/
107 #define M4TCP_DMUX          0x50  /**<Core TCP demux*/
108 #define M4IOD_PARSER        0x51  /**<Core IOD parser*/
109 #define M4OSA_FILE_COMMON   0x61  /**<OSAL file common*/
110 #define M4OSA_FILE_WRITER   0x62  /**<OSAL file writer*/
111 #define M4OSA_FILE_READER   0x63  /**<OSAL file reader*/
112 #define M4OSA_FILE_EXTRA    0x64  /**<OSAL file extra*/
113 #define M4OSA_DIRECTORY     0x65  /**<OSAL directory*/
114 #define M4OSA_SOCKET        0x71  /**<OSAL socket (both reader and writer)*/
115 #define M4OSA_THREAD        0x81  /**<OSAL thread*/
116 #define M4OSA_MUTEX         0x82  /**<OSAL mutex*/
117 #define M4OSA_SEMAPHORE     0x83  /**<OSAL semaphore*/
118 #define M4OSA_CLOCK         0x84  /**<OSAL clock*/
119 #define M4OSA_MEMORY        0x91  /**<OSAL memory*/
120 #define M4CALL_BACK         0xA1  /**<Call Back error*/
121 #define M4OSA_URI           0xB1  /**<OSAL URI handler*/
122 #define M4OSA_STRING        0xB2  /**<OSAL string*/
123 #define M4SYS_CMAPI         0xB3  /**<SYSTEM Common Medi API*/
124 #define M4OSA_CHARSTAR      0xB4  /**<OSAL CharStar*/
125 #define M4REACTOR           0xC1  /**<Core reactor*/
126 #define M4TEST              0xD1  /**<Test component*/
127 #define M4STACK                0xE1  /**< Core ID of the integrated stack*/
128 #define M4STACK_REAL        0xE2  /**<Core ID of the Real integrated stack */
129 #define M4TOOL_LBVT_PARAM   0xF1  /**<LB_VT config file manager*/
130 #define M4TOOL_LINK_LIST    0xF2  /**<Tool linked list*/
131 #define M4TOOL_BASE64       0xF3  /**<Core base64 encoder/decoder*/
132 
133 
134 
135 /* Definition of common error codes */
136 /** there is no error*/
137 #define M4NO_ERROR            0x00000000
138 
139 /** At least one parameter is NULL*/
140 #define M4ERR_PARAMETER            M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000001)
141 /** This function cannot be called now*/
142 #define M4ERR_STATE                M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000002)
143 /** There is no more memory available*/
144 #define M4ERR_ALLOC                M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000003)
145 /** Provided context is not a valid one*/
146 #define M4ERR_BAD_CONTEXT          M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000004)
147 #define M4ERR_CONTEXT_FAILED       M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000005)
148 #define M4ERR_BAD_STREAM_ID        M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000006)
149 /** The optionID is not a valid one*/
150 #define M4ERR_BAD_OPTION_ID        M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000007)
151 /** This option is a write only one*/
152 #define M4ERR_WRITE_ONLY           M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000008)
153 /** This option is a read only one*/
154 #define M4ERR_READ_ONLY            M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000009)
155 /** This function is not supported yet*/
156 #define M4ERR_NOT_IMPLEMENTED      M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x00000A)
157 
158 #define    M4ERR_UNSUPPORTED_MEDIA_TYPE  M4OSA_ERR_CREATE(M4_ERR, M4_COMMON, 0x00000B)
159 
160 #define M4WAR_NO_DATA_YET          M4OSA_ERR_CREATE(M4_WAR,M4_COMMON,0x000001)
161 #define M4WAR_NO_MORE_STREAM       M4OSA_ERR_CREATE(M4_WAR,M4_COMMON,0x000002)
162 #define M4WAR_INVALID_TIME         M4OSA_ERR_CREATE(M4_WAR,M4_COMMON,0x000003)
163 #define M4WAR_NO_MORE_AU           M4OSA_ERR_CREATE(M4_WAR,M4_COMMON,0x000004)
164 #define M4WAR_TIME_OUT             M4OSA_ERR_CREATE(M4_WAR,M4_COMMON,0x000005)
165 /** The buffer is full*/
166 #define M4WAR_BUFFER_FULL          M4OSA_ERR_CREATE(M4_WAR,M4_COMMON,0x000006)
167 /* The server asks for a redirection */
168 #define M4WAR_REDIRECT               M4OSA_ERR_CREATE(M4_WAR,M4_COMMON,0x000007)
169 #define M4WAR_TOO_MUCH_STREAMS     M4OSA_ERR_CREATE(M4_WAR,M4_COMMON,0x000008)
170 /* SF Codec detected INFO_FORMAT_CHANGE during decode */
171 #define M4WAR_INFO_FORMAT_CHANGE M4OSA_ERR_CREATE(M4_WAR, M4_COMMON, 0x000009)
172 
173 #endif /*M4OSA_ERROR_H*/
174 
175