mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-18 03:19:31 +02:00
c581cb4e4f
* qatar/master: Fix even more missing includes after the common.h removal build: Factor out rangecoder dependencies to CONFIG_RANGECODER build: Factor out error resilience dependencies to CONFIG_ERROR_RESILIENCE x86: avcodec: Consistently name all init files Add more missing includes after removing the implicit common.h Add some more missing includes after removing the implicit common.h Don't include common.h from avutil.h rtmp: Automatically compute the hash for SWFVerification Conflicts: configure doc/APIchanges doc/examples/decoding_encoding.c libavcodec/Makefile libavcodec/assdec.c libavcodec/audio_frame_queue.c libavcodec/avpacket.c libavcodec/dv_profile.c libavcodec/dwt.c libavcodec/libtheoraenc.c libavcodec/rawdec.c libavcodec/rv40dsp.c libavcodec/tiff.c libavcodec/tiffenc.c libavcodec/v210dec.h libavcodec/vc1dsp.c libavcodec/x86/Makefile libavfilter/asrc_anullsrc.c libavfilter/avfilter.c libavfilter/buffer.c libavfilter/formats.c libavfilter/vf_ass.c libavfilter/vf_drawtext.c libavfilter/vf_fade.c libavfilter/vf_select.c libavfilter/video.c libavfilter/vsrc_testsrc.c libavformat/version.h libavutil/audioconvert.c libavutil/error.h libavutil/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
99 lines
3.5 KiB
C
99 lines
3.5 KiB
C
/*
|
|
* This file is part of FFmpeg.
|
|
*
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#undef _GNU_SOURCE
|
|
#include "avutil.h"
|
|
#include "avstring.h"
|
|
#include "common.h"
|
|
|
|
struct error_entry {
|
|
int num;
|
|
const char *tag;
|
|
const char *str;
|
|
};
|
|
|
|
#define ERROR_TAG(tag) AVERROR_##tag, #tag
|
|
struct error_entry error_entries[] = {
|
|
{ ERROR_TAG(BSF_NOT_FOUND), "Bitstream filter not found" },
|
|
{ ERROR_TAG(BUG), "Internal bug, should not have happened" },
|
|
{ ERROR_TAG(BUG2), "Internal bug, should not have happened" },
|
|
{ ERROR_TAG(BUFFER_TOO_SMALL), "Buffer too small" },
|
|
{ ERROR_TAG(DECODER_NOT_FOUND), "Decoder not found" },
|
|
{ ERROR_TAG(DEMUXER_NOT_FOUND), "Demuxer not found" },
|
|
{ ERROR_TAG(ENCODER_NOT_FOUND), "Encoder not found" },
|
|
{ ERROR_TAG(EOF), "End of file" },
|
|
{ ERROR_TAG(EXIT), "Immediate exit requested" },
|
|
{ ERROR_TAG(EXTERNAL), "Generic error in an external library" },
|
|
{ ERROR_TAG(FILTER_NOT_FOUND), "Filter not found" },
|
|
{ ERROR_TAG(INVALIDDATA), "Invalid data found when processing input" },
|
|
{ ERROR_TAG(MUXER_NOT_FOUND), "Muxer not found" },
|
|
{ ERROR_TAG(OPTION_NOT_FOUND), "Option not found" },
|
|
{ ERROR_TAG(PATCHWELCOME), "Not yet implemented in FFmpeg, patches welcome" },
|
|
{ ERROR_TAG(PROTOCOL_NOT_FOUND), "Protocol not found" },
|
|
{ ERROR_TAG(STREAM_NOT_FOUND), "Stream not found" },
|
|
{ ERROR_TAG(UNKNOWN), "Unknown error occurred" },
|
|
};
|
|
|
|
int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
|
|
{
|
|
int ret = 0, i;
|
|
struct error_entry *entry = NULL;
|
|
|
|
for (i = 0; i < FF_ARRAY_ELEMS(error_entries); i++) {
|
|
if (errnum == error_entries[i].num) {
|
|
entry = &error_entries[i];
|
|
break;
|
|
}
|
|
}
|
|
if (entry) {
|
|
av_strlcpy(errbuf, entry->str, errbuf_size);
|
|
} else {
|
|
#if HAVE_STRERROR_R
|
|
ret = AVERROR(strerror_r(AVUNERROR(errnum), errbuf, errbuf_size));
|
|
#else
|
|
ret = -1;
|
|
#endif
|
|
if (ret < 0)
|
|
snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
#ifdef TEST
|
|
|
|
#undef printf
|
|
|
|
int main(void)
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; i < FF_ARRAY_ELEMS(error_entries); i++) {
|
|
struct error_entry *entry = &error_entries[i];
|
|
printf("%d: %s [%s]\n", entry->num, av_err2str(entry->num), entry->tag);
|
|
}
|
|
|
|
for (i = 0; i < 256; i++) {
|
|
printf("%d: %s\n", -i, av_err2str(-i));
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
#endif /* TEST */
|