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

22891 Commits

Author SHA1 Message Date
Harry Mallon
abd58a4192 libavformat/mxfenc: color_range should be inclusive
MXF CDCI color range was being set to (1<<sc->component_depth) - 1
for full range but it should be (1<<sc->component_depth) as 0 is
a valid value.

Signed-off-by: Harry Mallon <harry.mallon@codex.online>
2020-08-29 11:02:35 +02:00
Harry Mallon
719eb8a2e4 avformat/mxfdec: Read video range from CDCIEssenceDescriptor
* Capture black_ref, white_ref and color_range and recognise
  full and narrow range.

Signed-off-by: Harry Mallon <harry.mallon@codex.online>
2020-08-29 11:02:35 +02:00
Dale Curtis
2ff3c466ec avformat/mov: See if mfra makes up the difference for an incomplete sidx.
A few popular sites have started generating MP4 files which have a
sidx plus an mfra. The sidx accounts for all size except the mfra,
so the old code did not mark the fragment index as complete.

Instead we can just check if there's an mfra and if its size makes
up the difference we can mark the index as complete.

Bug: https://crbug.com/1107130
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2020-08-28 15:58:47 +01:00
Limin Wang
9bb4707b1f avformat/mpegtsenc: reindent the code
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-08-26 14:20:10 +08:00
Limin Wang
4aa6eda76e avformat/mpegtsenc: add registration descriptor for AC-3 and EAC3
Some DVB and ATSC captures are using the official MPEG2 registration
descriptor in addition to using the correct stream type and the
AC-3_audio_stream_descriptor/AC3_descriptor. So let's add it even if it is not
strictly needed for DVB/ATSC.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-08-26 14:20:10 +08:00
Carl Eugen Hoyos
09e260f69a lavf/rtpdec_jpeg: Fix JFIF version.
See also b1931321
2020-08-25 19:29:34 +02:00
Carl Eugen Hoyos
3092a53cbc lavf/mxfdec: Limit score for files with run-in.
Only return AVPROBE_SCORE_MAX if the header partition pack key
is at the start of the file.
Fixes ticket #8846.

