1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

1710 Commits

Author SHA1 Message Date
Ramiro Polla
7eb37c142a avdevice/v4l2: add limited support for multiplanar API
This commit adds support for V4L2's multiplanar API, but only when the
number of planes is 1.

Adding full support for the multiplanar API would require a device that
actually uses more than 1 plane, which I have not found yet.
2024-07-04 11:09:53 +02:00
Michael Niedermayer
4c285bb278
avdevice/dshow: Check ICaptureGraphBuilder2_SetFiltergraph() for failure
Fixes: CID1591939 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:22 +02:00
Ramiro Polla
cc6fb1643d avdevice/v4l2: add NV16 and NV24 pixel formats 2024-07-01 13:43:07 +02:00
Theo Fabi
d6d14b3a15 avdevice/avfoundation: add external video devices
Video devices categorized by AVFoundation as
'AVCaptureDeviceTypeExternal(Unknown)' (like USB video streams) were not
recognized by libavdevice.

Signed-off-by: Theo Fabi <fabi.theo@gmail.com>
2024-06-20 18:52:06 +02:00
Michael Niedermayer
78d6d13bab
avdevice/xcbgrab: Check sscanf() return
Alot more input checking can be performed, this is only checking the obvious missing case

Fixes: CID1598562 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:11 +02:00
Rémi Denis-Courmont
378d1b06c3 riscv: probe for Zbb extension at load time
Due to hysterical raisins, most RISC-V Linux distributions target a
RV64GC baseline excluding the Bit-manipulation ISA extensions, most
notably:
- Zba: address generation extension and
- Zbb: basic bit manipulation extension.
Most CPUs that would make sense to run FFmpeg on support Zba and Zbb
(including the current FATE runner), so it makes sense to optimise for
them. In fact a large chunk of existing assembler optimisations relies
on Zba and/or Zbb.

Since we cannot patch shared library code, the next best thing is to
carry a flag initialised at load-time and check it on need basis.
This results in 3 instructions overhead on isolated use, e.g.:
1:  AUIPC rd, %pcrel_hi(ff_rv_zbb_supported)
    LBU   rd, %pcrel_lo(1b)(rd)
    BEQZ  rd, non_Zbb_fallback_code
    // Zbb code here

The C compiler will typically load the flag ahead of time to reducing
latency, and can also keep it around if Zbb is used multiple times in a
single optimisation scope. For this to work, the flag symbol must be
hidden; otherwise the optimisation degrades with a GOT look-up to
support interposition:
1:  AUIPC rd, GOT_OFFSET_HI
    LD    rd, GOT_OFFSET_LO(rd)
    LBU   rd, (rd)
    BEQZ  rd, non_Zbb_fallback_code
    // Zbb code here

This patch adds code to provision the flag in libraries using bit
manipulation functions from libavutil: byte-swap, bit-weight and
counting leading or trailing zeroes.
2024-06-11 20:12:37 +03:00
Michael Niedermayer
6f52b64bcc
avdevice/pulse_audio_enc: Use av_rescale() to avoid integer overflow
Fixes: CID1503075 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-01 18:01:05 +02:00
Michael Niedermayer
c4004605b2
avdevice/dshow: fix badly indented line
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-28 03:48:04 +02:00
Brad Smith
9e674b3160 lavd/v4l2: Use proper field type for second parameter of ioctl() with BSD's
The proper type was used until 73251678c8.

This covers all of the OS's that currently have V4L2 support, permutations
of Linux glibc/musl, Android bionic, FreeBSD, NetBSD, OpenBSD, Solaris.

Copied from FreeBSD ports patch.

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-05-08 21:33:32 +02:00
Andreas Rheinhardt
790f793844 avutil/common: Don't auto-include mem.h
There are lots of files that don't need it: The number of object
files that actually need it went down from 2011 to 884 here.

Keep it for external users in order to not cause breakages.

