History

avfilter: make AVFilterFormats compatible with libav.

The list goes back to being simple integers, and avfilter_make_format64_list is fixed to work with the correct structure directly.

Nicolas George committed 14 years ago

Commit 5ac9ef61 parent 0e82d312 files · +14 −12Browse files

Unified · Split

2 files
  1. libavfilter/avfilter.h +1 −1
  2. libavfilter/formats.c +13 −11
libavfilter/avfilter.h+1−1
@@ -260,8 +260,8 @@ void avfilter_unref_bufferp(AVFilterBufferRef **ref); · 259 unmodified lines
260260 * pointer to each of the pointers to itself.
261261 */
262262 typedef struct AVFilterFormats {
263− int64_t *formats; ///< list of media formats
264263 unsigned format_count; ///< number of formats
264+ int *formats; ///< list of media formats
265265
266266 unsigned refcount; ///< number of references to this list
267267 struct AVFilterFormats ***refs; ///< references to this list
libavfilter/formats.c+13−11
@@ -196,18 +196,18 @@ int64_t *ff_copy_int64_list(const int64_t * const list) · 195 unmodified lines
196196 return ret;
197197 }
198198
199−#define MAKE_FORMAT_LIST() \
200− AVFilterFormats *formats; \
199+#define MAKE_FORMAT_LIST(type, field, count_field) \
200+ type *formats; \
201201 int count = 0; \
202202 if (fmts) \
203203 for (count = 0; fmts[count] != -1; count++) \
204204 ; \
205− formats = av_mallocz(sizeof(AVFilterFormats)); \
205+ formats = av_mallocz(sizeof(*formats)); \
206206 if (!formats) return NULL; \
207− formats->format_count = count; \
207+ formats->count_field = count; \
208208 if (count) { \
209− formats->formats = av_malloc(sizeof(*formats->formats)*count); \
210− if (!formats->formats) { \
209+ formats->field = av_malloc(sizeof(*formats->field)*count); \
210+ if (!formats->field) { \
211211 av_free(formats); \
212212 return NULL; \
213213 } \
@@ -215,7 +215,7 @@ int64_t *ff_copy_int64_list(const int64_t * const list) · 1 unmodified line
215215
216216 AVFilterFormats *avfilter_make_format_list(const int *fmts)
217217 {
218− MAKE_FORMAT_LIST();
218+ MAKE_FORMAT_LIST(AVFilterFormats, formats, format_count);
219219 while (count--)
220220 formats->formats[count] = fmts[count];
221221
@@ -224,11 +224,13 @@ AVFilterFormats *avfilter_make_format_list(const int *fmts) · 2 unmodified lines
224224
225225 AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts)
226226 {
227− MAKE_FORMAT_LIST();
227+ MAKE_FORMAT_LIST(AVFilterChannelLayouts,
228+ channel_layouts, nb_channel_layouts);
228229 if (count)
229− memcpy(formats->formats, fmts, sizeof(*formats->formats) * count);
230+ memcpy(formats->channel_layouts, fmts,
231+ sizeof(*formats->channel_layouts) * count);
230232
231− return (AVFilterChannelLayouts*)formats;
233+ return formats;
232234 }
233235
234236 #define ADD_FORMAT(f, fmt, type, list, nb) \
@@ -250,7 +252,7 @@ do { \ · 15 unmodified lines
250252
251253 int avfilter_add_format(AVFilterFormats **avff, int64_t fmt)
252254 {
253− ADD_FORMAT(avff, fmt, int64_t, formats, format_count);
255+ ADD_FORMAT(avff, fmt, int, formats, format_count);
254256 }
255257
256258 int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout)

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