From 58f8463947e56dc448baeeabd7875ea90bdb4a98 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Mon, 11 Apr 2011 00:52:04 +0200 Subject: error: add error code AVERROR_OPTION_NOT_FOUND, and use it in opt.c The new error code is better than AVERROR(ENOENT), which has a completely different semantics ("No such file or directory"). Signed-off-by: Stefano Sabatini Signed-off-by: Anton Khirnov --- libavutil/error.h | 1 + 1 file changed, 1 insertion(+) (limited to 'libavutil/error.h') diff --git a/libavutil/error.h b/libavutil/error.h index 33332b18c4..23e0b01789 100644 --- a/libavutil/error.h +++ b/libavutil/error.h @@ -48,6 +48,7 @@ #define AVERROR_MUXER_NOT_FOUND (-MKTAG(0xF8,'M','U','X')) ///< Muxer not found #define AVERROR_DECODER_NOT_FOUND (-MKTAG(0xF8,'D','E','C')) ///< Decoder not found #define AVERROR_ENCODER_NOT_FOUND (-MKTAG(0xF8,'E','N','C')) ///< Encoder not found +#define AVERROR_OPTION_NOT_FOUND (-MKTAG(0xF8,'O','P','T')) ///< Option not found #define AVERROR_PROTOCOL_NOT_FOUND (-MKTAG(0xF8,'P','R','O')) ///< Protocol not found #define AVERROR_FILTER_NOT_FOUND (-MKTAG(0xF8,'F','I','L')) ///< Filter not found #define AVERROR_BSF_NOT_FOUND (-MKTAG(0xF8,'B','S','F')) ///< Bitstream filter not found -- cgit v1.2.3 From 79157f400bec7fdb6385befa63fdafc727378143 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Mon, 11 Apr 2011 00:29:30 +0200 Subject: error: remove AVERROR_NUMEXPECTED AVERROR_NUMEXPECTED is used only in the image muxer and demuxer, and has a too much specific meaning, which is better explained through a log message. Thus it can be replaced by AVERROR(EINVAL). This breaks API. Signed-off-by: Stefano Sabatini Signed-off-by: Anton Khirnov --- ffmpeg.c | 2 +- libavformat/utils.c | 2 +- libavutil/error.c | 1 - libavutil/error.h | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) (limited to 'libavutil/error.h') diff --git a/ffmpeg.c b/ffmpeg.c index 6e620bf55e..886d5da7de 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -3722,7 +3722,7 @@ static void opt_output_file(const char *filename) /* check filename in case of an image number is expected */ if (oc->oformat->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(oc->filename)) { - print_error(oc->filename, AVERROR_NUMEXPECTED); + print_error(oc->filename, AVERROR(EINVAL)); ffmpeg_exit(1); } } diff --git a/libavformat/utils.c b/libavformat/utils.c index 19498b96a4..88e9a49e87 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -581,7 +581,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, /* check filename in case an image number is expected */ if (fmt->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(filename)) { - err = AVERROR_NUMEXPECTED; + err = AVERROR(EINVAL); goto fail; } } diff --git a/libavutil/error.c b/libavutil/error.c index 3c3f03fe9b..252007a6c9 100644 --- a/libavutil/error.c +++ b/libavutil/error.c @@ -27,7 +27,6 @@ int av_strerror(int errnum, char *errbuf, size_t errbuf_size) switch (errnum) { case AVERROR_EOF: errstr = "End of file"; break; case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input"; break; - case AVERROR_NUMEXPECTED: errstr = "Number syntax expected in filename"; break; case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in Libav, patches welcome"; break; case AVERROR_DEMUXER_NOT_FOUND: errstr = "Demuxer not found"; break; case AVERROR_MUXER_NOT_FOUND: errstr = "Muxer not found"; break; diff --git a/libavutil/error.h b/libavutil/error.h index 23e0b01789..62e75e136d 100644 --- a/libavutil/error.h +++ b/libavutil/error.h @@ -42,7 +42,6 @@ #define AVERROR_PATCHWELCOME (-MKTAG('P','A','W','E')) ///< Not yet implemented in Libav, patches welcome #define AVERROR_INVALIDDATA (-MKTAG('I','N','D','A')) ///< Invalid data found when processing input -#define AVERROR_NUMEXPECTED (-MKTAG('N','U','E','X')) ///< Number syntax expected in filename #define AVERROR_DEMUXER_NOT_FOUND (-MKTAG(0xF8,'D','E','M')) ///< Demuxer not found #define AVERROR_MUXER_NOT_FOUND (-MKTAG(0xF8,'M','U','X')) ///< Muxer not found -- cgit v1.2.3 From a975dbc86b97a421e51ac7075b8df869915745a2 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 20 Apr 2011 07:14:50 +0200 Subject: error: change AVERROR_EOF value The current value is masking the POSIX error code EPIPE, which has a different semantics. This breaks API. Signed-off-by: Stefano Sabatini Signed-off-by: Anton Khirnov --- libavutil/error.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavutil/error.h') diff --git a/libavutil/error.h b/libavutil/error.h index 62e75e136d..a422f8555c 100644 --- a/libavutil/error.h +++ b/libavutil/error.h @@ -37,7 +37,7 @@ #define AVUNERROR(e) (e) #endif -#define AVERROR_EOF AVERROR(EPIPE) ///< End of file +#define AVERROR_EOF (-MKTAG('E','O','F',' ')) ///< End of file #define AVERROR_PATCHWELCOME (-MKTAG('P','A','W','E')) ///< Not yet implemented in Libav, patches welcome -- cgit v1.2.3 From 8d67218bd73744c367450d8b8ecc5a6e6c42bd11 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Thu, 21 Apr 2011 13:36:12 +0200 Subject: error: sort, pack, and align error code and string definitions Signed-off-by: Diego Biurrun --- libavutil/error.c | 24 ++++++++++++------------ libavutil/error.h | 20 ++++++++------------ 2 files changed, 20 insertions(+), 24 deletions(-) (limited to 'libavutil/error.h') diff --git a/libavutil/error.c b/libavutil/error.c index 252007a6c9..ddcc038650 100644 --- a/libavutil/error.c +++ b/libavutil/error.c @@ -25,19 +25,19 @@ int av_strerror(int errnum, char *errbuf, size_t errbuf_size) const char *errstr = NULL; switch (errnum) { - case AVERROR_EOF: errstr = "End of file"; break; - case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input"; break; + case AVERROR_BSF_NOT_FOUND: errstr = "Bitstream filter not found" ; break; + case AVERROR_DECODER_NOT_FOUND: errstr = "Decoder not found" ; break; + case AVERROR_DEMUXER_NOT_FOUND: errstr = "Demuxer not found" ; break; + case AVERROR_ENCODER_NOT_FOUND: errstr = "Encoder not found" ; break; + case AVERROR_EOF: errstr = "End of file" ; break; + case AVERROR_EXIT: errstr = "Immediate exit requested" ; break; + case AVERROR_FILTER_NOT_FOUND: errstr = "Filter not found" ; break; + case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input" ; break; + case AVERROR_MUXER_NOT_FOUND: errstr = "Muxer not found" ; break; + case AVERROR_OPTION_NOT_FOUND: errstr = "Option not found" ; break; case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in Libav, patches welcome"; break; - case AVERROR_DEMUXER_NOT_FOUND: errstr = "Demuxer not found"; break; - case AVERROR_MUXER_NOT_FOUND: errstr = "Muxer not found"; break; - case AVERROR_DECODER_NOT_FOUND: errstr = "Decoder not found"; break; - case AVERROR_ENCODER_NOT_FOUND: errstr = "Encoder not found"; break; - case AVERROR_OPTION_NOT_FOUND: errstr = "Option not found"; break; - case AVERROR_PROTOCOL_NOT_FOUND:errstr = "Protocol not found"; break; - case AVERROR_FILTER_NOT_FOUND: errstr = "Filter not found"; break; - case AVERROR_BSF_NOT_FOUND: errstr = "Bitstream filter not found"; break; - case AVERROR_STREAM_NOT_FOUND: errstr = "Stream not found"; break; - case AVERROR_EXIT: errstr = "Immediate exit requested"; break; + case AVERROR_PROTOCOL_NOT_FOUND:errstr = "Protocol not found" ; break; + case AVERROR_STREAM_NOT_FOUND: errstr = "Stream not found" ; break; } if (errstr) { diff --git a/libavutil/error.h b/libavutil/error.h index a422f8555c..ba12d2bfae 100644 --- a/libavutil/error.h +++ b/libavutil/error.h @@ -37,24 +37,20 @@ #define AVUNERROR(e) (e) #endif -#define AVERROR_EOF (-MKTAG('E','O','F',' ')) ///< End of file - -#define AVERROR_PATCHWELCOME (-MKTAG('P','A','W','E')) ///< Not yet implemented in Libav, patches welcome - -#define AVERROR_INVALIDDATA (-MKTAG('I','N','D','A')) ///< Invalid data found when processing input - -#define AVERROR_DEMUXER_NOT_FOUND (-MKTAG(0xF8,'D','E','M')) ///< Demuxer not found -#define AVERROR_MUXER_NOT_FOUND (-MKTAG(0xF8,'M','U','X')) ///< Muxer not found +#define AVERROR_BSF_NOT_FOUND (-MKTAG(0xF8,'B','S','F')) ///< Bitstream filter not found #define AVERROR_DECODER_NOT_FOUND (-MKTAG(0xF8,'D','E','C')) ///< Decoder not found +#define AVERROR_DEMUXER_NOT_FOUND (-MKTAG(0xF8,'D','E','M')) ///< Demuxer not found #define AVERROR_ENCODER_NOT_FOUND (-MKTAG(0xF8,'E','N','C')) ///< Encoder not found +#define AVERROR_EOF (-MKTAG( 'E','O','F',' ')) ///< End of file +#define AVERROR_EXIT (-MKTAG( 'E','X','I','T')) ///< Immediate exit was requested; the called function should not be restarted +#define AVERROR_FILTER_NOT_FOUND (-MKTAG(0xF8,'F','I','L')) ///< Filter not found +#define AVERROR_INVALIDDATA (-MKTAG( 'I','N','D','A')) ///< Invalid data found when processing input +#define AVERROR_MUXER_NOT_FOUND (-MKTAG(0xF8,'M','U','X')) ///< Muxer not found #define AVERROR_OPTION_NOT_FOUND (-MKTAG(0xF8,'O','P','T')) ///< Option not found +#define AVERROR_PATCHWELCOME (-MKTAG( 'P','A','W','E')) ///< Not yet implemented in Libav, patches welcome #define AVERROR_PROTOCOL_NOT_FOUND (-MKTAG(0xF8,'P','R','O')) ///< Protocol not found -#define AVERROR_FILTER_NOT_FOUND (-MKTAG(0xF8,'F','I','L')) ///< Filter not found -#define AVERROR_BSF_NOT_FOUND (-MKTAG(0xF8,'B','S','F')) ///< Bitstream filter not found #define AVERROR_STREAM_NOT_FOUND (-MKTAG(0xF8,'S','T','R')) ///< Stream not found -#define AVERROR_EXIT (-MKTAG('E','X','I','T')) ///< Immediate exit was requested; the called function should not be restarted - /** * Put a description of the AVERROR code errnum in errbuf. * In case of failure the global variable errno is set to indicate the -- cgit v1.2.3