These per-stream FIFOs hold the packets before every stream is
initialized and the header can be written. Once that happens, current
code will flush each stream's queue one after the other. However, in
case we buffered a lot of data for multiple streams, this may cause the
muxer to overflow max_interleave_delta, resulting in worse interleaving
than necessary.
Change the code to interleave packets from all the queues by DTS.
I.e. those that are only used to figure out input/output counts, since
some filters might expect a valid hw device in init and refuse to
initalize otherwise.
This requires complex filtergraphs to be created in a separate step
after parsing global options, after all hw devices are guaranteed to
exist.
The log message was logged for `filtergraphs[j]` which would cause a
heap buffer overflow in certain circumstances.
Correctly it should be logged for the current filtergraph, so just
use `fg` here.
To streamcopy_init().
This will allow to simplify the control flow in ost_add() by moving the
ost_get_filters() call (which previously had to handle both encoding and
streamcopy streams) to ost_bind_filter() (which is only called for
audio/video encoding).
Also, return EINVAL rather than ENOSYS, as trying to combine filtering
with streamcopy is a parameter error.
Similar to what was previously done for other components, e.g. decoders
(see 3b84140a1b).
Start by moving {samples,frames}_encoded into the public struct.
This function creates AND initializes a filter, so setting any filter
options after it is wrong. It happens to work when the filter's init
function does not touch the options in question, but is forbidden by the
API and is not guaranteed to remain functional.
Instead, use avfilter_graph_alloc_filter(), followed by setting the
options, and avfilter_init_dict().
This function creates AND initializes a filter, so setting any filter
options after it is wrong. It happens to work when the filter's init
function does not touch the options in question, but is forbidden by the
API and is not guaranteed to remain functional.
Instead, use avfilter_graph_alloc_filter(), followed by setting the
options, and avfilter_init_dict().
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.
This code uses no encoder properties or state besides its name, and is
mostly muxer logic, and thus belongs more properly into the muxer.
The results of several test change due to different metadata tag order
(the "encoder" tag is now set first).
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.
The only variable accessed from it is AVCodecContext, which we can
pass directly.
Also, this function currently logs into the AVCodecContext, which is
wrong. Log to Encoder instead.
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).
If not, report it as a bug. avfilter_graph_create_filter() will return ENOMEM if the
passed filter argument is NULL, which is misleading.
Signed-off-by: James Almer <jamrial@gmail.com>