Reviewed-by: Tomas Härdin
2020-08-25 01:05:51 +02:00
Vikas Agrawal
026fea827d Set AVSTREAM_PARSE_HEADERS flag for AV1 MP4 streams
It help initialize chroma format and other info properly
Chroma format wasn't correct if I use below code:
        avformat_find_stream_info(fmtc, NULL);
        iVideoStream = av_find_best_stream(fmtc, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0);
        eChromaFormat = (AVPixelFormat)fmtc->streams[iVideoStream]->codecpar->format;

Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-24 11:40:03 -03:00
Limin Wang
7e61940794 avformat/mpegtsenc: support DVB 6A descriptor for AC-3
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-08-23 07:19:11 +08:00
Thierry Foucu
5cf439e72e libavformat/ffmetadec.c: Fix Use-of-uninitialized-value
Check the return value of sscanf as it can return -1(EOF), for example
when the first char in the line is 0x00

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-22 22:51:07 +02:00
hax@riseup.net
118e63dff1 libavformat/nut: Support SSA and ASS subtitles
ffmpeg documentation says the NUT container supports SubStation Alpha
This brings actual functionality in line with documentation.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-22 22:51:07 +02:00
Michael Bradshaw
c5b20cfe19 avformat/movenc: write the colr atom by default
The write_colr flag has been marked as experimental for over 5 years.
It should be safe to enable its behavior by default as follows:

  - Write the colr atom by default for mp4/mov if any of the following:
     - The primaries/trc/matrix are all specified, OR
     - There is an ICC profile, OR
     - The user specified +write_colr
  - Keep the write_colr flag for situations where the user wants to
    write the colr atom even if the color info is unspecified (e.g.,
    http://ffmpeg.org/pipermail/ffmpeg-devel/2020-March/259334.html)

This fixes https://trac.ffmpeg.org/ticket/7961

Signed-off-by: Michael Bradshaw <mjbshaw@google.com>
2020-08-21 10:01:58 -07:00
Nicolas Sugino
86f5fd471d avformat/libsrt: close listen fd in listener mode
In listener mode the first fd is not closed when libsrt_close() is called
because it is overwritten by the new accept fd.  Added the listen_fd to the
context to properly close it when libsrt_close() is called.

Fixes trac ticket #8372.

Signed-off-by: Nicolas Sugino <nsugino@3way.com.ar>
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-08-20 16:24:46 +02:00
Michael Niedermayer
8931c55789 avformat/siff: Reject audio packets without audio stream
Fixes: Assertion failure
Fixes: 24612/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6600899842277376.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-20 13:27:22 +02:00
Thierry Foucu
36f7b83568 libavformat/r3d.c: Fix Use-of-uninitialized-value in filename.
While reading the filename tag, it may return a EOF and we are still
copying the file with uninitialized value.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-20 13:27:22 +02:00
Jan Ekström
c820c2d4bf avformat/mpegts: only reset timestamps to NOPTS for DVB teletext
While having the possibility of non-NOPTS values that can suddenly
jump in time due to adjustments to match PCR is not nice for DVB
subtitles, apparently the parser for this format bases its behavior on
whether the packets' timestamps are NOPTS or not. Thus while we can
adjust timestamps, we should exclude DVB subtitles from the timestamp
unsetting logic.

Fixes #8844
2020-08-18 22:29:22 +03:00
Michael Niedermayer
e8a88a16f7 avformat/mpeg: Check avio_read() return value in get_pts()
Found-by: Thierry Foucu <tfoucu@gmail.com>
Fixes: Use-of-uninitialized-value
Reviewed-by: Thierry Foucu <tfoucu@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-18 14:56:04 +02:00
Andreas Rheinhardt
d661cfc184 avformat/mlvdec: Only store dimensions after having validated them
Otherwise it might happen that invalid dimensions are used when reading
a video packet; this might lead to undefined overflow.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-18 14:26:40 +02:00
Andreas Rheinhardt
0d560873da avformat/mlvdec: Don't leak open AVIOContexts on error
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-18 14:25:30 +02:00
Andreas Rheinhardt
6e0dd41fa3 avformat/mlvdec: Check for existence of AVIOContext before using it
The mlv demuxer supports input split into multiple files; if invalid
data is encountered when parsing one of the subsequent files, that file
is closed. But at this point some index entries belonging to this file
might already have been added. In this case, the read_packet function
might try to use the AVIOContext (which is NULL) to read data which will
of course crash. This commit fixes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-18 14:18:18 +02:00
Andreas Rheinhardt
97d8029149 avformat/hls: Use av_init_pkt() directly
and remove reset_packet(). The packet's data pointer is already zeroed,
so the only thing that reset_packet() does that av_init_pkt() doesn't is
redundant.

Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-18 07:03:00 +02:00
Andreas Rheinhardt
8c91b5c48a avformat/hls: Remove redundant resetting of AVPacket
av_read_frame() already returns blank packets on error.

Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-18 07:02:52 +02:00
Andreas Rheinhardt
dfc6a9f075 avformat/hls: Fix memleak when url is empty
Fixes Coverity ID 1465888.

Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-18 07:02:43 +02:00
James Almer
b6e92d928f avformat/av1dec: don't update temporal_unit_size after it's no longer used
Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-15 23:31:41 -03:00
James Almer
a72d5290c5 avformat/av1dec: inline obu_read_data() and obu_prefetch() into obu_get_packet()
They don't really help making the demuxer more readable.

Reviewed-by: Guangxin Xu <oddstone@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-15 13:01:30 -03:00
James Almer
a762fd2c1b avformat/av1dec: fix return value on some code paths
If avio_read() returns a value of bytes read that's lower than the
expected, return an error instead. And when there are zero bytes in
the prefetch buffer, return 0 in order for the frame merge bsf to
drain all potentially buffered packets.

Missed by mistake when amending and committing 9a7bdb6d71.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-14 00:14:37 -03:00
James Almer
3105e97050 avformat/av1dec: add missing preprocessor wrappers to annexb and obu demuxers
Ensure the modules are compiled only if enabled.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-14 00:02:29 -03:00
Xu Guangxin
9a7bdb6d71 avformat/av1dec: add low-overhead bitstream format
It's defined in Section 5.2, used by netflix.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-14 00:02:13 -03:00
Nicolas George
1201687da2 lavf/url: rewrite ff_make_absolute_url() using ff_url_decompose().
Also add and update some tests.

Change the semantic a little, because for filesytem paths
symlinks complicate things.
See the comments in the code for detail.

Fix trac tickets #8813 and 8814.
2020-08-12 16:45:21 +02:00
Nicolas George
d853293679 lavf/url: add ff_url_decompose(). 2020-08-12 16:33:09 +02:00
Harry Mallon
64ff61b3c5 avformat/mxfenc: Write color metadata to MXF
Writes color_primaries, color_trc and color_space to mxf
headers. ULs are from https://registry.smpte-ra.org/ site.

Signed-off-by: Harry Mallon <harry.mallon@codex.online>
2020-08-12 15:50:41 +02:00
Andreas Rheinhardt
7ad4928580 avformat/ty: Remove write-only array and variable
Up until now, the TiVo demuxer parse an array of SEQ entries, yet it has
never ever made any use of them. In fact, parse_master, the function
parsing said table, only influenced the outside world in three ways: Via
an excessive amount of error message in case a certain parameter is not
what it expected; via an allocation (the aforementioned write-only
array); and by setting a certain parameter (ty->cur_chunk_pos), but that
parameter is always overwritten before it is used (it is overwritten
in get_chunk() on success and if get_chunk() fails, the error is
returned to the caller anyway). So remove the array and the function
used to parse it.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-11 16:44:11 +02:00
Zane van Iperen
d2f42b9be1
avformat/argo_asf: strip file extension from name
Only when the user hasn't manually specified one.
Matches the original files more closely.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-11 08:50:27 +10:00
Zane van Iperen
a3a4591868
avformat/argo_asf: add name option
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-11 08:50:27 +10:00
Zane van Iperen
1f9dd53d5d
avformat/argo_asf: add version_major and version_minor options
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-11 08:50:27 +10:00
Zane van Iperen
a3e9821787
avformat/argo_asf: don't check file version
It has no bearing on structure. Determined by looking at the ASF
files from several Argonaut games:
  - FX Fighter,
  - Croc,
  - Croc 2,
  - The Emperor's New Groove, and
  - Disney's Aladdin in Nasira's Revenge

The only versions that appear are 1.1, 1.2, and 2.1, and their
structure is identical.

Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-11 08:50:26 +10:00
Zane van Iperen
97aaa15089
avformat/argo_asf: add games to version list
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-11 08:50:19 +10:00
Andreas Rheinhardt
1ead176d87 avformat/mpegts: Don't leave context in inconsistent state upon error
Up until now, opening a section filter works as follows: A filter is
opened and (on success) attached to the MpegTSContext. Then a buffer for
said filter is allocated and upon success attached to the section
filter; on error, the filter is simply freed without removing it from
the MpegTSContext, leaving the latter in an inconsistent state. This
leads to use-after-frees lateron.

This commit fixes this by allocating the buffer first; the filter is
only opened if the buffer could be successfully allocated.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-10 21:07:54 +02:00
Steven Liu
40597add98 avformat/hlsenc: write temp file for append single file by encryption mode
fix ticket: 8783
Because in single file by encryption mode, it cannot get the last one
block of the file, it need ff_format_io_close for get full file size,
then hlsenc can get the total size of the encryption content,
so write the content into temp file first, and get the temp file content
append the temp file content into append to single file, then hlsenc can
get the correct file/content size and offset.

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2020-08-10 15:52:59 +08:00
Steven Liu
6e4bba4055 avformat/hls: support avio_seek in encryption mode
Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2020-08-10 15:52:54 +08:00
Andreas Rheinhardt
ea8f8d28d0 avformat/sierravmd: Don't return packets for non-existing stream
It leads to an assert in ff_read_packet().

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-09 19:07:23 +02:00
Andreas Rheinhardt
c4a4fe938d avformat/vividas: Check allocation for success
Reviewed-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-09 19:07:23 +02:00
Andreas Rheinhardt
a3dced69c8 avformat/vividas: Check return value before storing it in smaller type
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-09 19:07:23 +02:00
Zane van Iperen
0549daa71b
avformat: add argo_asf muxer
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-07 23:14:28 +10:00
Zane van Iperen
b0b87f28c3
avformat/argo_asf: check sample count in demuxer
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-07 23:04:15 +10:00
Harry Mallon
7031a7beae avformat/mxfdec: Read color metadata from MXF
Reads color_primaries, color_trc and color_space from mxf
headers. ULs are from https://registry.smpte-ra.org/ site.

Signed-off-by: Harry Mallon <harry.mallon@codex.online>
2020-08-06 12:52:34 +02:00
Andreas Rheinhardt
1fbfa42432 avformat/dv: Avoid allocation for reading timecode
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-06 00:02:19 +02:00
Andreas Rheinhardt
8b0bba864b avformat/dv: Avoid alloction of DVDemuxContext
This commit avoids allocating a DVDemuxContext when demuxing raw DV by
making it part of the demuxer's context. This also allows to remove
dv_read_close().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-06 00:02:19 +02:00
Andreas Rheinhardt
edcd7c735c avformat/3dostr: Return directly after having read packet
Avoids an avio_skip(s->pb, 0).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-05 23:14:39 +02:00
Michael Niedermayer
ffa6072fc7 avformat/mov: Check comp_brand_size
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 24457/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5760093644390400

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