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

99279 Commits

Author SHA1 Message Date
Andreas Rheinhardt
a53f32cf49 avcodec/mobiclip: Fix memleak upon init failure
If an error happens during init after an allocation has succeeded,
the already allocated data leaked up until now. Fix this by setting the
FF_CODEC_CAP_INIT_CLEANUP flag.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-15 19:25:26 +02:00
Andreas Rheinhardt
a8ebb56320 avcodec/magicyuvenc: Fix memleak upon init failure
If an error happens during init after an allocation has succeeded,
the already allocated data leaked up until now. Fix this by setting the
FF_CODEC_CAP_INIT_CLEANUP flag.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-15 19:25:26 +02:00
Andreas Rheinhardt
0bb5cc0ee9 avcodec/hcom: Cleanup generically upon init failure
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-15 19:25:26 +02:00
Andreas Rheinhardt
8da8774d8e avcodec/gif: Fix leaks upon allocation error
If one of several allocations the gif encoder performs in its init
function fails, the successful allocations leak. Fix this by adding the
FF_CODEC_CAP_INIT_CLEANUP flag.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-15 19:25:26 +02:00
Andreas Rheinhardt
39638ace67 avcodec/dsicinvideo: Remove redundant code for freeing
The dsicinvideo decoder already has the FF_CODEC_CAP_INIT_CLEANUP flag
set, so it is unnecessary to directly clean up some already allocated
buffers in case another one could not be allocated in the init function,
as all buffers will be freed anyway later in the decoder's close
function.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-15 19:25:26 +02:00
Andreas Rheinhardt
3c2128df7f avcodec/avrndec: Fix memleak on error
If ff_codec_open2_recursive() fails, the already allocated
AVCodecContext leaks. Fix this by setting the FF_CODEC_CAP_INIT_CLEANUP
flag.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-15 19:25:26 +02:00
Andreas Rheinhardt
d8e4d26de6 avcodec/avrndec: Check allocation for success
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-15 19:25:25 +02:00
Andreas Rheinhardt
b0a29d88c8 avcodec/atrac1: Cleanup generically after init failure
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-15 19:25:25 +02:00
Andreas Rheinhardt
e75ccc8123 avcodec/atrac1: Check allocation of AVFloatDSPContext
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-15 19:25:25 +02:00
Mark Reid
8ddcbebc3f libavcodec/exr: fix incorrect translation of denorm mantissa 2020-09-15 19:22:18 +02:00
Paul B Mahol
2524e64dbe avfilter/f_interleave: fix some issues with interleaving 2020-09-15 17:21:38 +02:00
James Almer
022a12b306 avcodec/decode: use a packet list to store packet properties
Keeping only the latest packet fed to the decoder works only for decoders that
return a frame immediately after every consumed packet. Decoders that consume
several packets before they return a frame will fill said frame with properties
taken from the last consumed packet instead of the earliest.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-15 09:53:39 -03:00
James Almer
8a81820624 avcodec/packet: move AVPacketList definition and function helpers over from libavformat
And replace the flags parameter with a function callback that can be used to
copy the contents of the packet (e.g, av_packet_ref and av_packet_copy_props).

Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-15 09:53:39 -03:00
Paul B Mahol
fda5363c80 avfilter/x86/vf_convolution_init: there is asm only for 8bit depth 2020-09-15 08:13:04 +02:00
Paul B Mahol
05c8d0bce6 avfilter/avf_concat: check for possible integer overflow
Also check that segment delta pts is always bigger than input pts.