Also improve the other headers a bit while just at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-31 00:08:43 +01:00
Andreas Rheinhardt
b616be1649 lib*/version: Use static_assert for static asserts
Also update the checks that guard against inserting
a new enum entry in the middle of a range.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-31 00:08:42 +01:00
Michael Niedermayer
6b213175c9
Bump after 7.0 branch point
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-27 01:04:54 +01:00
Michael Niedermayer
872980ace6
Bump prior release/7.0 branch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-27 01:04:53 +01:00
Andreas Rheinhardt
4a4dcde339 avformat/internal: Move FF_FMT_INIT_CLEANUP to demux.h
and rename it to FF_INFMT_INIT_CLEANUP. This flag is demuxer-only,
so this is the more appropriate place for it.
This does not preclude adding internal flags common to both
demuxer and muxer in the future.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-26 06:36:43 +01:00
Andreas Rheinhardt
233e13f285 avformat/mux: Rename FF_FMT_ALLOW_FLUSH->FF_OFMT_FLAG_ALLOW_FLUSH
It better reflects that this is a muxer-only flag.
Also document the flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-22 23:57:19 +01:00
Andreas Rheinhardt
b6301dc658 avdevice/alldevices: Mark iterators as av_cold
Because they are.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 15:10:05 +01:00
Andreas Rheinhardt
7cf4c9037c avdevice/alldevices: Mark devices as hidden
Both GCC and Clang create code that inlines the loops in
next_input() and next_output() at high optimization
levels (presumably when there are not too many devices)
and this code leads to the creation of .got entries:
  e7:	48 3b 3d 00 00 00 00 	cmp    0x0(%rip),%rdi        # ee <av_input_video_device_next+0xe>
			ea: R_X86_64_REX_GOTPCRELX	ff_alsa_demuxer-0x4
  ee:	74 43                	je     133 <av_input_video_device_next+0x53>
  f0:	48 3b 3d 00 00 00 00 	cmp    0x0(%rip),%rdi        # f7 <av_input_video_device_next+0x17>
			f3: R_X86_64_REX_GOTPCRELX	ff_fbdev_demuxer-0x4
  f7:	74 41                	je     13a <av_input_video_device_next+0x5a>

These relocations can't be fixed up lateron when it is known
that the symbols exist in the same DSO.

This commit therefore marks these symbols as hidden, leading
to code like this:
  f7:	48 8d 05 00 00 00 00 	lea    0x0(%rip),%rax        # fe <av_input_video_device_next+0xe>
			fa: R_X86_64_PC32	ff_alsa_demuxer-0x4
  fe:	48 39 c7             	cmp    %rax,%rdi
 101:	74 55                	je     158 <av_input_video_device_next+0x68>
 103:	48 8d 05 00 00 00 00 	lea    0x0(%rip),%rax        # 10a <av_input_video_device_next+0x1a>
			106: R_X86_64_PC32	ff_fbdev_demuxer-0x4
 10a:	48 39 c7             	cmp    %rax,%rdi
 10d:	74 50                	je     15f <av_input_video_device_next+0x6f>

