Commit Graph

96162 Commits

Author SHA1 Message Date
Andreas Rheinhardt 39561bbe77 avformat/microdvdenc: Use avio_w8 to write a char
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-27 12:38:08 +01:00
Andreas Rheinhardt 9bde6c6be0 avformat/microdvd: Use \n instead of \0 to end file header
Up until now, the microdvd demuxer uses av_strdup() to allocate the
extradata from a string; its length is set to strlen() + 1, i.e.
including the \0 at the end. Upon remuxing, the muxer would simply copy
the extradata at the beginning, including the \0.

This commit changes this by not adding the \0 to the size of the
extradata; the muxer now delimits extradata by inserting a \n. This
required to change the subtitles-microdvd-remux FATE-test.

Furthermore, the extradata is now allocated with zeroed padding.

The microdvd decoder is not affected by this, as it didn't use the size
of the extradata at all, but treated it as a C-string.

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>
2019-12-27 12:38:08 +01:00
Andreas Rheinhardt b0d0d7e4d0 avformat/flvenc: Fix leak of oversized packets
Might happen for annex B H.264.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-26 22:48:44 +01:00
Andreas Rheinhardt 28d02524a0 avformat/flvenc: Forward errors from allocating keyframe index
While the function adding a new element to the keyframe index checked
the allocation, the caller didn't check the return value. This has been
changed. To do so, the return value has been changed to an ordinary ret
instead of pb->error. This doesn't pose a problem, as write_packet() in
mux.c already checks for write errors (since 9ad1e0c1).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-26 22:48:44 +01:00
Andreas Rheinhardt a94e6b50c6 avformat/wavenc: Add deinit function
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-26 22:48:44 +01:00
Andreas Rheinhardt 827bdc8418 avformat/spdifenc: Replace write_trailer by deinit
The write_trailer function doesn't write anything anyway. It only frees
memory.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-26 22:22:33 +01:00
Limin Wang ef91e3955a avcodec/vc1dec: remove the unneeded ()
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-26 22:22:33 +01:00
Limin Wang f8f86f8356 avcodec/ass: remove the unneeded ()
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-26 22:22:33 +01:00
Paul B Mahol b5f0cea16c avfilter/vf_histogram: use the name 's' for the pointer to the private context
This is consistent across filters.
2019-12-26 20:45:20 +01:00
Michael Niedermayer 4fa2d5a692 avcodec/cbs_vp9: Check data_size
Fixes: out of array access
Fixes: 19542/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5659498341728256

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-26 16:06:25 +01:00
Andreas Rheinhardt 398a5f5d8f avfilter/buffersrc: Remove unused variables
Unused since f09ae730.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-26 16:06:25 +01:00
Marton Balint c991e9cd91 avdevice/xcbgrab: use a buffer pool for shared memory segments
Also by wrapping the SHM buffer in an AVBufferRef we eliminate yet another
possible memcpy improving performance.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-26 00:47:24 +01:00
Marton Balint 16685114d5 avutil/buffer: add av_buffer_pool_buffer_get_opaque
In order to access the original opaque parameter of a buffer in the buffer
pool. (The buffer pool implementation overrides the normal opaque parameter but
also saves it so it is accessible).

v2: add assertion check before dereferencing the BufferPoolEntry.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-26 00:47:24 +01:00
Paul B Mahol e3dca0744d avformat/dhav: improve seeking 2019-12-25 22:10:47 +01:00
Michael Niedermayer d6553e2e60 avcodec/cbs_vp9: Check index_size
Fixes: out of array read
Fixes: 19300/clusterfuzz-testcase-minimized-ffmpeg_BSF_VP9_METADATA_fuzzer-5653911730126848

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-25 18:00:40 +01:00
Limin Wang 3dd6c4478b avfilter/vf_yadif: cosmetics in the pix_fmts[] array
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-25 18:00:40 +01:00
Gyan Doshi 287620f59c avfilter/drawtext: log why input pad failed to be configured 2019-12-24 11:04:52 +05:30
Paul B Mahol a13af9aee1 avformat/sccdec: only change duration for last subtitle 2019-12-23 22:47:27 +01:00
Paul B Mahol 13bffa7969 avformat/sccdec: fix sub->pos values 2019-12-23 22:39:46 +01:00
Paul B Mahol 9da7536ce2 avformat/sccdec: fix timestamp of last subtitle
Fixes -c:s copy case.
2019-12-23 22:16:25 +01:00
Paul B Mahol 547b0c61af avfilter/vf_fade: reindent after previous commit 2019-12-23 20:24:36 +01:00
Paul B Mahol 6c9a9dd25a avfilter/vf_fade: add support for gbrp/gbrap formats 2019-12-23 20:16:27 +01:00
Zhong Li 5dc527f9ca lavc/midivid: check return value of init_get_bits8()
Fix CID 1456088

