FFmpeg
|
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/eval.h"
#include "libavutil/pixdesc.h"
#include "libavutil/parseutils.h"
#include "avfilter.h"
#include "internal.h"
#include "formats.h"
#include "all_channel_layouts.inc"
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) |
Add all refs from a to ret and destroy a. | |
#define | MERGE_FORMATS(ret, a, b, fmts, nb, type, fail) |
Add all formats common for a and b to ret, copy the refs and destroy a and b. | |
#define | COPY_INT_LIST(list_copy, list, type) |
#define | MAKE_FORMAT_LIST(type, field, count_field) |
#define | ADD_FORMAT(f, fmt, type, list, nb) |
#define | FORMATS_REF(f, ref) |
#define | FIND_REF_INDEX(ref, idx) |
#define | FORMATS_UNREF(ref, list) |
#define | FORMATS_CHANGEREF(oldref, newref) |
#define | SET_COMMON_FORMATS(ctx, fmts, in_fmts, out_fmts, ref, list) |
Functions | |
AVFilterFormats * | ff_merge_formats (AVFilterFormats *a, AVFilterFormats *b, enum AVMediaType type) |
Return a format list which contains the intersection of the formats of a and b. | |
AVFilterFormats * | ff_merge_samplerates (AVFilterFormats *a, AVFilterFormats *b) |
AVFilterChannelLayouts * | ff_merge_channel_layouts (AVFilterChannelLayouts *a, AVFilterChannelLayouts *b) |
Return a channel layouts/samplerates list which contains the intersection of the layouts/samplerates of a and b. | |
int | ff_fmt_is_in (int fmt, const int *fmts) |
Tell is a format is contained in the provided list terminated by -1. | |
int * | ff_copy_int_list (const int *const list) |
Return a copy of a list of integers terminated by -1, or NULL in case of copy failure. | |
int64_t * | ff_copy_int64_list (const int64_t *const list) |
Return a copy of a list of 64-bit integers, or NULL in case of copy failure. | |
AVFilterFormats * | ff_make_format_list (const int *fmts) |
Create a list of supported formats. | |
AVFilterChannelLayouts * | avfilter_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. | |
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. | |
AVFilterFormats * | ff_planar_sample_fmts (void) |
Construct a formats list containing all planar sample 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. | |
AVFilterChannelLayouts * | ff_all_channel_counts (void) |
Construct an AVFilterChannelLayouts coding for any channel layout, with known or unknown disposition. | |
void | ff_channel_layouts_ref (AVFilterChannelLayouts *f, AVFilterChannelLayouts **ref) |
Add *ref as a new reference to f. | |
void | ff_formats_ref (AVFilterFormats *f, AVFilterFormats **ref) |
Add *ref as a new reference to formats. | |
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. | |
void | ff_channel_layouts_unref (AVFilterChannelLayouts **ref) |
Remove a reference to a channel layouts list. | |
void | ff_channel_layouts_changeref (AVFilterChannelLayouts **oldref, AVFilterChannelLayouts **newref) |
void | ff_formats_changeref (AVFilterFormats **oldref, AVFilterFormats **newref) |
Before After |formats |<------—. | |
void | 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. | |
void | ff_set_common_samplerates (AVFilterContext *ctx, AVFilterFormats *samplerates) |
void | ff_set_common_formats (AVFilterContext *ctx, AVFilterFormats *formats) |
A helper for query_formats() which sets all links to the same list of formats. | |
static int | default_query_formats_common (AVFilterContext *ctx, AVFilterChannelLayouts *(layouts)(void)) |
int | ff_default_query_formats (AVFilterContext *ctx) |
int | ff_query_formats_all (AVFilterContext *ctx) |
Set the formats list to all existing formats. | |
int | ff_parse_pixel_format (enum AVPixelFormat *ret, const char *arg, void *log_ctx) |
Parse a pixel format. | |
int | ff_parse_sample_format (int *ret, const char *arg, void *log_ctx) |
Parse a sample format name or a corresponding integer representation. | |
int | ff_parse_time_base (AVRational *ret, const char *arg, void *log_ctx) |
Parse a time base. | |
int | ff_parse_sample_rate (int *ret, const char *arg, void *log_ctx) |
Parse a sample rate. | |
int | ff_parse_channel_layout (int64_t *ret, const char *arg, void *log_ctx) |
Parse a channel layout or a corresponding integer representation. | |
Variables | |
const int64_t | avfilter_all_channel_layouts [] |
#define KNOWN | ( | l | ) | (!FF_LAYOUT2COUNT(l)) /* for readability */ |
Definition at line 32 of file formats.c.
Referenced by ff_merge_channel_layouts().
#define MERGE_REF | ( | ret, | |
a, | |||
fmts, | |||
type, | |||
fail | |||
) |
Add all refs from a to ret and destroy a.
Definition at line 37 of file formats.c.
Referenced by ff_merge_channel_layouts(), and ff_merge_samplerates().
Add all formats common for a and b to ret, copy the refs and destroy a and b.
Definition at line 61 of file formats.c.
Referenced by ff_merge_formats(), and ff_merge_samplerates().
#define COPY_INT_LIST | ( | list_copy, | |
list, | |||
type | |||
) |
Definition at line 261 of file formats.c.
Referenced by ff_copy_int64_list(), and ff_copy_int_list().
#define MAKE_FORMAT_LIST | ( | type, | |
field, | |||
count_field | |||
) |
Definition at line 287 of file formats.c.
Referenced by avfilter_make_format64_list(), and ff_make_format_list().
#define ADD_FORMAT | ( | f, | |
fmt, | |||
type, | |||
list, | |||
nb | |||
) |
Definition at line 324 of file formats.c.
Referenced by ff_add_channel_layout(), and ff_add_format().
#define FORMATS_REF | ( | f, | |
ref | |||
) |
Definition at line 416 of file formats.c.
Referenced by ff_channel_layouts_ref(), and ff_formats_ref().
#define FIND_REF_INDEX | ( | ref, | |
idx | |||
) |
#define FORMATS_UNREF | ( | ref, | |
list | |||
) |
Definition at line 443 of file formats.c.
Referenced by ff_channel_layouts_unref(), and ff_formats_unref().
#define FORMATS_CHANGEREF | ( | oldref, | |
newref | |||
) |
Definition at line 474 of file formats.c.
Referenced by ff_channel_layouts_changeref(), and ff_formats_changeref().
#define SET_COMMON_FORMATS | ( | ctx, | |
fmts, | |||
in_fmts, | |||
out_fmts, | |||
ref, | |||
list | |||
) |
Definition at line 498 of file formats.c.
Referenced by ff_set_common_channel_layouts(), ff_set_common_formats(), and ff_set_common_samplerates().
AVFilterFormats* ff_merge_formats | ( | AVFilterFormats * | a, |
AVFilterFormats * | b, | ||
enum AVMediaType | type | ||
) |
Return a format list which contains the intersection of the formats of a and b.
Also, all the references of a, all the references of b, and a and b themselves will be deallocated.
If a and b do not share any common formats, neither is modified, and NULL is returned.
Definition at line 92 of file formats.c.
Referenced by query_formats().
AVFilterFormats* ff_merge_samplerates | ( | AVFilterFormats * | a, |
AVFilterFormats * | b | ||
) |
Definition at line 139 of file formats.c.
Referenced by query_formats().
AVFilterChannelLayouts* ff_merge_channel_layouts | ( | AVFilterChannelLayouts * | a, |
AVFilterChannelLayouts * | b | ||
) |
Return a channel layouts/samplerates list which contains the intersection of the layouts/samplerates of a and b.
Also, all the references of a, all the references of b, and a and b themselves will be deallocated.
If a and b do not share any common elements, neither is modified, and NULL is returned.
Definition at line 166 of file formats.c.
Referenced by query_formats().
int ff_fmt_is_in | ( | int | fmt, |
const int * | fmts | ||
) |
Tell is a format is contained in the provided list terminated by -1.
Definition at line 250 of file formats.c.
Referenced by config_input(), config_input_main(), config_input_overlay(), config_out_props(), and config_props().
int* ff_copy_int_list | ( | const int *const | list | ) |
Return a copy of a list of integers terminated by -1, or NULL in case of copy failure.
Definition at line 273 of file formats.c.
Referenced by asink_init(), and vsink_init().
int64_t* ff_copy_int64_list | ( | const int64_t *const | list | ) |
AVFilterFormats* ff_make_format_list | ( | const int * | fmts | ) |
Create a list of supported formats.
This is intended for use in AVFilter->query_formats().
fmts | list of media formats, terminated by -1 |
Definition at line 304 of file formats.c.
Referenced by asink_query_formats(), ff_draw_supported_pixel_formats(), geq_query_formats(), movie_query_formats(), pp_query_formats(), query_formats(), and vsink_query_formats().
AVFilterChannelLayouts* avfilter_make_format64_list | ( | const int64_t * | fmts | ) |
Definition at line 313 of file formats.c.
Referenced by asink_query_formats(), movie_query_formats(), and query_formats().
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.
Definition at line 340 of file formats.c.
Referenced by ff_all_formats(), ff_planar_sample_fmts(), init(), query_formats(), and reduce_formats_on_filter().
int ff_add_channel_layout | ( | AVFilterChannelLayouts ** | l, |
uint64_t | channel_layout | ||
) |
Definition at line 346 of file formats.c.
Referenced by channelmap_init(), init(), join_query_formats(), query_formats(), and reduce_formats_on_filter().
AVFilterFormats* ff_all_formats | ( | enum AVMediaType | type | ) |
Return a list of all formats supported by FFmpeg for the given media type.
Definition at line 353 of file formats.c.
Referenced by default_query_formats_common(), filter_query_formats(), and query_formats().
AVFilterFormats* ff_planar_sample_fmts | ( | void | ) |
Construct a formats list containing all planar sample formats.
Definition at line 380 of file formats.c.
Referenced by channelmap_query_formats(), join_query_formats(), and query_formats().
AVFilterFormats* ff_all_samplerates | ( | void | ) |
Definition at line 392 of file formats.c.
Referenced by channelmap_query_formats(), default_query_formats_common(), filter_query_formats(), join_query_formats(), and query_formats().
AVFilterChannelLayouts* ff_all_channel_layouts | ( | void | ) |
Construct an empty AVFilterChannelLayouts/AVFilterFormats struct – representing any channel layout (with known disposition)/sample rate.
Definition at line 398 of file formats.c.
Referenced by channelmap_query_formats(), ff_default_query_formats(), 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 407 of file formats.c.
Referenced by asink_query_formats(), ff_query_formats_all(), and query_formats().
void ff_channel_layouts_ref | ( | AVFilterChannelLayouts * | f, |
AVFilterChannelLayouts ** | ref | ||
) |
Add *ref as a new reference to f.
Definition at line 423 of file formats.c.
Referenced by channelmap_query_formats(), ff_set_common_channel_layouts(), join_query_formats(), movie_query_formats(), and query_formats().
void 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:
Definition at line 428 of file formats.c.
Referenced by ff_set_common_formats(), ff_set_common_samplerates(), movie_query_formats(), and query_formats().
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 464 of file formats.c.
Referenced by avfilter_free(), pick_format(), and query_formats().
void ff_channel_layouts_unref | ( | AVFilterChannelLayouts ** | ref | ) |
Remove a reference to a channel layouts list.
Definition at line 469 of file formats.c.
Referenced by avfilter_free(), and pick_format().
void ff_channel_layouts_changeref | ( | AVFilterChannelLayouts ** | oldref, |
AVFilterChannelLayouts ** | newref | ||
) |
Definition at line 487 of file formats.c.
Referenced by avfilter_insert_filter().
void ff_formats_changeref | ( | AVFilterFormats ** | oldref, |
AVFilterFormats ** | newref | ||
) |
Before After
|formats |<---------.
| ____ | ___|___ | ____ | ___|___ | |refs| | | | | | |refs| | | | | NULL | |* *------—>|*oldref| | |* *------—>|*newref| ^ | |* * | | |_______| | |* * | | |_______| ___|___ | |____| | | |____| | | | | |________| |________| |*oldref| |_______|
Definition at line 493 of file formats.c.
Referenced by avfilter_insert_filter().
void 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 522 of file formats.c.
Referenced by asink_query_formats(), default_query_formats_common(), filter_query_formats(), and query_formats().
void ff_set_common_samplerates | ( | AVFilterContext * | ctx, |
AVFilterFormats * | samplerates | ||
) |
Definition at line 529 of file formats.c.
Referenced by asink_query_formats(), channelmap_query_formats(), default_query_formats_common(), filter_query_formats(), join_query_formats(), and query_formats().
void ff_set_common_formats | ( | AVFilterContext * | ctx, |
AVFilterFormats * | formats | ||
) |
A helper for query_formats() which sets all links to the same list of formats.
If there are no links hooked to this filter, the list of formats is freed.
Definition at line 541 of file formats.c.
Referenced by asink_query_formats(), channelmap_query_formats(), default_query_formats_common(), filter_query_formats(), geq_query_formats(), join_query_formats(), pp_query_formats(), query_formats(), and vsink_query_formats().
|
static |
Definition at line 547 of file formats.c.
Referenced by ff_default_query_formats(), and ff_query_formats_all().
int ff_default_query_formats | ( | AVFilterContext * | ctx | ) |
Definition at line 563 of file formats.c.
Referenced by main(), query_formats(), and vsink_query_formats().
int ff_query_formats_all | ( | AVFilterContext * | ctx | ) |
Set the formats list to all existing formats.
This function behaves like ff_default_query_formats(), except it also accepts channel layouts with unknown disposition. It should only be used with audio filters.
int ff_parse_pixel_format | ( | enum AVPixelFormat * | ret, |
const char * | arg, | ||
void * | log_ctx | ||
) |
Parse a pixel format.
ret | pixel format pointer to where the value should be written |
arg | string to parse |
log_ctx | log context |
Definition at line 575 of file formats.c.
Referenced by init(), and init_video().
int ff_parse_sample_format | ( | int * | ret, |
const char * | arg, | ||
void * | log_ctx | ||
) |
Parse a sample format name or a corresponding integer representation.
ret | integer pointer to where the value should be written |
arg | string to parse |
log_ctx | log context |
Definition at line 590 of file formats.c.
Referenced by init().
int ff_parse_time_base | ( | AVRational * | ret, |
const char * | arg, | ||
void * | log_ctx | ||
) |
Parse a time base.
ret | unsigned AVRational pointer to where the value should be written |
arg | string to parse |
log_ctx | log context |
int ff_parse_sample_rate | ( | int * | ret, |
const char * | arg, | ||
void * | log_ctx | ||
) |
int ff_parse_channel_layout | ( | int64_t * | ret, |
const char * | arg, | ||
void * | log_ctx | ||
) |
Parse a channel layout or a corresponding integer representation.
ret | 64bit integer pointer to where the value should be written. |
arg | string to parse |
log_ctx | log context |
Definition at line 628 of file formats.c.
Referenced by init().