Commit Graph

104182 Commits

Author SHA1 Message Date
Andreas Rheinhardt 9190302b2e examples/qsvdec: Don't use stack packet
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-03 20:50:50 +02:00
Andreas Rheinhardt e9182820ad examples/hw_decode: Don't use stack packet
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-03 20:50:49 +02:00
Andreas Rheinhardt 86ec1093eb examples/filtering_video: Don't use stack packet
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-03 20:50:49 +02:00
Andreas Rheinhardt a75f518b65 examples/filtering_audio: Don't use stack packet
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-03 20:50:49 +02:00
Andreas Rheinhardt f495604361 examples/extract_mvs: Do not use stack packet
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-03 20:50:49 +02:00
Andreas Rheinhardt 0230d125cb examples/muxing: Don't use stack packet
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-03 20:50:49 +02:00
Andreas Rheinhardt 53f374c08d examples/remuxing: Don't use stack packet
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-03 20:50:49 +02:00
Andreas Rheinhardt 78426da3f4 examples/remuxing: Use av_packet_rescale_ts()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-03 20:50:49 +02:00
Andreas Rheinhardt 8a23159797 fftools/ffmpeg, doc/examples: Remove redundant av_packet_unref
av_interleaved_write_frame() already returns blank packets.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-03 20:50:49 +02:00
Andreas Rheinhardt 259026b457 avformat/avformat: Clarify documentation of av_interleaved_write_frame()
The earlier documentation claimed that av_interleaved_write_frame()
always orders by dts, which is not necessarily true when using muxers
with custom interleavement functions or the audio_preload option.

Furthermore, the documentation stated that libavformat takes ownership
of the reference of the provided packet (if it is refcounted) and that
the caller may not access the data through this reference after the
function returns. This suggests that the returned packet is not blank,
but instead still contains some set, but invalid fields, which implies
that it would be dangerous to unreference this packet again.

But this is not true: av_interleaved_write_frame()'s actual behaviour
is to always output blank packet (even on error). This commit documents
this fact so that callers know that they can directly reuse this packet.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-03 20:50:49 +02:00
Andreas Rheinhardt 805ec95f8e avformat/mux: Sanitize packets without data and side-data
The BSF API treats such packets as signalling EOF and therefore
such a packet might corrupt the BSF state. In such a case,
the guarantee that av_interleaved_write_frame() always frees
the packet is not upheld.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-03 20:50:49 +02:00
Michael Niedermayer f801207568 swscale/swscale: Pass slice location into unscaled code also for dst scaling
Fixes: alphablend=checkerboard

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-10-03 20:38:29 +02:00
Michael Niedermayer 06d6726588 swscale/alphablend: Fix slice handling
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-10-03 20:38:29 +02:00
Paul B Mahol 9fbe54e4b2 avfilter/af_afwtdn: add internal timeline support 2021-10-03 13:06:57 +02:00
Paul B Mahol 24e349c74b avfilter/vf_morpho: switch to internal timeline 2021-10-03 13:06:55 +02:00
Paul B Mahol f9fc1fed29 avfilter/af_agate: switch to internal timeline 2021-10-03 13:06:54 +02:00
Paul B Mahol 8d13927340 avfilter/af_afftdn: switch to internal timeline 2021-10-03 13:06:44 +02:00
Paul B Mahol a97cad8b0b avcodec/amrnbdec: move channel_size bellow to avoid array overreads 2021-10-03 12:13:53 +02:00
Paul B Mahol 17130321f3 avcodec/mlpdec: skip decoding substreams if their channels are not to be used 2021-10-03 11:46:53 +02:00
Paul B Mahol 114634a51a avcodec/mlpdec: update matrix encoding only if it changed 2021-10-03 11:46:53 +02:00
Paul B Mahol d2cf2cb0bd avcodec/amr*dec: reindent 2021-10-03 11:42:15 +02:00
Paul B Mahol f282c34c00 avcodec/amr*dec: add multichannel support 2021-10-03 11:42:15 +02:00
Wu Jianhua e26c4d252f avfilter/x86/vf_blend: unify indentation format
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-10-03 09:15:55 +02:00
Paul B Mahol db7bd99ebf avfilter/f_reverse: add missing S64(P) sample format support 2021-10-02 18:49:40 +02:00
Paul B Mahol ba63078b0f avfilter: add (a)latency filters 2021-10-02 18:49:40 +02:00
Paul B Mahol 1f447fd954 avcodec: add amr parser 2021-10-02 18:49:40 +02:00
Andreas Rheinhardt 8ae0ef5327 avcodec/vc1_pred: Remove unused function parameter
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 18:35:35 +02:00
Andreas Rheinhardt 98f52efbfa avcodec/mpegaudiodec_template: Remove unused variable
Unused since 9ab0874ea8.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 18:35:16 +02:00
Andreas Rheinhardt 9e7e34ebcb avformat/lrcenc: Remove unnecessary header
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 18:34:35 +02:00
Andreas Rheinhardt d15efbdd5e fftools/ffmpeg_opt: Remove write-only variable
Unused since 6b35a83214 (the removal of
ffserver).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 18:34:35 +02:00
Andreas Rheinhardt 2b2e9afdd2 avformat/(lrc|scc)enc: Use avio_w8() to write a single char
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:16:34 +02:00
Andreas Rheinhardt 8766361fc1 avformat/subtitles: Honour ff_subtitles_read_line() documentation
It claims to always zero-terminate its buffer like snprintf(),
yet it does it not on EOF. Because of this the mcc demuxer
used uninitialized values when reading an empty input file.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:16:29 +02:00
Andreas Rheinhardt 2004d8d36d avformat/sccdec: Avoid zero-terminating unnecessarily
ff_subtitles_queue_insert() does not require its events to be
zero-terminated as it has a parameter for the length.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:16:21 +02:00
Andreas Rheinhardt ac42b60441 avformat/sccdec: Make constants more intelligible
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:16:02 +02:00
Andreas Rheinhardt 6795ebb2ea avformat/sccdec: Fix position of returned subtitle packets
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:15:43 +02:00
Andreas Rheinhardt e1d2a208a9 avformat/sccdec: Remove redundant check
The av_sscanf() will filter lines like "Scenarist_SCC V1.0" out.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:14:34 +02:00
Andreas Rheinhardt 60e12318bb avformat/sccdec: Don't use uninitialized data, fix crash, simplify logic
Up until now, the scc demuxer not only read the line that it intends
to process, but also the next line, in order to be able to calculate
the duration of the current line. This approach leads to unnecessary
complexity and also to bugs: For the last line, the timing of the
next subtitle is not only logically indeterminate, but also
uninitialized and the same applies to the duration of the last packet
derived from it.* Worse yet, in case of e.g. an empty file, it is not
only the duration that is uninitialized, but the whole timing as well
as the line buffer itself.** The latter is used in av_strtok(), which
could lead to crashes. Furthermore, the current code always outputs
at least one packet, even for empty files.