(Note: It is actually strange that the compiler creates code
that tries to read the addresses from the .got given that the
addresses can be read directly from indev_list/outdev_list.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 15:10:05 +01:00
Martin Storsjö
71e871280d libavdevice: Fix the avfoundation device after switching to FFInputFormat
This was missed in b800327f4c.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-03-08 12:48:59 +02:00
James Almer
783d00b203 libs: bump major version for all libraries
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 11:29:43 -03:00
Andreas Rheinhardt
b800327f4c avformat/avformat: Add FFInputFormat, hide internals of AVInputFormat
This commit does for AVInputFormat what commit
59c9dc82f4 did for AVOutputFormat:
It adds a new type FFInputFormat, moves all the internals
of AVInputFormat to it and adds a now reduced AVInputFormat
as first member.

This does not affect/improve extensibility of both public
or private fields for demuxers (it is still a mess due to lavd).

This is possible since 50f34172e0
(which removed the last usage of an internal field of AVInputFormat
in fftools).

(Hint: tools/probetest.c accesses the internals of FFInputFormat
as well, but given that it is a testing tool this is not considered
a problem.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
James Almer
b8fef7e9c5 avutil: remove deprecated FF_API_PKT_DURATION
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
J. Dekker
2b17a74df5 avdevice: deprecate sdl outdev
Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-02-28 10:28:49 +01:00
J. Dekker
e4c0cdf8df avdevice: deprecate opengl outdev
Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-02-28 10:28:49 +01:00
Anton Khirnov
1e7d2007c3 all: use designated initializers for AVOption.unit
Makes it robust against adding fields before it, which will be useful in
following commits.

Majority of the patch generated by the following Coccinelle script:

@@
typedef AVOption;
identifier arr_name;
initializer list il;
initializer list[8] il1;
expression tail;
@@
AVOption arr_name[] = { il, { il1,
- tail
+ .unit = tail
}, ...  };

with some manual changes, as the script:
* has trouble with options defined inside macros
* sometimes does not handle options under an #else branch
* sometimes swallows whitespace
2024-02-14 14:53:41 +01:00
Andreas Rheinhardt
e05d3c1a16 avdevice/caca: Allow to list multiple dither option types at once
This can be achieved by using AV_OPT_TYPE_FLAGS instead of
AV_OPT_TYPE_STRING. It also avoids strcmp() when accessing
the option.

Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:25:17 +01:00
Anton Khirnov
70ecb8238c lavd: deprecate the bktr device
It implements BSD-specific support for very old analog capture cards,
which are highly unlikely to be useful today. After being added in 2005,
there were never any commits to it beyond compilation fixes and generic
maintenance. There have also been zero trac tickets for this device, and
the only related web search result I found concludes that it does not
work.

The code also does some unacceptable things, like messing with signal
handlers and storing its state in global variables.
2024-02-02 15:40:35 +01:00
Anton Khirnov
08bebeb1be Revert "all: Don't set AVClass.item_name to its default value"
Some callers assume that item_name is always set, so this may be
considered an API break.

This reverts commit 0c6203c97a.
2024-01-20 10:34:48 +01:00
Andreas Rheinhardt
0c6203c97a all: Don't set AVClass.item_name to its default value
Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9;
also avoids relocations.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-12-22 15:12:33 +01:00
Martin Storsjö
f80b2ce9fa gdigrab: Fix hwnd parameter issues
Converting from an integer to HWND (which is a pointer) requires
an explicit cast, otherwise Clang errors out like this:

    src/libavdevice/gdigrab.c:280:14: error: incompatible integer to pointer conversion assigning to 'HWND' (aka 'struct HWND__ *') from 'long' [-Wint-conversion]
      280 |         hwnd = strtol(name, &p, 0);
          |              ^ ~~~~~~~~~~~~~~~~~~~

(With GCC and MSVC, this was a mere warning, but with recent Clang,
this is an error.)

After adding a cast, all compilers also warn something like this:

    src/libavdevice/gdigrab.c:280:16: warning: cast to 'HWND' (aka 'struct HWND__ *') from smaller integer type 'long' [-Wint-to-pointer-cast]
      280 |         hwnd = (HWND) strtol(name, &p, 0);
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~

On Windows, long types are 32 bit, so to get a usable pointer, we
need to use long long. And interpret it as unsigned long long
while at it - i.e. using strtoull.

Finally, right above it, the code triggered the following warning:

    src/libavdevice/gdigrab.c:278:15: warning: mixing declarations and code is incompatible with standards before C99 [-Wdeclaration-after-statement]
      278 |         char *p;
          |               ^

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-19 00:07:26 +02:00
Lena
d7ac7101ee gdigrab: allow capturing a window by its handle
x11grab can capture windows by their ID, but gdigrab can only capture
windows by their names, internally calling FindWindowW to lookup its
handle.

This patch simply allows the user to specify a window handle directly.
Signed-off-by: Lena <lena@nihil.gay>
2023-12-17 19:14:08 +01:00
Martin Storsjö
081d69b78d avfoundation: Fix version checks
<OS>_VERSION_MAX_ALLOWED indicates what version is available in
the SDK, while <OS>_VERSION_MIN_REQUIRED is the version we can
assume is available, i.e. similar to what is set with e.g.
-miphoneos-version-min on the command line.

This fixes build errors like these:

src/libavdevice/avfoundation.m:788:37: error: 'AVCaptureDeviceTypeContinuityCamera' is only available on macOS 14.0 or newer [-Werror,-Wunguarded-availability-new]
            [deviceTypes addObject: AVCaptureDeviceTypeContinuityCamera];
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureDevice.h:551:38: note: 'AVCaptureDeviceTypeContinuityCamera' has been marked as being introduced in macOS 14.0 here, but the deployment target is macOS 13.0.0
AVF_EXPORT AVCaptureDeviceType const AVCaptureDeviceTypeContinuityCamera API_AVAILABLE(macos(14.0), ios(17.0), macCatalyst(17.0), tvos(17.0)) API_UNAVAILABLE(visionos) API_UNAVAILABLE(watchos);
                                     ^

Alternatively, we could use these more modern APIs, if enclosed
in suitable @available() checks.
2023-12-15 11:27:23 +01:00
Thilo Borgmann
03ac6aa627 avdevice/audiotoolbox: Fix availability macro check
Since OSX 10.10 the availability macros expand into a 6 digit number instead of a 4 digit number.
Fixes compilation for OSX version [10.0, 12.0[.
2023-12-12 22:01:14 +01:00
Vittorio Giovara
944936ee1d lavd/avfoundation: Use correct preprocessing directive
Fixes compilation, introduced in e37b15e.

src/libavdevice/avfoundation.m:799:10: error: invalid preprocessing directive
        #elseif (TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED < 140000)
2023-12-11 18:38:09 +01:00
xufuji456
341a483b08 avdevice/audiotoolbox: silence warning with new api
Building with macOS platform, the compiler has a warning: 'kAudioObjectPropertyElementMaster' is deprecated in macOS 12.0

Signed-off-by: xufuji456 <839789740@qq.com>
2023-12-11 16:39:21 +01:00
xufuji456
e37b15e26f avdevice/avfoundation: replace deprecated AVCaptureDevice
Building with iOS platform, the compiler has a warning: "'devicesWithMediaType:' is deprecated: first deprecated in iOS 10.0 - Use AVCaptureDeviceDiscoverySession instead"

Signed-off-by: xufuji456 <839789740@qq.com>
2023-12-11 15:47:26 +01:00
Jun Zhao
ab3bd5ead0 avdevice/decklink_dec: add explicit specifier
The explicit specifier used with a single argument constructor
to prevent implicit type conversions.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2023-11-21 08:02:29 +08:00
Diederik de Haas via ffmpeg-devel
c07ed10b0e apply spelling fixes
Fix spelling issue as reported by Debian's lintian tool:
accomodate -> accommodate
addtional -> additional
auxillary -> auxiliary
bellow -> below
betweeen -> between
Calulate -> Calculate
coefficents -> coefficients
Defalt -> Default
defaul -> default
higer -> higher
neccesary -> necessary
orignal -> original
ouput -> output
precison -> precision
processsing -> processing
substract -> subtract
Transfered -> Transferred
upto -> up to

Also add several of them to the 'common typos' check in patcheck.

Signed-off-by: Diederik de Haas <didi.debian@cknow.org>
2023-11-18 19:55:42 +01:00
Zhao Zhili
f084e9b0be avdevice/android_camera: fix build failure due to typo
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-07 11:10:07 +08:00
Michael Niedermayer
47e784f881
Bump versions after 6.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-29 16:19:14 +01:00
Michael Niedermayer
9d3a7d30c4
Bump versions prior to 6.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-29 15:34:05 +01:00
James Almer
5432d2aaca avformat/avformat: use the side data from AVStream.codecpar
Deprecate AVStream.side_data and its helpers in favor of the AVStream's
codecpar.coded_side_data.

This will considerably simplify the propagation of global side data to decoders
and from encoders. Instead of having to do it inside packets, it will be
available during init().
Global and frame specific side data will therefore be distinct.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-06 10:03:57 -03:00
Andreas Rheinhardt
dd48e49d54 avformat/avformat: Deprecate AVFMT_ALLOW_FLUSH
It is of no value to the user, because every muxer can always
be flushed with a NULL packet. As its documentation shows
("If not set, the muxer will not receive a NULL packet in
the write_packet function") it is actually an internal flag
that has been publically exposed because there was no internal
flags field for output formats for a long time. But now there is
and so use it by replacing the public flag with a private one.

Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-03 01:45:46 +02:00
Andreas Rheinhardt
2cb2465cc7 avdevice/lavfi: Fix double-free on error
After the AVFrame has been wrapped into a buffer,
it is owned by the buffer and must not be freed manually
any more. Yet this happens on subsequent errors.

This bug was introduced in 6ca43a9675.

Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-30 12:27:44 +02:00
Andreas Rheinhardt
81afd4652b avdevice/fbdev_common: Make declaration proper prototype
Fixes a -Wstrict-prototypes warning from Clang 15.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-28 11:10:35 +02:00
Zhao Zhili
eb96dda5ed avdevice/android_camera: fix missing include for usleep
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-19 00:39:47 +08:00
Andreas Rheinhardt
423b6a7e49 avutil/imgutils: Add wrapper for av_image_copy() to avoid casts
av_image_copy() accepts const uint8_t* const * as source;
lots of user have uint8_t* const * and therefore either
cast (the majority) or copy the array of pointers.

This commit changes this by adding a static inline wrapper
for av_image_copy() that casts between the two types
so that we do not need to add casts everywhere else.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 09:42:27 +02:00
Andreas Rheinhardt
d6afd6c303 avdevice/lavfi: Remove unnecessary avio_internal.h inclusion
The stuff declared in said header is actually unusable in libavdevice.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:17:36 +02:00
Andreas Rheinhardt
7b6e1fbeb9 avformat/vapoursynth: Add missing inclusion of frame.h
Broken in 0c6e5f321b.
Also add it to decklink_enc.cpp in order not to rely
on an implicit inclusion via libavfilter/ccfifo.h.

Reviewed-by: あんこ <mailcrystaldiskinfo@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 17:32:11 +02:00
Andreas Rheinhardt
e999a09f19 all: Replace __FUNCTION__ by __func__
Only the latter is valid ISO C.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:48:50 +02:00
Andreas Rheinhardt
0c6e5f321b avformat/avformat: Avoid including codec.h, frame.h
AVCodec is only ever used as an incomplete type (i.e. via a pointer
to an AVCodec) in avformat.h and it is not really part of the core
of avformat.h or libavformat; almost none of our internal users
make use of it (and none make use of hwcontext.h, which is implicitly
included). So switch to use struct AVCodec, but continue to include
codec.h for external users for compatibility.

Also, do the same for AVFrame and frame.h, which is implicitly included
by codec.h (via lavu/hwcontext.h).

Also, remove an unnecessary inclusion of <time.h>.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:30:08 +02:00