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

97906 Commits

Author SHA1 Message Date
Nicolas George
df123590f0 lavfi/vf_crop: use ff_formats_pixdesc_filter(). 2020-05-23 15:50:20 +02:00
Nicolas George
563e1df5d6 lavfi/formats: add ff_formats_pixdesc_filter(). 2020-05-23 15:50:20 +02:00
Andreas Rheinhardt
aef670cff4 avformat/webm_chunk: Open AVIOContext before initializing sub-muxer
The description of AVOutputFormat.init contains the statement that "this
method must not write output". Due to this, the webm_chunk muxer defers
opening the AVIOContext for the child muxer until avformat_write_header(),
i.e. there is no AVIOContext when the sub-muxer's avformat_init_output()
is called. But this violates the documentation of said function which
requires the AVFormatContext to have an already opened AVIOContext.
This commit fixes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-23 07:15:35 +02:00
Andreas Rheinhardt
a5572f5a80 avformat/matroskaenc: Forward errors from avpriv_split_xiph_headers()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-23 07:10:56 +02:00
Andreas Rheinhardt
39f5bb6a3f avformat/matroskadec: Use proper context for logging
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-23 07:07:43 +02:00
Andreas Rheinhardt
6fb79c1af5 avcodec/xiph: Return better error codes
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-23 07:07:36 +02:00
Andreas Rheinhardt
b7d334e7b6 avformat/segment: Propagate disposition
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-23 07:06:54 +02:00
Andreas Rheinhardt
a6828034e0 avformat/segment: Access AVStream more directly
by storing s->streams[i] in a pointer instead of constantly using
s->streams[i]->...

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-23 07:05:48 +02:00
Andreas Rheinhardt
b2c0b3774f avformat/webmdashenc: Simplify parsing strings
Don't use the functions for searching substrings when all one is
looking for is a char anyway. Given that there is already a standard
library function for "find last occurence of a char in a string" also
allows one to remove a custom loop.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-23 06:41:50 +02:00
Andreas Rheinhardt
1e689518d5 avformat/webmdashenc: Don't segfault on invalid arguments
The current parsing process for adaptation_sets does not guarantee
every adaptation set to contain at least one stream, because the loop
exits immediately as soon as the end of the string has been reached,
without checking whether the currently active adaptation set group is
lacking a stream. This would lead to segfaults lateron as the rest of
the code presumed that every adaptation set contains a stream. This
commit fixes this by erroring out when the last adaptation set group
is incomplete.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-23 06:32:29 +02:00
Andreas Rheinhardt
9b61482627 avformat/webmdashenc: Remove possibility of infinite loop
The WebM DASH manifest muxer uses a loop to parse the adaptation_sets
string (which is given by the user and governs which AVStreams are
mapped to what adaptation set) and the very beginning of this loop is
"if (*p == ' ') continue;". This of course leads to an infinite loop if
the condition is true. It is true if e.g. the string begins with ' ' or
if there are more than one ' ' between different adaptation set groups.

To fix this, the parsing process has been modified to consume the space
if it is at a place where it can legitimately occur, i.e. when a new
adaptation set group is expected. The latter restriction implies that an
error is returned if a space exists where none is allowed to exist.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-23 06:29:53 +02:00
Andreas Rheinhardt
1030993db2 avformat/webmdashenc: Be more strict when parsing stream indices
The syntax of the adaptation_sets string by which the user determines
the mapping of AVStreams to adaptation sets is
"id=x,streams=a,b,c id=y,streams=d,e" (means: the streams with the
indices a, b and c belong to the adaptation set with id x). Yet there
was no check for whether these indices were actual numbers and if there
is a number whether it really extends to the next ',', ' ' or to the
end of the string or not. This commit adds a check for this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-23 06:09:09 +02:00
Andreas Rheinhardt
325c901430 avformat/webmdashenc: Avoid allocation for parsing a number
In order to parse a number from a string, the WebM DASH manifest muxer
would duplicate (via heap-allocation) the part of the string that
contains the number, then read the number via atoi() and then free the
duplicate again. This has been replaced by simply using strtoll() (which
in contrast to atoi() has defined behaviour when the number is not
representable).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-23 06:05:16 +02:00
Andreas Rheinhardt
06fdc82337 avformat/mux: Remove unnecessary unreferencing of AVPacket
Since commit c5324d92c5 all custom
interleave_packet() functions always return clean packets (even on
error), so that unreferencing manually can be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-23 05:43:42 +02:00
Andreas Rheinhardt
9dd8f7312a avformat/avformat: Remove redundant "NOT PART OF PUBLIC API"
AVStream.request_probe as well as AVStream.mux_ts_offset are below the
separator of public and private fields, so that a further "NOT PART OF
PUBLIC API" is redundant.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-23 01:40:05 +02:00
Mark Reid
04f67dcccf avfilter/vf_lut3d: initial float pixel format support
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-23 00:26:38 +02:00
Oneric
e6dcb6a0db avcodec/ass: explicitly set ScaledBorderAndShadow
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-23 00:26:38 +02:00
Marton Balint
82f9eb6f6c avcodec: move mpeg4 profiles to profiles.h
Also bump micro version after the recent option changes.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-05-22 22:23:18 +02:00
Marton Balint
ebb770d3ab avcodec: move msbc profile to encoder
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-05-22 22:23:18 +02:00
Marton Balint
d55f1cc58b avcodec/options_table: remove dts profiles
Our encoder (dcaenc) does not use any of these.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-05-22 22:22:46 +02:00
Marton Balint
aee036cdd0 avcodec: move aacenc profiles to profiles.h
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-05-22 22:16:53 +02:00
Marton Balint
337fe4bcc2 avcodec/options_table: make AVCodecContext->profile search for child constants
This change makes it possible for child encoders to define custom profile
option names which can be used for setting the AVCodecContext->profile.

