Commit Graph

67 Commits

Author SHA1 Message Date
mrbesen 8d36418bbe
Merge branch 'master' of https://git.ffmpeg.org/ffmpeg 2022-01-15 01:34:55 +01:00
Andreas Rheinhardt bbf00916e4 fftools/cmdutils: Fix undefined 1 << 31
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-11 00:20:35 +01:00
Diederick Niehorster 5c90c13a56 fftools: provide media type info for devices
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>
2021-12-24 14:06:56 +05:30
Yu Yang a4580bf959 fftools/cmdutils: Avoid crash when opts could not be allocated
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>
2021-12-16 11:56:00 +01:00
Andreas Rheinhardt 2d0bfbd0fa fftools/cmdutils: Use av_dynarray_add_nofree()
Simplifies code and reduces the number of allocations a bit
by overallocating.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-05 13:27:38 +01:00
Andreas Rheinhardt 2e7ef008e3 fftools/cmdutils: Make allocate_array_elem() return ptr to new element
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-05 13:27:38 +01:00
Andreas Rheinhardt 3ca1e31e63 fftools/cmdutils: Atomically add elements to list of pointers, fix crash
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>
2021-12-05 13:27:37 +01:00
Chad Fraleigh a185b526a9 fftools: Constify values from av_dict_get()
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>
2021-11-18 19:43:32 +01:00
Anton Khirnov d4ae2a20e8 cmdutils: add an option for listing stream dispositions 2021-11-16 10:51:32 +01:00
Soft Works f3b6e3e81a fftools/cmdutils: Print bit depths when executing 'ffmpeg -pix_fmts'
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>
2021-11-13 19:55:32 +01:00
mrbesen 8b7dd33a3b
Merge branch 'master' of https://git.ffmpeg.org/ffmpeg 2021-10-19 19:40:17 +02:00
Andreas Rheinhardt 1ea3650823 Replace all occurences of av_mallocz_array() by av_calloc()
They do the same.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-20 01:03:52 +02:00
Andreas Rheinhardt c5c6871a22 fftools/cmdutils: Don't report AV_CODEC_CAP_TRUNCATED
It is deprecated.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-20 00:21:57 +02:00
James Almer 535a835e51 ffmpeg: use display matrix frame side data for autorotation
And give it priority over stream side data when present.
Fixes part of ticket #6945.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-16 12:46:07 -03:00
James Almer a8bd8d46f9 cmdutils: round rotation value to nearest integer
As recommended by the doxy for av_display_rotation_get().

Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-16 12:46:07 -03:00
Andreas Rheinhardt b36b703c29 fftools/cmdutils: Use %c, not %s to write a single char
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-05 11:55:01 +02:00
Andreas Rheinhardt 70f06dd63c fftools/cmdutils: Use %c, not %s, to write single char
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:12:56 +02:00
Andreas Rheinhardt 23b83adb6d fftools/cmdutils: Don't access AV(In|Out)putformat.get_device_list
It is not part of the public API.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:12:56 +02:00
Andreas Rheinhardt f3f9041302 fftools: Remove remnants of resample_opts
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
420cedd497 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>
2021-09-03 16:08:19 +02:00
Limin Wang c500dc7cca fftools/cmdutils: Fix warning for initialization makes integer from pointer without a cast
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-01 09:32:24 +08:00
Andreas Rheinhardt 8f72bb866e fftools/cmdutils: Switch to avfilter_filter_pad_count()
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-20 14:29:15 +02:00
Andreas Rheinhardt d53d48c799 fftools/cmdutils: Use avfilter_pad_count() for AVFilter's number of pads
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>
2021-08-20 12:52:33 +02:00
Andreas Rheinhardt c66bb56d9a fftools/cmdutils: Use av_strstart() instead of strncmp()
This also avoids hardcoding lengths.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-11 16:24:36 +02:00
Andreas Rheinhardt 7f660035fe fftools/cmdutils: Remove unused cpu_count
Added in cf12a478b2, but not used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-08 18:40:46 +02:00
Linjie Fu 5b0e6b0d82 fftools: Don't set default swscale flags in ffmpeg/ffprobe/ffplay
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
2021-08-05 22:23:49 +08:00
Andreas Rheinhardt 1be3d8a0cb avcodec/avcodec: Stop including channel_layout.h in avcodec.h
Also include channel_layout.h directly wherever used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 11:14:31 +02:00
Andreas Rheinhardt 57b5ec6ba7 avcodec/avcodec: Stop including bsf.h in avcodec.h
Also include bsf.h directly wherever it is used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 11:14:16 +02:00
Thilo Borgmann c1bf56a526 lavu/cpu: Use av_cpu_ prefix 2021-07-20 10:31:41 +02:00
Thilo Borgmann cf12a478b2 fftools/cmdutils.c: Add cmd line option to override detection of cpu count. 2021-07-16 10:06:23 +02:00
Andreas Rheinhardt 8b3e6ce5f4 avdevice/avdevice: Constify av_*_device_next API
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:14 -03:00
Andreas Rheinhardt d7e0d428fa avdevice/avdevice: Constify avdevice_list_input_sources/output_sinks
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:14 -03:00
Andreas Rheinhardt 420cedd497 libavresample: Remove deprecated library
Deprecated in c29038f304.
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>
2021-04-27 10:43:13 -03:00
mrbesen 02d2c088fd
print (en/de)coders 2021-03-17 11:40:46 +01:00
mrbesen c05904cc3e
ETA, hidebanner, max_muxing_queue_size 2021-03-17 11:38:58 +01:00
Anton Khirnov b334fd39c9 cmdutils: replace strncpy() with direct assignment
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
2021-03-16 10:41:01 +01:00
Anton Khirnov 7d09579190 lavc: rename AV_CODEC_CAP_AUTO_THREADS->AV_CODEC_CAP_OTHER_THREADS
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.
2021-03-16 10:38:41 +01:00
Andreas Rheinhardt 988deae6da fftools: Switch to const AVCodec * where possible
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>
2021-03-02 08:20:10 +01:00
Andreas Rheinhardt bd85c63d1d fftools/cmdutils: Use av_strstart instead of strncmp
It makes the intent clearer and avoids searching for a delimiter
in advance.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-28 17:14:21 +01:00
Marton Balint 87c1b74233 fftools/cmdutils: also print warnings when using -sinks and -sources
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-12-03 18:32:57 +01:00
Anton Khirnov e0fbb6cf2b fftools: switch to the new child class iteration API 2020-06-10 12:36:44 +02:00
Andriy Gelman 6cd198860d fftools/ffmpeg: update text requesting samples
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Reviewed-by: Marton Balint <cus@passwd.hu>
2020-06-01 14:39:52 -04:00
Anton Khirnov 8cfab9fa8c cmdutils: drop libavformat/network.h include
It is not a public header and has not been used since
10173c0e58
2020-05-22 14:38:57 +02:00
James Almer cbb1760afa fftools/cmdutils: remove lossless and intra only capability entries from print_codec()
They are codec properties, not encoder capabilities.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-21 12:32:15 -03:00
Anton Khirnov 4cde83c780 cmdutils: stop using deprecated av_codec_next()
Signed-off-by: Josh de Kock <josh@itanimul.li>
2020-04-20 14:50:03 +00:00
Jun Zhao b99ed6e428 cmdutils: fix crash if no name for "ffmpeg -h protocol"
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>
2020-01-30 12:50:22 -03:00
Steven Liu 6087692a60 cmdutils: add show_help_protocol for get protocol options
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2020-01-30 17:10:21 +08:00
Martin Storsjö 2dc2b11fba cmdutils: Fix compilation on cygwin wrt SetDllDirectory and GetModuleHandle
After 06ec9c4746 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 06ec9c4746,
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>
2020-01-08 13:53:31 +02:00
Jun Zhao c1e215041b fftools/cmdutils: Fix break command dump for -map option
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>
2019-12-23 09:46:51 +08:00
Martin Storsjö 06ec9c4746 configure: Check for the SetDllDirectory and GetModuleHandle functions
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>
2019-12-13 10:53:05 +02:00
Lou Logan 61b7676bd5 cmdutils: trailing options may be ignored
Signed-off-by: Lou Logan <lou@lrcd.com>
Signed-off-by: mypopy <mypopy@gmail.com>
2019-10-01 10:43:37 -08:00