History

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.

Stefano Sabatini committed 15 years ago

Commit bebe72f1 parent 30fe9717 files · +63 −23Browse files

Unified · Split

7 files
  1. doc/APIchanges +5 −0
  2. libavcodec/avcodec.h +15 −9
  3. libavcodec/utils.c +3 −10
  4. libavcodec/version.h +4 −1
  5. libavfilter/avfilter.h +2 −2
  6. libavutil/avutil.h +20 −1
  7. libavutil/utils.c +14 −0
doc/APIchanges+5−0
@@ -13,6 +13,11 @@ libavutil: 2011-04-18 · 12 unmodified lines
1313
1414 API changes, most recent first:
1515
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+
1621 2011-04-xx - xxxxxx - lavfi 2.3.0 - avfilter.h
1722 Add pict_type and key_frame fields to AVFilterBufferRefVideo.
1823
libavcodec/avcodec.h+15−9
@@ -762,7 +762,7 @@ typedef struct AVPanScan{ · 761 unmodified lines
762762 * - encoding: Set by libavcodec. for coded_picture (and set by user for input).\
763763 * - decoding: Set by libavcodec.\
764764 */\
765− int pict_type;\
765+ enum AVPictureType pict_type;\
766766 \
767767 /**\
768768 * presentation timestamp in time_base units (time when frame should be shown to user)\
@@ -1004,14 +1004,16 @@ typedef struct AVPanScan{ · 235 unmodified lines
10041004 #define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
10051005 #define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
10061006
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
10151017
10161018 #define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore).
10171019 #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.
@@ -3766,13 +3768,17 @@ void avcodec_default_free_buffers(AVCodecContext *s); · 2748 unmodified lines
37663768
37673769 /* misc useful functions */
37683770
3771+#if FF_API_OLD_FF_PICT_TYPES
37693772 /**
37703773 * Return a single letter to describe the given picture type pict_type.
37713774 *
37723775 * @param[in] pict_type the picture type
37733776 * @return A single character representing the picture type.
3777+ * @deprecated Use av_get_picture_type_char() instead.
37743778 */
3779+attribute_deprecated
37753780 char av_get_pict_type_char(int pict_type);
3781+#endif
37763782
37773783 /**
37783784 * Return codec bits per sample.
libavcodec/utils.c+3−10
@@ -1030,18 +1030,11 @@ void avcodec_default_free_buffers(AVCodecContext *s){ · 1029 unmodified lines
10301030 s->internal_buffer_count=0;
10311031 }
10321032
1033+#if FF_API_OLD_FF_PICT_TYPES
10331034 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);
10441036 }
1037+#endif
10451038
10461039 int av_get_bits_per_sample(enum CodecID codec_id){
10471040 switch(codec_id){
libavcodec/version.h+4−1
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222
2323 #define LIBAVCODEC_VERSION_MAJOR 53
2424 #define LIBAVCODEC_VERSION_MINOR 1
25−#define LIBAVCODEC_VERSION_MICRO 0
25+#define LIBAVCODEC_VERSION_MICRO 1
2626
2727 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
2828 LIBAVCODEC_VERSION_MINOR, \
@@ -59,5 +59,8 @@ · 30 unmodified lines
5959 #ifndef FF_API_THREAD_INIT
6060 #define FF_API_THREAD_INIT (LIBAVCODEC_VERSION_MAJOR < 54)
6161 #endif
62+#ifndef FF_API_OLD_FF_PICT_TYPES
63+#define FF_API_OLD_FF_PICT_TYPES (LIBAVCODEC_VERSION_MAJOR < 54)
64+#endif
6265
6366 #endif /* AVCODEC_VERSION_H */
libavfilter/avfilter.h+2−2
@@ -27,7 +27,7 @@ · 26 unmodified lines
2727
2828 #define LIBAVFILTER_VERSION_MAJOR 2
2929 #define LIBAVFILTER_VERSION_MINOR 3
30−#define LIBAVFILTER_VERSION_MICRO 0
30+#define LIBAVFILTER_VERSION_MICRO 1
3131
3232 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
3333 LIBAVFILTER_VERSION_MINOR, \
@@ -115,7 +115,7 @@ typedef struct AVFilterBufferRefVideoProps { · 81 unmodified lines
115115 AVRational pixel_aspect; ///< pixel aspect ratio
116116 int interlaced; ///< is frame interlaced
117117 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
119119 int key_frame; ///< 1 -> keyframe, 0-> not
120120 } AVFilterBufferRefVideoProps;
121121
libavutil/avutil.h+20−1
@@ -40,7 +40,7 @@ · 39 unmodified lines
4040 #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
4141
4242 #define LIBAVUTIL_VERSION_MAJOR 51
43−#define LIBAVUTIL_VERSION_MINOR 0
43+#define LIBAVUTIL_VERSION_MINOR 1
4444 #define LIBAVUTIL_VERSION_MICRO 0
4545
4646 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -94,6 +94,25 @@ enum AVMediaType { · 47 unmodified lines
9494 #define AV_TIME_BASE 1000000
9595 #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
9696
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+
97116 #include "common.h"
98117 #include "error.h"
99118 #include "mathematics.h"
libavutil/utils.c+14−0
@@ -39,3 +39,17 @@ const char *avutil_license(void) · 38 unmodified lines
3939 #define LICENSE_PREFIX "libavutil license: "
4040 return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;
4141 }
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+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t