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

111888 Commits

Author SHA1 Message Date
Andreas Rheinhardt
ee485b4051 avformat/internal: Don't auto-include os_support.h
It includes various Windows-specific headers when compiling
for Windows and these sometimes cause issues: E.g. winbase.h
defines IGNORE, which clashes with a macro used in the Matroska
muxer (since 884653ee5b) and demuxer.

This header provides fallback defines for various stuff that is
mostly not used directly by (de)muxers at all:
mkdir, rename, rmdir, unlink, access, poll, pollfd, nfds_t,
closesocket, socklen_t, fstat, stat, lseek, SHUT_(RD|WR|RDWR)
and various POLL* constants.

Ergo fix this issue by not auto-including this header in lots
of places via an inclusion in internal.h and instead include
it everywhere where the above stuff is used (most of these
translation units already included os_support.h).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-02 10:36:11 +02:00
Nuo Mi
25ecc94d58
avutil: add thread executor
The executor design pattern was introduced by java
<https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/util/concurrent/Executor.html>
it also adapted by python
<https://docs.python.org/3/library/concurrent.futures.html>
Compared to handcrafted thread pool management, it greatly simplifies the thread code.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-02 02:49:06 +02:00
Lynne
139e54911c
lavc/avfft: deprecate the API
This deprecates the currently unused API.
2023-09-01 23:59:14 +02:00
Lynne
d40672e661
lavu/tx: fix scaling of R2R transforms
Still slightly inaccurate, but it's good enough now.
2023-09-01 23:59:13 +02:00
Lynne
59b39d241e
lavu/tx: improve rdft table generation precision slightly 2023-09-01 23:59:13 +02:00
Lynne
86aa34d339
avfft: wrap lavu/tx instead of ff_dct 2023-09-01 23:59:13 +02:00
Lynne
83ede01bb0
avfft: wrap lavu/tx instead of ff_rdft 2023-09-01 23:59:12 +02:00
Lynne
517e4fcca6
avfft: wrap lavu/tx instead of ff_mdct 2023-09-01 23:59:12 +02:00
Lynne
dfcd4bbf51
avfft: wrap lavu/tx instead of ff_fft 2023-09-01 23:59:11 +02:00
Lynne
4acd08be6c
ffplay: port to lavu/tx 2023-09-01 23:59:11 +02:00
Lynne
a810126501
wmavoice: convert DCT-I/DST-I to lavu/tx
This is the very last user of any lavc transform code.

This also *corrects* wmavoice decoding, as the previous DCT/DST
transforms were incorrect, bringing it closer to Microsoft's
own wmavoice decoder.
2023-09-01 23:59:11 +02:00
Lynne
d895d3c8c7
wmavoice: convert RDFT to lavu/tx 2023-09-01 23:59:10 +02:00
Lynne
ef8fd7bc3c
lavu/tx: add DCT-I and DST-I transforms
These are true, actual DCT-I and DST-I transforms, unlike the
libavcodec versions, which are plainly not.
2023-09-01 23:59:10 +02:00
Lynne
11e22730e1
lavu/tx: add real to real and real to imaginary RDFT transforms
These are in-place transforms, required for DCT-I and DST-I.

