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);
254 #define FORMATS_REF(f, ref) \ 257 f->refs = av_realloc(f->refs, sizeof(*f->refs) * ++f->refcount); \ 258 f->refs[f->refcount-1] = ref; \ 271 #define FIND_REF_INDEX(ref, idx) \ 274 for (i = 0; i < (*ref)->refcount; i ++) \ 275 if((*ref)->refs[i] == ref) { \ 281 #define FORMATS_UNREF(ref, list) \ 288 FIND_REF_INDEX(ref, idx); \ 291 memmove((*ref)->refs + idx, (*ref)->refs + idx + 1, \ 292 sizeof(*(*ref)->refs) * ((*ref)->refcount - idx - 1)); \ 294 if(!--(*ref)->refcount) { \ 295 av_free((*ref)->list); \ 296 av_free((*ref)->refs); \ 312 #define FORMATS_CHANGEREF(oldref, newref) \ 316 FIND_REF_INDEX(oldref, idx); \ 319 (*oldref)->refs[idx] = newref; \ 336 #define SET_COMMON_FORMATS(ctx, fmts, in_fmts, out_fmts, ref, list) \ 340 for (i = 0; i < ctx->nb_inputs; i++) { \ 341 if (ctx->inputs[i]) { \ 342 ref(fmts, &ctx->inputs[i]->out_fmts); \ 346 for (i = 0; i < ctx->nb_outputs; i++) { \ 347 if (ctx->outputs[i]) { \ 348 ref(fmts, &ctx->outputs[i]->in_fmts); \ 354 av_freep(&fmts->list); \ 355 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
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
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.