aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/cmdutils.c
Commit message (Collapse)AuthorAgeFilesLines
* fftools: Use report_error_then_exit_program() for allocation failuresAndreas Rheinhardt2022-09-011-14/+7
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Add function to report error before exitAndreas Rheinhardt2022-09-011-0/+6
| | | | | | | | | | | | 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-081-2/+2
| | | | | | | | | 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-211-13/+40
| | | | | | getenv() Signed-off-by: Martin Storsjö <martin@martin.st>
* fftools/cmdutils: drop redundant codeAnton Khirnov2022-03-221-15/+0
| | | | | | | 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-221-1/+7
| | | | | | 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-221-17/+0
| | | | This option is only supported by ffmpeg.
* fftools/cmdutils: split common option handlers into their own fileAnton Khirnov2022-03-221-1412/+5
|
* fftools: drop useless indirectionAnton Khirnov2022-03-221-2/+2
|
* libavfilter: Split version.hMartin Storsjö2022-03-161-0/+1
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* libswscale: Split version.hMartin Storsjö2022-03-161-0/+1
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* libswresample: Split version.hMartin Storsjö2022-03-161-0/+1
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* libpostproc: Split version.hMartin Storsjö2022-03-161-0/+1
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* libavdevice: Split version.hMartin Storsjö2022-03-161-0/+1
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* libavformat: Split version.hMartin Storsjö2022-03-161-0/+1
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* libavcodec: Split version.hMartin Storsjö2022-03-161-0/+1
| | | | | | | | | | | | | | 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-151-15/+27
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/cmdutils: Fix undefined 1 << 31Andreas Rheinhardt2022-01-111-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools: provide media type info for devicesDiederick Niehorster2021-12-241-10/+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-161-1/+1
| | | | | | | | 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>
* fftools/cmdutils: Use av_dynarray_add_nofree()Andreas Rheinhardt2021-12-051-10/+4
| | | | | | | Simplifies code and reduces the number of allocations a bit by overallocating. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Make allocate_array_elem() return ptr to new elementAndreas Rheinhardt2021-12-051-2/+4
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Atomically add elements to list of pointers, fix crashAndreas Rheinhardt2021-12-051-0/+16
| | | | | | | | | | | | | | Currently, adding a (separately allocated) element to a list of pointers works by first reallocating the array of pointers and (on success) incrementing its size and only then allocating the new element. If the latter allocation fails, the size is inconsistent, i.e. array[nb_array_elems - 1] is NULL. Our cleanup code crashes in such scenarios. Fix this by adding an auxiliary function that atomically allocates and adds a new element to a list of pointers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools: Constify values from av_dict_get()Chad Fraleigh2021-11-181-1/+1
| | | | | | | | Treat values returned from av_dict_get() as const, since they are internal to AVDictionary. Signed-off-by: Chad Fraleigh <chadf@triularity.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* cmdutils: add an option for listing stream dispositionsAnton Khirnov2021-11-161-0/+10
|
* fftools/cmdutils: Print bit depths when executing 'ffmpeg -pix_fmts'Soft Works2021-11-131-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | New output looks like this: Pixel formats: I.... = Supported Input format for conversion .O... = Supported Output format for conversion ..H.. = Hardware accelerated format ...P. = Paletted format ....B = Bitstream format FLAGS NAME NB_COMPONENTS BITS_PER_PIXEL BIT_DEPTHS ----- IO... yuv420p 3 12 8-8-8 IO... yuyv422 3 16 8-8-8 IO... rgb24 3 24 8-8-8 IO... bgr24 3 24 8-8-8 IO... yuv422p 3 16 8-8-8 IO... yuv444p 3 24 8-8-8 [..] Signed-off-by: softworkz <softworkz@hotmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* Replace all occurences of av_mallocz_array() by av_calloc()Andreas Rheinhardt2021-09-201-2/+2
| | | | | | | They do the same. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Don't report AV_CODEC_CAP_TRUNCATEDAndreas Rheinhardt2021-09-201-2/+0
| | | | | | | It is deprecated. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* ffmpeg: use display matrix frame side data for autorotationJames Almer2021-09-161-3/+1
| | | | | | | And give it priority over stream side data when present. Fixes part of ticket #6945. Signed-off-by: James Almer <jamrial@gmail.com>
* cmdutils: round rotation value to nearest integerJames Almer2021-09-161-1/+1
| | | | | | As recommended by the doxy for av_display_rotation_get(). Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/cmdutils: Use %c, not %s to write a single charAndreas Rheinhardt2021-09-051-3/+3
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Use %c, not %s, to write single charAndreas Rheinhardt2021-09-041-2/+2
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Don't access AV(In|Out)putformat.get_device_listAndreas Rheinhardt2021-09-041-14/+2
| | | | | | It is not part of the public API. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools: Remove remnants of resample_optsAndreas Rheinhardt2021-09-031-6/+2
| | | | | | | | | | | | | | These were intended to pass options to auto-inserted avresample resampling filters. Yet FFmpeg uses swresample for this purpose (with its own AVDictionary swr_opts similar to resample_opts). Therefore said options were not forwarded any more since commit 911417f0b34e611bf084319c5b5a4e4e630da940; moreover since commit 420cedd49745b284c35d97b936b71ff79b43bdf7 avresample options are not even recognized and ignored any more. Yet there are still remnants of all of this. This commit gets rid of them. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Fix warning for initialization makes integer from pointer ↵Limin Wang2021-09-011-1/+1
| | | | | | without a cast Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* fftools/cmdutils: Switch to avfilter_filter_pad_count()Andreas Rheinhardt2021-08-201-3/+3
| | | | | Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Use avfilter_pad_count() for AVFilter's number of padsAndreas Rheinhardt2021-08-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Besides being nicer code this also has the advantage of not making assumptions about the internal implementation: While it is documented that the AVFilter.inputs and AVFilter.outputs arrays are terminated by a zeroed sentinel, one is not allowed to infer that one can just check avfilter_pad_get_name(padarray, i) to see whether one has reached the sentinel: It could be that the pointer to the string is contained in a different structure than AVFilterPad that needs to be accessed first: return pad->struct->string. It could be that for small strings an internal buffer in AVFilterPad is used (to avoid a relocation) whereas for longer strings an external string is used; this is useful to avoid relocations: return pad->string_ptr ? pad->string_ptr : pad->interal_string Or it could be that the name has a default value: return pad->name ? pad->name : "default" (This actually made sense for us because the name of most of our AVFilterPads is just "default"; doing so would save lots of relocations.) The only thing one is allowed to infer from the existence of the sentinel is that one is allowed to use avfilter_pad_count() to get the number of pads. Therefore it is used. Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Use av_strstart() instead of strncmp()Andreas Rheinhardt2021-08-111-4/+2
| | | | | | This also avoids hardcoding lengths. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Remove unused cpu_countAndreas Rheinhardt2021-08-081-1/+0
| | | | | | Added in cf12a478b206cd107343827426a05aedb83816bc, but not used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools: Don't set default swscale flags in ffmpeg/ffprobe/ffplayLinjie Fu2021-08-051-8/+0
| | | | Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
* avcodec/avcodec: Stop including channel_layout.h in avcodec.hAndreas Rheinhardt2021-07-221-0/+1
| | | | | | Also include channel_layout.h directly wherever used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Stop including bsf.h in avcodec.hAndreas Rheinhardt2021-07-221-0/+1
| | | | | | Also include bsf.h directly wherever it is used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavu/cpu: Use av_cpu_ prefixThilo Borgmann2021-07-201-1/+1
|
* fftools/cmdutils.c: Add cmd line option to override detection of cpu count.Thilo Borgmann2021-07-161-0/+27
|
* avdevice/avdevice: Constify av_*_device_next APIAndreas Rheinhardt2021-04-271-2/+2
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avdevice/avdevice: Constify avdevice_list_input_sources/output_sinksAndreas Rheinhardt2021-04-271-2/+2
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* libavresample: Remove deprecated libraryAndreas Rheinhardt2021-04-271-12/+0
| | | | | | | | Deprecated in c29038f3041a4080342b2e333c1967d136749c0f. The resample filter based upon this library has been removed as well. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* cmdutils: replace strncpy() with direct assignmentAnton Khirnov2021-03-161-2/+2
| | | | | | | | Only one character is actually rewritten. Fixes truncation warnings, such as warning: ‘strncpy’ output truncated before terminating nul copying 3 bytes from a string of the same length [-Wstringop-truncation] in gcc 10.2.0
* lavc: rename AV_CODEC_CAP_AUTO_THREADS->AV_CODEC_CAP_OTHER_THREADSAnton Khirnov2021-03-161-3/+3
| | | | | | | | | | This cap is currently used to mark multithreading-capable codecs that wrap external libraries with their own multithreading code. The name is highly confusing for our API users, since libavcodec ALWAYS handles thread_count=0 (see commit message in previous commit). Therefore rename the cap and update its documentation to make its meaning clear. The old name is kept deprecated until next+1 major bump.
* fftools: Switch to const AVCodec * where possibleAndreas Rheinhardt2021-03-021-3/+4
| | | | | | | | | | | The obstacle to do so was in filter_codec_opts: It uses searches the AVCodec for options via the AV_OPT_SEARCH_FAKE_OBJ method, which requires using a void * that points to a pointer to a const AVClass. When using const AVCodec *, one can not simply use a pointer that points to the AVCodec's pointer to its AVClass, as said pointer is const, too. This is fixed by using a temporary pointer to the AVClass. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>