FFmpeg
Loading...
Searching...
No Matches
error.c
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include "libavutil/error.c"
20
21/* errno descriptions depend on the C library, so those are only looked up */
22static const struct {
23 int num;
24 const char *tag;
25} ffmpeg_codes[] = {
26#define ERROR_TAG(CODE, DESC) { AVERROR_ ## CODE, #CODE },
27#define ERROR_TAG2(CODE, CODE2, DESC) { AVERROR_ ## CODE, #CODE },
29};
30
31static const int errno_codes[] = {
32#define ERRNO_CODE(CODE, DESC) AVERROR(CODE),
34};
35
36int main(void)
37{
39 int ret = 0;
40
41 for (size_t i = 0; i < FF_ARRAY_ELEMS(ffmpeg_codes); i++) {
42 int num = ffmpeg_codes[i].num;
43
44 if (av_strerror(num, buf, sizeof(buf)) < 0) {
45 printf("%d: lookup failed [%s]\n", num, ffmpeg_codes[i].tag);
46 ret = 1;
47 continue;
48 }
49 printf("%d: %s [%s]\n", num, buf, ffmpeg_codes[i].tag);
50 }
51
52 for (size_t i = 0; i < FF_ARRAY_ELEMS(errno_codes); i++) {
53 if (av_strerror(errno_codes[i], buf, sizeof(buf)) < 0) {
54 printf("errno %d: lookup failed\n", AVUNERROR(errno_codes[i]));
55 ret = 1;
56 }
57 }
58
59 return ret;
60}
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
__device__ int printf(const char *,...)
#define AVERROR_LIST(E, E2)
Definition error.c:30
#define STRERROR_LIST(E)
Definition error.c:61
#define AVUNERROR(e)
Definition error.h:46
#define AV_ERROR_MAX_STRING_SIZE
Definition error.h:86
int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
Put a description of the AVERROR code errnum in errbuf.
Definition error.c:134
uint32_t tag
Definition movenc.c:2128
#define FF_ARRAY_ELEMS(a)
static const struct @052244050205067274272152245371334221201240175116 ffmpeg_codes[]
int main(void)
Definition error.c:36
int num
Definition error.c:23
static const int errno_codes[]
Definition error.c:31
#define ERRNO_CODE(CODE, DESC)
#define ERROR_TAG2(CODE, CODE2, DESC)
#define ERROR_TAG(CODE, DESC)