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

24202 Commits

Author SHA1 Message Date
Andreas Rheinhardt
945b2dcc63 avformat/hls_sample_encryption: Fix precedence
Fixes Coverity ticket #1492869.

Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-09 15:44:17 +01:00
Andreas Rheinhardt
e5199eebb4 avformat/apngenc: Use UINT16_MAX instead of USHRT_MAX
The latter needn't be 16 bits.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-09 15:40:36 +01:00
Andreas Rheinhardt
9139dc6140 avformat/matroskadec: Don't unnecessarily reduce aspect ratio
Fixes ticket #9497.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-07 15:38:03 +01:00
Alex Shumsky
1728127e8c avformat/mpegtsenc: do not include adaptation field in teletext TS packets
From ETSI EN 300 472 V1.3.1 (2003-05) Specification for conveying ITU-R System
B Teletext in DVB bitstreams:

4.1 Transport Stream (TS) packet format
The standard TS packet syntax and semantics are followed, noting the following
constraint:
- adaptation_field_control only the values "01" and "10" are permitted.

Some set top boxes (Motorola, Arris, Zyxel) refuse non-conforming packets.

Signed-off-by: Alex Shumsky <alexthreed@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-11-06 20:35:39 +01:00
Maksym Veremeyenko
a085418303 avformat/mpegtsenc: fix first_pcr initial update
Commit 6f36eb0da7 claim it fixes endless loop on
package generation if muxrate specified and copyts used. But actually it does
not work properly if -mpegts_copyts 1 is specified:

ffmpeg -y -copyts -i loewe.ts -c:v libx264 -x264opts nal-hrd=cbr:force-cfr=1 -b:v 3500k -minrate 3500k -maxrate 3500k -bufsize 1000k  -c:a mp2 -f mpegts -mpegts_copyts 1 -muxrate 4500k -vframes 1000 test.ts

ffmpeg generate huge file until it reach zero-based pcr value equal to first dts.

Attached patch fixes it.

Reviewed-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-11-06 20:35:19 +01:00
Zhao Zhili
a0f9650046 avformat/dashenc: enabling streaming and hls_playlist for lhls
Try to make the feature easier to use, especially since the user
have enabled -strict experimental manually. The user shouldn't
be surprised that hls_playlist is enabled for lhls automatically,
so change the log level from warning to info for that.
2021-11-05 15:32:11 -03:00
Zhao Zhili
f6b90d5fef avformat/dashenc: enabling streaming automatically for ldash
There is a little chance that user specified contradicted options
like -streaming 0 -ldash 1, however, it's more likely that user
didn't know or forgot to enable streaming for ldash. So enabling
streaming automatically to make the feature easier to use, similar
like enable FF_MOV_FLAG_FRAGMENT/EMPTY_MOOV/DEFAULT_BASE_MOOF and
so on for FF_MOV_FLAG_CMAF.
2021-11-05 15:30:43 -03:00
Thilo Borgmann
c42d513ede lavf/mov: Change default to prefer TFDT time and allow for fallback to SIDX or TFDT 2021-11-05 16:22:04 +01:00
Zhao Zhili
82e3251dd2 avformat/isom_tags: fix 'ipcm' with samplesize equal to 16
Use PCM_S16 so the codec_id will be updated later according to
bits_per_coded_sample.
2021-11-03 17:45:02 +01:00
Limin Wang
f05559554c avformat/dashenc: Fix comparing double with 0
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-03 21:38:37 +08:00
Michael Niedermayer
2171f97cc8 avformat/aiffdec: "-1" -> AVERROR_INVALIDDATA
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-11-01 20:37:20 +01:00
Michael Niedermayer
905588df97 avformat/aiffdec: Use av_rescale() for bitrate
Fixes: integer overflow
Fixes: 40313/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-4814761406103552

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>
2021-11-01 20:37:20 +01:00
Michael Niedermayer
93f7776921 avformat/aiffdec: sanity check block_align
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-11-01 20:37:20 +01:00
Michael Niedermayer
1b04836dff avformat/aiffdec: Check sample_rate
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-11-01 20:37:20 +01:00
Alex Shumsky
3925b826df avformat/demux: preserve AV_PKT_FLAG_CORRUPT in parse_packet
If original packet is corrupted, then parsed packet is probably corrupted too.
Let the application decide what to do.

Signed-off-by: Alex Shumsky <alexthreed@gmail.com>
2021-10-29 13:37:20 -03:00
Pekka Väänänen
947d0ce0ea avcodec/vqavideo: Decode 15-bit VQA3 files
Adds support for 15-bit VQA3 videos used in Westwood Studios' games.

