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

21929 Commits

Author SHA1 Message Date
Limin Wang
72915ca8ba avformat/mp3dec: replace SAME_HEADER_MASK with MP3_MASK
mp3 header bitstream syntax:
header()
{
    syncword   12bits bslsf
    id         1bit    bslsf
    layer      2bit    bslsf
    protection_bit 1bit bslsf
    bitrate_index 4bits bslsf
    sampling_frequency 2bits bslsf
    padding_bit  1bit bslsf
    private_bit 1bit bslsf
    mode 2bits bslsf
    mode_extension 2bits bslsf
    copyright 1bit bslsf
    original/home 1bit bslsf
    emphasis 2bits bslsf
}

if the header is masking with MP3_MASK(0xFFFE0CCF), below fields will be cleared:
protection_bit, bitrate_index, sampling_freqency, mode

with SAME_HEADER_MASK(0xFFFE0C00), extra below fields will be cleared which didn't make
sense:
mode_extension, copyright, original/home, emphasis

As the MP3_MASK is good for same mp3 header masking and is defined in the
header, so it's preferable to remove SAME_HEADER_MASK to keep the masking same.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-11 20:13:36 +01:00
Limin Wang
529145168b avformat/mp3dec: cosmetics
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-11 20:13:36 +01:00
Michael Niedermayer
14d3384cf3 avformat/flvenc: Check pts for mpeg4/h264 (which need the value)
Fixes: Ticket8152

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 15:59:38 +01:00
Michael Niedermayer
114ddf6430 avformat/vividas: Fix n_sb_blocks Check
Fixes: signed integer overflow: 1540265776 * 2 cannot be represented in type 'int'
Fixes: 18160/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5758808818712576

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 13:46:21 +01:00
Steven Liu
bb190ded67 avformat/mlvdec:drop unnecessary check before ff_format_io_close
Reviewed-by: Linjie Fu <linjie.fu@intel.com>
Reviewed-by: Jun Zhao <barryjzhao@tencent.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-11-09 11:27:14 +09:00
Michael Niedermayer
9802599ad0 avformat/mxfdec: cleanup on "essence prior to first PartitionPack"
Fixes: memleak
Fixes: 18473/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5738557074833408

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-08 14:48:01 +01:00
Jun Zhao
e700038990 lavf/dashdec: drop unnecessary check before ff_format_io_close
ff_format_io_close will check the AVIOContext pointer pb, so drop
the unnecessary check before ff_format_io_close.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-11-08 11:39:02 +08:00
Jun Zhao
a23c8d75ec lavf/dashenc: enable probesize/max_analyze_duration setting in sub-demuxer
Enable probesize/max_analyze_duration setting when open the sub-demuxer,
it's will be used to minimizing the initial delay.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-11-08 11:39:02 +08:00
Jun Zhao
5307c12acb lavf/hls: support probesize/max_analyze_duration when open sub-demuxer
Add probesize/max_analyze_duration support when open the sub-demuxer,
it's will be used to minimizing the initial delay.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-11-08 11:39:02 +08:00
Jun Zhao
d44c7235a8 lavf/flvenc: Cosmetics: fix indentation
fix indentation

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-11-08 11:39:02 +08:00
Jun Zhao
3dce89e55e lavf/mov: add log context dump in log message
add log context dump in log message.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-11-08 11:39:02 +08:00
Jun Zhao
bbf061c7ca lavf/hls: fix the log context setting in log message
Fix the log context setting in log message

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-11-08 11:39:02 +08:00
Michael Niedermayer
e4fdeb3fce avformat/nutenc: Do not pass NULL to memcmp() in get_needed_flags()
This compared to the other suggestions is cleaner and easier to understand
keeping the condition in the if() simple.

This affects alot of fate tests.

See: [FFmpeg-devel] [PATCH 05/11] avformat/nutenc: Don't pass NULL to memcmp
See: [FFmpeg-devel] [PATCH]lavf/nutenc: Do not call memcmp() with NULL argument

Fixes: Ticket 7980

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-05 21:21:59 +01:00
Lou Logan
cae7f6658c avformat/Makefile: add missing pcm dependency to sdx demuxer
Signed-off-by: Lou Logan <lou@lrcd.com>
Signed-off-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
2019-11-04 12:13:48 -09:00
Lou Logan
5f78ca83d6 avformat/Makefile: add missing pcm dependency to nsp demuxer
Signed-off-by: Lou Logan <lou@lrcd.com>
Signed-off-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
2019-11-04 12:13:48 -09:00
Lou Logan
82bb7900db avformat/Makefile: add missing pcm dependency to hcom demuxer
Signed-off-by: Lou Logan <lou@lrcd.com>
Signed-off-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
2019-11-04 12:13:48 -09:00
Jun Zhao
ec3d3fc65d lavf/asfdec: Simplify the check conditions
Simplify the check conditions

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-11-04 10:24:58 +08:00
Jun Zhao
8f7a043609 lavf/mpegtsenc: fix logic check error
fix the logic check error

