History

lavfi: use int64_t lists in AVFilteFormats

The list type was changed to int64_t to be able to hold channel layouts. avfilter_make_format_list() still takes a int32_t array and converts it to int64_t. A new function, avfilter_make_format64_list, that takes int64_t arrays has been added.

Mina Nagy Zaki committed 15 years ago

Commit 527ca391 parent 8f349b63 files · +40 −15Browse files

Unified · Split

3 files
  1. doc/APIchanges +8 −0
  2. libavfilter/avfilter.h +4 −3
  3. libavfilter/formats.c +28 −12
doc/APIchanges+8−0
@@ -13,6 +13,14 @@ libavutil: 2011-04-18 · 12 unmodified lines
13 13
14API changes, most recent first:14API changes, most recent first:
15 15
162011-06-19 - xxxxxxx - lavfi 2.22.0 - AVFilterFormats
17 Change type of AVFilterFormats.formats from int * to int64_t *,
18 and update formats handling API accordingly.
19
20 avfilter_make_format_list() still takes a int32_t array and converts
21 it to int64_t. A new function, avfilter_make_format64_list(), that
22 takes int64_t arrays has been added.
23
162011-06-19 - xxxxxxx - lavfi 2.21.0 - vsink_buffer.h242011-06-19 - xxxxxxx - lavfi 2.21.0 - vsink_buffer.h
17 Add video sink buffer and vsink_buffer.h public header.25 Add video sink buffer and vsink_buffer.h public header.
18 26
libavfilter/avfilter.h+4−3
@@ -26,7 +26,7 @@ · 25 unmodified lines
26#include "libavutil/samplefmt.h"26#include "libavutil/samplefmt.h"
27 27
28#define LIBAVFILTER_VERSION_MAJOR 228#define LIBAVFILTER_VERSION_MAJOR 2
29#define LIBAVFILTER_VERSION_MINOR 2129#define LIBAVFILTER_VERSION_MINOR 22
30#define LIBAVFILTER_VERSION_MICRO 030#define LIBAVFILTER_VERSION_MICRO 0
31 31
32#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \32#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
@@ -223,7 +223,7 @@ void avfilter_unref_buffer(AVFilterBufferRef *ref); · 190 unmodified lines
223 */223 */
224typedef struct AVFilterFormats {224typedef struct AVFilterFormats {
225 unsigned format_count; ///< number of formats225 unsigned format_count; ///< number of formats
226 int *formats; ///< list of media formats226 int64_t *formats; ///< list of media formats
227 227
228 unsigned refcount; ///< number of references to this list228 unsigned refcount; ///< number of references to this list
229 struct AVFilterFormats ***refs; ///< references to this list229 struct AVFilterFormats ***refs; ///< references to this list
@@ -238,6 +238,7 @@ typedef struct AVFilterFormats { · 8 unmodified lines
238 * @return the format list, with no existing references238 * @return the format list, with no existing references
239 */239 */
240AVFilterFormats *avfilter_make_format_list(const int *fmts);240AVFilterFormats *avfilter_make_format_list(const int *fmts);
241AVFilterFormats *avfilter_make_format64_list(const int64_t *fmts);
241 242
242/**243/**
243 * Add fmt to the list of media formats contained in *avff.244 * Add fmt to the list of media formats contained in *avff.
@@ -247,7 +248,7 @@ AVFilterFormats *avfilter_make_format_list(const int *fmts); · 3 unmodified lines
247 * @return a non negative value in case of success, or a negative248 * @return a non negative value in case of success, or a negative
248 * value corresponding to an AVERROR code in case of error249 * value corresponding to an AVERROR code in case of error
249 */250 */
250int avfilter_add_format(AVFilterFormats **avff, int fmt);251int avfilter_add_format(AVFilterFormats **avff, int64_t fmt);
251 252
252/**253/**
253 * Return a list of all formats supported by FFmpeg for the given media type.254 * Return a list of all formats supported by FFmpeg for the given media type.
libavfilter/formats.c+28−12
@@ -72,28 +72,44 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b) · 71 unmodified lines
72 return ret;72 return ret;
73}73}
74 74
75#define MAKE_FORMAT_LIST() \
76 AVFilterFormats *formats; \
77 int count = 0; \
78 if (fmts) \
79 for (count = 0; fmts[count] != -1; count++) \
80 ; \
81 formats = av_mallocz(sizeof(AVFilterFormats)); \
82 if (!formats) return NULL; \
83 formats->format_count = count; \
84 if (count) { \
85 formats->formats = av_malloc(sizeof(*formats->formats)*count); \
86 if (!formats->formats) { \
87 av_free(formats); \
88 return NULL; \
89 } \
90 }
91
75AVFilterFormats *avfilter_make_format_list(const int *fmts)92AVFilterFormats *avfilter_make_format_list(const int *fmts)
76{93{
77 AVFilterFormats *formats;94 MAKE_FORMAT_LIST();
78 int count = 0;95 while (count--)
96 formats->formats[count] = fmts[count];
79 97
80 if (fmts)98 return formats;
81 for (count = 0; fmts[count] != -1; count++)99}
82 ;
83 100
84 formats = av_mallocz(sizeof(AVFilterFormats));101AVFilterFormats *avfilter_make_format64_list(const int64_t *fmts)
85 formats->format_count = count;102{
86 if (count) {103 MAKE_FORMAT_LIST();
87 formats->formats = av_malloc(sizeof(*formats->formats) * count);104 if (count)
88 memcpy(formats->formats, fmts, sizeof(*formats->formats) * count);105 memcpy(formats->formats, fmts, sizeof(*formats->formats) * count);
89 }
90 106
91 return formats;107 return formats;
92}108}
93 109
94int avfilter_add_format(AVFilterFormats **avff, int fmt)110int avfilter_add_format(AVFilterFormats **avff, int64_t fmt)
95{111{
96 int *fmts;112 int64_t *fmts;
97 113
98 if (!(*avff) && !(*avff = av_mallocz(sizeof(AVFilterFormats))))114 if (!(*avff) && !(*avff = av_mallocz(sizeof(AVFilterFormats))))
99 return AVERROR(ENOMEM);115 return AVERROR(ENOMEM);

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