On date Monday 2011-04-25 01:46:48 +0200, Stefano Sabatini encoded:
> On date Sunday 2011-04-24 18:43:41 +0200, Stefano Sabatini encoded:
> > On date Saturday 2011-04-23 17:28:30 +0200, Stefano Sabatini encoded:
> > > On date Saturday 2011-04-23 13:54:52 +0200, Nicolas George encoded:
> > > > Le quartidi 4 floréal, an CCXIX, Stefano Sabatini a écrit :
> > > > > This breaks ABI as it redefines the previous values (since the first
> > > > > symbol will have a value of 0 rather than 1, consistent with enum
> > > > > definitions and allows the AV_*_NB trick).
> > > > 
> > > > Couldn't you add some sort of AV_PICTURE_TYPE_UNSPEC =0 to preserve the
> > > > values?
> > > 
> > > Rethinking about it, I dropped the redefinition (which were causing
> > > regressions, since the literal pict_type values are used in MPEG
> > > video) and the *_NB trick.
> > > 
> > > No ABI breaks anymore.
> > 
> > Patch updated with removal guards added.
> 
> ...and with APIchanges entry (already approved on the FFmpeg side,
> waiting on the Libav side, as for me I'd prefer to have it applied in
> both).

Updated with lavfi micro bump.
>From 6b99d1fffbe56ac21a1095883fa41cfb61470be5 Mon Sep 17 00:00:00 2001
From: Stefano Sabatini <[email protected]>
Date: Sat, 23 Apr 2011 13:38:50 +0200
Subject: [PATCH] lavc: deprecate FF_*_TYPE macros in favor of AV_PICTURE_TYPE_* enums

Also deprecate av_get_pict_type_char() in favor of
av_get_picture_type_char().

The new enum and av_get_picture_type_char() are defined in libavutil.
This allows the use in libavfilter without the need to link against
libavcodec.

Signed-off-by: Stefano Sabatini <[email protected]>
---
 doc/APIchanges         |    5 +++++
 libavcodec/avcodec.h   |   24 +++++++++++++++---------
 libavcodec/utils.c     |   13 +++----------
 libavcodec/version.h   |    5 ++++-
 libavfilter/avfilter.h |    4 ++--
 libavutil/avutil.h     |   21 ++++++++++++++++++++-
 libavutil/utils.c      |   14 ++++++++++++++
 7 files changed, 63 insertions(+), 23 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 8b1130b..af805bd 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,11 @@ libavutil:   2011-04-18
 
 API changes, most recent first:
 
