[PATCH] Move error code definitions from libavcodec/avcodec.h to libavutil/common.h, and mark the old definitions to be dropped at the next major bump.

Stefano Sabatini stefano.sabatini-lala
Sun Mar 7 15:15:00 CET 2010


Error code definitions and handling code belongs to libavutil, where
it can be shared by all the libav* libraries.
---
 libavcodec/avcodec.h |    2 ++
 libavutil/avutil.h   |    2 +-
 libavutil/common.h   |   10 ++++++++++
 3 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 31569d3..ffffa45 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3808,6 +3808,7 @@ int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str);
  */
 int av_parse_video_frame_rate(AVRational *frame_rate, const char *str);
 
+#if LIBAVCODEC_VERSION_MAJOR < 53
 /* error handling */
 #if EINVAL > 0
 #define AVERROR(e) (-(e)) /**< Returns a negative error code from a POSIX error code, to return from library functions. */
@@ -3827,6 +3828,7 @@ int av_parse_video_frame_rate(AVRational *frame_rate, const char *str);
 #define AVERROR_NOENT       AVERROR(ENOENT)  /**< No such file or directory. */
 #define AVERROR_EOF         AVERROR(EPIPE)   /**< End of file. */
 #define AVERROR_PATCHWELCOME    -MKTAG('P','A','W','E') /**< Not yet implemented in FFmpeg. Patches welcome. */
+#endif
 
 /**
  * Logs a generic warning message about a missing feature. This function is
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index d44a906..f147a7d 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -40,7 +40,7 @@
 #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
 
 #define LIBAVUTIL_VERSION_MAJOR 50
-#define LIBAVUTIL_VERSION_MINOR 11
+#define LIBAVUTIL_VERSION_MINOR 12
 #define LIBAVUTIL_VERSION_MICRO  0
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff --git a/libavutil/common.h b/libavutil/common.h
index 4b757d1..547b7d0 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -35,6 +35,16 @@
 #include <stdlib.h>
 #include <string.h>
 
+/** Returns a negative error code from a POSIX error code, to return from library functions. */
+#if EINVAL > 0
+#define AVERROR(e) (-(e))
+#else
+/* Some platforms have E* and errno already negated. */
+#define AVERROR(e) (e)
+#endif
+
+#define AVERROR_PATCHWELCOME    -MKTAG('P','A','W','E') ///< Not yet implemented in FFmpeg. Patches welcome.
+
 #ifdef HAVE_AV_CONFIG_H
 #include "config.h"
 #endif
-- 
1.6.6.1


--w7PDEPdKQumQfZlR--



More information about the ffmpeg-devel mailing list