Anton Khirnov
42f3f54cf4
fftools/ffmpeg_filter: make OutputFile.format/sample_rate private
...
They are not used outside of the filtering code.
2023-07-11 19:28:18 +02:00
Anton Khirnov
c9a99ffe51
fftools/ffmpeg_filter: make sure no input or output is bound twice
2023-07-11 19:28:18 +02:00
Anton Khirnov
1617d1a752
fftools/ffmpeg: pass subtitle decoder dimensions to sub2video
...
Restores behavior from before 20cacfe493 .
Eventually this should be handled similarly to audio/video - with a
filtergraph reset or a manual scaler.
2023-06-19 09:48:56 +02:00
Anton Khirnov
88f80977eb
fftools/ffmpeg: use AVFrame to pass subtitles from decoders to filters
...
Allows to use the same buffering code for all media types. Will also be
important for the following commit.
2023-06-19 09:48:56 +02:00
Anton Khirnov
5293adb1a7
fftools/ffmpeg: attach bits_per_raw_sample information to frames
...
This way avoids encoders reaching into filters or decoders for this
information.
2023-06-19 09:48:55 +02:00
Anton Khirnov
1bdd53e2f9
fftools/ffmpeg_filter: make configure_filtergraph() static
...
It is no longer used outside of ffmpeg_filter.
2023-06-19 09:48:55 +02:00
Anton Khirnov
b1a213ab5d
fftools/ffmpeg_filter: reject filtergraphs with zero outputs
...
Nothing useful can be done with them currently.
2023-06-19 09:48:55 +02:00
Anton Khirnov
a7aa05c599
fftools/ffmpeg_filter: add an AVClass to FilterGraph
...
Use it for logging.
2023-06-19 09:48:55 +02:00
Anton Khirnov
568d414074
fftools/ffmpeg: attach filter framerate to frames
...
This way the encoder does not need to reach backward into the filter.
2023-06-05 16:15:04 +02:00
Anton Khirnov
d8c61ba723
fftools/ffmpeg_filter: drop a block disabled since 2012
2023-06-05 16:15:04 +02:00
Anton Khirnov
ad14bdbcfd
fftools/ffmpeg_filter: drop a write-only variable
2023-06-05 16:15:04 +02:00
Anton Khirnov
ba2c791627
fftools/ffmpeg_filter: do not flush encoders on parameter change
...
It makes no sense to do so.
2023-05-31 16:20:19 +02:00
Anton Khirnov
2674532eee
fftools/ffmpeg_filter: constify the argument of filtergraph_is_simple()
2023-05-31 16:20:19 +02:00
Anton Khirnov
3bfc2c589a
fftools/ffmpeg_filter: make InputStream.filter private
...
It is no longer accessed outside of ffmpeg_filter.
2023-05-31 16:20:19 +02:00
Anton Khirnov
5924b70075
fftools/ffmpeg_filter: make ifilter_has_all_input_formats() static
...
It is no longer used outside ffmpeg_filter.
2023-05-31 16:20:19 +02:00
Anton Khirnov
2262df5e8a
fftools/ffmpeg_filter: drop unreachable code
...
Filtergraphs with no inputs are initialized as soon as all their outputs
are bound, so this code should not be reachable.
2023-05-31 16:20:19 +02:00
Anton Khirnov
f8abab673c
fftools/ffmpeg: move sub2video handling to ffmpeg_filter
...
Make all relevant state per-filtergraph input, rather than per-input
stream. Refactor the code to make it work and avoid leaking memory when
a single subtitle stream is sent to multiple filters.
2023-05-31 16:20:19 +02:00
Anton Khirnov
20cacfe493
fftools/ffmpeg: rework setting sub2video parameters
...
Set them in ifilter_parameters_from_dec(), similarly to audio/video
streams. This reduces the extent to which sub2video filters need to be
treated specially.
2023-05-31 16:20:19 +02:00
Anton Khirnov
a6d67b11f5
fftools/ffmpeg_filter: move sub2video subtitle queue to InputFilterPriv
...
This queue should be associated with a specific filtergraph input - if
a subtitle stream is sent to multiple filters then each should have its
own queue.
2023-05-31 16:20:19 +02:00
Anton Khirnov
5d530e3a72
fftools/ffmpeg_dec: move sub2video submission to ffmpeg_filter
...
This code is a sub2video analogue of ifilter_send_frame(), so it
properly belongs to the filtering code.
Note that using sub2video with more than one target for a given input
subtitle stream is currently broken and this commit does not change
that. It will be addressed in following commits.
2023-05-31 16:19:49 +02:00
Anton Khirnov
ad4efb9158
fftools/ffmpeg_filter: try to configure filtergraphs earlier
...
When the filtergraph has no inputs, it can be configured immediately
when all its outputs are bound to output streams. This will simplify
treating some corner cases.
2023-05-31 16:15:47 +02:00
Anton Khirnov
7520cd9f07
fftools/ffmpeg_mux_init: move OutputFilter setup code to ffmpeg_filter
...
That is a more appropriate place for it.
2023-05-31 16:15:47 +02:00
Anton Khirnov
87b576135e
fftools/ffmpeg_filter: factor out binding an output stream to OutputFilter
...
While the new function is trivial for now, it will become more useful in
future commits.
2023-05-31 16:15:47 +02:00
Anton Khirnov
dc5864a00c
fftools/ffmpeg_filter: create Input/OutputFilters together with FilterGraph
...
This way the list of filtergraph inputs/outputs is always known after
FilterGraph creation. This will allow treating simple and complex
filtergraphs in a more uniform manner.
2023-05-31 16:15:47 +02:00
Anton Khirnov
a1061d4bdc
fftools/ffmpeg_filter: move some functions higher up
...
Needed by the following commit.
2023-05-31 16:15:47 +02:00
Anton Khirnov
00183880aa
fftools/ffmpeg_filter: decouple allocating InputFilter and binding it to InputStream
...
Will be useful in future commits.
2023-05-31 16:15:47 +02:00
Anton Khirnov
7ea10bfef3
fftools/ffmpeg_filter: store just the link label in OutputFilter
...
Not the entire AVFilterInOut. This is simpler.
2023-05-31 16:15:47 +02:00
Anton Khirnov
da7ae627e1
fftools/ffmpeg_filter: always pass graph description to fg_create()
...
Currently NULL would be passed for simple filtergraphs, which would
make the filter code extract the graph description from the output
stream when needed. This is unnecessarily convoluted.
2023-05-31 16:15:47 +02:00
Anton Khirnov
badf959ed6
fftools/ffmpeg_filter: use a dedicated variable for marking simple filtergraphs
...
Do not use an unrelated graph property, which will change in future
commits.
2023-05-31 16:15:47 +02:00
Anton Khirnov
6abb4a28ef
fftools/ffmpeg: add InputStream.index
...
This allows to avoid access to the underlying AVStream in many places.
2023-05-28 10:47:59 +02:00
Anton Khirnov
4a59dde0c7
fftools/ffmpeg: eliminate InputStream.got_output
...
It tracks whether the decoder for this stream ever produced any frames
and its only use is for checking whether a filter input ever received a
frame - those that did not are prioritized by the scheduler.
This is awkward and unnecessarily complicated - checking whether the
filtergraph input format is valid works just as well and does not
require maintaining an extra variable.
2023-05-22 17:10:44 +02:00
Anton Khirnov
9effea016c
fftools/ffmpeg_filter: embed displaymatrix into private context
...
It has a small fixed size, so it is better to embed it rather than deal
with dynamic allocation.
2023-05-22 17:10:44 +02:00
Anton Khirnov
dcfbfb417c
fftools/ffmpeg_filter: keep track of the real filter input type
...
Avoid extracting it from various remote sources.
2023-05-22 17:10:44 +02:00
Anton Khirnov
f980df2c04
fftools/ffmpeg_filter: move InputFilter.type to private data
...
It is not accessed outside of ffmpeg_filter.
2023-05-22 17:10:44 +02:00
Anton Khirnov
c4a3f7edb8
fftools/ffmpeg_filter: move InputFilter.ist to private data
...
It is not accessed outside of ffmpeg_filter.
2023-05-22 17:10:44 +02:00
Anton Khirnov
0f501b2ad9
fftools/ffmpeg_filter: drop a redundant error message
...
In case no decoder is available, dec_open() called from ist_use() will
fail with 'Decoding requested, but no decoder found', so this check is
redundant.
2023-05-22 17:10:44 +02:00
Anton Khirnov
89b37ae70a
fftools/ffmpeg_filter: make input filter configured parameters private
...
They are not used outside of ffmpeg_filter.
2023-05-22 17:10:44 +02:00
Anton Khirnov
82c75ddfad
fftools/ffmpeg: move ifilter_has_all_input_formats() to ffmpeg_filter
...
That is a more appropriate place for that function.
2023-05-22 17:10:44 +02:00
Anton Khirnov
2628c7049e
fftools/ffmpeg_filter: try configuring graphs from input EOF
...
When a filtergraph input receives EOF but never saw any input frames, we
use the fallback parameters. Currently an attempt to actually configure
the filtergraph will happen elsewhere, but there is no reason to
postpone this.
2023-05-22 17:10:44 +02:00
Anton Khirnov
a16d7171d1
fftools/ffmpeg_filter: only use fallback parameters when necessary
...
With complex filtergraphs it can happen that the filtergraph is
unconfigured because some other filter than the one we just got EOF on
is missing parameters.
Make sure that the fallback parametes for a given input are only used
when that input is unconfigured.
2023-05-22 17:10:44 +02:00
Anton Khirnov
65f3d042a6
fftools/ffmpeg_demux: disallow using disabled input streams
...
This is less ad-hoc than checking explicitly in every place that binds
an input stream to a filter or output.
2023-05-22 17:10:44 +02:00
Anton Khirnov
dfa29ba955
fftools/ffmpeg: return error codes from ist_*_add()
...
Will be useful in future commits.
2023-05-22 17:10:44 +02:00
Anton Khirnov
ede6794d6a
fftools/ffmpeg_filter: split finding an unused stream into a function
...
Avoids filtering code from digging in demuxer internals.
2023-05-22 17:10:44 +02:00
Anton Khirnov
1132507327
fftools/ffmpeg_filter: make sure pkt_duration matches duration
...
Otherwise the two values might get desynchronized and lavfi can prefer
the wrong one.
2023-05-22 17:10:44 +02:00
Anton Khirnov
14b9946967
fftools/ffmpeg_filter: convert input frame timestamps
...
Decoder timebase does not always have to match filter timebase.
2023-05-22 17:10:44 +02:00
Anton Khirnov
a0174a235b
fftools/ffmpeg_filter: use InputFilterPriv.eof instead of InputFile.eof_reached
...
The two checks using eof_reached are testing whether more input can
possibly appear on this filtergraph input. InputFilterPriv.eof is the
more authoritative source for this information.
2023-05-08 10:38:59 +02:00
Anton Khirnov
dd1c67d539
fftools/ffmpeg: move unconfigured graph handling to ffmpeg_filter
...
This code more properly belongs there.
2023-05-08 10:38:59 +02:00
Anton Khirnov
c26a6c5a52
fftools/ffmpeg_filter: use av_buffer_replace() to improve code
...
It is shorter and more efficient.
2023-05-08 10:38:59 +02:00
Anton Khirnov
5356f5ed23
fftools/ffmpeg_filter: move InputFilter.hw_frames_ctx to private data
...
It is not used outside of ffmpeg_filter.
2023-05-08 10:38:59 +02:00
Anton Khirnov
71d7e9bbec
fftools/ffmpeg_filter: move InputFilter.displaymatrix to private data
...
It is not used outside of ffmpeg_filter.
2023-05-08 10:38:59 +02:00