annotate lib/libavutil/error.h @ 2452:5991abe37c1d

cleaning
author Ritor1
date Fri, 25 Jul 2014 14:38:08 +0600
parents 992d2e6f907d
children
rev   line source
2134
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
1 /*
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
2 * This file is part of FFmpeg.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
3 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
4 * FFmpeg is free software; you can redistribute it and/or
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
5 * modify it under the terms of the GNU Lesser General Public
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
6 * License as published by the Free Software Foundation; either
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
7 * version 2.1 of the License, or (at your option) any later version.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
8 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
9 * FFmpeg is distributed in the hope that it will be useful,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
12 * Lesser General Public License for more details.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
13 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
14 * You should have received a copy of the GNU Lesser General Public
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
15 * License along with FFmpeg; if not, write to the Free Software
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
17 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
18
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
19 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
20 * @file
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
21 * error code definitions
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
22 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
23
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
24 #ifndef AVUTIL_ERROR_H
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
25 #define AVUTIL_ERROR_H
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
26
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
27 #include <errno.h>
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
28 #include <stddef.h>
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
29
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
30 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
31 * @addtogroup lavu_error
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
32 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
33 * @{
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
34 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
35
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
36
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
37 /* error handling */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
38 #if EDOM > 0
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
39 #define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
40 #define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
41 #else
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
42 /* Some platforms have E* and errno already negated. */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
43 #define AVERROR(e) (e)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
44 #define AVUNERROR(e) (e)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
45 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
46
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
47 #define FFERRTAG(a, b, c, d) (-(int)MKTAG(a, b, c, d))
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
48
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
49 #define AVERROR_BSF_NOT_FOUND FFERRTAG(0xF8,'B','S','F') ///< Bitstream filter not found
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
50 #define AVERROR_BUG FFERRTAG( 'B','U','G','!') ///< Internal bug, also see AVERROR_BUG2
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
51 #define AVERROR_BUFFER_TOO_SMALL FFERRTAG( 'B','U','F','S') ///< Buffer too small
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
52 #define AVERROR_DECODER_NOT_FOUND FFERRTAG(0xF8,'D','E','C') ///< Decoder not found
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
53 #define AVERROR_DEMUXER_NOT_FOUND FFERRTAG(0xF8,'D','E','M') ///< Demuxer not found
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
54 #define AVERROR_ENCODER_NOT_FOUND FFERRTAG(0xF8,'E','N','C') ///< Encoder not found
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
55 #define AVERROR_EOF FFERRTAG( 'E','O','F',' ') ///< End of file
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
56 #define AVERROR_EXIT FFERRTAG( 'E','X','I','T') ///< Immediate exit was requested; the called function should not be restarted
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
57 #define AVERROR_EXTERNAL FFERRTAG( 'E','X','T',' ') ///< Generic error in an external library
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
58 #define AVERROR_FILTER_NOT_FOUND FFERRTAG(0xF8,'F','I','L') ///< Filter not found
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
59 #define AVERROR_INVALIDDATA FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
60 #define AVERROR_MUXER_NOT_FOUND FFERRTAG(0xF8,'M','U','X') ///< Muxer not found
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
61 #define AVERROR_OPTION_NOT_FOUND FFERRTAG(0xF8,'O','P','T') ///< Option not found
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
62 #define AVERROR_PATCHWELCOME FFERRTAG( 'P','A','W','E') ///< Not yet implemented in FFmpeg, patches welcome
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
63 #define AVERROR_PROTOCOL_NOT_FOUND FFERRTAG(0xF8,'P','R','O') ///< Protocol not found
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
64
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
65 #define AVERROR_STREAM_NOT_FOUND FFERRTAG(0xF8,'S','T','R') ///< Stream not found
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
66 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
67 * This is semantically identical to AVERROR_BUG
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
68 * it has been introduced in Libav after our AVERROR_BUG and with a modified value.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
69 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
70 #define AVERROR_BUG2 FFERRTAG( 'B','U','G',' ')
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
71 #define AVERROR_UNKNOWN FFERRTAG( 'U','N','K','N') ///< Unknown error, typically from an external library
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
72 #define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
73
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
74 #define AV_ERROR_MAX_STRING_SIZE 64
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
75
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
76 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
77 * Put a description of the AVERROR code errnum in errbuf.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
78 * In case of failure the global variable errno is set to indicate the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
79 * error. Even in case of failure av_strerror() will print a generic
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
80 * error message indicating the errnum provided to errbuf.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
81 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
82 * @param errnum error code to describe
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
83 * @param errbuf buffer to which description is written
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
84 * @param errbuf_size the size in bytes of errbuf
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
85 * @return 0 on success, a negative value if a description for errnum
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
86 * cannot be found
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
87 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
88 int av_strerror(int errnum, char *errbuf, size_t errbuf_size);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
89
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
90 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
91 * Fill the provided buffer with a string containing an error string
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
92 * corresponding to the AVERROR code errnum.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
93 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
94 * @param errbuf a buffer
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
95 * @param errbuf_size size in bytes of errbuf
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
96 * @param errnum error code to describe
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
97 * @return the buffer in input, filled with the error description
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
98 * @see av_strerror()
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
99 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
100 static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int errnum)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
101 {
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
102 av_strerror(errnum, errbuf, errbuf_size);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
103 return errbuf;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
104 }
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
105
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
106 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
107 * Convenience macro, the return value should be used only directly in
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
108 * function arguments but never stand-alone.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
109 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
110 #define av_err2str(errnum) \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
111 av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
112
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
113 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
114 * @}
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
115 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
116
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
117 #endif /* AVUTIL_ERROR_H */