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

106617 Commits

Author SHA1 Message Date
Andreas Rheinhardt
f703cbabdb avcodec/mpegvideo_enc: Remove always-true check
It is a remnant of the old way for user-supplied buffers;
it is always-true since 93016f5d1d.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-14 18:38:55 +02:00
Andreas Rheinhardt
c3047da646 avcodec/mpegvideo_enc: Fix unnecessary linear growth of buffer
If one encodes MJPEG with a single slice and uses input with
AV_FRAME_DATA_ICC_PROFILE side data, the current allocation code
in ff_mpv_encode_picture() will always increase the size of the
temporary buffer used for allocating packets by the size needed
for to write the ICC chunk even when the current buffer is actually
large enough. This commit fixes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-14 18:38:55 +02:00
Andreas Rheinhardt
4487dd8bb5 avcodec/mpegvideo_enc: Ignore ICC profile size when not MJPEG
MJPEG is the only mpegvideo-based encoder making use of it.
Fixes linking failures in case mpegvideo_enc.c is compiled
with AMV, LJPEG and MJPEG encoders disabled.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-14 18:38:55 +02:00
Paul B Mahol
1764a6887b avfilter/avf_showspectrum: add alpha pixel format support 2022-04-14 17:29:14 +02:00
Mark Gaiser
ea84eb2db1 avformat/ipfsgateway: define PATH_MAX
PATH_MAX is posix. Some compilers (MSVC) don't define this
thus failing to compile the ipfsgateway file.
Defining it fixes the compile.

Signed-off-by: Mark Gaiser <markg85@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-04-14 10:52:21 +03:00
Paul B Mahol
bf6735e945 avfilter/af_adenorm: simplify handling of commands 2022-04-13 22:02:47 +02:00
Paul B Mahol
24144af2dd avfilter/avf_showvolume: check for allocation error and stop leaks 2022-04-13 18:24:25 +02:00
Andreas Rheinhardt
fa3f9f2f6a avcodec/avcodec: Don't reset decoder-fields for encoders when flushing
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-13 18:04:25 +02:00
Andreas Rheinhardt
f6e167998f avcodec/avcodec: Simplify accessing AVSubtitleRect via dedicated pointer
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-13 18:03:40 +02:00
Andreas Rheinhardt
3649051dc4 avcodec/avcodec: Avoid av_frame_unref(NULL)
It works, but it is not documented to work.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-13 18:03:25 +02:00
Andreas Rheinhardt
3a920372a1 avcodec/encode: Fix check for encoders impl. encode-simple API
FFCodec.cb is a union.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-13 17:59:34 +02:00
Paul B Mahol
f67403edb3 avcodec/mlpenc: fix encoding after receiving last frame
This happened when major header needed to be written
after input EOF.
2022-04-13 14:22:39 +02:00
Anton Khirnov
e663030267 lavc/encode: pick a sane default for bits_per_raw_sample if it's not set
Fixes #9563.
2022-04-13 12:48:19 +02:00
Anton Khirnov
ee26138e67 lavc/encode: reindent 2022-04-13 12:48:18 +02:00
Anton Khirnov
15975881ae lavc/encode: factor audio/video-specific parts out of ff_encode_preinit() 2022-04-13 12:45:47 +02:00
Anton Khirnov
ce3c20f2aa lavc: move default get_buffer2() to its own file
It is also used by some encoders, so decode.c is not the right place for
it.
2022-04-13 12:15:02 +02:00
Anton Khirnov
32413600e8 lavc/encode: drop EncodeSimpleContext
It has only a single member.
2022-04-13 12:14:30 +02:00
Anton Khirnov
1c01dca144 lavc/avcodec: only allocate the encoding frame for encoders
And only when needed, i.e. for encoders using the simple API.
2022-04-13 12:14:08 +02:00
Anton Khirnov
7efa6418b8 lavc/avcodec: simplify codec id/type validity checking
On entry to avcodec_open2(), the AVCodecContext type and id either have
to be UNKNOWN/NONE or have to match the codec to be used.
2022-04-13 12:13:15 +02:00
Anton Khirnov
4a7c8bb3d8 fftools/ffmpeg: store output format separately from the muxer context
Allows accessing it without going through the muxer context. This will
be useful in the following commits, where the muxer context will be
hidden.
2022-04-13 12:07:54 +02:00
Anton Khirnov
5c66ee6351 fftools/ffmpeg: move freeing the output file to ffmpeg_mux.c 2022-04-13 12:07:54 +02:00
Anton Khirnov
5bc644ea8a fftools/ffmpeg: move writing the trailer to ffmpeg_mux.c 2022-04-13 12:07:54 +02:00
Anton Khirnov
288aa37387 fftools/ffmpeg: move some muxing-related code into a separate file
This is a first step towards making muxers more independent from the
rest of the code.
2022-04-13 12:07:54 +02:00
Anton Khirnov
b1a984cb49 fftools/ffmpeg: store the output file index in OutputFile
Use it to simplify check_init_output_file(). Will allow further
simplifications in the following commits.
2022-04-13 12:07:54 +02:00
Anton Khirnov
16aea9a38b fftools/ffmpeg: pass the muxer context explicitly to some functions
Stop accessing OutputFile.ctx. This will be useful in the following
commits, where it will become hidden.
2022-04-13 12:07:54 +02:00
Anton Khirnov
662364b2ef fftools/ffmpeg: stop using OutputStream.frame_number for streamcopy
This field is currently used by checks
- skipping packets before the first keyframe
- skipping packets before start time
to test whether any packets have been output already. But since
frame_number is incremented after the bitstream filters are applied
(which may involve delay), this use is incorrect. The keyframe check
works around this by adding an extra flag, the start-time check does
not.

