[FFmpeg-devel] [PATCH] error: remove AVERROR_NUMEXPECTED at the next major bump

Stefano Sabatini stefano.sabatini-lala at poste.it
Mon Apr 11 01:06:16 CEST 2011


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). Simplify.

Signed-off-by: Stefano Sabatini <stefano.sabatini-lala at poste.it>
---
 ffmpeg.c            |    2 +-
 libavformat/utils.c |    2 +-
 libavutil/error.c   |    2 ++
 libavutil/error.h   |    1 -
 4 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 8e44895..119a6e3 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3861,7 +3861,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 835408b..1369cb3 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -657,7 +657,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 93f8925..4e56887 100644
--- a/libavutil/error.c
+++ b/libavutil/error.c
@@ -27,7 +27,9 @@ 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;
+#if LIBAVUTIL_VERSION_MAJOR < 51
     case AVERROR_NUMEXPECTED:       errstr = "Number syntax expected in filename"; break;
+#endif
     case AVERROR_PATCHWELCOME:      errstr = "Not yet implemented in FFmpeg, 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 0d47566..0780ea2 100644
--- a/libavutil/error.h
+++ b/libavutil/error.h
@@ -54,7 +54,6 @@
 
 #if LIBAVUTIL_VERSION_MAJOR > 50
 #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
 #endif
 
 #define AVERROR_DEMUXER_NOT_FOUND  (-MKTAG(0xF8,'D','E','M')) ///< Demuxer not found
-- 
1.7.2.3



More information about the ffmpeg-devel mailing list