Define a new struct AVFilterBufferRefVideoProps and add a type field to AVFilterBufferRef. Video specific properties in AVFilterBufferRefVideoProps are now referred to by *video pointer in AVFilterBufferRef. Patch by S.N. Hemanth Meenakshisundaram smeenaks->ucsd.edu. Originally committed as revision 24763 to svn://svn.ffmpeg.org/ffmpeg/trunk
Showing the changes to libavfilter/avfilter.h (1 of 10 files). Show all
Unified · Split
| @@ -25,7 +25,7 @@ · 24 unmodified lines | |||
| 25 | #include "libavutil/avutil.h" | 25 | #include "libavutil/avutil.h" |
| 26 | 26 | ||
| 27 | #define LIBAVFILTER_VERSION_MAJOR 1 | 27 | #define LIBAVFILTER_VERSION_MAJOR 1 |
| 28 | #define LIBAVFILTER_VERSION_MINOR 31 | 28 | #define LIBAVFILTER_VERSION_MINOR 32 |
| 29 | #define LIBAVFILTER_VERSION_MICRO 0 | 29 | #define LIBAVFILTER_VERSION_MICRO 0 |
| 30 | 30 | ||
| 31 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ | 31 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ |
| @@ -88,6 +88,20 @@ typedef struct AVFilterBuffer · 56 unmodified lines | |||
| 88 | #define AV_PERM_REUSE 0x08 ///< can output the buffer multiple times, with the same contents each time | 88 | #define AV_PERM_REUSE 0x08 ///< can output the buffer multiple times, with the same contents each time |
| 89 | #define AV_PERM_REUSE2 0x10 ///< can output the buffer multiple times, modified each time | 89 | #define AV_PERM_REUSE2 0x10 ///< can output the buffer multiple times, modified each time |
| 90 | 90 | ||
| 91 | /** | ||
| 92 | * Video specific properties in a reference to an AVFilterBuffer. Since | ||
| 93 | * AVFilterBufferRef is common to different media formats, video specific | ||
| 94 | * per reference properties must be separated out. | ||
| 95 | */ | ||
| 96 | typedef struct AVFilterBufferRefVideoProps | ||
| 97 | { | ||
| 98 | int w; ///< image width | ||
| 99 | int h; ///< image height | ||
| 100 | AVRational pixel_aspect; ///< pixel aspect ratio | ||
| 101 | int interlaced; ///< is frame interlaced | ||
| 102 | int top_field_first; ///< field order | ||
| 103 | } AVFilterBufferRefVideoProps; | ||
| 104 | |||
| 91 | /** | 105 | /** |
| 92 | * A reference to an AVFilterBuffer. Since filters can manipulate the origin of | 106 | * A reference to an AVFilterBuffer. Since filters can manipulate the origin of |
| 93 | * a buffer to, for example, crop image without any memcpy, the buffer origin | 107 | * a buffer to, for example, crop image without any memcpy, the buffer origin |
| @@ -101,19 +115,15 @@ typedef struct AVFilterBufferRef · 7 unmodified lines | |||
| 101 | AVFilterBuffer *buf; ///< the buffer that this is a reference to | 115 | AVFilterBuffer *buf; ///< the buffer that this is a reference to |
| 102 | uint8_t *data[4]; ///< picture data for each plane | 116 | uint8_t *data[4]; ///< picture data for each plane |
| 103 | int linesize[4]; ///< number of bytes per line | 117 | int linesize[4]; ///< number of bytes per line |
| 104 | int w; ///< image width | ||
| 105 | int h; ///< image height | ||
| 106 | int format; ///< media format | 118 | int format; ///< media format |
| 107 | 119 | ||
| 108 | int64_t pts; ///< presentation timestamp in units of 1/AV_TIME_BASE | 120 | int64_t pts; ///< presentation timestamp in units of 1/AV_TIME_BASE |
| 109 | int64_t pos; ///< byte position in stream, -1 if unknown | 121 | int64_t pos; ///< byte position in stream, -1 if unknown |
| 110 | 122 | ||
| 111 | AVRational pixel_aspect; ///< pixel aspect ratio | ||
| 112 | |||
| 113 | int perms; ///< permissions, see the AV_PERM_* flags | 123 | int perms; ///< permissions, see the AV_PERM_* flags |
| 114 | 124 | ||
| 115 | int interlaced; ///< is frame interlaced | 125 | enum AVMediaType type; ///< media type of buffer data |
| 116 | int top_field_first; | 126 | AVFilterBufferRefVideoProps *video; ///< video buffer specific properties |
| 117 | } AVFilterBufferRef; | 127 | } AVFilterBufferRef; |
| 118 | 128 | ||
| 119 | /** | 129 | /** |
| @@ -122,13 +132,13 @@ typedef struct AVFilterBufferRef · 2 unmodified lines | |||
| 122 | */ | 132 | */ |
| 123 | static inline void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src) | 133 | static inline void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src) |
| 124 | { | 134 | { |
| 135 | // copy common properties | ||
| 125 | dst->pts = src->pts; | 136 | dst->pts = src->pts; |
| 126 | dst->pos = src->pos; | 137 | dst->pos = src->pos; |
| 127 | dst->pixel_aspect = src->pixel_aspect; | 138 | |
| 128 | dst->interlaced = src->interlaced; | 139 | switch (src->type) { |
| 129 | dst->top_field_first = src->top_field_first; | 140 | case AVMEDIA_TYPE_VIDEO: *dst->video = *src->video; break; |
| 130 | dst->w = src->w; | 141 | } |
| 131 | dst->h = src->h; | ||
| 132 | } | 142 | } |
| 133 | 143 | ||
| 134 | /** | 144 | /** |