Andreas Rheinhardt
071c625ad7
fftools/ffmpeg_opt: Reduce scope of variables for deprecated code
...
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 years ago
Andreas Rheinhardt
8bb1bcf47d
fftools/ffmpeg_opt: Fix leak on error
...
Fixes Coverity id #1539096 .
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 years ago
Andreas Rheinhardt
0368ded1a9
fftools/opt_common: Fix leak on error
...
Fixes Coverity issue #743443 .
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 years ago
Andreas Rheinhardt
2654347d7a
fftools/ffmpeg_opt: Fix leak on error
...
Fixes Coverity issue #1539097 .
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 years ago
Andreas Rheinhardt
2a44c4bc9e
fftools/ffmpeg_mux_init: Fix leak on error
...
Fixes Coverity issue #1539098 .
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 years ago
Anton Khirnov
ccc6849932
fftools/ffmpeg: stop calling exit_program()
...
Remove exit_program() and register_exit(), as they are no longer used.
2 years ago
Anton Khirnov
a81d9231b9
fftools/ffprobe: stop calling exit_program()
...
Inline the relevant part of ffprobe_cleanup() into main() and drop the
rest.
2 years ago
Anton Khirnov
be49c48282
fftools/ffprobe: inline opt_output_file() into its only caller
...
There is no reason to keep them separate.
Also, replace exit_program() with returning an error code.
2 years ago
Anton Khirnov
411e183360
fftools/opt_common: replace report_and_exit() with returning an error code
...
Remove report_and_exit(), as it has no more users.
2 years ago
Anton Khirnov
78699923ac
fftools/ffplay: replace report_and_exit() with returning an error code
2 years ago
Anton Khirnov
140cb5a742
fftools/ffprobe: replace report_and_exit() with returning error codes
2 years ago
Anton Khirnov
83ace80bfd
fftools/ffmpeg: return an error from MATCH_PER_STREAM_OPT() instead of aborting
2 years ago
Anton Khirnov
2f155b18a1
fftools/ffmpeg: return an error from assert_avoptions() instead of aborting
...
Rename it to check_avoptions().
2 years ago
Anton Khirnov
eda1fac27a
fftools/cmdutils: return AVERROR_EXIT for OPT_EXIT options instead of aborting()
2 years ago
Anton Khirnov
8173623e39
fftools/ffmpeg: consolidate exiting from main() on error
2 years ago
Anton Khirnov
c56fabde27
fftools/ffmpeg_opt: consolidate printing errors in ffmpeg_parse_options()
2 years ago
Anton Khirnov
87f0333af1
fftools/cmdutils: add error handling to filter_codec_opts()
2 years ago
Anton Khirnov
6b8cf2505a
fftools/cmdutils: constify the first parameter of filter_codec_opts()
2 years ago
Anton Khirnov
39d5104332
fftools: handle errors in parse_options()
2 years ago
Anton Khirnov
49ac7fc485
fftools: remove parse_time_or_die()
...
Replace it with calling av_parse_time() directly, which provides
graceful error handling and more accurate error messages.
2 years ago
Anton Khirnov
9cb47c78d6
fftools: return errors from parse_number_or_die() instead of aborting
...
Rename the function to just parse_number().
2 years ago
Anton Khirnov
4adbe2d219
fftools/opt_common: replace exit_program() with returning error codes
2 years ago
Anton Khirnov
a50f90f1c2
fftools/ffmpeg_opt: replace exit_program() with returning error codes
2 years ago
Anton Khirnov
6c6f13baf3
fftools/ffmpeg: return errors from find_codec_or_die() instead of aborting
...
Rename the function to just find_codec().
2 years ago
Anton Khirnov
2e6afa799e
fftools/cmdutils: add error handling to GROW_ARRAY()
2 years ago
Anton Khirnov
b23abb7c48
fftools/cmdutils: add error handling to grow_array()
2 years ago
Anton Khirnov
6be4a29397
fftools/cmdutils: add error handling to allocate_array_elem()
2 years ago
Anton Khirnov
8eb5adeab8
fftools/cmdutils: drop unused ALLOC_ARRAY_ELEM()
2 years ago
Anton Khirnov
26e1e80152
fftools/ffmpeg_opt: reimplement -streamid using a dictionary
...
This does not require an arbitrary limit on the number of streams.
Also, return error codes from opt_streamid() instead of aborting.
2 years ago
Anton Khirnov
37abb3a419
fftools/cmdutils: return error codes from setup_find_stream_info_opts() instead of aborting
2 years ago
Anton Khirnov
13ebc9a0a9
fftools/ffmpeg_filter: replace remaining report_and_exit() with error codes
2 years ago
Anton Khirnov
cb8242db8d
fftools/ffmpeg_filter: return error codes from set_channel_layout() instead of aborting
2 years ago
Anton Khirnov
5ba7aa2ce8
fftools/ffmpeg_filter: return error codes from fg_create() instead of aborting
2 years ago
Anton Khirnov
8db96808bc
fftools/ffmpeg_filter: return error codes from choose_pix_fmts() instead of aborting
2 years ago
Anton Khirnov
8815adfe75
fftools/ffmpeg_filter: replace remaining exit_program() with error codes
2 years ago
Anton Khirnov
a52ee1aa47
fftools/ffmpeg_filter: return error codes from init_input_filter() instead of aborting
2 years ago
Anton Khirnov
ab16e324ea
fftools/ffmpeg_filter: return error codes from ofilter_bind_ost() instead of aborting
2 years ago
Anton Khirnov
6298dd683b
fftools/ffmpeg_dec: drop redundant handling of AVERROR_EXPERIMENTAL
...
Normal error handling does the job just as well.
2 years ago
Anton Khirnov
518b49a735
fftools/ffmpeg_dec: return error codes from dec_packet() instead of aborting
2 years ago
Anton Khirnov
e0f4259689
fftools/ffmpeg_mux: return errors from of_output_packet() instead of aborting
2 years ago
Anton Khirnov
2b4afe8169
fftools/ffmpeg_enc: return errors from encode_frame() instead of aborting
2 years ago
Anton Khirnov
43bcf631d0
fftools/ffmpeg_enc: return errors from enc_flush() instead of aborting
2 years ago
Anton Khirnov
dde3de0170
fftools/ffmpeg_enc: return errors from do_*_out() instead of aborting
2 years ago
Anton Khirnov
aa1173feee
fftools/ffmpeg_enc: return errors from enc_open() instead of aborting
2 years ago
Anton Khirnov
80a64800ea
fftools/ffmpeg_enc: return errors from enc_frame() instead of aborting
2 years ago
Anton Khirnov
c4b074676a
fftools/ffmpeg_mux_init: avoid invalid memory access in set_dispositions()
...
This function assumes AVMEDIA_* are always positive, while in fact it
can also handle AVMEDIA_TYPE_UNKNOWN, which is -1.
2 years ago
Anton Khirnov
3a89e6d352
fftools/ffmpeg_filter: restrict reap_filters() to a single filtergraph
...
This is more natural, as all except one of its callers require
processing only one filtergraph.
2 years ago
Anton Khirnov
9d44eb8af5
fftools/ffmpeg_filter: stop accessing encoder from pixfmt selection
...
ffmpeg CLI pixel format selection for filtering currently special-cases
MJPEG encoding, where it will restrict the supported list of pixel
formats depending on the value of the -strict option. In order to get
that value it will apply it from the options dict into the encoder
context, which is a highly invasive action even now, and would become a
race once encoding is moved to its own thread.
The ugliness of this code can be much reduced by moving the special
handling of MJPEG into ofilter_bind_ost(), which is called from encoder
init and is thus synchronized with it. There is also no need to write
anything to the encoder context, we can evaluate the option into our
stack variable.
There is also no need to access AVCodec at all during pixel format
selection, as the pixel formats array is already stored in
OutputFilterPriv.
2 years ago
Anton Khirnov
037d364797
fftools/ffmpeg_filter: move "smart" pixfmt selection to ffmpeg_mux_init
...
This code works on encoder information and has no interaction with
filtering, so it does not belong in ffmpeg_filter.
2 years ago
Anton Khirnov
249bca763d
fftools/ffmpeg_mux_init: handle pixel format endianness
...
When -pix_fmt designates a BE/LE pixel format, it gets translated into
the native one by av_get_pix_fmt(). This may not always be the best
choice, as the encoder might only support one endianness. In such a
case, explicitly choose the endianness supported by the encoder.
While this is currently redundant with choose_pixel_fmt() in
ffmpeg_filter.c, the latter code will be deprecated in following commits.
2 years ago