32 #define KNOWN(l) (!FF_LAYOUT2COUNT(l))  
   37 #define MERGE_REF(ret, a, fmts, type, fail)                                \ 
   42     if (!(tmp = av_realloc_array(ret->refs, ret->refcount + a->refcount,   \ 
   47     for (i = 0; i < a->refcount; i ++) {                                   \ 
   48         ret->refs[ret->refcount] = a->refs[i];                             \ 
   49         *ret->refs[ret->refcount++] = ret;                                 \ 
   61 #define MERGE_FORMATS(ret, a, b, fmts, nb, type, fail)                          \ 
   63     int i, j, k = 0, count = FFMIN(a->nb, b->nb);                               \ 
   65     if (!(ret = av_mallocz(sizeof(*ret))))                                      \ 
   69         if (!(ret->fmts = av_malloc_array(count, sizeof(*ret->fmts))))          \ 
   71         for (i = 0; i < a->nb; i++)                                             \ 
   72             for (j = 0; j < b->nb; j++)                                         \ 
   73                 if (a->fmts[i] == b->fmts[j]) {                                 \ 
   74                     if(k >= FFMIN(a->nb, b->nb)){                               \ 
   75                         av_log(NULL, AV_LOG_ERROR, "Duplicate formats in avfilter_merge_formats() detected\n"); \ 
   80                     ret->fmts[k++] = a->fmts[i];                                \ 
   88     MERGE_REF(ret, a, fmts, type, fail);                                        \ 
   89     MERGE_REF(ret, b, fmts, type, fail);                                        \ 
   97     int alpha1=0, alpha2=0;
 
   98     int chroma1=0, chroma2=0;
 
  124     if (alpha2 > alpha1 || chroma2 > chroma1)
 
  144     if (a == b) 
return a;
 
  172     int ret_max, ret_nb = 0, i, j, 
round;
 
  174     if (a == b) 
return a;
 
  179         FFSWAP(
unsigned, a_all, b_all);
 
  182         if (a_all == 1 && !b_all) {
 
  216     for (round = 0; round < 2; round++) {
 
  219             if (!fmt || !
KNOWN(fmt))
 
  258     for (p = fmts; *p != -1; p++) {
 
  265 #define MAKE_FORMAT_LIST(type, field, count_field)                      \ 
  269         for (count = 0; fmts[count] != -1; count++)                     \ 
  271     formats = av_mallocz(sizeof(*formats));                             \ 
  274     formats->count_field = count;                                       \ 
  276         formats->field = av_malloc_array(count, sizeof(*formats->field));      \ 
  277         if (!formats->field) {                                          \ 
  278             av_freep(&formats);                                         \ 
  295                      channel_layouts, nb_channel_layouts);
 
  297         memcpy(
formats->channel_layouts, fmts,
 
  303 #define ADD_FORMAT(f, fmt, type, list, nb)                  \ 
  308     if (!(*f) && !(*f = av_mallocz(sizeof(**f))))           \ 
  309         return AVERROR(ENOMEM);                             \ 
  311     fmts = av_realloc_array((*f)->list, (*f)->nb + 1,       \ 
  312                             sizeof(*(*f)->list));           \ 
  316         return AVERROR(ENOMEM);                             \ 
  320     (*f)->list[(*f)->nb++] = fmt;                           \ 
  332     ADD_FORMAT(l, channel_layout, uint64_t, channel_layouts, nb_channel_layouts);
 
  403 #define FORMATS_REF(f, ref)                                                     \ 
  407         return AVERROR_BUG;                                                     \ 
  409     tmp = av_realloc_array(f->refs, sizeof(*f->refs), f->refcount + 1);         \ 
  411         return AVERROR(ENOMEM);                                                 \ 
  413     f->refs[f->refcount++] = ref;                                               \ 
  427 #define FIND_REF_INDEX(ref, idx)            \ 
  430     for (i = 0; i < (*ref)->refcount; i ++) \ 
  431         if((*ref)->refs[i] == ref) {        \ 
  437 #define FORMATS_UNREF(ref, list)                                   \ 
  444     FIND_REF_INDEX(ref, idx);                                      \ 
  447         memmove((*ref)->refs + idx, (*ref)->refs + idx + 1,        \ 
  448             sizeof(*(*ref)->refs) * ((*ref)->refcount - idx - 1)); \ 
  450     if(!--(*ref)->refcount) {                                      \ 
  451         av_free((*ref)->list);                                     \ 
  452         av_free((*ref)->refs);                                     \ 
  468 #define FORMATS_CHANGEREF(oldref, newref)       \ 
  472     FIND_REF_INDEX(oldref, idx);                \ 
  475         (*oldref)->refs[idx] = newref;          \ 
  492 #define SET_COMMON_FORMATS(ctx, fmts, in_fmts, out_fmts, ref, list) \ 
  496         return AVERROR_BUG;                                         \ 
  498     for (i = 0; i < ctx->nb_inputs; i++) {                          \ 
  499         if (ctx->inputs[i] && !ctx->inputs[i]->out_fmts) {          \ 
  500             int ret = ref(fmts, &ctx->inputs[i]->out_fmts);         \ 
  506     for (i = 0; i < ctx->nb_outputs; i++) {                         \ 
  507         if (ctx->outputs[i] && !ctx->outputs[i]->in_fmts) {         \ 
  508             int ret = ref(fmts, &ctx->outputs[i]->in_fmts);         \ 
  516         av_freep(&fmts->list);                                      \ 
  517         av_freep(&fmts->refs);                                      \ 
  588         pix_fmt = strtol(arg, &tail, 0);
 
  603         sfmt = strtol(arg, &tail, 0);
 
  628     if (*tail || srate < 1 || (
int)srate != srate || srate > INT_MAX) {
 
  640     int64_t chlayout, 
count;
 
  643         count = strtol(arg, &tail, 10);
 
  644         if (*tail == 
'c' && !tail[1] && count > 0 && count < 63) {
 
  652         chlayout = strtol(arg, &tail, 10);
 
  653         if (*tail || chlayout == 0) {
 
int av_parse_ratio(AVRational *q, const char *str, int max, int log_offset, void *log_ctx)
Parse str and store the parsed ratio in q. 
static enum AVPixelFormat pix_fmt
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 
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout. 
uint64_t av_get_channel_layout(const char *name)
Return a channel layout id that matches name, or 0 if no match is found. 
AVFilterLink ** inputs
array of pointers to input links 
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel. 
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar. 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered. 
uint64_t * channel_layouts
list of channel layouts 
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format. 
simple assert() macros that are a bit more flexible than ISO C assert(). 
static av_always_inline av_const double round(double x)
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. 
char all_counts
accept any channel layout or count 
enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
uint8_t nb_components
The number of components each pixel has, (1-4) 
audio channel layout utility functions 
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code. 
A list of supported channel layouts. 
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout)
Return a description of a channel layout. 
double av_strtod(const char *numstr, char **tail)
Parse the string in numstr and return its value as a double. 
AVSampleFormat
Audio sample formats. 
char all_layouts
accept any known channel layout 
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
rational number numerator/denominator 
enum AVSampleFormat av_get_sample_fmt(const char *name)
Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE on error. 
AVFilterLink ** outputs
array of pointers to output links 
enum MovChannelLayoutTag * layouts
enum AVMediaType type
filter media type 
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample. 
common internal and external API header 
int nb_channel_layouts
number of channel layouts 
#define av_malloc_array(a, b)
#define FFSWAP(type, a, b)
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name. 
int main(int argc, char **argv)
AVPixelFormat
Pixel format. 
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
simple arithmetic expression evaluator 
const AVPixFmtDescriptor * av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
Iterate over all pixel format descriptors known to libavutil.