+2011-04-XX - XXXXXXX - lavu 51.1.0 - avutil.h
+  Add AVPictureType enum and av_get_picture_type_char(), deprecate
+  FF_*_TYPE defines and av_get_pict_type_char() defined in
+  libavcodec/avcodec.h.
+
 2011-04-21 - 94f7451 - lavc 53.1.0 - avcodec.h
   Add CODEC_CAP_SLICE_THREADS for codecs supporting sliced threading.
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 58a38fa..6835102 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -766,7 +766,7 @@ typedef struct AVPanScan{
      * - encoding: Set by libavcodec. for coded_picture (and set by user for input).\
      * - decoding: Set by libavcodec.\
      */\
-    int pict_type;\
+    enum AVPictureType pict_type;\
 \
     /**\
      * presentation timestamp in time_base units (time when frame should be shown to user)\
@@ -1016,14 +1016,16 @@ typedef struct AVPanScan{
 #define FF_BUFFER_TYPE_SHARED   4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
 #define FF_BUFFER_TYPE_COPY     8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
 
-
-#define FF_I_TYPE  1 ///< Intra
-#define FF_P_TYPE  2 ///< Predicted
-#define FF_B_TYPE  3 ///< Bi-dir predicted
-#define FF_S_TYPE  4 ///< S(GMC)-VOP MPEG4
-#define FF_SI_TYPE 5 ///< Switching Intra
-#define FF_SP_TYPE 6 ///< Switching Predicted
-#define FF_BI_TYPE 7
+#if FF_API_OLD_FF_PICT_TYPES
+/* DEPRECATED, directly use the AV_PICTURE_TYPE_* enum values */
+#define FF_I_TYPE  AV_PICTURE_TYPE_I  ///< Intra
+#define FF_P_TYPE  AV_PICTURE_TYPE_P  ///< Predicted
+#define FF_B_TYPE  AV_PICTURE_TYPE_B  ///< Bi-dir predicted
+#define FF_S_TYPE  AV_PICTURE_TYPE_S  ///< S(GMC)-VOP MPEG4
+#define FF_SI_TYPE AV_PICTURE_TYPE_SI ///< Switching Intra
+#define FF_SP_TYPE AV_PICTURE_TYPE_SP ///< Switching Predicted
+#define FF_BI_TYPE AV_PICTURE_TYPE_BI
+#endif
 
 #define FF_BUFFER_HINTS_VALID    0x01 // Buffer hints value is meaningful (if 0 ignore).
 #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.
@@ -3866,13 +3868,17 @@ void avcodec_default_free_buffers(AVCodecContext *s);
 
 /* misc useful functions */
 
+#if FF_API_OLD_FF_PICT_TYPES
 /**
  * Return a single letter to describe the given picture type pict_type.
  *
  * @param[in] pict_type the picture type
  * @return A single character representing the picture type.
+ * @deprecated Use av_get_picture_type_char() instead.
  */
+attribute_deprecated
 char av_get_pict_type_char(int pict_type);
+#endif
 
 /**
  * Return codec bits per sample.
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d6b71b4..6cdbb43 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1105,18 +1105,11 @@ void avcodec_default_free_buffers(AVCodecContext *s){
     s->internal_buffer_count=0;
 }
 
+#if FF_API_OLD_FF_PICT_TYPES
 char av_get_pict_type_char(int pict_type){
-    switch(pict_type){
-    case FF_I_TYPE: return 'I';
-    case FF_P_TYPE: return 'P';
-    case FF_B_TYPE: return 'B';
-    case FF_S_TYPE: return 'S';
-    case FF_SI_TYPE:return 'i';
-    case FF_SP_TYPE:return 'p';
-    case FF_BI_TYPE:return 'b';
-    default:        return '?';
-    }
+    return av_get_picture_type_char(pict_type);
 }
+#endif
 
 int av_get_bits_per_sample(enum CodecID codec_id){
     switch(codec_id){
diff --git a/libavcodec/version.h b/libavcodec/version.h
index e5ca102..ad49a27 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -22,7 +22,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR 53
 #define LIBAVCODEC_VERSION_MINOR  1
-#define LIBAVCODEC_VERSION_MICRO  0
+#define LIBAVCODEC_VERSION_MICRO  1
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
@@ -68,5 +68,8 @@
 #ifndef FF_API_THREAD_INIT
 #define FF_API_THREAD_INIT      (LIBAVCODEC_VERSION_MAJOR < 54)
 #endif
+#ifndef FF_API_OLD_FF_PICT_TYPES
+#define FF_API_OLD_FF_PICT_TYPES (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
 
 #endif /* AVCODEC_VERSION_H */
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 6525f57..1d6a748 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -27,7 +27,7 @@
 
 #define LIBAVFILTER_VERSION_MAJOR  2
 #define LIBAVFILTER_VERSION_MINOR  0
-#define LIBAVFILTER_VERSION_MICRO  0
+#define LIBAVFILTER_VERSION_MICRO  1
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
                                                LIBAVFILTER_VERSION_MINOR, \
@@ -115,7 +115,7 @@ typedef struct AVFilterBufferRefVideoProps {
     AVRational pixel_aspect;    ///< pixel aspect ratio
     int interlaced;             ///< is frame interlaced
     int top_field_first;        ///< field order
-    int pict_type;              ///< Picture type of the frame
+    enum AVPictureType pict_type; ///< picture type of the frame
     int key_frame;              ///< 1 -> keyframe, 0-> not
 } AVFilterBufferRefVideoProps;
 
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index 307a585..b0462f1 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 51
-#define LIBAVUTIL_VERSION_MINOR  0
+#define LIBAVUTIL_VERSION_MINOR  1
 #define LIBAVUTIL_VERSION_MICRO  0
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -97,6 +97,25 @@ enum AVMediaType {
 #define AV_TIME_BASE            1000000
 #define AV_TIME_BASE_Q          (AVRational){1, AV_TIME_BASE}
 
+enum AVPictureType {
+    AV_PICTURE_TYPE_I = 1, ///< Intra
+    AV_PICTURE_TYPE_P,     ///< Predicted
+    AV_PICTURE_TYPE_B,     ///< Bi-dir predicted
+    AV_PICTURE_TYPE_S,     ///< S(GMC)-VOP MPEG4
+    AV_PICTURE_TYPE_SI,    ///< Switching Intra
+    AV_PICTURE_TYPE_SP,    ///< Switching Predicted
+    AV_PICTURE_TYPE_BI,    ///< BI type
+};
+
+/**
+ * Return a single letter to describe the given picture type
+ * pict_type.
+ *
+ * @param[in] pict_type the picture type @return a single character
+ * representing the picture type, '?' if pict_type is unknown
+ */
+char av_get_picture_type_char(enum AVPictureType pict_type);
+
 #include "common.h"
 #include "error.h"
 #include "mathematics.h"
diff --git a/libavutil/utils.c b/libavutil/utils.c
index 8a1d32e..c77a060 100644
--- a/libavutil/utils.c
+++ b/libavutil/utils.c
@@ -39,3 +39,17 @@ const char *avutil_license(void)
 #define LICENSE_PREFIX "libavutil license: "
     return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
 }
+
+char av_get_picture_type_char(enum AVPictureType pict_type)
+{
+    switch (pict_type) {
+    case AV_PICTURE_TYPE_I:  return 'I';
+    case AV_PICTURE_TYPE_P:  return 'P';
+    case AV_PICTURE_TYPE_B:  return 'B';
+    case AV_PICTURE_TYPE_S:  return 'S';
+    case AV_PICTURE_TYPE_SI: return 'i';
+    case AV_PICTURE_TYPE_SP: return 'p';
+    case AV_PICTURE_TYPE_BI: return 'b';
+    default:                 return '?';
+    }
+}
-- 
1.7.2.3

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to