There is nothing much currently that can be done to recover from
this situation so just return AVERROR_INVALIDDATA error code.
2020-09-14 18:16:42 +02:00
Paul B Mahol
17b44f759e avfilter/af_amix: do not leave unset PTS for frames after first stream is over
First stream is used only to get number of samples to put into each output frame.
2020-09-14 18:16:42 +02:00
Andreas Rheinhardt
a489b6a8e3 avcodec/cfhdenc: Fix leaks on allocation errors
The CineForm HD encoder attempts to allocate several buffers in its init
function; yet if only some of these allocations succeed, the
successfully allocated buffers leak. This is fixed by setting the
FF_CODEC_CAP_INIT_CLEANUP flag.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-14 15:11:27 +02:00
Andreas Rheinhardt
82b6f4b556 avcodec/snowdec: Use ff_snow_common_init() directly
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-14 15:11:02 +02:00
Mark Reid
60e7021064 avfilter/vf_premultiply: add missing AV_PIX_FMT_YUVA444P12
query_formats says its supported, but is missing from switch statement leading to segfault
2020-09-14 10:31:46 +02:00
Zane van Iperen
119efa275e
avformat: add Argonaut Games BRP demuxer
Used in FMVs for FX Fighter and Croc. Supports BVID and BASF streams,
requests samples for anything else.

Due to the way BASF streams are contained in the file, only one is
supported. I have yet to see a BRP file with multiple.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-14 14:38:45 +10:00
Zane van Iperen
121016f827
avformat/argo_asf: add ASF_MIN_BUFFER_SIZE #define
For future use by the argo_brp demuxer

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-14 14:24:01 +10:00
Zane van Iperen
442249ef28
avformat/argo_asf: split functionality into a header
For future use by the argo_brp demuxer.

Adds:
  - void ff_argo_asf_parse_file_header(ArgoASFFileHeader *hdr, const uint8_t *buf);
  - int  ff_argo_asf_validate_file_header(AVFormatContext *s, const ArgoASFFileHeader *hdr);
  - void ff_argo_asf_parse_chunk_header(ArgoASFChunkHeader *hdr, const uint8_t *buf);
  - int  ff_argo_asf_fill_stream(AVStream *st, const ArgoASFChunkHeader *ckhdr);

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-14 14:23:54 +10:00
Zane van Iperen
0476b6ee1e
avformat/argo_asf: bail if invalid tag
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-14 14:23:15 +10:00
Marton Balint
96907e84dd avdevice/decklink_dec: add support for querying RP188 High Frame Rate timecode
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 18:06:54 +02:00
Marton Balint
f1b908d20a avdevice/decklink_dec: add support for rgb/yuv pixel format autodetection
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:59:30 +02:00
Marton Balint
e33c0d8c69 avdevice/decklink_dec: use decklink_ctx->raw_format as bmdPixelFormat
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:59:30 +02:00
Marton Balint
a9ede0bde4 avdevice/decklink_common.h: remove unsupported decklink version ifdef
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:59:30 +02:00
Marton Balint
9b434bea75 avformat: use av_timecode_make_smpte_tc_string2
WSD format has no frames stored for playback time.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:51:57 +02:00
Marton Balint
172af0ee51 avfilter/vf_showinfo: use av_timecode_make_smpte_tc_string2
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:51:57 +02:00
Marton Balint
5673802511 avcodec: use av_timecode_make_smpte_tc_string2 in hevc and h264 decoder
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:51:57 +02:00
Marton Balint
babbb5a4ba fftools/ffprobe: use av_timecode_make_smpte_tc_string2
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:51:57 +02:00
Marton Balint
837b6eb90e avutil/timecode: add av_timecode_make_smpte_tc_string2
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:51:57 +02:00
Marton Balint
5357401671 avutil/timecode: do not trash bits on invalid av_timecode_get_smpte arguments
The function has no way to return error, so let's clip or calculate modulo.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:51:57 +02:00
Marton Balint
d0596e0bb0 avutil/timecode: cosmetics on av_timecode_get_smpte
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:51:57 +02:00
Marton Balint
00117e28c1 avutil/timecode: fix av_timecode_get_smpte_from_framenum with 50/60 fps
SMPTE 12M timecode can only count frames up to 39, because the tens-of-frames
value is stored in 2 bit. In order to resolve this 50/60 fps SMPTE timecode is
using the field bit (which is the same bit as the phase correction bit) to
signal the least significant bit of a 50/60 fps timecode. See SMPTE ST
12-1:2014 section 12.1.

