1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

97473 Commits

Author SHA1 Message Date
Andreas Rheinhardt
ba36a07734 avformat/matroskadec: Don't discard the upper 32bits of TrackNumber
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 19:49:45 +01:00
Andreas Rheinhardt
ed18ec5577 doc/developer.texi: Add variadic macros to allowed C language features
They are used in several places like CBS.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 19:29:54 +01:00
James Almer
59c993e227 avformat/movenc: Reduce size of the allocated MOVIentry array
Increasing it by 2048 entries per realloc is exessive.
Reduces memory usage, especially on long, non fragmented output.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-03-26 11:46:08 -03:00
James Almer
e4dd8ee323 avcodec/vp9: use a buffer pool to allocate VP9Frame extradata
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-03-26 11:45:12 -03:00
Paul B Mahol
840e92da17 avfilter/vf_v360: improve sg input format
Specifically unbreak yaw functionality.
2020-03-26 13:53:22 +01:00
Paul B Mahol
7931e766ad avfilter/vf_v360: improve sg output format 2020-03-26 13:37:13 +01:00
Steve Lhomme
b5dd964cdc avformat/matroskadec: fix the type of the TrackLanguage
It's an ASCII string, not a UTF-8 string.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 05:51:49 +01:00
Andreas Rheinhardt
dc2f6b54ac avformat/matroskaenc: Avoid allocations for SeekHead
Up until e7ddafd5, the Matroska muxer wrote two SeekHeads: One at the
beginning referencing the main level 1 elements (i.e. not the Clusters)
and one at the end, referencing the Clusters. This second SeekHead was
useless and has therefore been removed. Yet the SeekHead-related
functions and structures are still geared towards this usecase: They
are built around an allocated array of variable size that gets
reallocated every time an element is added to it although the maximum
number of Seek entries is a small compile-time constant, so that one should
rather include the array in the SeekHead structure itself; and said
structure should be contained in the MatroskaMuxContext instead of being
allocated separately.

The earlier code reserved space for a SeekHead with 10 entries, although
we currently write at most 6. Reducing said number implied that every
Matroska/Webm file will be 84 bytes smaller and required to adapt
several FATE tests; furthermore, the reserved amount overestimated the
amount needed for for the SeekHead's length field and how many bytes
need to be reserved to write a EBML Void element, bringing the total
reduction to 89 bytes.

This also fixes a potential segfault: If !mkv->is_live and if the
AVIOContext is initially unseekable when writing the header, the
SeekHead is already written when writing the header and this used to
free the SeekHead-related structures that have been allocated. But if
the AVIOContext happens to be seekable when writing the trailer, it will
be attempted to write the SeekHead again which will lead to segfaults
because the corresponding structures have already been freed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 03:19:56 +01:00
Andreas Rheinhardt
107783006c avformat/webm_chunk: Cosmetics
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 02:39:14 +01:00
Andreas Rheinhardt
f289a6b721 avformat/webm_chunk: Check unchecked functions for errors
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 02:31:52 +01:00
Andreas Rheinhardt
d624fb5dad avformat/webm_chunk: Add deinit function
This fixes memleaks if an error happens after one of the allocations
in init; or if the trailer isn't written (e.g. because there was an
error when writing a packet).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 02:28:13 +01:00
Andreas Rheinhardt
42b000427d avformat/webm_chunk: Add init function
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 02:25:14 +01:00
Andreas Rheinhardt
73a595b8e8 avformat/webm_chunk: Remove unnecessary variable
chunk_start_index (which was set via an option) was only used to
initialize chunk_index and otherwise unused. So initialize chunk_index
directly via the option and remove chunk_start_index.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 02:22:46 +01:00
Andreas Rheinhardt
8a632b3e2e avformat/webm_chunk: Don't copy header filename
Instead just reuse the filename string that is given via an option
for the child muxer's url field.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 02:17:40 +01:00
Andreas Rheinhardt
f397dc3378 avformat/webm_chunk: Don't keep pointer to AVOutputFormat
It is no longer needed given that the function pointers of the child
muxer's AVOutputFormat are no longer called directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 02:12:10 +01:00
Andreas Rheinhardt
3d4dd9195f avformat/webm_chunk: Avoid unnecessary flushes
The webm_chunk muxer caches its output to a dynamic buffer and when it
outputs anything, it explicitly flushes it. So set the flags indicating
that flushing after each packet should not be done automatically
(basically avoiding avio_write_marker() to be called by flush_if_needed()
in libavformat/mux.c).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 02:08:17 +01:00
Andreas Rheinhardt
e70c2d02fc avformat/webm_chunk: Use API functions for child muxer
instead of calling the write_header/packet/trailer functions directly
via the function pointers. Also, use distinct AVStreams for the child
AVFormatContext (up until now the two AVFormatContexts shared their
AVStreams because allocating their own was deemed too onerous).

