Commit Graph

54 Commits

Author SHA1 Message Date
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
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
Gyan Doshi 0993327939 cmdutils: promote report level if loglevel is higher 2019-09-13 11:53:54 +05:30
Andreas Rheinhardt f2d522f2a8 fftools: Use right function signature and pointers
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>
2019-08-15 01:26:21 +02:00
James Almer d228df6ff3 cmdutils: print a more descriptive error message in show_help_bsf() when no bsf is specified
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-07-28 11:14:45 -03:00
Jun Zhao bd47cca6a7 fftools/cmdutils: Replace the number by macro for bprint init
Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-06-17 10:00:23 +08:00
Jun Zhao 81b77e7bf1 cmdutils: dump supported hardware devices in print_codec()
dump the supported hardware devices for codec when use the command
like ./ffmpeg -h decoder=h264.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-05-28 18:21:48 +08:00
Jun Zhao 90acf168a6 cmdutils: print missing caps in print_codec().
print full caps type in print_codec().

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-05-28 18:21:35 +08:00
Tobias Rapp 4b736bc921 fftools/cmdutils: add support for level flag in loglevel option parser
Allows to manage the AV_LOG_PRINT_LEVEL flag as a prefix to the loglevel
option value, similar to the existing AV_LOG_SKIP_REPEATE flag. Adds
support for setting flags relative to the existing value by using a +/-
prefix.

Previous version reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2018-04-03 10:17:38 +02:00
Jun Zhao 9b125826ed cmdutils: fix new API break the "ffmpeg -muxers/demuxers"
fix commit 2238190 break the "ffmpeg -muxers/demuxers".

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Josh de Kock <josh@itanimul.li>
2018-04-02 02:19:26 +01:00
Josh de Kock 22381906f3 cmdutils: use new APIs
Signed-off-by: Josh de Kock <josh@itanimul.li>
2018-03-31 23:26:31 +01:00
James Almer ead257db56 cmdutils: print supported codecs in show_help_bsf()
Tested-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-22 00:15:05 -03:00
James Almer 055f60e874 cmdutils: remove a superfluous line break
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-17 12:12:37 -03:00
Jun Zhao a675eed175 ffmpeg: support dump bit stream filter options.
Support dump bit stream filter option in ffmpeg -h full and
ffmpeg -h bsf=FooBar.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-16 02:09:59 +01:00
James Almer cb97400f93 Revert "cmdutils: make use of new iteration APIs"
This reverts commit cdc78058c7.

It introduced several issues in the command line tools, and it's
implementing a new API that may still see some changes.
Revert for the time being until the state of the API is defined.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-02-08 13:20:36 -03:00