Therefore we slightly change the format of the return value of
av_timecode_get_smpte_from_framenum and AV_FRAME_DATA_S12M_TIMECODE and start
using the previously unused Phase Correction bit as Field bit. (As the SMPTE
standard suggests)

We add 50/60 fps support to av_timecode_get_smpte_from_framenum by calling the
recently added av_timecode_get_smpte function in it which already handles this
properly.

This change affects the decklink indev and the DV and MXF muxers. MXF has no
fate test for 50/60fps content, DV does, therefore the changes.

MediaInfo (a recent version) confirms that half-frame timecode must be inserted
to DV. MXFInspect confirms valid timecode insertion to the System Item of MXF
files. For MXF, also see EBU R122.

Note that for DV the field flag is not used because in the HDV specs (SMPTE
370M) it is still defined as biphase mark polarity correction flag. So it
should not matter that the DV muxer overrides the field bit.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:51:57 +02:00
Paul B Mahol
ddc9cce3cd avformat: add Square SVS demuxer 2020-09-13 16:05:01 +02:00
Paul B Mahol
cd67bf2a28 avformat/moflex: make seeking more useful 2020-09-13 16:05:01 +02:00
Paul B Mahol
bd7d832e84 avcodec/mobiclip: add missing flush 2020-09-13 16:05:01 +02:00
Paul B Mahol
2752323046 avformat/flic: add support for seeking to start 2020-09-13 16:05:01 +02:00
Paul B Mahol
e1da139a33 avcodec/cdgraphics: fix decoded output when seeking to start of file
Also in cdg demuxer do not skip packets data, and remove
private context which is not really needed.
2020-09-13 16:05:01 +02:00
Paul B Mahol
55af1807f7 avfilter/asrc_anullsrc: actually return correct EOF pts 2020-09-13 13:26:11 +02:00
Paul B Mahol
c28b14eb98 avfilter/asrc_anullsrc: give better limits to number of samples per frame 2020-09-13 13:18:18 +02:00
Paul B Mahol
0a17a4891d avfilter/asrc_anullsrc: make number of output samples match duration 2020-09-13 13:18:18 +02:00
Michael Niedermayer
aa8935b395 avformat/cdg: Fix integer overflow in duration computation
Fixes: signed integer overflow: 8398407 * 300 cannot be represented in type 'int'
Fixes: 23914/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4702539290509312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-09-13 10:40:02 +02:00
Michael Niedermayer
e3af2a0756 tools:target_dem_fuzzer: Split into a fuzzer fuzzing at the protocol level and one fuzzing a fixed demuxer input
This should improve coverage and should improve the efficiency of seed files

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-09-13 10:40:02 +02:00
Andreas Rheinhardt
f5a61a1728 avcodec/crystalhd: Remove unused packet
Unused since 41b0561dc7.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-13 05:03:44 +02:00
James Almer
e46f34e85b avcodec/av1dec: fix setting pix_fmt
Fill the array with the software pix_fmt and move the avctx->hwaccel
check back to the proper place.
Also remove the avoid probing flag to ensure an external av1 decoder
will not set a pix_fmt we don't want during format probing.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-12 17:39:45 -03:00
James Almer
9c6026bc72 avcodec/av1dec: update reference frame state on show_existing_frame
As defined in Section 7.4

Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-12 13:10:16 -03:00
James Almer
b80c66bb6b avcodec/av1dec: set chroma_sample_location
Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-12 13:10:16 -03:00
James Almer
b7a06885f1 avcodec/av1dec: use av_cmp_q() to compare aspect ratio
Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-12 13:10:16 -03:00