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
1313
1414 API changes, most recent first:
1515
16+2011-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+
1624 2011-06-19 - xxxxxxx - lavfi 2.21.0 - vsink_buffer.h
1725 Add video sink buffer and vsink_buffer.h public header.
1826
libavfilter/avfilter.h+4−3
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626 #include "libavutil/samplefmt.h"
2727
2828 #define LIBAVFILTER_VERSION_MAJOR 2
29−#define LIBAVFILTER_VERSION_MINOR 21
29+#define LIBAVFILTER_VERSION_MINOR 22
3030 #define LIBAVFILTER_VERSION_MICRO 0
3131
3232 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
@@ -223,7 +223,7 @@ void avfilter_unref_buffer(AVFilterBufferRef *ref); · 190 unmodified lines
223223 */
224224 typedef struct AVFilterFormats {
225225 unsigned format_count; ///< number of formats
226− int *formats; ///< list of media formats
226+ int64_t *formats; ///< list of media formats
227227
228228 unsigned refcount; ///< number of references to this list
229229 struct AVFilterFormats ***refs; ///< references to this list
@@ -238,6 +238,7 @@ typedef struct AVFilterFormats { · 8 unmodified lines
238238 * @return the format list, with no existing references
239239 */
240240 AVFilterFormats *avfilter_make_format_list(const int *fmts);
241+AVFilterFormats *avfilter_make_format64_list(const int64_t *fmts);
241242
242243 /**
243244 * 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
247248 * @return a non negative value in case of success, or a negative
248249 * value corresponding to an AVERROR code in case of error
249250 */
250−int avfilter_add_format(AVFilterFormats **avff, int fmt);
251+int avfilter_add_format(AVFilterFormats **avff, int64_t fmt);
251252
252253 /**
253254 * 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
7272 return ret;
7373 }
7474
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+
7592 AVFilterFormats *avfilter_make_format_list(const int *fmts)
7693 {
77− AVFilterFormats *formats;
78− int count = 0;
94+ MAKE_FORMAT_LIST();
95+ while (count--)
96+ formats->formats[count] = fmts[count];
7997
80− if (fmts)
81− for (count = 0; fmts[count] != -1; count++)
82− ;
98+ return formats;
99+}
83100
84− formats = av_mallocz(sizeof(AVFilterFormats));
85− formats->format_count = count;
86− if (count) {
87− formats->formats = av_malloc(sizeof(*formats->formats) * count);
101+AVFilterFormats *avfilter_make_format64_list(const int64_t *fmts)
102+{
103+ MAKE_FORMAT_LIST();
104+ if (count)
88105 memcpy(formats->formats, fmts, sizeof(*formats->formats) * count);
89− }
90106
91107 return formats;
92108 }
93109
94−int avfilter_add_format(AVFilterFormats **avff, int fmt)
110+int avfilter_add_format(AVFilterFormats **avff, int64_t fmt)
95111 {
96− int *fmts;
112+ int64_t *fmts;
97113
98114 if (!(*avff) && !(*avff = av_mallocz(sizeof(AVFilterFormats))))
99115 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