Signed-off-by: Pekka Väänänen <pekka.vaananen@iki.fi>
2021-10-28 22:24:54 +02:00
Limin Wang
08c688e64d avformat/mpegts: Fix for the DOVI video stream descriptor
By <<Dolby Vision Streams Within the MPEG-2 Transport Stream Format v1.2>>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-28 09:25:31 +08:00
Limin Wang
c0edfb514b avformat/movenc: support dvwC box for Dolby Vision
By <<Dolby Vision Streams Within the ISO Base Media File Format Version 2.2>>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-28 09:25:31 +08:00
Limin Wang
3c3ef41593 avformat/mov: support dvwC box for Dolby Vision
By <<Dolby Vision Streams Within the ISO Base Media File Format Version 2.2>>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-28 09:25:31 +08:00
Jan Ekström
682bafdb12 avformat/avio{,buf}: introduce public AVIOContext::bytes_{read,written}
Such fields can be seen as generally useful in cases where the
API user is not implementing custom AVIO callbacks, but still would
like to know if data is being read or written out, such as in case
data is being read from input but no AVPacket has been received yet.
2021-10-24 13:04:39 +03:00
Jan Ekström
a5622ed16f avformat/avio{,buf}: deprecate AVIOContext::written
Originally added as a private entry in commit
3f75e5116b, but its grouping with
the comment noting its private state was missed during merging of
the field from Libav (most likely due to an already existing field
in between).
2021-10-24 13:04:39 +03:00
Jan Ekström
d39b58dc32 avformat/avio: privatize source of truth for AVIOContext::written
Looking at 3f75e5116b, the field
was supposed to be private, but during merging the field and the
group that had the comment about it got separated.

Thus, move the actual privately utilized state of this variable
into the private FFIOContext. Additionally, name the private field
somewhat better, so that it does not get confused with the amount
of bytes written out.
2021-10-24 13:04:26 +03:00
Derek Buitenhuis
7216458c96 avformat/mov: Do not hard fail if bit rate calculation overflows unless in explode mode
bit_rate is not a critical field, and we shouln't hard fail if we
can't caluclate it due to a large timebase - it needlessly breaks
valid files.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2021-10-21 14:34:36 +01:00
Derek Buitenhuis
a987b5c9ee avformat/mov: Use av_rescale when calculating bit rate
It is less susceptible to overflows.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2021-10-21 14:34:36 +01:00
Limin Wang
44fe572371 avformat/mpegtsenc: add AVSV format_identifier for AVS standard
Listing of Registered Identifiers:
https://smpte-ra.org/registered-mpeg-ts-ids

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-20 22:47:17 +08:00
Limin Wang
5779bd5b2a avformat/mpegts: add support for stream_type 0xd4, which is AVS3
GB/T 17975.1
Information technology-Generic coding of moving pictures and associated audio
information-Part 1:Systems

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-20 22:40:13 +08:00
Limin Wang
a59f8ea2a9 avformat/mpegts: add support for stream_type 0xd2, which is AVS2
GB/T 17975.1
Information technology-Generic coding of moving pictures and associated audio
information-Part 1:Systems

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-19 20:15:48 +08:00
Limin Wang
38052757f5 avformat: add raw avs3 muxer
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-19 20:15:47 +08:00
Martin Storsjö
ab79263419 seek: Fix crashes in ff_seek_frame_binary if built with latest Clang 14
Passing an uninitialized variable as argument to a function is
undefined behaviour (UB). The compiler can assume that UB does not
happen.

Hence, the compiler can assume that the variables are never
uninitialized when passed as argument, which means that the codepaths
that initializes them must be taken.

In ff_seek_frame_binary, this means that the compiler can assume
that the codepaths that initialize pos_min and pos_max are taken,
which means that the conditions "if (sti->index_entries)" and
"if (index >= 0)" can be optimized out.

Current Clang git versions (upcoming Clang 14) enabled an optimization
that does this, which broke the current version of this function
(which intentionally left the variables uninitialized, but silencing
warnings about being uninitialized). See [1] for discussion on
the matter.

[1] https://reviews.llvm.org/D105169#3069555

