FFmpeg
Macros | Functions
formats.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/eval.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "internal.h"
#include "formats.h"

Go to the source code of this file.

Macros

#define KNOWN(l)   (!FF_LAYOUT2COUNT(l)) /* for readability */
 
#define MERGE_REF(ret, a, fmts, type, fail_statement)
 Add all refs from a to ret and destroy a. More...
 
#define MERGE_FORMATS(a, b, fmts, nb, type, check, empty_allowed)
 Add all formats common to a and b to a, add b's refs to a and destroy b. More...
 
#define MAKE_FORMAT_LIST(type, field, count_field)
 
#define ADD_FORMAT(f, fmt, unref_fn, type, list, nb)
 
#define FORMATS_REF(f, ref, unref_fn)
 
#define FIND_REF_INDEX(ref, idx)
 
#define FORMATS_UNREF(ref, list)
 
#define FORMATS_CHANGEREF(oldref, newref)
 
#define SET_COMMON_FORMATS(ctx, fmts, ref_fn, unref_fn)
 

Functions

static int merge_formats_internal (AVFilterFormats *a, AVFilterFormats *b, enum AVMediaType type, int check)
 
int ff_can_merge_formats (const AVFilterFormats *a, const AVFilterFormats *b, enum AVMediaType type)
 Check the formats/samplerates lists for compatibility for merging without actually merging. More...
 
int ff_merge_formats (AVFilterFormats *a, AVFilterFormats *b, enum AVMediaType type)
 
static int merge_samplerates_internal (AVFilterFormats *a, AVFilterFormats *b, int check)
 
int ff_can_merge_samplerates (const AVFilterFormats *a, const AVFilterFormats *b)
 
int ff_merge_samplerates (AVFilterFormats *a, AVFilterFormats *b)
 
int ff_merge_channel_layouts (AVFilterChannelLayouts *a, AVFilterChannelLayouts *b)
 Merge the formats/channel layouts/samplerates lists if they are compatible and update all the references of a and b to point to the combined list and free the old lists as needed. More...
 
int ff_fmt_is_in (int fmt, const int *fmts)
 Tell if an integer is contained in the provided -1-terminated list of integers. More...
 
AVFilterFormatsff_make_format_list (const int *fmts)
 Create a list of supported formats. More...
 
AVFilterChannelLayoutsff_make_format64_list (const int64_t *fmts)
 
AVFilterChannelLayoutsavfilter_make_format64_list (const int64_t *fmts)
 
int ff_add_format (AVFilterFormats **avff, int64_t fmt)
 Add fmt to the list of media formats contained in *avff. More...
 
int ff_add_channel_layout (AVFilterChannelLayouts **l, uint64_t channel_layout)
 
AVFilterFormatsff_all_formats (enum AVMediaType type)
 Return a list of all formats supported by FFmpeg for the given media type. More...
 
int ff_formats_pixdesc_filter (AVFilterFormats **rfmts, unsigned want, unsigned rej)
 Construct a formats list containing all pixel formats with certain properties. More...
 
AVFilterFormatsff_planar_sample_fmts (void)
 Construct a formats list containing all planar sample formats. More...
 
AVFilterFormatsff_all_samplerates (void)
 
AVFilterChannelLayoutsff_all_channel_layouts (void)
 Construct an empty AVFilterChannelLayouts/AVFilterFormats struct – representing any channel layout (with known disposition)/sample rate. More...
 
AVFilterChannelLayoutsff_all_channel_counts (void)
 Construct an AVFilterChannelLayouts coding for any channel layout, with known or unknown disposition. More...
 
int ff_channel_layouts_ref (AVFilterChannelLayouts *f, AVFilterChannelLayouts **ref)
 Add *ref as a new reference to f. More...
 
int ff_formats_ref (AVFilterFormats *f, AVFilterFormats **ref)
 Add *ref as a new reference to formats. More...
 
void ff_formats_unref (AVFilterFormats **ref)
 If *ref is non-NULL, remove *ref as a reference to the format list it currently points to, deallocates that list if this was the last reference, and sets *ref to NULL. More...
 
