Libav 0.7.1
|
00001 /* 00002 * This file is part of Libav. 00003 * 00004 * Libav is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * Libav is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with Libav; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00017 */ 00018 00019 #include "avutil.h" 00020 #include "avstring.h" 00021 00022 int av_strerror(int errnum, char *errbuf, size_t errbuf_size) 00023 { 00024 int ret = 0; 00025 const char *errstr = NULL; 00026 00027 switch (errnum) { 00028 case AVERROR_BSF_NOT_FOUND: errstr = "Bitstream filter not found" ; break; 00029 case AVERROR_DECODER_NOT_FOUND: errstr = "Decoder not found" ; break; 00030 case AVERROR_DEMUXER_NOT_FOUND: errstr = "Demuxer not found" ; break; 00031 case AVERROR_ENCODER_NOT_FOUND: errstr = "Encoder not found" ; break; 00032 case AVERROR_EOF: errstr = "End of file" ; break; 00033 case AVERROR_EXIT: errstr = "Immediate exit requested" ; break; 00034 case AVERROR_FILTER_NOT_FOUND: errstr = "Filter not found" ; break; 00035 case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input" ; break; 00036 case AVERROR_MUXER_NOT_FOUND: errstr = "Muxer not found" ; break; 00037 case AVERROR_OPTION_NOT_FOUND: errstr = "Option not found" ; break; 00038 case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in Libav, patches welcome"; break; 00039 case AVERROR_PROTOCOL_NOT_FOUND:errstr = "Protocol not found" ; break; 00040 case AVERROR_STREAM_NOT_FOUND: errstr = "Stream not found" ; break; 00041 } 00042 00043 if (errstr) { 00044 av_strlcpy(errbuf, errstr, errbuf_size); 00045 } else { 00046 #if HAVE_STRERROR_R 00047 ret = strerror_r(AVUNERROR(errnum), errbuf, errbuf_size); 00048 #else 00049 ret = -1; 00050 #endif 00051 if (ret < 0) 00052 snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum); 00053 } 00054 00055 return ret; 00056 }