This commit fixes all of this: It stops using two lines at a time;
instead only the current line is dealt with and in case there is
a packet after that, the duration of the last packet is fixed up
after having already parsed it; consequently the duration of the
last packet is left in its default state (meaning "unknown/up until
the next subtitle"). If no further line could be read, processing
is stopped; in particular, no packet is output for an empty file.

*: Due to stack reuse it seems to be zero quite often; for the same
reason Valgrind does not report any errors for a normal input file.
**: While ff_subtitles_read_line() claims to always zero-terminate
the buffer like snprintf(), it doesn't do so if it didn't read anything.
And even if it did, it would not necessarily help here: The current
code jumps over 12 bytes that it deems to have read even when it
hasn't.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:14:20 +02:00
Andreas Rheinhardt 03a0dbaff3 avutil/md5: Avoid av_unused variable
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:13:57 +02:00
Andreas Rheinhardt 5d10e21809 libpostproc/postprocess_template: Don't reimplement FFSWAP
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:13:42 +02:00
Andreas Rheinhardt a412b5e792 avcodec/bmpenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt eec5a45f05 avcodec/dnxhdenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt 30c802f3ae avcodec/dpxenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt 39d28ea4d5 avcodec/magicyuvenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt c10a2959c0 avcodec/proresenc_anatoliy: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt be6da2f252 avcodec/snowenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt 4b1aa74de3 avcodec/magicyuvenc: Use immediate when known
It allows the compiler to optimize the bytestream2 checks away.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt 1f387ae4cb avfilter/af_afade: Remove impossible branch
Also don't call ff_inlink_queued_samples() unnecessarily often.

Fixes Coverity issue 1427665.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:29:11 +02:00
Andreas Rheinhardt 797fefa2e5 avfilter/formats: Update outdated comment
Forgotten in 06754f7bbf.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:29:11 +02:00
Andreas Rheinhardt e1ddaf229d avfilter/formats: Don't unnecessarily reget pixfmt descriptor
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:29:11 +02:00
Andreas Rheinhardt 3a82bb8128 avfilter/f_reverse: Don't use redundant query_formats function
Said function did exactly what ff_default_query_formats() does
for audio; so just remove it, so that ff_default_query_formats()
will be called.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:21:58 +02:00