void ff_channel_layouts_unref (AVFilterChannelLayouts **ref)
 Remove a reference to a channel layouts list. More...
 
void ff_channel_layouts_changeref (AVFilterChannelLayouts **oldref, AVFilterChannelLayouts **newref)
 
void ff_formats_changeref (AVFilterFormats **oldref, AVFilterFormats **newref)
 
   Before                                 After

|formats |<------—. More...

 
int ff_set_common_channel_layouts (AVFilterContext *ctx, AVFilterChannelLayouts *channel_layouts)
 A helper for query_formats() which sets all links to the same list of channel layouts/sample rates. More...
 
int ff_set_common_samplerates (AVFilterContext *ctx, AVFilterFormats *samplerates)
 
int ff_set_common_formats (AVFilterContext *ctx, AVFilterFormats *formats)
 A helper for query_formats() which sets all links to the same list of formats. More...
 
int ff_default_query_formats (AVFilterContext *ctx)
 
int ff_parse_pixel_format (enum AVPixelFormat *ret, const char *arg, void *log_ctx)
 Parse a pixel format. More...
 
int ff_parse_sample_rate (int *ret, const char *arg, void *log_ctx)
 Parse a sample rate. More...
 
int ff_parse_channel_layout (int64_t *ret, int *nret, const char *arg, void *log_ctx)
 Parse a channel layout or a corresponding integer representation. More...
 
static int check_list (void *log, const char *name, const AVFilterFormats *fmts)
 
int ff_formats_check_pixel_formats (void *log, const AVFilterFormats *fmts)
 Check that fmts is a valid pixel formats list. More...
 
int ff_formats_check_sample_formats (void *log, const AVFilterFormats *fmts)
 Check that fmts is a valid sample formats list. More...
 
int ff_formats_check_sample_rates (void *log, const AVFilterFormats *fmts)
 Check that fmts is a valid sample rates list. More...
 
static int layouts_compatible (uint64_t a, uint64_t b)
 
int ff_formats_check_channel_layouts (void *log, const AVFilterChannelLayouts *fmts)
 Check that fmts is a valid channel layouts list. More...
 

Macro Definition Documentation

#define KNOWN (   l)    (!FF_LAYOUT2COUNT(l)) /* for readability */

Definition at line 31 of file formats.c.

Referenced by ff_merge_channel_layouts(), and layouts_compatible().

#define MERGE_REF (   ret,
  a,
  fmts,
  type,
  fail_statement 
)
Value:
do { \
type ***tmp; \
if (!(tmp = av_realloc_array(ret->refs, ret->refcount + a->refcount, \
sizeof(*tmp)))) \
{ fail_statement } \
ret->refs = tmp; \
for (i = 0; i < a->refcount; i ++) { \
ret->refs[ret->refcount] = a->refs[i]; \
*ret->refs[ret->refcount++] = ret; \
} \
av_freep(&a->refs); \
av_freep(&a->fmts); \
} while (0)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:36
GLint GLenum type
Definition: opengl_enc.c:104
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Definition: mem.c:198
if(ret)
int
#define av_freep(p)
for(j=16;j >0;--j)
int i
Definition: input.c:407
static uint8_t tmp[11]
Definition: aes_ctr.c:26

Add all refs from a to ret and destroy a.

Definition at line 36 of file formats.c.

Referenced by ff_merge_channel_layouts().

#define MERGE_FORMATS (   a,
  b,
  fmts,
  nb,
  type,
  check,
  empty_allowed 
)

Add all formats common to a and b to a, add b's refs to a and destroy b.

If check is set, nothing is modified and it is only checked whether the formats are compatible. If empty_allowed is set and one of a,b->nb is zero, the lists are merged; otherwise, it is treated as error.

Definition at line 63 of file formats.c.

Referenced by merge_formats_internal(), and merge_samplerates_internal().

