44#define OFFSET(x) offsetof(AVFilterGraph, x)
45#define F AV_OPT_FLAG_FILTERING_PARAM
46#define V AV_OPT_FLAG_VIDEO_PARAM
47#define A AV_OPT_FLAG_AUDIO_PARAM
53 { .i64 = 0 }, 0, INT_MAX,
F|
V|
A, .unit =
"threads"},
54 {
"auto",
"autodetect a suitable number of threads to use", 0,
AV_OPT_TYPE_CONST, {.i64 = 0 }, .flags =
F|
V|
A, .unit =
"threads"},
55 {
"scale_sws_opts" ,
"default scale filter options" ,
OFFSET(scale_sws_opts) ,
57 {
"aresample_swr_opts" ,
"default aresample filter options" ,
OFFSET(aresample_swr_opts) ,
59 {
"max_buffered_frames" ,
"maximum number of buffered frames allowed",
OFFSET(max_buffered_frames),
65 .class_name =
"AVFilterGraph",
110 for (j = 0; j<
filter->nb_outputs; j++)
141 const char *
name,
const char *args,
void *opaque,
219 for (j = 0; j <
filt->nb_inputs; j++) {
220 if (!
filt->inputs[j] || !
filt->inputs[j]->src) {
221 pad = &
filt->input_pads[j];
223 "Input pad \"%s\" with type %s of the filter instance \"%s\" of %s not connected to any source\n",
229 for (j = 0; j <
filt->nb_outputs; j++) {
230 if (!
filt->outputs[j] || !
filt->outputs[j]->dst) {
231 pad = &
filt->output_pads[j];
233 "Output pad \"%s\" with type %s of the filter instance \"%s\" of %s not connected to any destination\n",
256 if (!
filt->nb_outputs) {
274 for (j = 0; j <
f->nb_outputs; j++) {
301 switch (link->
type) {
334 for (
i = 0;
i <
ctx->nb_inputs;
i++) {
339 for (
i = 0;
i <
ctx->nb_outputs;
i++) {
353 if ((ret =
filter->formats.query_func(
ctx)) < 0) {
370 cfg_in =
ctx->nb_inputs ? cfg_in_stack :
NULL;
372 for (
unsigned i = 0;
i <
ctx->nb_inputs;
i++) {
383 cfg_out = cfg_out_dyn;
385 cfg_out =
ctx->nb_outputs ? cfg_out_stack :
NULL;
387 for (
unsigned i = 0;
i <
ctx->nb_outputs;
i++) {
392 ret =
filter->formats.query_func2(
ctx, cfg_in, cfg_out);
417 for (
i = 0;
i <
f->nb_inputs;
i++) {
418 if (!
f->inputs[
i]->outcfg.formats)
421 !(
f->inputs[
i]->outcfg.color_ranges &&
422 f->inputs[
i]->outcfg.color_spaces &&
423 f->inputs[
i]->outcfg.alpha_modes))
426 !(
f->inputs[
i]->outcfg.samplerates &&
427 f->inputs[
i]->outcfg.channel_layouts))
430 for (
i = 0;
i <
f->nb_outputs;
i++) {
431 if (!
f->outputs[
i]->incfg.formats)
434 !(
f->outputs[
i]->incfg.color_ranges &&
435 f->outputs[
i]->incfg.color_spaces &&
436 f->outputs[
i]->incfg.alpha_modes))
439 !(
f->outputs[
i]->incfg.samplerates &&
440 f->outputs[
i]->incfg.channel_layouts))
456 av_log(log_ctx,
level,
"Link '%s.%s' -> '%s.%s':\n",
459 for (
unsigned i = 0;
i < nb_mergers;
i++) {
484 av_log(log_ctx,
level,
"Filter '%s' formats:\n",
f->name);
485 for (
int i = 0;
i <
f->nb_inputs;
i++) {
488 av_log(log_ctx,
level,
" in[%d] '%s':\n",
i,
f->input_pads[
i].name);
499 for (
int i = 0;
i <
f->nb_outputs;
i++) {
502 av_log(log_ctx,
level,
" out[%d] '%s':\n",
i,
f->output_pads[
i].name);
529 int converter_count = 0;
530 int count_queried = 0;
531 int count_merged = 0;
532 int count_already_merged = 0;
533 int count_delayed = 0;
540 if (ret < 0 && ret !=
AVERROR(EAGAIN))
554 for (j = 0; j <
filter->nb_inputs; j++) {
559 const char *conv_filters[4], *conv_opts[4] = {0};
560 unsigned neg_step, num_conv = 0, num_mergers = 0;
567 for (neg_step = 0; neg_step < neg->
nb_mergers; neg_step++) {
572 for (k = 0; k < num_conv; k++) {
584 mergers[num_mergers++] = m;
587 for (neg_step = 0; neg_step < neg->
nb_mergers; neg_step++) {
594 count_already_merged++;
595 }
else if (!num_conv) {
601 mergers[num_mergers++] = m;
615 for (k = num_conv - 1; k >= 0; k--) {
621 "The filters '%s' and '%s' do not have a common format "
622 "and automatic conversion is disabled.\n",
630 "'%s' filter not present, cannot convert formats.\n",
635 snprintf(inst_name,
sizeof(inst_name),
"auto_%s_%d",
636 conv_filters[k], converter_count++);
638 conv_opts[k],
NULL, graph);
649 for (k = 0; k < num_conv; k++) {
657 av_assert0( inlink-> incfg.color_spaces->refcount > 0);
659 av_assert0(outlink-> incfg.color_spaces->refcount > 0);
661 av_assert0( inlink-> incfg.color_ranges->refcount > 0);
663 av_assert0(outlink-> incfg.color_ranges->refcount > 0);
665 av_assert0( inlink-> incfg.alpha_modes->refcount > 0);
667 av_assert0(outlink-> incfg.alpha_modes->refcount > 0);
670 av_assert0( inlink-> incfg.samplerates->refcount > 0);
672 av_assert0(outlink-> incfg.samplerates->refcount > 0);
674 av_assert0( inlink-> incfg.channel_layouts->refcount > 0);
676 av_assert0(outlink-> incfg.channel_layouts->refcount > 0);
680#define MERGE(merger, link) \
681 ((merger)->merge(FF_FIELD_AT(void *, (merger)->offset, (link)->incfg), \
682 FF_FIELD_AT(void *, (merger)->offset, (link)->outcfg)))
684 for (neg_step = 0; neg_step < neg->
nb_mergers; neg_step++) {
688 if ((ret =
MERGE(m, inlink)) <= 0 ||
689 (ret =
MERGE(m, outlink)) <= 0) {
693 "Impossible to convert between the formats supported by the filter "
714 "%d queried, %d merged, %d already done, %d delayed\n",
715 count_queried, count_merged, count_already_merged, count_delayed);
724 if (count_queried || count_merged)
732 "The following filters could not choose their formats: %s\n"
733 "Consider inserting the (a)format filter near their input or "
734 "output.\n", bp.str);
771 return score1 < score2 ? dst_fmt1 : dst_fmt2;
779 if (
desc->nb_components < 3)
866 " the link between filters %s and %s.\n", link->
src->
name,
878 " the link between filters %s and %s.\n", link->
src->
name,
890 " the link between filters %s and %s.\n", link->
src->
name,
904 " the link between filters %s and %s.\n", link->
src->
name,
913 " the link between filters %s and %s.\n", link->
src->
name,
917 "supported, try specifying a channel layout using "
918 "'aformat=channel_layouts=something'.\n");
943#define REDUCE_FORMATS(fmt_type, list_type, list, var, nb, add_format) \
945 for (i = 0; i < filter->nb_inputs; i++) { \
946 AVFilterLink *link = filter->inputs[i]; \
949 if (!link->outcfg.list || link->outcfg.list->nb != 1) \
951 fmt = link->outcfg.list->var[0]; \
953 for (j = 0; j < filter->nb_outputs; j++) { \
954 AVFilterLink *out_link = filter->outputs[j]; \
957 if (link->type != out_link->type || \
958 out_link->incfg.list->nb == 1) \
960 fmts = out_link->incfg.list; \
962 if (!out_link->incfg.list->nb) { \
963 if ((ret = add_format(&out_link->incfg.list, fmt)) < 0)\
969 for (k = 0; k < out_link->incfg.list->nb; k++) \
970 if (fmts->var[k] == fmt) { \
971 fmts->var[0] = fmt; \
982 int i, j, k, ret = 0;
996 for (
i = 0;
i <
filter->nb_inputs;
i++) {
1005 for (j = 0; j <
filter->nb_outputs; j++) {
1042 int i, reduced, ret;
1063 for (
i = 0;
i <
filter->nb_inputs;
i++) {
1075 for (
i = 0;
i <
filter->nb_outputs;
i++) {
1077 int best_idx, best_diff = INT_MAX;
1088 if (
diff < best_diff) {
1106#define CH_CENTER_PAIR (AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER)
1107#define CH_FRONT_PAIR (AV_CH_FRONT_LEFT | AV_CH_FRONT_RIGHT)
1108#define CH_STEREO_PAIR (AV_CH_STEREO_LEFT | AV_CH_STEREO_RIGHT)
1109#define CH_WIDE_PAIR (AV_CH_WIDE_LEFT | AV_CH_WIDE_RIGHT)
1110#define CH_SIDE_PAIR (AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT)
1111#define CH_DIRECT_PAIR (AV_CH_SURROUND_DIRECT_LEFT | AV_CH_SURROUND_DIRECT_RIGHT)
1112#define CH_BACK_PAIR (AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT)
1145 for (
i = 0;
i <
filter->nb_inputs;
i++) {
1155 for (
i = 0;
i <
filter->nb_outputs;
i++) {
1157 int best_idx = -1, best_score = INT_MIN, best_count_diff = INT_MAX;
1168 int matched_channels, extra_channels;
1174 out_channels = out_chlayout.nb_channels;
1175 count_diff = out_channels - in_channels;
1176 if (!
KNOWN(&in_chlayout) || !
KNOWN(&out_chlayout)) {
1181 if (!
KNOWN(&in_chlayout))
1183 if (!
KNOWN(&out_chlayout))
1185 score -= 10000 +
FFABS(out_channels - in_channels) +
1186 (in_channels > out_channels ? 10000 : 0);
1218 score += 10 * matched_channels - 5 * extra_channels;
1220 if (score > best_score ||
1221 (count_diff < best_count_diff && score == best_score)) {
1224 best_count_diff = count_diff;
1248 for (
i = 0;
i <
filter->nb_inputs;
i++) {
1261 for (
i = 0;
i <
filter->nb_outputs;
i++) {
1263 int best_idx = -1, best_score = INT_MIN;
1281 if (
bps == 4 && out_bps == 8) {
1287 score = -
abs(out_bps -
bps);
1291 if (score > best_score) {
1321 for (j = 0; j <
filter->nb_inputs; j++){
1322 if (
filter->inputs[j]->incfg.formats &&
filter->inputs[j]->incfg.formats->nb_formats == 1) {
1330 for (j = 0; j <
filter->nb_outputs; j++){
1331 if (
filter->outputs[j]->incfg.formats &&
filter->outputs[j]->incfg.formats->nb_formats == 1) {
1339 for (j = 0; j <
filter->nb_outputs; j++) {
1340 if (
filter->outputs[j]->format<0) {
1353 for (j = 0; j <
filter->nb_inputs; j++)
1356 for (j = 0; j <
filter->nb_outputs; j++)
1397 int sink_links_count = 0, n = 0;
1403 for (j = 0; j <
f->nb_inputs; j++) {
1406 for (j = 0; j <
f->nb_outputs; j++) {
1409 if (!
f->nb_outputs) {
1410 if (
f->nb_inputs > INT_MAX - sink_links_count)
1412 sink_links_count +=
f->nb_inputs;
1415 sinks =
av_calloc(sink_links_count,
sizeof(*sinks));
1420 if (!
f->nb_outputs) {
1421 for (j = 0; j <
f->nb_inputs; j++) {
1472 if (!strcmp(target,
"all") || (
filter->name && !strcmp(target,
filter->name)) || !strcmp(target,
filter->filter->name)) {
1494 if(
filter && (!strcmp(target,
"all") || !strcmp(target,
filter->name) || !strcmp(target,
filter->filter->name))){
1496 while (*queue && (*queue)->
time <= ts)
1497 queue = &(*queue)->
next;
1505 (*queue)->time = ts;
1506 (*queue)->flags =
flags;
1507 (*queue)->next = next;
1524 int parent = (
index - 1) >> 1;
1527 links[
index] = links[parent];
1543 int child = 2 *
index + 1;
1551 links[
index] = links[child];
1577 oldest = &oldesti->
l.
pub;
static const char *const format[]
#define filters(fmt, type, inverse, clp, inverset, clip, one, clip_fn, packed)
static const int8_t filt[NUMTAPS *2]
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
AVFilterContext * ff_filter_alloc(const AVFilter *filter, const char *inst_name)
Allocate a new filter context and return it.
int ff_filter_config_links(AVFilterContext *filter)
Negotiate the media format, dimensions, etc of all inputs to a filter.
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
int ff_filter_activate(AVFilterContext *filter)
Main libavfilter public API header.
static FFFilterContext * fffilterctx(AVFilterContext *ctx)
static FFFilterGraph * fffiltergraph(AVFilterGraph *graph)
#define REDUCE_FORMATS(fmt_type, list_type, list, var, nb, add_format)
static int graph_check_validity(AVFilterGraph *graph, void *log_ctx)
Check for the validity of graph.
static void heap_bubble_down(FFFilterGraph *graph, FilterLinkInternal *li, int index)
void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter)
Remove a filter from a graph;.
static int reduce_formats_on_filter(AVFilterContext *filter)
int ff_filter_graph_run_once(AVFilterGraph *graph)
Run one round of processing on a filter graph.
static void print_link_formats(void *log_ctx, int level, const AVFilterLink *l, const AVFilterFormatsMerger *mergers[], int nb_mergers)
static const uint64_t ch_subst[][2]
static void swap_channel_layouts_on_filter(AVFilterContext *filter)
static int graph_check_links(AVFilterGraph *graph, void *log_ctx)
static void swap_sample_fmts(AVFilterGraph *graph)
static void heap_bubble_up(FFFilterGraph *graph, FilterLinkInternal *li, int index)
void ff_avfilter_graph_update_heap(AVFilterGraph *graph, FilterLinkInternal *li)
Update the position of a link in the age heap.
static int query_formats(AVFilterGraph *graph, void *log_ctx)
Perform one round of query_formats() and merging formats lists on the filter graph.
static int formats_declared(AVFilterContext *f)
static int graph_config_pointers(AVFilterGraph *graph, void *log_ctx)
static void swap_samplerates_on_filter(AVFilterContext *filter)
void ff_graph_thread_free(FFFilterGraph *graph)
static void swap_channel_layouts(AVFilterGraph *graph)
static int filter_check_formats(AVFilterContext *ctx)
Check the validity of the formats / etc.
#define MERGE(merger, link)
static void print_filter_formats(void *log_ctx, int level, const AVFilterContext *f)
static int graph_config_links(AVFilterGraph *graph, void *log_ctx)
Configure all the links of graphctx.
static enum AVSampleFormat find_best_sample_fmt_of_2(enum AVSampleFormat dst_fmt1, enum AVSampleFormat dst_fmt2, enum AVSampleFormat src_fmt)
int ff_graph_thread_init(FFFilterGraph *graph)
static int reduce_formats(AVFilterGraph *graph)
int ff_fmt_is_forced_full_range(enum AVPixelFormat fmt)
Returns true if a YUV pixel format is forced full range (i.e.
static int graph_config_formats(AVFilterGraph *graph, void *log_ctx)
Configure the formats of all the links in the graph.
static int filter_link_check_formats(void *log, AVFilterLink *link, AVFilterFormatsConfig *cfg)
static int pick_formats(AVFilterGraph *graph)
static int filter_query_formats(AVFilterContext *ctx)
static void swap_sample_fmts_on_filter(AVFilterContext *filter)
static int pick_format(AVFilterLink *link, AVFilterLink *ref)
int ff_fmt_is_regular_yuv(enum AVPixelFormat fmt)
Returns true if a pixel format is "regular YUV", which includes all pixel formats that are affected b...
static int get_fmt_score(enum AVSampleFormat dst_fmt, enum AVSampleFormat src_fmt)
static void swap_samplerates(AVFilterGraph *graph)
void av_bprintf(AVBPrint *buf, const char *fmt,...)
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define AV_BPRINT_SIZE_UNLIMITED
#define AV_BPRINT_SIZE_AUTOMATIC
static BitStreamFilterLinkInternal * ff_link_internal(AVBitStreamFilterLink *link)
static const AVClass filtergraph_class
static const AVOption filtergraph_options[]
memory buffer sink API for audio and video
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
Public libavutil channel layout APIs header.
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static CheckasmConfig cfg
void ff_framequeue_global_init(FFFrameQueueGlobal *fqg)
Init a global structure.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
@ AV_OPT_TYPE_UINT
Underlying C type is unsigned int.
#define AV_CH_BACK_CENTER
#define AV_CH_FRONT_CENTER
#define AV_CH_LOW_FREQUENCY
int attribute_align_arg av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags)
Get a frame with filtered data from sink and put it in frame.
#define AV_BUFFERSINK_FLAG_PEEK
Tell av_buffersink_get_buffer_ref() to read video/samples buffer reference, but not remove it from th...
int avfilter_init_str(AVFilterContext *filter, const char *args)
Initialize a filter with the supplied parameters.
int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, unsigned filt_srcpad_idx, unsigned filt_dstpad_idx)
Insert a filter in the middle of an existing link.
void avfilter_free(AVFilterContext *filter)
Free a filter context.
int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
Check validity and configure all the links and formats in the graph.
const AVFilter * avfilter_get_by_name(const char *name)
Get a filter definition matching the given name.
int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *command, const char *arg, int flags, double ts)
Queue a command for one or more filter instances.
AVFilterContext * avfilter_graph_get_filter(AVFilterGraph *graph, const char *name)
Get a filter instance identified by instance name from graph.
AVFilterContext * avfilter_graph_alloc_filter(AVFilterGraph *graph, const AVFilter *filter, const char *name)
Create a new filter instance in a filter graph.
int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags)
Make the filter instance process a command.
void avfilter_graph_free(AVFilterGraph **graphp)
Free a graph, destroy its links, and set *graph to NULL.
#define AVFILTER_THREAD_SLICE
Process multiple parts of the frame concurrently.
int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags)
Send a command to one or more filter instances.
int avfilter_graph_request_oldest(AVFilterGraph *graph)
Request a frame on the oldest sink link.
int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt, const char *name, const char *args, void *opaque, AVFilterGraph *graph_ctx)
A convenience wrapper that allocates and initializes a filter in a single step.
#define AVFILTER_CMD_FLAG_ONE
Stop once a filter understood the command (for target=all for example), fast filters are favored auto...
#define AVFILTER_CMD_FLAG_FAST
Only execute command when its fast (like a video out that supports contrast adjustment in hw)
void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags)
Enable or disable automatic format conversion inside the graph.
AVFilterGraph * avfilter_graph_alloc(void)
Allocate a filter graph.
int av_channel_layout_index_from_channel(const AVChannelLayout *channel_layout, enum AVChannel channel)
Get the index of a given channel in a channel layout.
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask)
Initialize a native channel layout from a bitmask indicating which channels are present.
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
uint64_t av_channel_layout_subset(const AVChannelLayout *channel_layout, uint64_t mask)
Find out what channels from a given set are present in a channel layout, without regard for their pos...
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
#define AVERROR_EOF
End of file.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
int av_log_get_level(void)
Get the current log level.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
int av_image_check_size2(unsigned int w, unsigned int h, int64_t max_pixels, enum AVPixelFormat pix_fmt, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of a plane of an image with...
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt)
Get the packed alternative form of the given sample format.
enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt)
Get the planar alternative form of the given sample 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.
AVSampleFormat
Audio sample formats.
@ AV_SAMPLE_FMT_S32
signed 32 bits
#define LIBAVUTIL_VERSION_INT
void av_opt_free(void *obj)
Free all allocated objects in obj.
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
#define FFERROR_BUFFERSRC_EMPTY
static FilterLink * ff_filter_link(AVFilterLink *link)
@ FF_FILTER_FORMATS_QUERY_FUNC
formats.query active.
@ FF_FILTER_FORMATS_QUERY_FUNC2
formats.query_func2 active.
static const FFFilter * fffilter(const AVFilter *f)
#define FF_FIELD_AT(type, off, obj)
Access a field in a structure by its offset.
@ AV_CLASS_CATEGORY_FILTER
#define FFSWAP(type, a, b)
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
Compute what kind of losses will occur when converting from one specific pixel format to another.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
#define AV_PIX_FMT_FLAG_FLOAT
The pixel format contains IEEE-754 floating point values.
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
#define AV_PIX_FMT_FLAG_XYZ
The pixel format contains XYZ-like data (as opposed to YUV/RGB/grayscale).
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
@ AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_JPEG
Full range content.
@ AVALPHA_MODE_UNSPECIFIED
Unknown alpha handling, or no alpha channel.
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
#define FF_ARRAY_ELEMS(a)
An AVChannelLayout holds information about the channel layout of audio data.
uint64_t mask
This member must be used for AV_CHANNEL_ORDER_NATIVE, and may be used for AV_CHANNEL_ORDER_AMBISONIC ...
union AVChannelLayout::@162063043056170047076125117143030261346263330336 u
Details about which channels are present in this layout.
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
A list of supported channel layouts.
char all_layouts
accept any known channel layout
char all_counts
accept any channel layout or count
AVChannelLayout * channel_layouts
list of channel layouts
int nb_channel_layouts
number of channel layouts
unsigned refcount
number of references to this list
struct AVFilterCommand * next
double time
time expressed in seconds
char * name
name of this filter instance
AVFilterLink ** inputs
array of pointers to input links
const AVFilter * filter
the AVFilter of which this is an instance
AVFilterLink ** outputs
array of pointers to output links
AVFilterContext ** filters
unsigned max_buffered_frames
Sets the maximum number of buffered frames in the filtergraph combined.
int thread_type
Type of multithreading allowed for filters in this graph.
avfilter_execute_func * execute
This callback may be set by the caller immediately after allocating the graph and before adding any f...
int nb_threads
Maximum number of threads used by filters in this graph.
A link between two filters.
AVFilterFormatsConfig incfg
Lists of supported formats / etc.
int w
agreed upon image width
int h
agreed upon image height
AVFilterFormatsConfig outcfg
Lists of supported formats / etc.
enum AVMediaType type
filter media type
AVFilterContext * src
source filter
int sample_rate
samples per second
AVChannelLayout ch_layout
channel layout of current buffer (see libavutil/channel_layout.h)
enum AVColorSpace colorspace
For non-YUV links, these are respectively set to fallback values (as appropriate for that colorspace)...
AVFilterPad * srcpad
output pad on the source filter
enum AVAlphaMode alpha_mode
alpha mode (for videos with an alpha channel)
AVFilterPad * dstpad
input pad on the dest filter
AVFilterContext * dst
dest filter
int format
agreed upon media format
enum AVColorRange color_range
agreed upon YUV color range
Callbacks and properties to describe the steps of a format negotiation.
const AVFilterFormatsMerger * mergers
A filter pad used for either input or output.
enum AVMediaType type
AVFilterPad type.
const char * name
Pad name.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
uint8_t nb_components
The number of components each pixel has, (1-4)
int age_index
Index in the age array.
struct AVFilterCommand * command_queue
AVFilterContext p
The public AVFilterContext.
unsigned ready
Ready status of the filter.
avfilter_execute_func * thread_execute
AVFilterGraph p
The public AVFilterGraph.
FFFrameQueueGlobal frame_queues
struct FilterLinkInternal ** sink_links
unsigned disable_auto_convert
int(* activate)(AVFilterContext *ctx)
Filter activation function.
size_t max_queued
Maximum number of allowed frames in the queues combined.
int frame_wanted_out
True if a frame is currently wanted on the output of this filter.
int age_index
Index in the age array.
int status_in
Link input status.
int frame_blocked_in
If set, the source filter can not generate a frame as is.
int64_t current_pts_us
Current timestamp of the link, as defined by the most recent frame(s), in AV_TIME_BASE units.
struct AVFilterGraph * graph
Graph the filter belongs to.
#define av_malloc_array(a, b)
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
static int ref[MAX_W *MAX_W]
static AVFormatContext * ctx
static int command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)