Signed-off-by: Zhong Li <zhongli_dev@126.com>
2019-12-23 20:14:42 +01:00
Paul B Mahol 94ad5d0128 avfilter/vf_readeia608: factor some constants out 2019-12-23 20:09:20 +01:00
Paul B Mahol 94682555c6 avfilter/vf_readeia608: check if gaps between clock bits are big enough
Should help finding less false positives.
2019-12-23 19:56:05 +01:00
Paul B Mahol 16968b619d avfilter/vf_readeia608: use special struct to hold line items 2019-12-23 18:02:38 +01:00
Zhao Zhili 0115dbd043 avfilter/avfilter: update documentation of avfilter_graph_create_filter 2019-12-23 17:02:55 +01:00
Zhao Zhili 61097535cd avfilter/buffersink: deprecate AVBufferSinkParams and AVABufferSinkParams 2019-12-23 17:02:55 +01:00
Zhao Zhili 07ffdedf78 avfilter/buffersink: replace init_opaque by init
The argument 'opaque' is always NULL since 0acf7e2 (2013),
and avfilter_init_filter() was removed in 52067b3c0e (2016).
2019-12-23 17:02:55 +01:00
Zhao Zhili 807e90d232 avfilter/buffersink: remove unused macros 2019-12-23 17:02:55 +01:00
Zhao Zhili bf08264daa avfilter/buffersrc: remove redundant flag
!(c->pix_fmt != AV_PIX_FMT_NONE || c->got_format_from_params)

equals

(c->pix_fmt == AV_PIX_FMT_NONE) && !c->got_format_from_params

1. When (c->pix_fmt == AV_PIX_FMT_NONE) is true, got_format_from_params is
always false, the flag doesn't contribute to the result.

2. When the first part is false, the second part doesn't matter, the flag
doesn't contribute to the result.

The result only depends on c->pix_fmt.
2019-12-23 17:02:55 +01:00
Gyan Doshi f0b3b55002 avformat/mpegtsenc: warn users if codec isn't supported
The MPEG-TS muxer will mux streams with unsupported codec id
as a private data stream; this usually makes the stream
not recognizable by ffmpeg and likely other tools.
2019-12-23 21:06:37 +05:30
James Almer c75f246a3c avcodec/noise_bsf: remove superfluous fail label
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-23 11:49:44 -03:00
Steven Liu ec2a8e3390 Changelog: Fix typo of comments
Signed-off-by: Steven Liu <lq@onvideo.cn>
Reviewed-by: Lou Logan <lou@lrcd.com>
2019-12-23 22:13:48 +08:00
Nicolas George f09ae7309d lavfi/buffersrc: push frame directly.
This allows to remove the queued frame entirely.
2019-12-23 13:03:38 +01:00
Nicolas George 02daafb45c lavfi: remove AVFilterPad.poll_frame().
This design is no longer used and was replaced a long time ago.
2019-12-23 13:03:38 +01:00
Nicolas George f3a6ef69bf lavfi/buffersrc: remove poll_frame. 2019-12-23 13:03:38 +01:00
Nicolas George 65e6850c56 lavfi: remove ff_poll_frame().
It is never used.
2019-12-23 13:03:38 +01:00
Nicolas George 9ea7e68907 lavfi/buffersrc: remove fifo.
The frame is immediately pushed, the fifo has never more than one.
2019-12-23 13:03:38 +01:00
Limin Wang 03eb96f9b7 avfilter/vf_readeia608: fix check for failed av_calloc
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-12-23 10:26:36 +01:00
Andreas Rheinhardt 5b42d33571 avformat/hls: Use av_packet_move_ref() for packet ownership transfer
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-12-23 15:39:49 +08:00
Andreas Rheinhardt 74a8be3546 avformat/hlsenc: Fix check for presence of webvtt muxer
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:54 +08:00
Andreas Rheinhardt 5ba3a8958c avformat/hlsenc: Fix memleaks with repeating parameters
When a parameter like e.g. language is contained more than once in the
part of var_stream_map pertaining to a single VariantStream, the later
one just overwrites the pointer to the earlier one, leading to a
memleak. This commit changes this by handling the situation gracefully:
The earlier string is silently freed first, so that the last one wins.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:51 +08:00
Andreas Rheinhardt 53c1458bf2 avformat/hlsenc: Fix return value from localtime_r failure
"If an error is detected, localtime_r() shall return a null pointer
and set errno to indicate the error." Yet in case this happened in
hls_init(), AVERROR(ENOMEM) has been returned.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:47 +08:00
Andreas Rheinhardt 149ee954a3 avformat/hlsenc: Fix potential segfault upon allocation failure
The hls muxer allocates an array of VariantStreams, a structure that
contains pointers to objects that need to be freed on their own. This
means that the number of allocated VariantStreams needs to be correct
when they are freed; yet the number of VariantStreams is set in
update_variant_stream_info() resp. parse_variant_stream_mapstring()
before the allocation has been checked for success, so that upon error
an attempt would be made to free the objects whose pointers are
positioned at position NULL (the location of VariantStreams) +
offsetof(VariantStream, the corresponding pointer).

