AVPKit
IError.h
1 /*******************************************************************************
2  * Copyright (c) 2024, 2026, Olivier Ayache. All rights reserved.
3  *
4  * This file is part of AVPKit.
5  *
6  * AVPKit is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * AVPKit is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with AVPKit. If not, see <http://www.gnu.org/licenses/>.
18  *******************************************************************************/
19 
20 /*
21  * IError.h
22  *
23  * A way of translating between FFMPEG error codes and some core defined
24  * values.
25  *
26  * Created on: Mar 20, 2009
27  * Author: aclarke
28  */
29 
30 #ifndef IERROR_H_
31 #define IERROR_H_
32 
33 #include <com/avpkit/ferry/RefCounted.h>
34 #include <com/avpkit/core/AVPKit.h>
35 
36 namespace com { namespace avpkit { namespace core
37 {
38 
59 class VS_API_AVPKIT IError : public com::avpkit::ferry::RefCounted
60 {
61 public:
65  typedef enum Type {
66  /* Unknown error */
67  ERROR_UNKNOWN,
68  /* IO error */
69  ERROR_IO,
70  /* Number expected */
71  ERROR_NUMEXPECTED,
72  /* Invalid data */
73  ERROR_INVALIDDATA,
74  /* Out of memory */
75  ERROR_NOMEM,
76  /* Format not supported */
77  ERROR_NOFMT,
78  /* Operation not supported */
79  ERROR_NOTSUPPORTED,
80  /* File not found */
81  ERROR_NOENT,
82  /* End of file or pipe */
83  ERROR_EOF,
84  /* Value out of range */
85  ERROR_RANGE,
86  /* Try again; Not enough data available on this non-blocking call */
87  ERROR_AGAIN,
88  /* Not supported, and the FFMPEG team wouldn't mind a patch */
89  ERROR_PATCHWELCOME,
90  /* Thread was interrupted while trying an IO operation */
91  ERROR_INTERRUPTED,
92  } Type;
93 
94 
100  virtual Type getType()=0;
101 
113  virtual const char* getDescription()=0;
114 
125  virtual int32_t getErrorNumber()=0;
126 
134  static IError* make(int32_t errorNumber);
135 
142  static IError* make(Type type);
143 
149  static Type errorNumberToType(int32_t errorNo);
150 
156  static int32_t typeToErrorNumber(Type type);
157 
158 protected:
159  IError();
160  virtual ~IError();
161 };
162 
163 }}}
164 #endif /* IERROR_H_ */
Maps from int return codes to defined Error values.
Definition: IError.h:60
virtual Type getType()=0
Get the OS-independent AVPKit type for this error.
Type
A set of errors that AVPKit knows about.
Definition: IError.h:65
virtual const char * getDescription()=0
Get a text description for this error.
virtual int32_t getErrorNumber()=0
Return the raw integer value that AVPKit returned and was used to create this IError.
Parent of all Ferry objects – it mains reference counts in native code.
Definition: RefCounted.h:85
WARNING: Do not use logging in this class, and do not set any static file variables to values other t...