Signed-off-by: Martin Storsjö <martin@martin.st>
2021-10-18 14:34:30 +03:00
Limin Wang
fb4f9a2043 avformat/rtpdec_rfc4175: add support for RANGE
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-17 16:54:03 +08:00
Limin Wang
bad48dfe9a avformat/rtpdec_rfc4175: add support for colorimetry
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-17 16:54:03 +08:00
Limin Wang
ca56fedab5 avformat/rtpdec_rfc4175: add support for TCS
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-17 16:54:03 +08:00
Limin Wang
b07437f956 avformat/rtpdec_rfc4175: add support for exactframerate
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-17 16:54:03 +08:00
Zane van Iperen
5d16660598
avformat/argo_asf: use title metadata when muxing
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-10-15 23:40:15 +10:00
Zane van Iperen
9a2b9aafba
avformat/argo_asf: pass name through as metadata
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-10-15 23:40:15 +10:00
Zane van Iperen
20fa838da5
avformat/argo_asf: cleanup and NULL-terminate name field in header
Preparation for metadata changes in the following patches. Saves
having to create an extra buffer.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-10-15 23:39:47 +10:00
Pekka Väänänen
4d52e36bd0 avformat/westwood_vqa: Store VQFL codebook chunks
High color 15-bit VQA3 video streams contain high level chunks with
only codebook updates that shouldn't be considered new frames. Now
the demuxer stores a reference to such VQFL chunks and returns them
later along with a VQFR chunk with full frame data.
2021-10-14 09:59:52 +02:00
Paul B Mahol
13141339c1 avformat/dhav: make duration extraction more robust 2021-10-13 12:14:39 +02:00
Paul B Mahol
6384175d8c avformat/dhav: check if timestamp matches when seeking 2021-10-13 12:14:39 +02:00
Nachiket Tarate
f14adb0516 libavformat/hls: correct indentation
Signed-off-by: Nachiket Tarate <nachiket.programmer@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2021-10-13 11:24:02 +08:00
Nachiket Tarate
ff958b3846 libavformat/hls: add support for decryption of HLS media segments encrypted using SAMPLE-AES encryption method
Apple HTTP Live Streaming Sample Encryption:

https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/HLS_Sample_Encryption

Signed-off-by: Nachiket Tarate <nachiket.programmer@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2021-10-13 11:23:53 +08:00
Nachiket Tarate
ef0f5d1be6 libavformat/mov: add support for 'cens', 'cbc1' and 'cbcs' encryption schemes specified in Common Encryption (CENC) standard
correct implementation of 'cenc' encryption scheme to support
decryption of partial cipher blocks at the end of subsamples

https://www.iso.org/standard/68042.html

Signed-off-by: Nachiket Tarate <nachiket.programmer@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2021-10-13 11:23:44 +08:00
Limin Wang
78c30857b7 avformat/rtpdec_rfc4175: return the proper value
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-11 23:27:27 +08:00
Limin Wang
5724e8a664 avformat/rtpdec_rfc4175: Remove redundant initialization
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-11 23:27:21 +08:00
Limin Wang
f7823c9a3a avformat/rtpdec_rfc4175: use av_get_bits_per_pixel()
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-11 23:27:15 +08:00
Limin Wang
6260c611c5 avformat/libsrt: add snddropdelay parameter for srt
Reviewed-by: "zhilizhao(赵志立)" <quinkblack@foxmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-11 18:43:47 +08:00
Gijs Peskens
5274f2f7f8 avformat/librist: replace deprecated functions
This gets rid of of rist_receiver_data_read, rist_receiver_data_block_free and rist_parse_address
these functions have been deprecated since librist release v0.2.1 and are replaced with functions
suffixed with 2.
I added a version macro check at the top of the file to ensure ffmpeg can still be compiled against
older versions.

Signed-off-by: Gijs Peskens <gijs@peskens.net>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-10-10 17:25:23 +02:00
Marton Balint
9420f7e095 avformat/mpegts: fix max_packet_size in mpegts payload parsing
The maximum allowed useful PES payload data was set to PES_packet_length, but
it is in fact smaller by the length of the PES header.

This changes how corrupt streams are packetized:
- If PES header length is bigger than PES_packet_length then the PES packet
  payload will be handled as an unbound packet
- PES packets with payload across multiple MPEGTS packets will always be
  splitted if with the next chunk of data the payload should exceed
  PES_packet_length, previously a PES_header_length amount of excess was
  allowed.

Fixes ticket #9355.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-10-10 16:54:15 +02:00
Marton Balint
aeea2ad0e4 avformat/mpegts: rename PES total_size to PES_packet_length
This renames PESContext->total_size to PESContext->PES_packet_length and keeps
it 0 for unbound packets, so its name and semantics will match the standard.

There should be no change in functionality.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-10-10 16:54:15 +02:00
Marton Balint
65cd43cff3 avformat/mpegts: delay allocation of PES buffer
This allows us to allocate the buffer in a single code path.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-10-10 16:54:15 +02:00