#define MAKE_FORMAT_LIST (   type,
  field,
  count_field 
)
Value:
int count = 0; \
if (fmts) \
for (count = 0; fmts[count] != -1; count++) \
; \
formats->count_field = count; \
if (count) { \
formats->field = av_malloc_array(count, sizeof(*formats->field)); \
if (!formats->field) { \
} \
}
#define NULL
Definition: coverity.c:32
GLint GLenum type
Definition: opengl_enc.c:104
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:237
GLsizei count
Definition: opengl_enc.c:108
if(ret)
int
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a it should return
#define av_freep(p)
#define av_malloc_array(a, b)
formats
Definition: signature.h:48
for(j=16;j >0;--j)

Definition at line 269 of file formats.c.

Referenced by ff_make_format64_list(), and ff_make_format_list().

#define ADD_FORMAT (   f,
  fmt,
  unref_fn,
  type,
  list,
  nb 
)
Value:
do { \
type *fmts; \
if (!(*f) && !(*f = av_mallocz(sizeof(**f)))) { \
return AVERROR(ENOMEM); \
} \
\
fmts = av_realloc_array((*f)->list, (*f)->nb + 1, \
sizeof(*(*f)->list)); \
if (!fmts) { \
unref_fn(f); \
return AVERROR(ENOMEM); \
} \
\
(*f)->list = fmts; \
(*f)->list[(*f)->nb++] = fmt; \
} while (0)
GLint GLenum type
Definition: opengl_enc.c:104
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:237
#define f(width, name)
Definition: cbs_vp9.c:255
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Definition: mem.c:198
if(ret)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a it should return
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions

Definition at line 314 of file formats.c.

Referenced by ff_add_channel_layout(), and ff_add_format().

#define FORMATS_REF (   f,
  ref,
  unref_fn 
)
Value:
void *tmp; \
if (!f) \
return AVERROR(ENOMEM); \
\
tmp = av_realloc_array(f->refs, sizeof(*f->refs), f->refcount + 1); \
if (!tmp) { \
unref_fn(&f); \
return AVERROR(ENOMEM); \
} \
f->refs = tmp; \
f->refs[f->refcount++] = ref; \
*ref = f; \
#define f(width, name)
Definition: cbs_vp9.c:255
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Definition: mem.c:198
if(ret)
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:107
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a it should return
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
static uint8_t tmp[11]
Definition: aes_ctr.c:26

Definition at line 446 of file formats.c.

Referenced by ff_channel_layouts_ref(), and ff_formats_ref().

#define FIND_REF_INDEX (   ref,
  idx 
)
Value:
do { \
for (i = 0; i < (*ref)->refcount; i ++) \
if((*ref)->refs[i] == ref) { \
idx = i; \
break; \
} \
} while (0)
int
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:107
for(j=16;j >0;--j)
int i
Definition: input.c:407

Definition at line 472 of file formats.c.

#define FORMATS_UNREF (   ref,
  list 
)
Value:
do { \
int idx = -1; \
if (!*ref) \
if (idx >= 0) { \
memmove((*ref)->refs + idx, (*ref)->refs + idx + 1, \
sizeof(*(*ref)->refs) * ((*ref)->refcount - idx - 1)); \
--(*ref)->refcount; \
} \
if (!(*ref)->refcount) { \
av_free((*ref)->list); \
av_free((*ref)->refs); \
} \
*ref = NULL; \
} while (0)
#define NULL
Definition: coverity.c:32
#define FIND_REF_INDEX(ref, idx)
Definition: formats.c:472
if(ret)
int
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:107
#define av_free(p)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a it should return

Definition at line 482 of file formats.c.

Referenced by ff_channel_layouts_unref(), and ff_formats_unref().

#define FORMATS_CHANGEREF (   oldref,
  newref 
)
Value:
do { \
int idx = -1; \
FIND_REF_INDEX(oldref, idx); \
if (idx >= 0) { \
(*oldref)->refs[idx] = newref; \
*newref = *oldref; \
*oldref = NULL; \
} \
} while (0)
#define NULL
Definition: coverity.c:32
#define FIND_REF_INDEX(ref, idx)
Definition: formats.c:472
if(ret)
int

Definition at line 514 of file formats.c.

Referenced by ff_channel_layouts_changeref(), and ff_formats_changeref().

