Anton Khirnov
20c42213ea
fftools/ffmpeg_mux_init: drop an obsolete assignment
...
This line was added in c30a4489b4
along with
AVStream.sample_aspect_ratio. However, configuring SAR for video
encoding is now done after this code (specifically in enc_open(), which
is called when the first video frame to be encoded is obtained), so this
line cannot have any meaningful effect.
2 years ago
Anton Khirnov
858b635613
fftools/ffmpeg_mux_init: replace all remaining aborts with returning error codes
...
Mainly concerns new_stream_*() and their callees.
2 years ago
Anton Khirnov
45473258ff
fftools/ffmpeg_mux_init: return error codes from metadata processing instead of aborting
2 years ago
Anton Khirnov
dd44871eb9
fftools/ffmpeg_mux_init: improve of_add_programs()
...
Replace duplicated(!) and broken* custom string parsing with
av_dict_parse_string(). Return error codes instead of aborting.
* e.g. it treats NULL returned from av_get_token() as "separator not
found", when in fact av_get_token() only returns NULL on memory
allocation failure
2 years ago
Anton Khirnov
fd40197170
fftools/ffmpeg_mux_init: return error codes from validate_enc_avopt() instead of aborting
2 years ago
Anton Khirnov
4e3557aadb
fftools/ffmpeg_mux_init: return error codes from parse_forced_key_frames() instead of aborting
2 years ago
Anton Khirnov
6691d131d8
fftools/ffmpeg_mux_init: return error codes from copy_meta() instead of aborting
2 years ago
Anton Khirnov
54cbe6f57d
fftools/ffmpeg_mux_init: return error codes from ost_add() instead of aborting
2 years ago
Anton Khirnov
38a2fc2c29
fftools/ffmpeg_mux_init: move allocation out of prologue
...
ost_add() has a very large variable declaration prologue, performing
"active" actions that can fail in there is confusing.
2 years ago
Anton Khirnov
4e366100e9
fftools/ffmpeg_mux_init: return error codes from map_*() instead of aborting
2 years ago
Anton Khirnov
eee09cdf39
fftools/ffmpeg_mux_init: improve error handling in of_add_attachments()
...
* return error codes instead of aborting
* avoid leaking the AVIOContext on failure
* check the return code of avio_read()
2 years ago
Anton Khirnov
b3eedca5e5
fftools/ffmpeg_mux_init: return errors from create_streams() instead of aborting
2 years ago
Anton Khirnov
cce294638b
fftools/ffmpeg: return errors from assert_file_overwrite() instead of aborting
2 years ago
Anton Khirnov
c313cdd70c
fftools/ffmpeg_mux_init: return errors from of_open() instead of aborting
2 years ago
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.
2 years ago
Anton Khirnov
141d11cb3c
fftools/ffmpeg_mux: make OutputStream.pkt private
...
It is no longer used outside of muxing code.
2 years ago
Anton Khirnov
93e26a4db7
fftools/ffmpeg: handle -enc_time_base -1 during stream creation
...
There is no reason to postpone it until opening the encoder. Also, abort
when the input stream is unknown, rather than disregard an explicit
request from the user.
2 years ago
Anton Khirnov
58a64e3d54
fftools/ffmpeg_mux_init: only process -enc_time_base if the stream is encoded
...
It has no effect otherwise.
2 years ago
Anton Khirnov
c8a85d1b2f
fftools/ffmpeg_mux_init: do not overwrite OutputStream.frame_rate for streamcopy
...
The values currently written into it are not used after
streamcopy_init(), so it is better to confine them to that function.
2 years ago
Anton Khirnov
57021a68d9
fftools/ffmpeg_mux: set stream duration after the timebase is certainly known
...
Stop assuming the encoder knows the muxing timebase, which does not
always have to hold (e.g. due to bitstream filters).
2 years ago
Anton Khirnov
7520cd9f07
fftools/ffmpeg_mux_init: move OutputFilter setup code to ffmpeg_filter
...
That is a more appropriate place for it.
2 years ago
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.
2 years ago
Anton Khirnov
7ea10bfef3
fftools/ffmpeg_filter: store just the link label in OutputFilter
...
Not the entire AVFilterInOut. This is simpler.
2 years ago
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.
2 years ago
Anton Khirnov
b56db2956b
fftools/ffmpeg: add logging for creating output streams
2 years ago
Anton Khirnov
eeb7d92ac7
fftools/ffmpeg_mux_init: merge ost_add_from_filter() to ost_add()
...
This way ost_add() knows about the complex filtergraph it is fed from,
which will become useful in future commits.
2 years ago
Anton Khirnov
e9a868e9ee
fftools/sync_queue: add debug logging
2 years ago
Anton Khirnov
6abb4a28ef
fftools/ffmpeg: add InputStream.index
...
This allows to avoid access to the underlying AVStream in many places.
2 years ago
Anton Khirnov
ec75b79fe1
fftools/ffmpeg: fail earlier on text/bitmap subtitles mismatch
...
Checking whether the user requested an unsupported conversion between
text and bitmap subtitles can be done immediately when creating the
output stream.
2 years ago
Anton Khirnov
dfa29ba955
fftools/ffmpeg: return error codes from ist_*_add()
...
Will be useful in future commits.
2 years ago
Anton Khirnov
09dd9c5f41
fftools/ffmpeg_filter: add filtergraph private data
...
Start by moving OutputStream.filtered_frame to it, which really belongs
to the filtergraph rather than the output stream.
2 years ago
Anton Khirnov
0add05bd3a
fftools/ffmpeg_mux_init: rename init_output_filter() to ost_add_from_filter()
...
The previous name is misleading, because the function does not actually
initialize any filters - it creates a new output stream and binds a
filtergraph output to it.
2 years ago
Anton Khirnov
4800b50258
fftools/ffmpeg: simplify init_output_filter()
2 years ago
Anton Khirnov
ea4c42779b
fftools/ffmpeg_mux_init: drop a redundant assignment
...
OutputFilter.format is initialized in ofilter_alloc().
2 years ago
Anton Khirnov
2104de13e9
fftools/ffmpeg: reindent after previous commit
2 years ago
Anton Khirnov
6cace17b0d
fftools/ffmpeg_mux_init: drop useless new_stream_{data,unknown}
...
Their only function is checking that encoding was not specified for
data/unknown-type streams, but the check is broken because enc_ctx will
not be created in ost_add() unless a valid encoder can be found.
Add an actually working check for all types for which encoding is not
supported in choose_encoder().
2 years ago
Anton Khirnov
ab0d2052a3
fftools/ffmpeg: remove unused function arguments
2 years ago
Anton Khirnov
ecb44ca877
fftools/ffmpeg_mux_init: drop OutputStream.filters[_script]
...
They are not needed outside of ost_get_filters(), so make them stack
variables there.
2 years ago
Anton Khirnov
84e1e0fa73
fftools/ffmpeg_mux_init: move check for mixing simple/complex filters
...
Do it in ost_get_filters() together with other similar checks. Will be
useful in following commits.
Also, improve the log message.
2 years ago
Anton Khirnov
0fe5eaf69d
fftools/ffmpeg_mux_init: consolidate handling -filter for audio/video
2 years ago
Anton Khirnov
30699c103f
fftools/ffmpeg_mux: make copy_initial_nonkeyframes private to muxing code
...
It is no longer used outside of ffmpeg_mux*
2 years ago
Anton Khirnov
7f8827f28e
fftools/ffmpeg_mux: make copy_prior_start private to muxing code
...
It is no longer used outside of ffmpeg_mux*
2 years ago
Anton Khirnov
83646146fe
fftools/ffmpeg_mux: make ts_copy_start private to muxing code
...
It is no longer used outside of ffmpeg_mux*
2 years ago
Anton Khirnov
a34f483291
fftools/ffmpeg: add muxer-input codec parameters to OutputStream
...
It stores codec parameters of the stream submitted to the muxer, which
may be different from the codec parameters in AVStream due to bitstream
filtering.
This avoids the confusing back and forth synchronisation between the
encoder, bitstream filters, and the muxer, now information flows only in
one direction. It also reduces the need for non-muxing code to access
AVStream.
2 years ago
Anton Khirnov
a064aed4c3
fftools/ffmpeg: store stream media type in OutputStream
...
Reduces access to a deeply nested muxer property
OutputStream.st->codecpar->codec_type for this fundamental and immutable
stream property.
Besides making the code shorter, this will allow making the AVStream
(OutputStream.st) private to the muxer in the future.
2 years ago
Anton Khirnov
de38e17583
fftools/ffmpeg: initialize no-filter streams earlier
...
There is no reason to postpone it until transcode_init() anymore, it can
be done right at the end of of_open().
2 years ago
Anton Khirnov
ff92ecad2f
fftools/ffmpeg: stop setting InputStream fields from muxing/filtering code
...
Set InputStream.decoding_needed/discard/etc. only from
ist_{filter,output},add() functions. Reduces the knowledge of
InputStream internals in muxing/filtering code.
2 years ago
Anton Khirnov
c7438e8737
fftools/ffmpeg_mux_init: consolidate input stream flagging code
...
Makes it easier to see where the input stream is modified from muxer
code.
2 years ago
Anton Khirnov
a0452ee837
fftools/ffmpeg_mux_init: remove a redundant check
2 years ago
Anton Khirnov
12f3f41bbf
fftools/ffmpeg: move init_output_stream_streamcopy() to ffmpeg_mux_init
...
Everything in it can be done immediately when creating the output
stream, there is no reason to postpone it.
2 years ago