Browse code

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 <stefano.sabatini-lala@poste.it>
Signed-off-by: Anton Khirnov <anton@khirnov.net>

Stefano Sabatini authored on 2011/04/23 20:38:50
Showing 7 changed files
... ...
@@ -13,6 +13,11 @@ libavutil:   2011-04-18
13 13
 
14 14
 API changes, most recent first:
15 15
 
16
+2011-04-XX - XXXXXXX - lavu 51.1.0 - avutil.h
17
+  Add AVPictureType enum and av_get_picture_type_char(), deprecate
18
+  FF_*_TYPE defines and av_get_pict_type_char() defined in
19
+  libavcodec/avcodec.h.
20
+
16 21
 2011-04-xx - xxxxxx - lavfi 2.3.0 - avfilter.h
17 22
   Add pict_type and key_frame fields to AVFilterBufferRefVideo.
18 23
 
... ...
@@ -762,7 +762,7 @@ typedef struct AVPanScan{
762 762
      * - encoding: Set by libavcodec. for coded_picture (and set by user for input).\
763 763
      * - decoding: Set by libavcodec.\
764 764
      */\
765
-    int pict_type;\
765
+    enum AVPictureType pict_type;\
766 766
 \
767 767
     /**\
768 768
      * presentation timestamp in time_base units (time when frame should be shown to user)\
... ...
@@ -1004,14 +1004,16 @@ typedef struct AVPanScan{
1004 1004
 #define FF_BUFFER_TYPE_SHARED   4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
1005 1005
 #define FF_BUFFER_TYPE_COPY     8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
1006 1006
 
1007
-
1008
-#define FF_I_TYPE  1 ///< Intra
1009
-#define FF_P_TYPE  2 ///< Predicted
1010
-#define FF_B_TYPE  3 ///< Bi-dir predicted
1011
-#define FF_S_TYPE  4 ///< S(GMC)-VOP MPEG4
1012
-#define FF_SI_TYPE 5 ///< Switching Intra
1013
-#define FF_SP_TYPE 6 ///< Switching Predicted
1014
-#define FF_BI_TYPE 7
1007
+#if FF_API_OLD_FF_PICT_TYPES
1008
+/* DEPRECATED, directly use the AV_PICTURE_TYPE_* enum values */
1009
+#define FF_I_TYPE  AV_PICTURE_TYPE_I  ///< Intra
1010
+#define FF_P_TYPE  AV_PICTURE_TYPE_P  ///< Predicted
1011
+#define FF_B_TYPE  AV_PICTURE_TYPE_B  ///< Bi-dir predicted
1012
+#define FF_S_TYPE  AV_PICTURE_TYPE_S  ///< S(GMC)-VOP MPEG4
1013
+#define FF_SI_TYPE AV_PICTURE_TYPE_SI ///< Switching Intra
1014
+#define FF_SP_TYPE AV_PICTURE_TYPE_SP ///< Switching Predicted
1015
+#define FF_BI_TYPE AV_PICTURE_TYPE_BI
1016
+#endif
1015 1017
 
1016 1018
 #define FF_BUFFER_HINTS_VALID    0x01 // Buffer hints value is meaningful (if 0 ignore).
1017 1019
 #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.
... ...
@@ -3766,13 +3768,17 @@ void avcodec_default_free_buffers(AVCodecContext *s);
3766 3766
 
3767 3767
 /* misc useful functions */
3768 3768
 
3769
+#if FF_API_OLD_FF_PICT_TYPES
3769 3770
 /**
3770 3771
  * Return a single letter to describe the given picture type pict_type.
3771 3772
  *
3772 3773
  * @param[in] pict_type the picture type
3773 3774
  * @return A single character representing the picture type.
3775
+ * @deprecated Use av_get_picture_type_char() instead.
3774 3776
  */
3777
+attribute_deprecated
3775 3778
 char av_get_pict_type_char(int pict_type);
3779
+#endif
3776 3780
 
3777 3781
 /**
3778 3782
  * Return codec bits per sample.
... ...
@@ -1030,18 +1030,11 @@ void avcodec_default_free_buffers(AVCodecContext *s){
1030 1030
     s->internal_buffer_count=0;
1031 1031
 }
1032 1032
 
1033
+#if FF_API_OLD_FF_PICT_TYPES
1033 1034
 char av_get_pict_type_char(int pict_type){
1034
-    switch(pict_type){
1035
-    case FF_I_TYPE: return 'I';
1036
-    case FF_P_TYPE: return 'P';
1037
-    case FF_B_TYPE: return 'B';
1038
-    case FF_S_TYPE: return 'S';
1039
-    case FF_SI_TYPE:return 'i';
1040
-    case FF_SP_TYPE:return 'p';
1041
-    case FF_BI_TYPE:return 'b';
1042
-    default:        return '?';
1043
-    }
1035
+    return av_get_picture_type_char(pict_type);
1044 1036
 }
1037
+#endif
1045 1038
 
1046 1039
 int av_get_bits_per_sample(enum CodecID codec_id){
1047 1040
     switch(codec_id){
... ...
@@ -22,7 +22,7 @@
22 22
 
23 23
 #define LIBAVCODEC_VERSION_MAJOR 53
24 24
 #define LIBAVCODEC_VERSION_MINOR  1
25
-#define LIBAVCODEC_VERSION_MICRO  0
25
+#define LIBAVCODEC_VERSION_MICRO  1
26 26
 
27 27
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
28 28
                                                LIBAVCODEC_VERSION_MINOR, \
... ...
@@ -59,5 +59,8 @@
59 59
 #ifndef FF_API_THREAD_INIT
60 60
 #define FF_API_THREAD_INIT      (LIBAVCODEC_VERSION_MAJOR < 54)
61 61
 #endif
62
+#ifndef FF_API_OLD_FF_PICT_TYPES
63
+#define FF_API_OLD_FF_PICT_TYPES (LIBAVCODEC_VERSION_MAJOR < 54)
64
+#endif
62 65
 
63 66
 #endif /* AVCODEC_VERSION_H */
... ...
@@ -27,7 +27,7 @@
27 27
 
28 28
 #define LIBAVFILTER_VERSION_MAJOR  2
29 29
 #define LIBAVFILTER_VERSION_MINOR  3
30
-#define LIBAVFILTER_VERSION_MICRO  0
30
+#define LIBAVFILTER_VERSION_MICRO  1
31 31
 
32 32
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
33 33
                                                LIBAVFILTER_VERSION_MINOR, \
... ...
@@ -115,7 +115,7 @@ typedef struct AVFilterBufferRefVideoProps {
115 115
     AVRational pixel_aspect;    ///< pixel aspect ratio
116 116
     int interlaced;             ///< is frame interlaced
117 117
     int top_field_first;        ///< field order
118
-    int pict_type;              ///< Picture type of the frame
118
+    enum AVPictureType pict_type; ///< picture type of the frame
119 119
     int key_frame;              ///< 1 -> keyframe, 0-> not
120 120
 } AVFilterBufferRefVideoProps;
121 121
 
... ...
@@ -40,7 +40,7 @@
40 40
 #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
41 41
 
42 42
 #define LIBAVUTIL_VERSION_MAJOR 51
43
-#define LIBAVUTIL_VERSION_MINOR  0
43
+#define LIBAVUTIL_VERSION_MINOR  1
44 44
 #define LIBAVUTIL_VERSION_MICRO  0
45 45
 
46 46
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
... ...
@@ -94,6 +94,25 @@ enum AVMediaType {
94 94
 #define AV_TIME_BASE            1000000
95 95
 #define AV_TIME_BASE_Q          (AVRational){1, AV_TIME_BASE}
96 96
 
97
+enum AVPictureType {
98
+    AV_PICTURE_TYPE_I = 1, ///< Intra
99
+    AV_PICTURE_TYPE_P,     ///< Predicted
100
+    AV_PICTURE_TYPE_B,     ///< Bi-dir predicted
101
+    AV_PICTURE_TYPE_S,     ///< S(GMC)-VOP MPEG4
102
+    AV_PICTURE_TYPE_SI,    ///< Switching Intra
103
+    AV_PICTURE_TYPE_SP,    ///< Switching Predicted
104
+    AV_PICTURE_TYPE_BI,    ///< BI type
105
+};
106
+
107
+/**
108
+ * Return a single letter to describe the given picture type
109
+ * pict_type.
110
+ *
111
+ * @param[in] pict_type the picture type @return a single character
112
+ * representing the picture type, '?' if pict_type is unknown
113
+ */
114
+char av_get_picture_type_char(enum AVPictureType pict_type);
115
+
97 116
 #include "common.h"
98 117
 #include "error.h"
99 118
 #include "mathematics.h"
... ...
@@ -39,3 +39,17 @@ const char *avutil_license(void)
39 39
 #define LICENSE_PREFIX "libavutil license: "
40 40
     return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;
41 41
 }
42
+
43
+char av_get_picture_type_char(enum AVPictureType pict_type)
44
+{
45
+    switch (pict_type) {
46
+    case AV_PICTURE_TYPE_I:  return 'I';
47
+    case AV_PICTURE_TYPE_P:  return 'P';
48
+    case AV_PICTURE_TYPE_B:  return 'B';
49
+    case AV_PICTURE_TYPE_S:  return 'S';
50
+    case AV_PICTURE_TYPE_SI: return 'i';
51
+    case AV_PICTURE_TYPE_SP: return 'p';
52
+    case AV_PICTURE_TYPE_BI: return 'b';
53
+    default:                 return '?';
54
+    }
55
+}