Furthermore d1fe1344 added another possibility for the first function
to leave an inconsistent state behind: If an allocation of one of the
objects referenced by the VariantStream fails, the VariantStream will be
freed, but the number of allocated VariantStreams isn't reset, leading
to the same problem as above. (This was done in the mistaken belief that
the VariantStreams array would leak otherwise.)

Essentially the same also happens for the number of cc-streams. It has
been fixed, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:43 +08:00
Andreas Rheinhardt bd131b64bc avformat/hlsenc: Fix leak of options when writing packets
Under certain circumstances hls_write_packet() would add options to an
AVDictionary. Said dictionary was never explicitly freed, instead it was
presumed that these options would be consumed when opening a new
IO-context. This left several possibilities for memleaks:

a) When no new IO-context would be opened at all. This is possible when
using both the flags temp_file and single_file together with a file
output.
b) When an error happens before one actually tries to open the new
IO-context.
c) When the new IO-context does not consume all options.

All three have been fixed; furthermore, the AVDictionary has been put
into a smaller scope (namely the only part of hls_write_packet() where
it is actually used).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:40 +08:00
Andreas Rheinhardt 9e4b3ccbb6 avformat/hlsenc: Fix leak of options when initializing muxing fails
hls_mux_init() currently leaks an AVDictionary if opening a dynamic
buffer fails or if avformat_init_output fails. This has been fixed by
moving the initialization resp. the freeing of the dictionary around:
In the former case to a place after opening the dynamic buffer, in the
latter to a place before the check for initialization failure so that it
is done unconditionally.

Furthermore, the dictionary is now only copied and freed if the options
in it are actually used (namely when in SEGMENT_TYPE_FMP4 mode).

Finally, a similar situation in hls_start() has been fixed, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:37 +08:00
Andreas Rheinhardt ae84305036 avformat/hlsenc: Only allocate when data is known to be needed
hls_init() would allocate a buffer, although it is only needed in one of
two branches that follow. This commit moves the allocation to the branch
that actually needs the buffer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:33 +08:00
Andreas Rheinhardt 728c44b861 avformat/hlsenc: Fix typo in error message
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:30 +08:00
Andreas Rheinhardt 7d6637bcc4 avformat/hlsenc: Fix leak of child AVFormatContext
Before ed897633, the hls muxer would free its child AVFormatContexts
and reset the pointer to these contexts to NULL immediately afterwards;
ed897633 moved the former to later (into a separate function), but kept
the resetting, ensuring that the child context leaks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:26 +08:00