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
13 13
14API changes, most recent first:14API changes, most recent first:
15 15
162011-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
162011-04-xx - xxxxxx - lavfi 2.3.0 - avfilter.h212011-04-xx - xxxxxx - lavfi 2.3.0 - avfilter.h
17 Add pict_type and key_frame fields to AVFilterBufferRefVideo.22 Add pict_type and key_frame fields to AVFilterBufferRefVideo.
18 23
libavcodec/avcodec.h+15−9
@@ -762,7 +762,7 @@ typedef struct AVPanScan{ · 761 unmodified lines
762 * - encoding: Set by libavcodec. for coded_picture (and set by user for input).\762 * - encoding: Set by libavcodec. for coded_picture (and set by user for input).\
763 * - decoding: Set by libavcodec.\763 * - decoding: Set by libavcodec.\
764 */\764 */\
765 int pict_type;\765 enum AVPictureType pict_type;\
766\766\
767 /**\767 /**\
768 * presentation timestamp in time_base units (time when frame should be shown to user)\768 * presentation timestamp in time_base units (time when frame should be shown to user)\
@@ -1004,14 +1004,16 @@ typedef struct AVPanScan{ · 235 unmodified lines
1004#define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.1004#define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
1005#define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.1005#define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
1006 1006
1007 1007#if FF_API_OLD_FF_PICT_TYPES
1008#define FF_I_TYPE 1 ///< Intra1008/* DEPRECATED, directly use the AV_PICTURE_TYPE_* enum values */
1009#define FF_P_TYPE 2 ///< Predicted1009#define FF_I_TYPE AV_PICTURE_TYPE_I ///< Intra
1010#define FF_B_TYPE 3 ///< Bi-dir predicted1010#define FF_P_TYPE AV_PICTURE_TYPE_P ///< Predicted
1011#define FF_S_TYPE 4 ///< S(GMC)-VOP MPEG41011#define FF_B_TYPE AV_PICTURE_TYPE_B ///< Bi-dir predicted
1012#define FF_SI_TYPE 5 ///< Switching Intra1012#define FF_S_TYPE AV_PICTURE_TYPE_S ///< S(GMC)-VOP MPEG4
1013#define FF_SP_TYPE 6 ///< Switching Predicted1013#define FF_SI_TYPE AV_PICTURE_TYPE_SI ///< Switching Intra
1014#define FF_BI_TYPE 71014#define FF_SP_TYPE AV_PICTURE_TYPE_SP ///< Switching Predicted
1015#define FF_BI_TYPE AV_PICTURE_TYPE_BI
1016#endif
1015 1017
1016#define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore).1018#define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore).
1017#define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.1019#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
3766 3768
3767/* misc useful functions */3769/* misc useful functions */
3768 3770
3771#if FF_API_OLD_FF_PICT_TYPES
3769/**3772/**
3770 * Return a single letter to describe the given picture type pict_type.3773 * Return a single letter to describe the given picture type pict_type.
3771 *3774 *
3772 * @param[in] pict_type the picture type3775 * @param[in] pict_type the picture type
3773 * @return A single character representing the picture type.3776 * @return A single character representing the picture type.
3777 * @deprecated Use av_get_picture_type_char() instead.
3774 */3778 */
3779attribute_deprecated
3775char av_get_pict_type_char(int pict_type);3780char av_get_pict_type_char(int pict_type);
3781#endif
3776 3782
3777/**3783/**
3778 * Return codec bits per sample.3784 * Return codec bits per sample.
libavcodec/utils.c+3−10
@@ -1030,18 +1030,11 @@ void avcodec_default_free_buffers(AVCodecContext *s){ · 1029 unmodified lines
1030 s->internal_buffer_count=0;1030 s->internal_buffer_count=0;
1031}1031}
1032 1032
1033#if FF_API_OLD_FF_PICT_TYPES
1033char av_get_pict_type_char(int pict_type){1034char av_get_pict_type_char(int pict_type){
1034 switch(pict_type){1035 return av_get_picture_type_char(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 }
1044}1036}
1037#endif
1045 1038
1046int av_get_bits_per_sample(enum CodecID codec_id){1039int av_get_bits_per_sample(enum CodecID codec_id){
1047 switch(codec_id){1040 switch(codec_id){
libavcodec/version.h+4−1
@@ -22,7 +22,7 @@ · 21 unmodified lines
22 22
23#define LIBAVCODEC_VERSION_MAJOR 5323#define LIBAVCODEC_VERSION_MAJOR 53
24#define LIBAVCODEC_VERSION_MINOR 124#define LIBAVCODEC_VERSION_MINOR 1
25#define LIBAVCODEC_VERSION_MICRO 025#define LIBAVCODEC_VERSION_MICRO 1
26 26
27#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \27#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
28 LIBAVCODEC_VERSION_MINOR, \28 LIBAVCODEC_VERSION_MINOR, \
@@ -59,5 +59,8 @@ · 30 unmodified lines
59#ifndef FF_API_THREAD_INIT59#ifndef FF_API_THREAD_INIT
60#define FF_API_THREAD_INIT (LIBAVCODEC_VERSION_MAJOR < 54)60#define FF_API_THREAD_INIT (LIBAVCODEC_VERSION_MAJOR < 54)
61#endif61#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#endif /* AVCODEC_VERSION_H */66#endif /* AVCODEC_VERSION_H */
libavfilter/avfilter.h+2−2
@@ -27,7 +27,7 @@ · 26 unmodified lines
27 27
28#define LIBAVFILTER_VERSION_MAJOR 228#define LIBAVFILTER_VERSION_MAJOR 2
29#define LIBAVFILTER_VERSION_MINOR 329#define LIBAVFILTER_VERSION_MINOR 3
30#define LIBAVFILTER_VERSION_MICRO 030#define LIBAVFILTER_VERSION_MICRO 1
31 31
32#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \32#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
33 LIBAVFILTER_VERSION_MINOR, \33 LIBAVFILTER_VERSION_MINOR, \
@@ -115,7 +115,7 @@ typedef struct AVFilterBufferRefVideoProps { · 81 unmodified lines
115 AVRational pixel_aspect; ///< pixel aspect ratio115 AVRational pixel_aspect; ///< pixel aspect ratio
116 int interlaced; ///< is frame interlaced116 int interlaced; ///< is frame interlaced
117 int top_field_first; ///< field order117 int top_field_first; ///< field order
118 int pict_type; ///< Picture type of the frame118 enum AVPictureType pict_type; ///< picture type of the frame
119 int key_frame; ///< 1 -> keyframe, 0-> not119 int key_frame; ///< 1 -> keyframe, 0-> not
120} AVFilterBufferRefVideoProps;120} AVFilterBufferRefVideoProps;
121 121
libavutil/avutil.h+20−1
@@ -40,7 +40,7 @@ · 39 unmodified lines
40#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)40#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
41 41
42#define LIBAVUTIL_VERSION_MAJOR 5142#define LIBAVUTIL_VERSION_MAJOR 51
43#define LIBAVUTIL_VERSION_MINOR 043#define LIBAVUTIL_VERSION_MINOR 1
44#define LIBAVUTIL_VERSION_MICRO 044#define LIBAVUTIL_VERSION_MICRO 0
45 45
46#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \46#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -94,6 +94,25 @@ enum AVMediaType { · 47 unmodified lines
94#define AV_TIME_BASE 100000094#define AV_TIME_BASE 1000000
95#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}95#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
96 96
97enum 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 */
114char av_get_picture_type_char(enum AVPictureType pict_type);
115
97#include "common.h"116#include "common.h"
98#include "error.h"117#include "error.h"
99#include "mathematics.h"118#include "mathematics.h"
libavutil/utils.c+14−0
@@ -39,3 +39,17 @@ const char *avutil_license(void) · 38 unmodified lines
39#define LICENSE_PREFIX "libavutil license: "39#define LICENSE_PREFIX "libavutil license: "
40 return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;40 return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;
41}41}
42
43char 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