#define SET_COMMON_FORMATS (   ctx,
  fmts,
  ref_fn,
  unref_fn 
)
Value:
int count = 0, i; \
if (!fmts) \
return AVERROR(ENOMEM); \
for (i = 0; i < ctx->nb_inputs; i++) { \
if (ctx->inputs[i] && !ctx->inputs[i]->outcfg.fmts) { \
int ret = ref_fn(fmts, &ctx->inputs[i]->outcfg.fmts); \
if (ret < 0) { \
} \
count++; \
} \
} \
for (i = 0; i < ctx->nb_outputs; i++) { \
if (ctx->outputs[i] && !ctx->outputs[i]->incfg.fmts) { \
int ret = ref_fn(fmts, &ctx->outputs[i]->incfg.fmts); \
if (ret < 0) { \
} \
count++; \
} \
} \
if (!count) { \
unref_fn(&fmts); \
} \
\
GLsizei count
Definition: opengl_enc.c:108
AVFormatContext * ctx
Definition: movenc.c:48
if(ret)
int
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a it should return
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
for(j=16;j >0;--j)
int i
Definition: input.c:407

Definition at line 538 of file formats.c.

Referenced by ff_set_common_channel_layouts(), ff_set_common_formats(), and ff_set_common_samplerates().

Function Documentation

static int merge_formats_internal ( AVFilterFormats a,
AVFilterFormats b,
enum AVMediaType  type,
int  check 
)
static

Definition at line 96 of file formats.c.

Referenced by ff_can_merge_formats(), and ff_merge_formats().

int ff_can_merge_formats ( const AVFilterFormats a,
const AVFilterFormats b,
enum AVMediaType  type 
)

Check the formats/samplerates lists for compatibility for merging without actually merging.

Returns
1 if they are compatible, 0 if not.

Definition at line 135 of file formats.c.

Referenced by query_formats().

int ff_merge_formats ( AVFilterFormats a,
AVFilterFormats b,
enum AVMediaType  type 
)

Definition at line 142 of file formats.c.

static int merge_samplerates_internal ( AVFilterFormats a,
AVFilterFormats b,
int  check 
)
static

Definition at line 149 of file formats.c.

Referenced by ff_can_merge_samplerates(), and ff_merge_samplerates().

int ff_can_merge_samplerates ( const AVFilterFormats a,
const AVFilterFormats b 
)

Definition at line 158 of file formats.c.

Referenced by query_formats().

int ff_merge_samplerates ( AVFilterFormats a,
AVFilterFormats b 
)

Definition at line 163 of file formats.c.

int ff_merge_channel_layouts ( AVFilterChannelLayouts a,
AVFilterChannelLayouts b 
)

Merge the formats/channel layouts/samplerates lists if they are compatible and update all the references of a and b to point to the combined list and free the old lists as needed.

The combined list usually contains the intersection of the lists of a and b.

Both a and b must have owners (i.e. refcount > 0) for these functions.

Returns
1 if merging succeeded, 0 if a and b are incompatible and negative AVERROR code on failure. a and b are unmodified if 0 is returned.

Definition at line 169 of file formats.c.

int ff_fmt_is_in ( int  fmt,
const int fmts 
)

Tell if an integer is contained in the provided -1-terminated list of integers.

This is useful for determining (for instance) if an AVPixelFormat is in an array of supported formats.

Parameters
fmtprovided format
fmts-1-terminated list of formats
Returns
1 if present, 0 if absent

Definition at line 258 of file formats.c.

Referenced by config_input(), config_input_main(), config_input_overlay(), config_out_props(), and config_props().

AVFilterFormats* ff_make_format_list ( const int fmts)
AVFilterChannelLayouts* ff_make_format64_list ( const int64_t *  fmts)

Definition at line 296 of file formats.c.

Referenced by avfilter_make_format64_list(), movie_query_formats(), and query_formats().

AVFilterChannelLayouts* avfilter_make_format64_list ( const int64_t *  fmts)

Definition at line 308 of file formats.c.

int ff_add_format ( AVFilterFormats **  avff,
int64_t  fmt 
)

Add fmt to the list of media formats contained in *avff.

If *avff is NULL the function allocates the filter formats struct and puts its pointer in *avff.

