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
260 * pointer to each of the pointers to itself.260 * pointer to each of the pointers to itself.
261 */261 */
262typedef struct AVFilterFormats {262typedef struct AVFilterFormats {
263 int64_t *formats; ///< list of media formats
264 unsigned format_count; ///< number of formats263 unsigned format_count; ///< number of formats
264 int *formats; ///< list of media formats
265 265
266 unsigned refcount; ///< number of references to this list266 unsigned refcount; ///< number of references to this list
267 struct AVFilterFormats ***refs; ///< references to this list267 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
196 return ret;196 return ret;
197}197}
198 198
199#define MAKE_FORMAT_LIST() \199#define MAKE_FORMAT_LIST(type, field, count_field) \
200 AVFilterFormats *formats; \200 type *formats; \
201 int count = 0; \201 int count = 0; \
202 if (fmts) \202 if (fmts) \
203 for (count = 0; fmts[count] != -1; count++) \203 for (count = 0; fmts[count] != -1; count++) \
204 ; \204 ; \
205 formats = av_mallocz(sizeof(AVFilterFormats)); \205 formats = av_mallocz(sizeof(*formats)); \
206 if (!formats) return NULL; \206 if (!formats) return NULL; \
207 formats->format_count = count; \207 formats->count_field = count; \
208 if (count) { \208 if (count) { \
209 formats->formats = av_malloc(sizeof(*formats->formats)*count); \209 formats->field = av_malloc(sizeof(*formats->field)*count); \
210 if (!formats->formats) { \210 if (!formats->field) { \
211 av_free(formats); \211 av_free(formats); \
212 return NULL; \212 return NULL; \
213 } \213 } \
@@ -215,7 +215,7 @@ int64_t *ff_copy_int64_list(const int64_t * const list) · 1 unmodified line
215 215
216AVFilterFormats *avfilter_make_format_list(const int *fmts)216AVFilterFormats *avfilter_make_format_list(const int *fmts)
217{217{
218 MAKE_FORMAT_LIST();218 MAKE_FORMAT_LIST(AVFilterFormats, formats, format_count);
219 while (count--)219 while (count--)
220 formats->formats[count] = fmts[count];220 formats->formats[count] = fmts[count];
221 221
@@ -224,11 +224,13 @@ AVFilterFormats *avfilter_make_format_list(const int *fmts) · 2 unmodified lines
224 224
225AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts)225AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts)
226{226{
227 MAKE_FORMAT_LIST();227 MAKE_FORMAT_LIST(AVFilterChannelLayouts,
228 channel_layouts, nb_channel_layouts);
228 if (count)229 if (count)
229 memcpy(formats->formats, fmts, sizeof(*formats->formats) * count);230 memcpy(formats->channel_layouts, fmts,
231 sizeof(*formats->channel_layouts) * count);
230 232
231 return (AVFilterChannelLayouts*)formats;233 return formats;
232}234}
233 235
234#define ADD_FORMAT(f, fmt, type, list, nb) \236#define ADD_FORMAT(f, fmt, type, list, nb) \
@@ -250,7 +252,7 @@ do { \ · 15 unmodified lines
250 252
251int avfilter_add_format(AVFilterFormats **avff, int64_t fmt)253int avfilter_add_format(AVFilterFormats **avff, int64_t fmt)
252{254{
253 ADD_FORMAT(avff, fmt, int64_t, formats, format_count);255 ADD_FORMAT(avff, fmt, int, formats, format_count);
254}256}
255 257
256int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout)258int 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