fix #6751

Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-11-04 10:22:11 +08:00
Nicolas Frattaroli
a8ec0685ac avformat/ftp: add AVOptions for authentication
This introduces two new AVOption options for the FTP protocol,
one named ftp-user to supply the username to be used for auth,
one named ftp-password to supply the password to be used for auth.

These are useful for when an API user does not wish to deal with
URL manipulation and percent encoding.

Setting them while also having credentials in the URL will use the
credentials from the URL. The rationale for this is that credentials
embedded in the URL are probably more specific to what the user is
trying to do than anything set by some API user.

Signed-off-by: Nicolas Frattaroli <ffmpeg@fratti.ch>
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-11-03 12:24:19 +01:00
Andriy Gelman
5e3229df4c avformat: Add max_probe_packets option
Allows user to set maximum number of buffered packets when
probing a codec. It was a hard-coded parameter before this commit.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-03 11:52:32 +01:00
Mattias Wadman
e447a4d112 libavformat/flacenc: reject too big picture blocks
A too big picture will case the muxer to write a truncated block size (uint24)
causing the output file to be corrupt.

How to reproduce:

Write a file with truncated block size:
ffmpeg -y -f lavfi -i sine -f lavfi -i color=red:size=2400x2400 -map 0🅰️0 -map 1✌️0 -c✌️0 bmp -disposition:1 attached_pic -t 1 test.flac

Try to decode:
ffmpeg -i test.flac test.wav

Signed-off-by: Mattias Wadman <mattias.wadman@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-01 14:43:16 +01:00
Limin Wang
7c872df3e1 avformat/hlsenc: fix the av_dirname path isn't include separator in the end of string
Reviewed-by: Liu Steven <lq@chinaffmpeg.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-10-31 14:13:00 +08:00
Andreas Rheinhardt
26aa04991e avformat/apngenc: Add deinit function
Prevents memleaks when the trailer is never written (e.g. when there was
a write error when writing the header).

Fixes ticket #8347.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-30 15:28:48 -03:00
Philip Langdale
d6ac6650b9 avformat/hls: Set AVFMT_TS_DISCONT flag on HLS input format
There have been many reports over the years about problems when
taking an HLS stream as input to `ffmpeg` where there are timestamp
discontinuities present. This is explicitly supported in the
HLS spec (EXT-X-DISCONTINUITY) and often used for ad injection.

Various fixes and work-arounds have been proposed over the years,
but one step that seems obvious, even if it's not a complete fix,
is to mark the HLS input format as supporting discontinuities. This
will prevent timestamp fixup logic in ffmpeg.c kicking in that ends
up mangling the timestamps unnecessarily.

I've tested this out with an example provided by Joe Koberg early
last year, and it is sufficient to allow `ffmpeg` to download and
mux the stream correctly. Joe had briefly suggested that other
situations can still be handled incorrectly, but this seems like
a strict improvement.

Joe's example:

https://s3.amazonaws.com/playon-test-videos/discont_test_new/discont_test.m3u8

Reviewed-by: Steven Liu <lq@onvideo.cn>
Reviewed-by: Dennis Mungai <dmngaie@gmail.com>
2019-10-30 17:59:02 +08:00
Andreas Rheinhardt
8b28aa0767 avformat/dss: Remove superfluous headers
Both attributes.h and bswap.h have been included from the very beginning
of this muxer without there being any reason to do so.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-29 16:20:33 +01:00
Steven Liu
68f623d644 avformat/wc3movie: fix memleak when read content size not equvipe input size
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-28 14:26:22 +08:00
Steven Liu
70c6e84069 avformat/swfdec: fix memleak when inflateInit failed
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-28 14:26:20 +08:00
Steven Liu
a3655a5cb2 avformat/smacker: fix memleak when avformat_new_stream failed
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-28 14:26:16 +08:00
Steven Liu
991cf95fde avformat/rtmpproto: fix memleak when open rtmp failed
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-28 14:26:14 +08:00
Steven Liu
59697e42e1 avformat/rl2: fix memleak when read end of file
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-28 14:26:11 +08:00
Steven Liu
7a20008964 avformat/mpc8: fix memleak when seek table too big
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-28 14:26:10 +08:00
Steven Liu
22eae2d0c9 avformat/libmodplug: fix memleak when load modplug failed
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-28 14:26:07 +08:00
Steven Liu
1a109fba54 avformat/hlsenc: move freep segment from sls_flags_filename_process after caller failed
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-28 14:26:04 +08:00
Andreas Rheinhardt
b78227e168 avformat/avienc: Remove superfluous header
04d2540c added intreadwrite.h to avienc.c, although there was (and is)
no need to do so. The inclusion seems to be a mistake as this commit
added a AV_WL32 to avidec.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-25 23:27:02 +02:00
Andreas Rheinhardt
982539a07a avformat/avidec: Remove superfluous header
bswap.h was included since 7b114c09, yet since 3788a3c0 no explicit use
of anything from bswap.h has been made, so remove this header.

