Similar to what was previously done for other components, e.g. decoders
(see 3b84140a1b).
Start by moving {samples,frames}_encoded into the public struct.
With this, nothing in ffmpeg_filter acesses OutputStream anymore, thus
there are no more direct ties between filtering and muxing.
Rename init_simple_filtergraph() to fg_create_simple() for consistency.
It is no longer used for anything besides a sanity-checking assert.
Rename the function to ofilter_bind_enc(), as it no longer has any
assumptions about the target being an output stream.
Pass them to ofilter_bind_ost() via OutputFilterOptions, as is done for
most other data it needs. OutputStream.[max_]frame_rate/force_fps are no
longer used outside of ffmpeg_mux*, and so can be made private.
This is a step toward decoupling encoders from muxers.
Have the muxer code read them out of the encoder context in
of_stream_init() instead.
OutputStream.par_in no longer needs to be public, so can be moved to
MuxStream.
This is a step towards decoupling encoders from muxers.
Instead, pass the encoder context to of_stream_init() and have the muxer
take the timebase from there. Note that the muxer can currently access
the codec context directly, but that will change in future commits.
This is a step towards decoupling encoders from muxers.
Log decoder messages to the encoder rather than OutputStream.
This is a step towards decoupling encoders from muxers, similarly to
what was previously done to decoders and demuxers.
This extends the syntax for specifying input streams in -map and complex
filtergraph labels, to allow selecting a view by view ID, index, or
position. The corresponding decoder is then set up to decode the
appropriate view and send frames for that view to the correct
filtergraph input(s).
This has multiple advantages:
* The macro has multiple parameters that often have similar or identical
values, yet very different meanings (one is the name of the
OptionsContext member where the parsed options are stored, the other
the name of the variable into which the result is written); this
change makes each of these explicit.
* The macro returns on failure, which may cause leaks - this was the
reason for adding MATCH_PER_STREAM_OPT_CLEAN(), also ost_add()
currently leaks encoder_opts. The new function returns failure to its
caller, which decides how to deal with it. While that adds a lot of
error checks/forwards for now, those will be reduced in following
commits.
* new code is type- and const- correct
Invocations of MATCH_PER_STREAM_OPT() with other types will be converted
in following commits.
Share the code between encoding and decoding. Instead of checking every
stream's options dictionary (which is also used for other purposes),
track all used options in a dedicated dictionary.
The decision whether -apad actually does anything is made based on muxer
properties, and so more properly belongs there. Filtering code only
receives the result.
Instead pass the encoder through a newly-added output options struct,
analogous to previously added input options.
Will allow decoupling filtering from encoding in future commits.
These functions used to be passed directly to pthread_create(), which
required them to return void*. This is no longer the case, so they can
return a plain int.
Current callstack looks like this:
* ifilter_bind_ist() (filter) calls ist_filter_add() (demuxer);
* ist_filter_add() opens the decoder, and then calls
dec_add_filter() (decoder);
* dec_add_filter() calls ifilter_parameters_from_dec() (i.e. back into
the filtering code) in order to give post-avcodec_open2() parameters
to the filter.
This is unnecessarily complicated. Pass the parameters as follows
instead:
* dec_init() (which opens the decoder) returns post-avcodec_open2()
parameters to its caller (i.e. the demuxer) in a parameter-only
AVFrame
* the demuxer passes these parameters to the filter in
InputFilterOptions, together with other filter options
The first of these binds inputs of complex filtergraphs to demuxer
streams (with a misleading comment claiming it *creates* complex
filtergraphs).
The second ensures that all filtergraph outputs are connected to an
encoder.
Merge them into a single function, which simplifies the ffmpeg_filter
API, is shorter, and will also be useful in following commits.
Also, rename misleadingly-named init_input_filter() to
fg_complex_bind_input().