summaryrefslogtreecommitdiff
path: root/fftools/cmdutils.c
Commit message (Collapse)AuthorAge
* 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>
* fftools/cmdutils: Use av_dynarray_add_nofree()Andreas Rheinhardt2021-12-05
| | | | | | | 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-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Atomically add elements to list of pointers, fix crashAndreas Rheinhardt2021-12-05
| | | | | | | | | | | | | | 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-18
| | | | | | | | 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-16
|
* fftools/cmdutils: Print bit depths when executing 'ffmpeg -pix_fmts'Soft Works2021-11-13
| | | | | | | | | | | | | | | | | | | | | | | | 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-20
| | | | | | | 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-20
| | | | | | | 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-16
| | | | | | | 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-16
| | | | | | 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-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Use %c, not %s, to write single charAndreas Rheinhardt2021-09-04
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Don't access AV(In|Out)putformat.get_device_listAndreas Rheinhardt2021-09-04
| | | | | | 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-03
| | | | | | | | | | | | | | 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-01
| | | | | | without a cast Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* fftools/cmdutils: Switch to avfilter_filter_pad_count()Andreas Rheinhardt2021-08-20
| | | | | 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-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-11
| | | | | | This also avoids hardcoding lengths. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Remove unused cpu_countAndreas Rheinhardt2021-08-08
| | | | | | 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-05
| | | | Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
* avcodec/avcodec: Stop including channel_layout.h in avcodec.hAndreas Rheinhardt2021-07-22
| | | | | | 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-22
| | | | | | 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-20
|
* fftools/cmdutils.c: Add cmd line option to override detection of cpu count.Thilo Borgmann2021-07-16
|
* avdevice/avdevice: Constify av_*_device_next APIAndreas Rheinhardt2021-04-27
| | | | | 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-27
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* libavresample: Remove deprecated libraryAndreas Rheinhardt2021-04-27
| | | | | | | | 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-16
| | | | | | | | 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-16
| | | | | | | | | | 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-02
| | | | | | | | | | | 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>
* fftools/cmdutils: Use av_strstart instead of strncmpAndreas Rheinhardt2021-02-28
| | | | | | | It makes the intent clearer and avoids searching for a delimiter in advance. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* fftools/cmdutils: also print warnings when using -sinks and -sourcesMarton Balint2020-12-03
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* fftools: switch to the new child class iteration APIAnton Khirnov2020-06-10
|
* fftools/ffmpeg: update text requesting samplesAndriy Gelman2020-06-01
| | | | | Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com> Reviewed-by: Marton Balint <cus@passwd.hu>
* cmdutils: drop libavformat/network.h includeAnton Khirnov2020-05-22
| | | | | It is not a public header and has not been used since 10173c0e58e557582dbd659f42c6aa164a8682db
* fftools/cmdutils: remove lossless and intra only capability entries from ↵James Almer2020-05-21
| | | | | | | | print_codec() They are codec properties, not encoder capabilities. Signed-off-by: James Almer <jamrial@gmail.com>
* cmdutils: stop using deprecated av_codec_next()Anton Khirnov2020-04-20
| | | | Signed-off-by: Josh de Kock <josh@itanimul.li>
* cmdutils: fix crash if no name for "ffmpeg -h protocol"Jun Zhao2020-01-30
| | | | | | | | | | fix crash when used the command like: - ffmpeg -h protocol - ffmpeg -h protocol= Signed-off-by: Jun Zhao <barryjzhao@tencent.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* cmdutils: add show_help_protocol for get protocol optionsSteven Liu2020-01-30
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* cmdutils: Fix compilation on cygwin wrt SetDllDirectory and GetModuleHandleMartin Storsjö2020-01-08
| | | | | | | | | | | | After 06ec9c4746ebc1d3b613c1847e434bbd0b4407b4 we check for these functions in configure (which will succeed in cygwin), but cmdutils.c only includes windows.h if _WIN32 is defined (which it isn't in cygwin). Retain the old intent from before 06ec9c4746ebc1d3b613c1847e434bbd0b4407b4, that these functions only would be used when _WIN32 is defined, while only using them if configure has agreed that they do exist. Signed-off-by: Martin Storsjö <martin@martin.st>
* fftools/cmdutils: Fix break command dump for -map optionJun Zhao2019-12-23
| | | | | | | | | | | | | | Before this fix, ffmpeg -h full | grep map get the command dump like: -map [-]input_file_id[:stream_specifier][,sync_file_id[:stream_s set input stream mapping ^ | truncated after this fix, we can get full option dump. Found-by: vacingfang <vacingfang@tencent.com> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* configure: Check for the SetDllDirectory and GetModuleHandle functionsMartin Storsjö2019-12-13
| | | | | | | | | | | | These functions aren't available when building for the restricted UWP/WinRT/WinStore API subsets. Normally when building in this mode, one is probably only building the libraries, but being able to build ffmpeg.exe still is useful (and a ffmpeg.exe targeting these API subsets still can be run e.g. in wine, for testing). Signed-off-by: Martin Storsjö <martin@martin.st>
* cmdutils: trailing options may be ignoredLou Logan2019-10-01
| | | | | Signed-off-by: Lou Logan <lou@lrcd.com> Signed-off-by: mypopy <mypopy@gmail.com>
* cmdutils: promote report level if loglevel is higherGyan Doshi2019-09-13
|
* fftools: Use right function signature and pointersAndreas Rheinhardt2019-08-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The option tables of the various fftools (in particular ffprobe) are arrays of OptionDef; said type contains a union of a pointer to void and a function pointer of type int (*)(void *, const char *, const char *) as well as a size_t. Some entries (namely the common entry for writing a report as well as several more of ffprobe's entries) used the pointer to void to store a pointer to functions of type int (*)(const char *) or type int (*)(const char *, const char *); nevertheless, when the functions are actually called in write_option (in cmdutils.c), it is done via a pointer of the first type. There are two things wrong here: 1. Pointer to void can be converted to any pointer to incomplete or object type and back; but they are nevertheless not completely generic pointers: There is no provision in the C standard that guarantees their convertibility with function pointers. C90 lacks a generic function pointer, C99 made every function pointer a generic function pointer and still disallows the convertibility with void *. 2. The signature of the called function differs from the signature of the pointed-to type. This is undefined behaviour in C99 (given that C90 lacks a way to convert function pointers at all, it doesn't say anything about such a situation). It only works because none of the functions this patch is about make any use of their parameters at all. Therefore this commit changes the type of the relevant functions to match the type used for the call and uses the union's function pointer to store it. This is legal even in C90. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* cmdutils: print a more descriptive error message in show_help_bsf() when no ↵James Almer2018-07-28
| | | | | | | bsf is specified Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/cmdutils: Replace the number by macro for bprint initJun Zhao2018-06-17
| | | | | | Replace the number by macro for bprint init. Signed-off-by: Jun Zhao <mypopydev@gmail.com>