(Only AV_RL32 is used and while this might imply swapping on
big-endian systems, it is contained in libavutil/intreadwrite.h.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-25 23:27:02 +02:00
Andreas Rheinhardt
09e938b3a1 avformat/asfenc: Remove unnecessary header
libavutil/parseutils.h has been included in 22bbd6e8 for av_parse_time()
and the header has not been removed when said function was replaced by
ff_parse_creation_time_metadata() in ea1bf08a.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-25 23:27:02 +02:00
Andreas Rheinhardt
2e37237ff1 avformat/aiffenc: Add deinit function
Prevents memleaks if the trailer is never written.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-25 23:27:02 +02:00
Paul B Mahol
9d711a90fd avformat/bintext: avoid division by zero
Fixes #8335
2019-10-25 12:22:25 +02:00
Jun Li
155508c6e9 avformat/tee.c: steal bsf option before passing to fifo muxer
Fix #7620
In the case tee muxer with both "bsf" and "use_fifo" parameters
will trigger this bug. Tee muxer will first steal parameters (like "f",
"select"...) and then "use_fifo" will try reading out remaining options
and pass them to fifo as option "format_options".
Current code miss the part of stealing "bsf" options.
2019-10-25 11:55:52 +08:00
Andreas Rheinhardt
262eef6b89 avformat/mpeg: Don't free unintialized pointer
In order to fix a potential memleak upon failure, 0b8956b2 made sure that
a buffer given by a pointer was freed upon error. But this pointer was
only initialized upon use and in several cases (Clang gives no fewer
than 13 -Wsometimes-uninitialized warnings) this meant that an
uninitialized pointer was used to free a buffer. So initialize the
pointer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-24 15:51:20 -03:00
Andreas Rheinhardt
3d5d0301c3 avformat/icoenc: Add deinit function
Prevents memleaks in situations where the trailer isn't written, e.g.
because of errors during writing the header.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-24 19:45:17 +02:00
Andreas Rheinhardt
f53525d248 avformat/aiffenc: Use better error codes
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-24 19:45:17 +02:00
Andreas Rheinhardt
c36eae65e4 avformat/mpeg: Add padding to extradata
Extradata is supposed to be padded with AV_INPUT_BUFFER_PADDING_SIZE bytes,
yet the VobSub demuxer used av_strdup for the allocation of extradata.
This has been changed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-24 19:45:17 +02:00
Steven Liu
0b8956b25c avformat/mpeg: move the header_str free into end label
fix CID: 1454875

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-22 10:54:36 +08:00
Steven Liu
d92b2296f8 avformat/segafilmenc: remove unneeded code
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-22 10:51:30 +08:00
Andreas Rheinhardt
74cafb0e6f avformat/matroskaenc: Cosmetics
Contains renaming of variables (e.g. mkv_write_cues() contained
variables called tracknum that actually contain the index of a track in
s->streams and not the track number (which can differ in case an
explicit dash track number is set)).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-21 21:05:14 -03:00
Andreas Rheinhardt
c486fe206e avformat/matroskaenc: Use more appropriate function name
mkv_start_new_cluster() actually didn't start a new cluster, but ended
the old one instead and emitted a debug message that it had started a
new cluster. This has been changed: The debug message has been moved to
the place that really starts a new cluster and the function has been
renamed to mkv_end_cluster().

Furthermore, without this debug message the function can be used for
flushing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-21 21:05:14 -03:00
Andreas Rheinhardt
b4e36df74f avformat/matroskaenc: Remove redundant assert
The Matroska muxer groups index entries with the same pts together in
order to save a few bytes. Because of Matroska's variable-length length
fields, mkv_write_cues() does this by first finding out how many index
entries will be grouped together before actually writing them.
Currently, it is asserted at both of these stages that the stream index
of the list of designated index entries is valid. But the second assert
is redundant, because the very same index entries have already been
checked.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-21 21:05:14 -03:00
Andreas Rheinhardt
65ef74f749 avformat/matroskaenc: Move track-related fields to mkv_track
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-21 21:05:14 -03:00
Andreas Rheinhardt
7797fdfe6f avformat/matroskaenc: Use ffio_free_dyn_buf
instead of replicating its behaviour.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-21 20:35:54 -03:00