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++)
184 memcpy(formats->
formats, fmts,
sizeof(*formats->
formats) * count);
189 #define ADD_FORMAT(f, fmt, type, list, nb) \ 193 if (!(*f) && !(*f = av_mallocz(sizeof(**f)))) \ 194 return AVERROR(ENOMEM); \ 196 fmts = av_realloc((*f)->list, \ 197 sizeof(*(*f)->list) * ((*f)->nb + 1));\ 200 return AVERROR(ENOMEM); \ 204 (*f)->list[(*f)->nb++] = fmt; \ 215 ADD_FORMAT(l, channel_layout, uint64_t, channel_layouts, nb_channel_layouts);
262 #define FORMATS_REF(f, ref) \ 265 f->refs = av_realloc(f->refs, sizeof(*f->refs) * ++f->refcount); \ 268 f->refs[f->refcount-1] = ref; \ 281 #define FIND_REF_INDEX(ref, idx) \ 284 for (i = 0; i < (*ref)->refcount; i ++) \ 285 if((*ref)->refs[i] == ref) { \ 291 #define FORMATS_UNREF(ref, list) \ 298 FIND_REF_INDEX(ref, idx); \ 301 memmove((*ref)->refs + idx, (*ref)->refs + idx + 1, \ 302 sizeof(*(*ref)->refs) * ((*ref)->refcount - idx - 1)); \ 304 if(!--(*ref)->refcount) { \ 305 av_free((*ref)->list); \ 306 av_free((*ref)->refs); \ 322 #define FORMATS_CHANGEREF(oldref, newref) \ 326 FIND_REF_INDEX(oldref, idx); \ 329 (*oldref)->refs[idx] = newref; \ 346 #define SET_COMMON_FORMATS(ctx, fmts, in_fmts, out_fmts, ref, list) \ 350 for (i = 0; i < ctx->nb_inputs; i++) { \ 351 if (ctx->inputs[i]) { \ 352 ref(fmts, &ctx->inputs[i]->out_fmts); \ 356 for (i = 0; i < ctx->nb_outputs; i++) { \ 357 if (ctx->outputs[i]) { \ 358 ref(fmts, &ctx->outputs[i]->in_fmts); \ 364 av_freep(&fmts->list); \ 365 av_freep(&fmts->refs); \ void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Number of sample formats. DO NOT USE if linking dynamically.
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
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
uint64_t * channel_layouts
list of channel layouts
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
AVSampleFormat
Audio Sample Formats.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
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
void * av_mallocz(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_next(const AVPixFmtDescriptor *prev)
Iterate over all pixel format descriptors known to libavutil.