Simplify both checks by replacing the seen_kf flag with a flag tracking
whether any packets have been output by do_streamcopy().
2022-04-13 12:07:54 +02:00
Anton Khirnov
86e1c0303c fftools/ffmpeg: move a comment to a more appropriate place 2022-04-13 12:07:54 +02:00
Anton Khirnov
a8c95e1feb fftools/ffmpeg: drop an obsolete hack
Introduced in 05741d70c7. All encoders should set the timestamps
properly now, so it should never be necessary.
2022-04-13 12:07:54 +02:00
Paul B Mahol
9a22c6508a avfilter/vf_deblock: fix posible overreads 2022-04-13 10:25:08 +02:00
Paul B Mahol
b74f212b7a avfilter/vf_xmedian: simplify changing index variable 2022-04-13 09:54:20 +02:00
Paul B Mahol
9d40fe20c9 avfilter/af_crystalizer: remove no longer needed wrapper function 2022-04-13 09:41:14 +02:00
Paul B Mahol
63d12a48b5 avfilter/vf_chromashift: simplify handling of commands 2022-04-13 09:30:36 +02:00
Wenbin Chen
7e7b3a4c28 libavutil/hwcontext_qsv: Align width and heigh when download qsv frame
The width and height for qsv frame to download need to be
aligned with 16. Add the alignment operation.
Now the following command works:
ffmpeg -hwaccel qsv -f rawvideo -s 1920x1080 -pix_fmt yuv420p -i \
input.yuv -vf "hwupload=extra_hw_frames=16,format=qsv,hwdownload, \
format=nv12" -f null -

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-04-13 13:41:27 +08:00
Andreas Rheinhardt
7427b87e44 avcodec/mss12: Constify slice context->parent context pointer
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-13 00:37:13 +02:00
Andreas Rheinhardt
77ed56f0ec avcodec/vbnenc: Add AV_CODEC_CAP_DR1
This encoder uses ff_get_encode_buffer().

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-13 00:37:06 +02:00
Andreas Rheinhardt
cc0a4fa630 avcodec/vbn(dec|enc): Avoid always-false checks
Do this by switching to bytestream2_(get|put)_le32u() from
bytestream2_(get|put)_le32(); it has after all already been checked
that the packet contains at least a full header, making all
the implicit checks in bytestream2_(get|put)_le32() dead code.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-13 00:36:57 +02:00
Andreas Rheinhardt
300dd79c3d avcodec/vbn(dec|enc): Avoid leaving stale pointers in context
Therefore move the (Get|Put)ByteContext from the context to the stack.
It is transient anyway.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-13 00:36:39 +02:00
Andreas Rheinhardt
81b6a10937 avcodec/vbn(dec|enc): Remove empty close function
Reviewed-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-13 00:25:36 +02:00
Mark Gaiser
f889837e00 avformat: Add IPFS protocol support.
This patch adds support for:
- ffplay ipfs://<cid>
- ffplay ipns://<cid>