Returns
a non negative value in case of success, or a negative value corresponding to an AVERROR code in case of error

Definition at line 333 of file formats.c.

Referenced by asink_query_formats(), ff_all_formats(), ff_draw_supported_pixel_formats(), ff_planar_sample_fmts(), gate(), hwupload_query_formats(), init(), query_formats(), reduce_formats_on_filter(), and vsink_query_formats().

int ff_add_channel_layout ( AVFilterChannelLayouts **  l,
uint64_t  channel_layout 
)
AVFilterFormats* ff_all_formats ( enum AVMediaType  type)

Return a list of all formats supported by FFmpeg for the given media type.

Definition at line 346 of file formats.c.

Referenced by ff_default_query_formats(), filter_frame(), filter_query_formats(), hwmap_query_formats(), and query_formats().

int ff_formats_pixdesc_filter ( AVFilterFormats **  rfmts,
unsigned  want,
unsigned  rej 
)

Construct a formats list containing all pixel formats with certain properties.

Definition at line 368 of file formats.c.

Referenced by hwdownload_query_formats(), and query_formats().

AVFilterFormats* ff_planar_sample_fmts ( void  )

Construct a formats list containing all planar sample formats.

Definition at line 409 of file formats.c.

Referenced by channelmap_query_formats(), join_query_formats(), and query_formats().

AVFilterFormats* ff_all_samplerates ( void  )
AVFilterChannelLayouts* ff_all_channel_layouts ( void  )

Construct an empty AVFilterChannelLayouts/AVFilterFormats struct – representing any channel layout (with known disposition)/sample rate.

Definition at line 428 of file formats.c.

Referenced by filter_query_formats(), join_query_formats(), and query_formats().

AVFilterChannelLayouts* ff_all_channel_counts ( void  )

Construct an AVFilterChannelLayouts coding for any channel layout, with known or unknown disposition.

Definition at line 437 of file formats.c.

Referenced by aeval_query_formats(), asink_query_formats(), channelmap_query_formats(), ff_default_query_formats(), filter_frame(), gate(), process_command(), and query_formats().

int ff_channel_layouts_ref ( AVFilterChannelLayouts f,
AVFilterChannelLayouts **  ref 
)
int ff_formats_ref ( AVFilterFormats formats,
AVFilterFormats **  ref 
)

Add *ref as a new reference to formats.

That is the pointers will point like in the ascii art below:


|formats |<-----—. | ____ | ____|___________________ | |refs| | | __|_ | |* * | | | | | | AVFilterLink | |* *------—>|*ref| | |____| | | |____| |________| |________________________

Definition at line 467 of file formats.c.

Referenced by cudaupload_query_formats(), deint_cuda_query_formats(), ff_set_common_formats(), ff_set_common_samplerates(), ff_vaapi_vpp_query_formats(), hwdownload_query_formats(), hwmap_query_formats(), hwupload_query_formats(), movie_query_formats(), overlay_qsv_query_formats(), query_formats(), and query_formats_src().

void ff_formats_unref ( AVFilterFormats **  ref)

If *ref is non-NULL, remove *ref as a reference to the format list it currently points to, deallocates that list if this was the last reference, and sets *ref to NULL.

Before After ________ ________ NULL |formats |<-----—. |formats | ^ | ____ | ____|________________ | ____ | ____|________________ | |refs| | | __|_ | |refs| | | __|_ | |* * | | | | | | AVFilterLink | |* * | | | | | | AVFilterLink | |* *------—>|*ref| | |* | | | |*ref| | |____| | | |____| | |____| | | |____| |________| |_____________________ |________| |_____________________

Definition at line 504 of file formats.c.

Referenced by ff_add_format(), ff_formats_ref(), ff_set_common_formats(), ff_set_common_samplerates(), free_link(), pick_format(), and uninit().

void ff_channel_layouts_unref ( AVFilterChannelLayouts **  ref)

Remove a reference to a channel layouts list.

Definition at line 509 of file formats.c.

Referenced by ff_add_channel_layout(), ff_channel_layouts_ref(), ff_set_common_channel_layouts(), free_link(), pick_format(), and uninit().