Templated as the mod2 variant requires minor modifications, and is
required specifically for DCT-I/DST-I.
2023-09-01 23:59:08 +02:00
Paul B Mahol
fba4546175 avformat: add OSQ demuxer 2023-09-01 14:26:47 +02:00
Paul B Mahol
7ef9d31071 avcodec: add OSQ audio decoder 2023-09-01 14:26:47 +02:00
Leo Izen
60be62d293
fftools/ffmpeg_mux: replace monotonous with monotonic
The word "monotonous" means "spoken in a monotone" which is not what we
mean here. We mean "monotonic" i.e. nondecreasing.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-09-01 03:36:24 -04:00
Leo Izen
a49d7a1497
fate/jpegxl_anim: add demuxer fate test for jpegxl_anim
Adds a fate test for the jpegxl_anim demuxer, that should allow testing
for true positives and false positives for animated jpegxl files. Note
that two of the test cases are not animated, in order to help sort out
false positives.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-09-01 03:36:02 -04:00
Paul B Mahol
7aa71ab5c0 avcodec/rka: do not output extra invalid samples in last frame 2023-08-30 23:07:34 +02:00
Andreas Rheinhardt
a94a6617a3 avformat/riffdec: Pass logctx as void* instead of AVFormatContext*
Also stop second-guessing error codes from ff_get_extradata().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-30 20:00:55 +02:00
Andreas Rheinhardt
6a15b4d16c avformat/matroskadec: Use named constants instead of their value
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-30 19:43:49 +02:00
Andreas Rheinhardt
b3825bd711 avformat/matroskadec: Replace switch with array
This simplification reduces codesize.
(It even reduces the size of .rodata here, because
the jump table used by the compiler is bigger than
the actual array.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-30 19:42:55 +02:00
Andreas Rheinhardt
9c46faaf77 avformat/matroska: Move ff_mkv_stereo3d_conv() to demuxer
It is now its only user; also make it static.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-30 19:34:47 +02:00
Andreas Rheinhardt
2d09488ac3 avformat/matroskaenc: Improve message for WebM-incompatible StereoModes
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-30 19:31:34 +02:00
Andreas Rheinhardt
884653ee5b avformat/matroskaenc: Don't add side-data to input stream
When muxing, the AVStreams' side-data is typically set
by the caller before avformat_write_header();
it is not documented to be else. Yet the Matroska muxer
added an AVStereo3D side data if certain metadata
was present:

Since commit 4d686fb721
(adding support for AVStereo3D stream side-data),
the Matroska muxer checked certain stream tags that
contain Matroska's StereoMode and (if they are present)
converted this value into an AVStereo3D struct that
gets attached to the AVStream (reusing a function from
the demuxer). Afterwards the AVStereo3D side data struct
(whether it has just been added by the muxer or not) gets
parsed and converted back into a Matroska StereoMode.

Besides being an API violation this change broke
StereoMode values without a corresponding AVStereo3D
(namely the anaglyph ones).

This commit fixes this: A StereoMode given via tags
is now used-as-is; if no such tag exists and an AVStereo3D
side data exists, it is converted into the corresponding
StereoMode (if possible). This approach also fixes
handling of the anaglyph ones; the changes to the
matroska-stereo_mode are due to this.

The new STEREOMODE_STEREO3D_MAPPING has been put to
good use for this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-30 19:31:30 +02:00
Andreas Rheinhardt
230312b3c8 avformat/matroska: Add macro for stereomode<->AVStereo3D correspondence
It will allow to create tables for easy conversion from AVStereo3D
to stereomode and back again as well as derive the properties
of a given stereomode.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-30 19:29:34 +02:00
Andreas Rheinhardt
3fc9ed8497 avformat/matroska: Move ff_matroska_video_stereo_plane to demuxer
Only used there.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-30 19:26:10 +02:00
Andreas Rheinhardt
088f08db71 avformat/matroskaenc: Avoid atoi()
It has undefined behaviour in case the value does not fit into an int.
Also stop allowing to override a stream level "alpha_mode" tag
by an AVFormatContext one and properly check that the stereo_mode
number given via a tag is actually in the range 0..14: Negative
values would have been treated as zero before this patch.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-30 19:15:48 +02:00
Anton Khirnov
3c397a1d46 fftools/ffmpeg: move sending filtergraph commands to a separate function
Stop accessing filtergraph internals from keyboard reading code.
2023-08-30 11:53:50 +02:00
Anton Khirnov
bff48e8d69 fftools/ffmpeg_mux: rename of_close() to of_free()
This function is primarily a destructor for OutputFile, the underlying
AVIOContext is normally closed earlier (right after writing the
trailer).
2023-08-30 11:53:50 +02:00
Anton Khirnov
d55262704e fftools/ffmpeg_filter: shorten a variable name 2023-08-30 11:53:50 +02:00
Anton Khirnov
fbcecdec8a fftools/ffmpeg_filter: reindent after previous commit 2023-08-30 11:53:50 +02:00
Anton Khirnov
d9c862b57f fftools/ffmpeg_filter: factor processing a single frame out of reap_filters()
This is easier to read.
2023-08-30 11:53:50 +02:00
Anton Khirnov
82dd4dbe3f fftools/ffmpeg_filter: sanitize framerate retrieved from the filtergraph
Lavfi uses 1/0 to signal unknown/VFR, which should not be passed to
encoders.
2023-08-30 11:53:50 +02:00
Anton Khirnov
d65d0f4df1 fftools/ffmpeg_enc: reindent after previous commit 2023-08-30 11:53:50 +02:00
Anton Khirnov
411ada649f fftools/ffmpeg_enc: only use fallback framerate when encoding CFR
When no output video framerate is specified by the user with -r or can
be inferred from the filtergraph, encoder setup will arbitrarily decide
that the framerate is 25fps. However, making up any framerate value for
VFR encoding is at best unnecessary.

Changes the results of the sub2video tests, where the input timebase is
now used instead of 1/25.
2023-08-30 11:53:50 +02:00
Anton Khirnov
8b6b2518fa fftools/ffmpeg_enc: reindent after previous commit 2023-08-30 11:53:50 +02:00
Anton Khirnov
d1a2cd1e13 fftools/ffmpeg_enc: factor out setting encoder timebase
Mainly this fixes handling special values of -enc_time_base ('demux' or
'filter') for audio. It also prints a warning if -enc_time_base is
specified for subtitles, instead of ignoring it silently (current
subtitle encoding API only works with AV_TIME_BASE_Q).
2023-08-30 11:53:50 +02:00
Anton Khirnov
8ecbb1f9af fftools/ffmpeg_mux: stop rescaling timestamps in of_streamcopy()
This function converts packet timestamps from the input stream timebase
to OutputStream.mux_timebase, which may or may not be equal to the
actual output AVStream timebase (and even when it is, this may not
always be the optimal choice due to bitstream filtering).

Just keep the timestamps in input stream timebase, they will be rescaled
as needed before bitstream filtering and/or sending the packet to the
muxer.

Move the av_rescale_delta() call for audio (needed to preserve accuracy
with coarse demuxer timebases) to write_packet.

Drop now-unused OutputStream.mux_timebase.
2023-08-30 11:53:46 +02:00
Anton Khirnov
ed5caaaf22 fftools/ffmpeg_mux: use correct timebases for bitstream filtering
Bitstream filtering input timebase is not always necessarily equal to
OutputStream.mux_timebase. Also, set AVPacket.time_base correctly for
packets output by bitstream filters

Do not rescale at all in of_output_packet() when not doing bitstream
filtering, as it's unnecessary - write_packet() will rescale to the
actual muxer timebase.
2023-08-30 11:51:42 +02:00
Anton Khirnov
b39b6b7456 fftools/ffmpeg: simplify handling input -t for streamcopy
Output stream will be closed implicitly after a NULL packet is sent to
it, there is no need to explicitly call close_output_stream().
2023-08-30 11:51:42 +02:00
Anton Khirnov
8f2e7e9dcf fftools/ffmpeg: stop explicitly closing output streams on input EOF
Sending an empty packet already does that implicitly.
2023-08-30 11:51:42 +02:00
Steinar H. Gunderson
69c308a6d1 avformat/matroskaenc: Fix writing of markers
When the marker writing code was merged from libav to FFmpeg
in dc62016c, it failed to take into account that the meaning of
cluster_pos had changed in bda5b662; in particular, the special
value for “I'm not currently working on a cluster” had changed
from 0 to -1. This makes the avio_write_marker() call never
be called. Update the if statement to fix it.

Fixes: Ticket9843
Signed-off-by: Steinar H. Gunderson <steinar+ffmpeg@gunderson.no>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-08-29 23:28:44 +03:00
Tong Wu
a25a60d763 avcodec/jpegxl_parser: fix a compile error
Compiler: MSVC 14.35.32215
Error type: error C2099: initializer is not a constant
Related commit: 0c0dd23 avcodec/jpegxl_parser: add JPEG XL parser

Signed-off-by: Tong Wu <tong1.wu@intel.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-08-28 22:11:51 -03:00
Lynne
d0a64f9a81
vulkan: do not leak bound_buffer_indices 2023-08-28 22:29:36 +02:00
Lynne
5f8feddd6a
lavfi/testsrc_vulkan: fix memory leaks 2023-08-28 22:29:36 +02:00
Lynne
3ef1e50c92
lavfi/transpose_vulkan: fix memory leaks 2023-08-28 22:29:36 +02:00
Lynne
d0ab2e2f98
lavfi/scale_vulkan: fix memory leaks 2023-08-28 22:29:35 +02:00
Lynne
0f2ae1ba69
lavfi/nlmeans_vulkan: fix memory leaks 2023-08-28 22:29:35 +02:00
Lynne
9944e96c61
lavfi/chromaber_vulkan: fix memory leaks 2023-08-28 22:29:34 +02:00