31 #define MERGE_REF(ret, a, fmts, type, fail) \
36 if (!(tmp = av_realloc(ret->refs, \
37 sizeof(*tmp) * (ret->refcount + a->refcount)))) \
41 for (i = 0; i < a->refcount; i ++) { \
42 ret->refs[ret->refcount] = a->refs[i]; \
43 *ret->refs[ret->refcount++] = ret; \
55 #define MERGE_FORMATS(ret, a, b, fmts, nb, type, fail) \
57 int i, j, k = 0, count = FFMIN(a->nb, b->nb); \
59 if (!(ret = av_mallocz(sizeof(*ret)))) \
63 if (!(ret->fmts = av_malloc(sizeof(*ret->fmts) * count))) \
65 for (i = 0; i < a->nb; i++) \
66 for (j = 0; j < b->nb; j++) \
67 if (a->fmts[i] == b->fmts[j]) \
68 ret->fmts[k++] = a->fmts[i]; \
76 MERGE_REF(ret, a, fmts, type, fail); \
77 MERGE_REF(ret, b, fmts, type, fail); \
104 if (a == b)
return a;
131 if (a == b)
return a;
134 MERGE_FORMATS(ret, a, b, channel_layouts, nb_channel_layouts,
170 for (count = 0; fmts[count] != -1; count++)
177 memcpy(formats->
formats, fmts,
sizeof(*formats->
formats) * count);
182 #define ADD_FORMAT(f, fmt, type, list, nb) \
186 if (!(*f) && !(*f = av_mallocz(sizeof(**f)))) \
187 return AVERROR(ENOMEM); \
189 fmts = av_realloc((*f)->list, \
190 sizeof(*(*f)->list) * ((*f)->nb + 1));\
192 return AVERROR(ENOMEM); \
195 (*f)->list[(*f)->nb++] = fmt; \
206 ADD_FORMAT(l, channel_layout, uint64_t, channel_layouts, nb_channel_layouts);
216 for (fmt = 0; fmt < num_formats; fmt++) {
250 #define FORMATS_REF(f, ref) \
253 f->refs = av_realloc(f->refs, sizeof(*f->refs) * ++f->refcount); \
254 f->refs[f->refcount-1] = ref; \
267 #define FIND_REF_INDEX(ref, idx) \
270 for (i = 0; i < (*ref)->refcount; i ++) \
271 if((*ref)->refs[i] == ref) { \
277 #define FORMATS_UNREF(ref, list) \
284 FIND_REF_INDEX(ref, idx); \
287 memmove((*ref)->refs + idx, (*ref)->refs + idx + 1, \
288 sizeof(*(*ref)->refs) * ((*ref)->refcount - idx - 1)); \
290 if(!--(*ref)->refcount) { \
291 av_free((*ref)->list); \
292 av_free((*ref)->refs); \
308 #define FORMATS_CHANGEREF(oldref, newref) \
312 FIND_REF_INDEX(oldref, idx); \
315 (*oldref)->refs[idx] = newref; \
332 #define SET_COMMON_FORMATS(ctx, fmts, in_fmts, out_fmts, ref, list) \
336 for (i = 0; i < ctx->nb_inputs; i++) { \
337 if (ctx->inputs[i]) { \
338 ref(fmts, &ctx->inputs[i]->out_fmts); \
342 for (i = 0; i < ctx->nb_outputs; i++) { \
343 if (ctx->outputs[i]) { \
344 ref(fmts, &ctx->outputs[i]->in_fmts); \
350 av_freep(&fmts->list); \
351 av_freep(&fmts->refs); \
Number of sample formats. DO NOT USE if linking dynamically.
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Main libavfilter public API header.
static enum AVSampleFormat formats[]
struct AVFilterChannelLayouts *** refs
references to this list
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
AVFilterLink ** inputs
array of pointers to input links
uint64_t * channel_layouts
list of channel layouts
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
AVFilterLink ** outputs
array of pointers to output links
enum MovChannelLayoutTag * layouts
enum AVMediaType type
filter media type
common internal and external API header
int nb_channel_layouts
number of channel layouts
number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of...
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...