void ff_channel_layouts_changeref ( AVFilterChannelLayouts **  oldref,
AVFilterChannelLayouts **  newref 
)

Definition at line 527 of file formats.c.

Referenced by avfilter_insert_filter().

void ff_formats_changeref ( AVFilterFormats **  oldref,
AVFilterFormats **  newref 
)

   Before                                 After

|formats |<------—.

|formats |<------—. | ____ | ___|___ | ____ | ___|___ | |refs| | | | | | |refs| | | | | NULL | |* *------—>|*oldref| | |* *------—>|*newref| ^ | |* * | | |_______| | |* * | | |_______| ___|___ | |____| | | |____| | | | | |________| |________| |*oldref| |_______|

Definition at line 533 of file formats.c.

Referenced by avfilter_insert_filter().

int ff_set_common_channel_layouts ( AVFilterContext ctx,
AVFilterChannelLayouts layouts 
)

A helper for query_formats() which sets all links to the same list of channel layouts/sample rates.

If there are no links hooked to this filter, the list is freed.

Definition at line 569 of file formats.c.

Referenced by aeval_query_formats(), asink_query_formats(), ff_default_query_formats(), filter_frame(), filter_query_formats(), gate(), process_command(), and query_formats().

int ff_set_common_samplerates ( AVFilterContext ctx,
AVFilterFormats samplerates 
)
int ff_set_common_formats ( AVFilterContext ctx,
AVFilterFormats formats 
)
int ff_default_query_formats ( AVFilterContext ctx)

Definition at line 594 of file formats.c.

Referenced by main(), query_formats(), uninit(), and vsink_query_formats().

int ff_parse_pixel_format ( enum AVPixelFormat ret,
const char *  arg,
void log_ctx 
)

Parse a pixel format.

Parameters
retpixel format pointer to where the value should be written
argstring to parse
log_ctxlog context
Returns
>= 0 in case of success, a negative AVERROR code on error

Definition at line 618 of file formats.c.

Referenced by init().

int ff_parse_sample_rate ( int ret,
const char *  arg,
void log_ctx 
)

Parse a sample rate.

Parameters
retunsigned integer pointer to where the value should be written
argstring to parse
log_ctxlog context
Returns
>= 0 in case of success, a negative AVERROR code on error

Definition at line 633 of file formats.c.

Referenced by init().

int ff_parse_channel_layout ( int64_t *  ret,
int nret,
const char *  arg,
void log_ctx 
)

Parse a channel layout or a corresponding integer representation.

Parameters
ret64bit integer pointer to where the value should be written.
nretinteger pointer to the number of channels; if not NULL, then unknown channel layouts are accepted
argstring to parse
log_ctxlog context
Returns
>= 0 in case of success, a negative AVERROR code on error

Definition at line 645 of file formats.c.

Referenced by init(), and main().

static int check_list ( void log,
const char *  name,
const AVFilterFormats fmts 
)
static
int ff_formats_check_pixel_formats ( void log,
const AVFilterFormats fmts 
)

Check that fmts is a valid pixel formats list.

In particular, check for duplicates.

Definition at line 687 of file formats.c.

Referenced by filter_link_check_formats().

int ff_formats_check_sample_formats ( void log,
const AVFilterFormats fmts 
)

Check that fmts is a valid sample formats list.

In particular, check for duplicates.

Definition at line 692 of file formats.c.

Referenced by filter_link_check_formats().

int ff_formats_check_sample_rates ( void log,
const AVFilterFormats fmts 
)

Check that fmts is a valid sample rates list.

In particular, check for duplicates.

Definition at line 697 of file formats.c.

Referenced by filter_link_check_formats().

static int layouts_compatible ( uint64_t  a,
uint64_t  b 
)
static

Definition at line 704 of file formats.c.

Referenced by ff_formats_check_channel_layouts().

int ff_formats_check_channel_layouts ( void log,
const AVFilterChannelLayouts fmts 
)

Check that fmts is a valid channel layouts list.

In particular, check for duplicates.

Definition at line 711 of file formats.c.

Referenced by filter_link_check_formats().