IPFS data can be played from so called "ipfs gateways".
A gateway is essentially a webserver that gives access to the
distributed IPFS network.

This protocol support (ipfs and ipns) therefore translates
ipfs:// and ipns:// to a http:// url. This resulting url is
then handled by the http protocol. It could also be https
depending on the gateway provided.

To use this protocol, a gateway must be provided.
If you do nothing it will try to find it in your
$HOME/.ipfs/gateway file. The ways to set it manually are:
1. Define a -gateway <url> to the gateway.
2. Define $IPFS_GATEWAY with the full http link to the gateway.
3. Define $IPFS_PATH and point it to the IPFS data path.
4. Have IPFS running in your local user folder (under $HOME/.ipfs).

Signed-off-by: Mark Gaiser <markg85@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-04-12 19:58:33 +02:00
Paul B Mahol
c2351d5a53 avcodec/mlpenc: simplify calling function 2022-04-12 19:30:58 +02:00
Paul B Mahol
dc068a7265 avcodec/mlpenc: use FFMAX() 2022-04-12 19:30:58 +02:00
Paul B Mahol
cbad385f04 avcodec/mlpenc: improve handling of last samples 2022-04-12 19:30:58 +02:00
Paul B Mahol
25cd1845ab avfilter/af_asetnsamples: fix excessive frames queueing at start 2022-04-12 19:30:58 +02:00
James Almer
b64043a83d avfilter/vf_drawbox: remove redefinition of DrawBoxContext typedef
It's forbidden in C99.

Should fix compilation with old non C11 compilers.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-04-12 11:09:59 -03:00
Gyan Doshi
1405b65d22 avfilter/lensfun: add option db_path
The lensfun filter, at present, loads its database from a path hardcoded
at build time. This may not be known or available to end users.

Added option db_path allows custom path.
2022-04-12 15:20:10 +05:30
Paul B Mahol
1047fedd0f avfilter: add Audio Video Sync Test filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2022-04-12 10:51:46 +02:00
Martin Storsjö
74439b67f2 tests: Fix the dependencies for the fate-jpg-icc test
The test also requires a png decoder, which often can be disabled in
cross building setups, where zlib might be missing.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-04-12 09:06:07 +03:00
Paul B Mahol
13fe148c31 avfilter/f_ebur128: fix typos for swr chlayouts 2022-04-11 23:14:54 +02:00
Andreas Rheinhardt
3bbbb09a53 avcodec/hevc_sei: Don't use GetBit-API for byte-aligned reads
Instead use the bytestream2-API.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-11 19:19:50 +02:00
Andreas Rheinhardt
cf3f8ab9e6 avcodec/hevc_sei: Fix parsing SEI messages
SEI messages are naturally byte-aligned by adding padding bits
to achieve byte-alignment. The parsing code in libavcodec/hevc_sei.c
nevertheless uses a GetBitContext to read it. When doing so, parsing
the next SEI message starts exactly at the position where reading
the last message (if any) ended.

This means that one would have to handle both the payload extension data
(which makes most SEI messages extensible structs) as well as the
padding bits for byte-alignment. Yet our SEI parsing code in
libavcodec/hevc_sei.c does not read these at all. Instead several of
the functions used for parsing specific SEI messages use
skip_bits_long(); some don't use it at all, in which case it is possible
for the GetBitContext to not be byte-aligned at the start of the next
SEI message (the parsing code for several types of SEI messages relies
on byte-alignment).

Fix this by always using a dedicated GetBitContext per SEI message;
skipping the necessary amount of bytes in the NALU context
is done at a higher level. This also allows to remove unnecessary
parsing code that only existed in order to skip enough bytes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-11 19:19:50 +02:00