Using the function pointers directly meant that the Matroska muxer's
init-function was never called, because init-functions were only
introduced a few months after webm_chunk has been added and no one
thought of/bothered to adapt webm_chunk for this (when the init-function
was added in b287d7ea, the code setting the timebase was moved to it,
so that the timebases were no longer set to ms-precision when using
the webm_chunk muxer; this has been fixed after some time in 42a635dd
by setting the timebases direcly (instead of calling the init-function)).

And when 982a98a0 added a deinit-function for the Matroska muxer, it
introduced memleaks in webm_chunk, because the child muxer's internal
structures were no longer freed when calling write_trailer directly.
(Given that the init function has never ever been called, the child
muxer has never ever been properly initialized, so that the
deinit-function was not called when freeing the child context.)

This commit stops calling the function pointers directly and instead
uses the standard API functions for muxers. This fixes the above
mentioned memleaks. (Memleaks are still possible on error. This will be
fixed in a future commit that adds a deinit-function to webm_chunk
itself.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 01:54:56 +01:00
Andreas Rheinhardt
a9004ffe0f avformat/webm_chunk: Use appropriate initializer for AV_OPT_TYPE_STRING
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 01:54:06 +01:00
Andreas Rheinhardt
b1b847ba56 avformat/webm_chunk: Copy more information to the child AVFormatContext
In particular the flags are important so that AVFMT_FLAG_BITEXACT can be
honoured by the child muxer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 01:52:10 +01:00
Andreas Rheinhardt
2a78968849 avformat/webm_chunk: Close IO if writing header fails
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 01:49:34 +01:00
Andreas Rheinhardt
0b1af9d330 avformat/webm_chunk: Don't use child AVFormatContext for logging
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 01:44:06 +01:00
Andreas Rheinhardt
00d0934fce avformat/webmdashenc: Don't use custom option for bitexactness
The WebM DASH Manifest muxer can write manifests for live streams and
these contain an entry that depends on the time the manifest is written;
an AVOption to make the output reproducible has been added for tests.
But this is unnecessary, as there already is a method for reproducible
output: The AVFMT_FLAG_BITEXACT-flag of the AVFormatContext. Therefore
this commit removes the custom option.

Given that the description of said option contained "private option -
users should never set this" and that it was not documented in
muxers.texi, no deprecation period for this option seemed necessary.

The commands of the FATE-tests for this muxer have been changed to no
longer use this option.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-25 23:26:29 +01:00
Steve Lhomme
a95351ea50 avformat/matroska: add missing Buttons track type
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-25 22:24:05 +01:00
Limin Wang
157873623f avcodec/dvbsubdec: replace data_size with got_sub_ptr for better readability
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-03-25 18:41:21 +01:00
Limin Wang
8ea4efffdb avcodec/libzvbi-teletextdec: replace data_size with got_sub_ptr for better readability
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-03-25 18:41:21 +01:00
Limin Wang
766888e519 avcodec/pgssubdec: replace data_size with got_sub_ptr for better readability
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-03-25 18:41:21 +01:00
Limin Wang
2d244c9a00 avcodec/xsubdec: replace data_size with got_sub_ptr for better readability
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-03-25 18:41:21 +01:00
Paul B Mahol
0b43897530 avfilter/vf_v360: fix hfov/vfov calculation from dfov for sg projection 2020-03-25 13:38:41 +01:00
Andreas Rheinhardt
e5d25d1147 avcodec/hevc: Cosmetics: Realign after last commit
Suggested-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-24 23:47:00 +01:00
Andreas Rheinhardt
7272d0c0a9 avcodec/hevc, h2645_parse: Fix HEVC NAL unit names and constants
This commit fixes the names and constants of the reserved NAL units
with nal_unit_type 22 resp. 23. They were "IRAP_IRAP_VLC2x", but are
actually "RSV_IRAP_VLC2x".

This also required a change to cbs_h265_syntax_template.c.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-24 23:33:24 +01:00
Andreas Rheinhardt
557668e8cb avformat/dss: Use AV_DICT_DONT_STRDUP_VAL to save a malloc+memcpy
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-24 23:02:30 +01:00
Andreas Rheinhardt
3ab16d091e avcodec/dfa: Use array of fixed-sized strings for fixed-sized strings
Surprisingly neither GCC nor Clang did this transformation on their own.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-24 22:02:13 +01:00
Andreas Rheinhardt
9dfc409e6b avformat/hls: Don't strdup non-null-terminated string
If an URI indicated that the data protocol was in use, it would be
copied into a temporary buffer via strncpy(dst, src, strlen(src)),
thereby ensuring that the trailing \0 would not be copied, despite dst
being uninitialized. dst would then be av_strdup'ed, leading to
potential segfaults.

The solution to this is simple: Don't copy the URI in the temporary
buffer at all, instead av_strdup it directly.

This fixes a -Wstringop-truncation warning emitted by GCC 9.2.

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-24 21:22:15 +01:00
Andreas Rheinhardt
65e8f6dd9b avfilter/vf_paletteuse: Forward error codes
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-24 20:14:08 +01:00
Gyan Doshi
7239254b1d avfilter/hue: fix range in comment
Found-by: Michael Koch
Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
2020-03-24 15:04:52 +05:30
Ramiro Polla
ba698a23c6 MAINTAINERS: add my gpg fingerprint
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-03-23 23:37:19 +01:00
Limin Wang
750a81ba99 avformat/mxfdec: use av_asprintf()
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-03-23 23:37:19 +01:00
Lynne
2465fe1302 lavu/tx: add 2-point FFT transform
By itself, this allows 6-point, 10-point and 30-point transforms.
When the 9-point transform is added it allows for 18-point FFT,
and also for a 36-point MDCT (used by MP3).
2020-03-23 21:26:25 +00:00
Lynne
9f494d1397 lavu/tx: improve documentation 2020-03-23 21:26:25 +00:00
Ramiro Polla
c455a28a9e avcodec/wmadec: cosmetics
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-03-22 11:55:44 -03:00
Ramiro Polla
c2b540d0c7 avcodec/get_bits: cosmetics
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-03-22 11:55:44 -03:00
Limin Wang
a289cc5643 avcodec/decode: increase nb_bsfs after av_bsf_alloc in case alloc failed
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-03-22 13:00:19 +01:00
Andreas Rheinhardt
9e0f3352d1 avformat/hnm: Check for extradata allocation failure
and also add padding to it; moreover, don't use memcpy to write one byte
to extradata.

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>
2020-03-22 13:00:19 +01:00
Andreas Rheinhardt
6bd8bcc2ac avformat/subtitles: Don't increment packet counter prematurely
Do it only if the packet has been successfully allocated in
av_new_packet() -- otherwise on error a completely uninitialized packet
would be unreferenced later.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-03-22 13:00:19 +01:00
Andreas Rheinhardt
5acef12061 avformat/bethsoftvid: Fix potential memleak upon reallocation failure
The classical ptr = av_realloc(ptr, size), just with av_fast_realloc().

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>
2020-03-22 13:00:19 +01:00
Andreas Rheinhardt
6e14ddd156 avformat/bethsoftvid: Avoid allocations and frees for palettes
by putting the palette in the demuxer's context. This also allows to
remove this demuxer's read_close-function.

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>
2020-03-22 13:00:19 +01:00
Andreas Rheinhardt
ea46b45e9c avcodec/bsf: Beautify log messages from bitstream filters
Up until now, the name of every AVBSFContext for logging purposes was
"AVBSFContext", so that the default logging callback produced output
like "[AVBSFContext @ 0x55813bae92c0] Extradata". This has been changed
to "[trace_headers @ 0x60a000000700] Extradata" by adding an item_name-
function to the AVClass for bitstream filters.

Furthermore, the correct category has been set so that the introductory
part before the actual message (everything before "Extradata" in the
above examples) are displayed in a different colour than the rest.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-03-21 18:52:45 -03:00
Andreas Rheinhardt
d0ba6715d2 avcodec/bsf: Don't set defaults for AVClass without options
This happened for AVBSFContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-03-21 18:52:10 -03:00
Michael Niedermayer
c8140fe732 avformat/asfdec_f: Fix overflow check in get_tag()
Fixes: signed integer overflow: 2 * 1210064928 cannot be represented in type 'int'
Fixes: 20873/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5761116909338624

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-03-21 20:55:27 +01:00
Carl Eugen Hoyos
559ce9c845 lavf/subviewerdec: Support higher sub-second precision.
Fixes ticket #8575.
2020-03-21 18:46:36 +01:00