Also rename unit name to something rather unique, so it won't be used elsewhere.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-05-22 22:16:53 +02:00
Marton Balint
af9e622776 avutil/opt: add AV_OPT_FLAG_CHILD_CONSTS
This will be used for AVCodecContext->profile. By specifying constants in the
encoders we won't have to use the common AVCodecContext options table and
different encoders can use the same profile name even with different values.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-05-22 22:16:52 +02:00
Martin Storsjö
638b5d51cf movenc: Fix accidental leftover duplication from 1aec1fbcc5
Signed-off-by: Martin Storsjö <martin@martin.st>
2020-05-22 22:00:03 +03:00
Martin Storsjö
c116c127f9 mfenc: Fall back to avctx->time_base if avctx->framerate isn't set
The framerate field is the one users are supposed to set, but not
all users might be setting it, so it might be good to fall back
time_base in that case.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-05-22 21:49:48 +03:00
Martin Storsjö
fea5f5bc64 mfenc: Fix setting has_b_frames for max_b_frames == 1
This was a mistake in my own additions in
050b72ab5e.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-05-22 21:49:37 +03:00
Martin Storsjö
1aec1fbcc5 movenc: Fix conversion of the first frame for extradata-less H264/HEVC
Move the copying of the frame to vos_data further up in the function,
so that when writing the actual frame data for the first frame, it's
clear that the stream really is in annex b format, for the cases where
we create extradata from the first frame.

Alternatively - we could invert the checks for bitstream format. If
extradata is missing, we can't pretend that the bitstream is in
mp4 form, because we can't even know the NAL unit length prefix size
in that case.

Also avoid creating extradata for AVC intra. If the track tag is
an AVC intra tag, don't copy the frame into vos_data - this matches
other existing cases of how vos_data and TAG_IS_AVCI interact in
other places.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-05-22 21:01:44 +03:00
Martin Storsjö
1f7c8d319b cbs_h265: Fix use of an uninitialized variable
This fixes test failures in fate-cbs-hevc-* in certain configurations
since c53f9f4364.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-05-22 21:01:29 +03:00
James Almer
1e8ed181e3 avcodec/bsf: mention that av_bsf_send_packet() returning EAGAIN is not an error
EAGAIN is returned when input is provided but can't be consumed. The filtering
process is unaffected in this case, and the function will be able to consume
new input after retrieving filtered packets with av_bsf_receive_packet().

