summaryrefslogtreecommitdiff
path: root/fftools/cmdutils.c
Commit message (Collapse)AuthorAge
* fftools/cmdutils: remove harmful variable shadowingAnton Khirnov2024-02-24
| | | | It causes write_option() to return 0 when calling func_arg() fails.
* fftools/cmdutils: Don't cast const awayAndreas Rheinhardt2024-02-09
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: surround option arguments by <> in help outputAnton Khirnov2024-01-20
| | | | Makes it more clear that they are placeholders for actual values.
* fftools/cmdutils: indicate specifiers in option syntax in help outputAnton Khirnov2024-01-20
|
* fftools/cmdutils: drop alt_flags parameter from show_help_options()Anton Khirnov2024-01-20
| | | | | No user sets it to more than one flag, so it is redundant with req_flags.
* fftools/cmdutils: add option syntax for loading arbitrary arguments from a fileAnton Khirnov2024-01-20
| | | | Aligned with analogous feature for filter options in ffmpeg CLI.
* fftools/ffmpeg: improve WARN_MULTIPLE_OPT_USAGE()Anton Khirnov2023-12-22
| | | | | | | | | | | | Currently it requires every single OPT_SPEC option to be accompanied by an array of alternate names for this option. The vast majority of options have no alternate names, resulting in a large numbers of unnecessary single-element arrays that merely contain the option name. Extend the option parsing API to allow marking options as having alternate names, or as being the canonical name for some existing alternatives. Use this new information to avoid the need for abovementioned unnecessary single-element arrays.
* fftools/ffmpeg: change the MATCH_PER_TYPE_OPT macro into a functionAnton Khirnov2023-12-22
| | | | | There is no reason for it to be a macro anymore, this makes the code using it cleaner and simpler.
* fftools/cmdutils: add a struct for a list of SpecifierOptAnton Khirnov2023-12-22
| | | | Significantly simplifies the code dealing with OPT_SPEC.
* fftools/cmdutils: check valid flags for OPT_TYPE_FUNCAnton Khirnov2023-12-22
| | | | SPEC and OFFSET do not make sense for functions.
* fftools/cmdutils: include OPT_PERFILE in OPT_OFFSETAnton Khirnov2023-12-22
| | | | | And analogously OPT_OFFSET in OPT_SPEC. Previously the inclusion would be implicit and required all code to remember this.
* fftools/cmdutils: rename HAS_ARG to OPT_FUNC_ARGAnton Khirnov2023-12-22
| | | | | For consistent namespacing with other option flags. Also, document and enforce that it can only be set for func-type options.
* fftools: split off option types from other flagsAnton Khirnov2023-12-22
| | | | | These values are not actually flags, as only one of them can be meaningfully set.
* fftools/cmdutils: simplify handling of the HAS_ARG option flagAnton Khirnov2023-12-22
| | | | | | | | | | This option flag only carries nontrivial information for options that call a function, in all other cases its presence can be inferred from the option type (bool options do not have arguments, all other types do) and is thus nothing but useless clutter. Change the option parsing code to infer its value when it can, and drop the flag from options where it's not needed.
* fftools/cmdutils: only set array size after allocation succeededAnton Khirnov2023-11-09
|
* fftools/ffmpeg: stop calling exit_program()Anton Khirnov2023-07-20
| | | | Remove exit_program() and register_exit(), as they are no longer used.
* fftools/opt_common: replace report_and_exit() with returning an error codeAnton Khirnov2023-07-20
| | | | Remove report_and_exit(), as it has no more users.
* fftools/cmdutils: return AVERROR_EXIT for OPT_EXIT options instead of aborting()Anton Khirnov2023-07-20
|
* fftools/cmdutils: add error handling to filter_codec_opts()Anton Khirnov2023-07-20
|
* fftools/cmdutils: constify the first parameter of filter_codec_opts()Anton Khirnov2023-07-20
|
* fftools: handle errors in parse_options()Anton Khirnov2023-07-20
|
* fftools: remove parse_time_or_die()Anton Khirnov2023-07-20
| | | | | Replace it with calling av_parse_time() directly, which provides graceful error handling and more accurate error messages.
* fftools: return errors from parse_number_or_die() instead of abortingAnton Khirnov2023-07-20
| | | | Rename the function to just parse_number().
* fftools/cmdutils: add error handling to GROW_ARRAY()Anton Khirnov2023-07-20
|
* fftools/cmdutils: add error handling to grow_array()Anton Khirnov2023-07-20
|
* fftools/cmdutils: add error handling to allocate_array_elem()Anton Khirnov2023-07-20
|
* fftools/cmdutils: return error codes from setup_find_stream_info_opts() ↵Anton Khirnov2023-07-20
| | | | instead of aborting
* fftools/cmdutils: constify the argument of get_rotation()Anton Khirnov2023-05-22
|
* fftools: use av_dict_iterateMarvin Scholz2022-12-01
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Use av_err2strMarvin Scholz2022-10-14
| | | | | | | | | av_err2str which is a wrapper for av_strerror already calls strerror_r if available and if not has a fallback for the other error codes that would be handled by that, so manually calling strerror again if it fails is not necessary. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* fftools: Use report_error_then_exit_program() for allocation failuresAndreas Rheinhardt2022-09-01
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Add function to report error before exitAndreas Rheinhardt2022-09-01
| | | | | | | | | | | | This is designed to improve and unify error handling for allocation failures for the many (often small) allocations that we have in the fftools. These typically either don't return an error message or an error message that is not really helpful to the user and can be replaced by a generic error message without loss of information. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools: Fix preset search pathesNicolas Gaullier2022-07-08
| | | | | | | | | regression since 13350e81fd Fix looking for .ffmpeg subfolder in FFMPEG_DATADIR and inversely not in HOME. Fix search order (documentation). Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* fftools: Remove MAX_PATH limit and switch to UTF-8 versions of fopen() and ↵Nil Admirari2022-06-21
| | | | | | getenv() Signed-off-by: Martin Storsjö <martin@martin.st>
* fftools/cmdutils: drop redundant codeAnton Khirnov2022-03-22
| | | | | | | It allocates a dummy sws/swr context and tries setting options on it, apparently to check if they are valid. This is redundant, since the options will be checked if/when they are later applied on a context that is actually used for conversion.
* fftools: drop the fake "default" option from ffplay/ffprobeAnton Khirnov2022-03-22
| | | | | | It tries to process any unhandled options as AVOptions. Handle this directly in cmdutils.c, without resorting to a confusing fake option definition (which is currently visible to the users in -help output).
* fftools: move opt_timelimit from cmdutils to ffmpegAnton Khirnov2022-03-22
| | | | This option is only supported by ffmpeg.
* fftools/cmdutils: split common option handlers into their own fileAnton Khirnov2022-03-22
|
* fftools: drop useless indirectionAnton Khirnov2022-03-22
|
* libavfilter: Split version.hMartin Storsjö2022-03-16
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* libswscale: Split version.hMartin Storsjö2022-03-16
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* libswresample: Split version.hMartin Storsjö2022-03-16
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* libpostproc: Split version.hMartin Storsjö2022-03-16
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* libavdevice: Split version.hMartin Storsjö2022-03-16
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* libavformat: Split version.hMartin Storsjö2022-03-16
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* libavcodec: Split version.hMartin Storsjö2022-03-16
| | | | | | | | | | | | | | This avoids including version.h in all source files, avoiding unnecessary rebuilds when the version number is bumped. Only version_major.h is included by the main header, which defines availability of e.g. FF_API_* macros, and which is bumped much less often. This isn't done for libavutil/version.h, because that header needs to be included essentially everywhere due to LIBAVUTIL_VERSION_INT being used wherever an AVClass is constructed. Signed-off-by: Martin Storsjö <martin@martin.st>
* ffmpeg: convert to new channel layout-APIJames Almer2022-03-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/cmdutils: Fix undefined 1 << 31Andreas Rheinhardt2022-01-11
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools: provide media type info for devicesDiederick Niehorster2021-12-24
| | | | | | | | fftools now print info about what media type(s), if any, are provided by sink and source avdevices. Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* fftools/cmdutils: Avoid crash when opts could not be allocatedYu Yang2021-12-16
| | | | | | | | If 'opts' could not be allocated, exiting the program to avoid crash when release it. Reported-by: TOTE Robot <oslab@tsinghua.edu.cn> Signed-off-by: Yu Yang <yuyang14@kuaishou.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>