00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #undef _GNU_SOURCE
00020 #include "avutil.h"
00021 #include "avstring.h"
00022
00023 int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
00024 {
00025 int ret = 0;
00026 const char *errstr = NULL;
00027
00028 switch (errnum) {
00029 case AVERROR_BSF_NOT_FOUND: errstr = "Bitstream filter not found" ; break;
00030 case AVERROR_BUG2:
00031 case AVERROR_BUG: errstr = "Internal bug, should not have happened" ; break;
00032 case AVERROR_DECODER_NOT_FOUND: errstr = "Decoder not found" ; break;
00033 case AVERROR_DEMUXER_NOT_FOUND: errstr = "Demuxer not found" ; break;
00034 case AVERROR_ENCODER_NOT_FOUND: errstr = "Encoder not found" ; break;
00035 case AVERROR_EOF: errstr = "End of file" ; break;
00036 case AVERROR_EXIT: errstr = "Immediate exit requested" ; break;
00037 case AVERROR_FILTER_NOT_FOUND: errstr = "Filter not found" ; break;
00038 case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input" ; break;
00039 case AVERROR_MUXER_NOT_FOUND: errstr = "Muxer not found" ; break;
00040 case AVERROR_OPTION_NOT_FOUND: errstr = "Option not found" ; break;
00041 case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in FFmpeg, patches welcome"; break;
00042 case AVERROR_PROTOCOL_NOT_FOUND:errstr = "Protocol not found" ; break;
00043 case AVERROR_STREAM_NOT_FOUND: errstr = "Stream not found" ; break;
00044 case AVERROR_UNKNOWN: errstr = "Unknown error occurred" ; break;
00045 case AVERROR(EINVAL): errstr = "Invalid argument" ; break;
00046 case 0: errstr = "Success" ; break;
00047 }
00048
00049 if (errstr) {
00050 av_strlcpy(errbuf, errstr, errbuf_size);
00051 } else {
00052 #if HAVE_STRERROR_R
00053 ret = strerror_r(AVUNERROR(errnum), errbuf, errbuf_size);
00054 #else
00055 ret = -1;
00056 #endif
00057 if (ret < 0)
00058 snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum);
00059 }
00060
00061 return ret;
00062 }