Remove the line about empty packets never failing added in
41b05b849f while at it. Even if it's currently
the case, it unnecessarily constrains the API and could be changed in the future
in case it needs to be extended.
The user should always check for errors and never expect a call to never fail.

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-22 11:16:40 -03:00
Anton Khirnov
bdd6aa25c1 avcodec.h: split bitstream filters API into its own header 2020-05-22 14:38:57 +02:00
Anton Khirnov
bf80725352 lavc: rename bsf.h to bsf_internal.h
This will allow adding a public header named bsf.h
2020-05-22 14:38:57 +02:00
Anton Khirnov
9d443c3e68 avcodec.h: split AVCodecParameters API into its own header 2020-05-22 14:38:57 +02:00
Anton Khirnov
f30a41a608 Stop hardcoding align=32 in av_frame_get_buffer() calls.
Use 0, which selects the alignment automatically.
2020-05-22 14:38:57 +02:00
Anton Khirnov
8cfab9fa8c cmdutils: drop libavformat/network.h include
It is not a public header and has not been used since
10173c0e58
2020-05-22 14:38:57 +02:00
Paul B Mahol
ca7095a907 avfilter/af_aiir: move response drawing as last step 2020-05-22 14:14:15 +02:00
Paul B Mahol
8c825e43f8 avfilter/af_aiir: fix first denominator calculation 2020-05-22 14:12:06 +02:00
Paul B Mahol
07a9e5ec5e avfilter/af_aiir: add more descriptive options aliases 2020-05-22 12:37:17 +02:00
Paul B Mahol
ffda57b800 avfilter/af_aiir: export normalize option
And enable it in all modes by default.
2020-05-22 12:30:59 +02:00
Paul B Mahol
1fc5ddf774 avfilter/af_aiir: fix first delay value 2020-05-22 11:02:45 +02:00
Andreas Rheinhardt
38490cbeb3 avformat/utils: Set stream side-data size even without side-data
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-22 06:35:00 +02:00
Andreas Rheinhardt
72baae1395 avformat/matroskaenc: Remove pointless casts
by using a const void * pointer as an intermediate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-22 06:33:25 +02:00
Andreas Rheinhardt
68dd1e6a57 avformat/matroskaenc: Don't use stream side-data size
av_stream_get_side_data() tells the caller whether a stream has side
data of a specific type; if present it can also tell the caller the size
of the side data via an optional argument. The Matroska muxer always
used this optional argument, although it doesn't really need the size,
as the relevant side-data are not buffers, but structures. So change
this.

Furthermore, relying on the size also made the code susceptible to
a quirk of av_stream_get_side_data(): It only sets the size argument if
it found side data of the desired type. mkv_write_video_color() checks
for side-data twice with the same variable for the size without resetting
the size in between; if the second type of side-data isn't present, the
size will still be what it was after the first call. This was not
dangerous in practice, as the check for the existence of the second
side-data compared the size with the expected size, so it would only be
problematic if lots of elements were to be added to AVContentLightMetadata.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-22 06:30:56 +02:00
Joey Smith
d29c429744 avformat/http: increase BUFFER_SIZE to MAX_URL_SIZE + HTTP_HEADERS_SIZE
Some real-world sites use an authorization header with a bearer token; when
combined with lengthy request parameters to identify the video segment,
it's rather trivial these days to have a request body of more than 4k bytes.

MAX_URL_SIZE is hard-coded to 4k bytes in libavformat/internal.h, and
HTTP_HEADERS_SIZE is 4k as well in libavformat/http.h, so this patch increases
the buffer size to 8k, as that is the default request body limit in Apache, and
most other httpds seem to support at least as much, if not more.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-05-21 22:45:21 +02:00
James Almer
13b1bbff0b avcodec: deprecate Lossless and Intra Only encoder capabilites
Both are codec properties and not encoder capabilities. The relevant
AVCodecDescriptor.props flags exist for this purpose.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-21 12:32:15 -03:00
James Almer
cbb1760afa fftools/cmdutils: remove lossless and intra only capability entries from print_codec()
They are codec properties, not encoder capabilities.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-21 12:32:15 -03:00
James Almer
0a3ba58b44 fftools/ffmpeg_filter: check the codec's descriptor to see if it's lossless
Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-21 12:32:15 -03:00
James Almer
d3bedba97f avcodec/decode: remove ff_decode_bsfs_uninit()
It's been a wrapper for a simple av_bsf_free() call since c96904f525.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-21 12:32:15 -03:00
Michael Niedermayer
70faa9f618 avcodec/tiff: Check for Tiled and Stripped TIFFs
TIFF 6 spec: "Do not use both strip-oriented and tile-oriented fields in the same TIFF file."

Fixes: null pointer use, crash
Fixes: crash-762680f9d1b27f9b9085e12887ad44893fb2b020

Found-by: Shiziru <lunasl@protonmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-21 13:08:23 +02:00
Michael Niedermayer
49459aca47 avcodec/pnmdec: Use unsigned for maxval rescaling
Fixes: signed integer overflow: 65535 * 55335 cannot be represented in type 'int'
Fixes: 21955/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGMYUV_fuzzer-5669206981083136

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-21 09:31:08 +02:00
Michael Niedermayer
1d633e6a0a avcodec/ivi: Clear got_p_frame before decoding a new frame using it
Fixes: assertion failure
Fixes: 21666/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO4_fuzzer-5706468994318336

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-21 09:31:08 +02:00