The warning is:
libavfilter/avfiltergraph.c: In function ‘avfilter_graph_config’:
libavfilter/avfiltergraph.c:528:9: warning: ‘best_idx’ may be used uninitialized in this function [-Wuninitialized]
libavfilter/avfiltergraph.c:479:13: note: ‘best_idx’ was declared here
Initialize it to an invalid value and add an assert that it's properly
set later.
Allow substitution of channel pairs in the input for nearby channel pairs in
the output in order to get a closer match. Also weigh LFE channel mismatch
differently to favor matching the same layout without LFE over one less
channel with LFE.
The warning silenced was:
libavfilter/avfiltergraph.c: In function ‘avfilter_graph_config’:
libavfilter/avfiltergraph.c:500:13: warning: ‘best_idx’ may be used uninitialized in this function [-Wuninitialized]
libavfilter API was designed in order to be clarly distinguished from the
libavcodec API, including avcodec.h in avfilter.h is not going to help to
stick to this principle.
The inclusion of libavutil/audioconvert.h in many files was required
because avcodec.h includes audioconvert.h.
libavfilter/avcodec.h is where the lavc/lavfi interface should be
entirely placed.
While here:
- add missing .version and .category,
- make .class_name consistent across filters,
- align declarations.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
I changed the *_set_common_* functions to only set unset formats, then
added a wrapper that calls them after the filters query_formats.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avfilter_default_filter_name() is supposed to access an AVFilterContext
struct, if used with a private struct it will cause a crash since it will
access fields which are non defined in the private struct.
The function is modelled after av_default_item_name(), and will print the
name of the instance filter if defined, otherwise the name of the filter.
This allows to show the instance name in the log, which is useful when
debugging complex filter graphs.
The planar/packed switch and the packing_formats list is no longer
required, since the planar/packed information is now stored in the sample
format enum.
This is technically a major API break, possibly it should be not too
painful as we marked the audio filtering API as unstable.
The old code had two bugs:
For audio filters, the format was not set.
For video filters, if several links reference the same format list,
the same format must be selected in the end. This is done by
setting formats->format_count to 1: the other links sharing
the reference will therefore have only one choice.
If the heuristic does not pick the first format, the selected format
must also be moved to the first position.
Current code, with a filterchain such as
(input - yuv411) -> (scale - any) -> (sink - any)
will result in yuv420 being chosen for the second link, which is clearly
not right.
This commit attempts to improve in the following way:
repeat until convergence:
loop over all filters
find input link with exactly one format
force this format on all output links of the same type (if possible)
With the current code, an automatically inserted aconvert necessary
for format change would usually convert to mono for no good reason.
The new code will not avoid all conversions, but at least will keep
them among the layouts common to both filters.