Commit Graph

25449 Commits

Author SHA1 Message Date
Andreas Rheinhardt
76f244b84e avformat/internal: Use forward declaration for AVCodecDescriptor
This avoids including lavc/codec_desc.h everywhere and thereby
forces users to include it directly instead of lazily and potentially
unknowingly relying on indirect inclusions.

Also add the proper inclusion to libavformat/demux.c, one of the
two files that actually use the new field.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Andreas Rheinhardt
abc6a4a6bc avformat/evcdec: Remove unused headers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Andreas Rheinhardt
09e8ccb19e avformat/av1dec: Remove avcodec.h inclusion
Possible since 60ecf44b03.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Marton Balint
207e9f4e50 avformat/flvdec: handle exheader fourcc correctly in metadata
In metadata fourcc is carried in the AMF number, not as binary.

Partially based on a patch by Steven Liu.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-08-03 21:56:00 +02:00
Andreas Rheinhardt
28817b90fc avformat/hls_sample_encryption: Always free AC3HeaderInfo on error
The code currently presumes that a return value of AVERROR(ENOMEM)
implies that ac3hdr could not be allocated, so it need not be freed.
Yet any avpriv_ac3_parse_header() might allocate more than the
AC3HeaderInfo internally (it doesn't currently), so simply free
it unconditionally.

Fixes Coverity issues #1492870 and #1492868.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-02 18:31:59 +02:00
Michael Niedermayer
32556fa62b
avformat/avr: Check sample rate
Fixes: 54979/clusterfuzz-testcase-minimized-ffmpeg_dem_AVR_fuzzer-6681035461230592
Fixes: Timeout

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-08-02 17:31:13 +02:00
Andreas Rheinhardt
bf9f6a5e55 avformat/lrcdec: Fix declaration-after-statement warning
Happens since c0f867bf50.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-29 17:58:58 +02:00
Reimar Döffinger
c0f867bf50 libavformat: fix incorrect handling of incomplete AVBPrint.
Change some internal APIs a bit to make it harder to make
such mistakes.
In particular, have the read chunk functions return an error
when the result is incomplete.
This might be less flexible, but since there has been no
use-case for that so far, avoiding coding mistakes seems better.
Add a function to queue a AVBPrint directly (ff_subtitles_queue_insert_bprint).
Also fixes a leak in lrcdec when ff_subtitles_queue_insert fails.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2023-07-29 16:05:29 +02:00
Jan Ekström
b300552dfb avformat/mov: enable identifying TTML subtitle streams as such
The contents are full TTML XML documents. TTML writing tests'
results are updated as the streams are now properly identified
as TTML ones.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2023-07-28 15:31:56 +03:00
Michael Niedermayer
ac3e6b74bd
avformat/imf_cpl: Replace NULL content_title_utf8 by ""
Suggested-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Reviewed-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-25 23:17:29 +02:00
Michael Niedermayer
509ce40f18
avformat/imf_cpl: xmlNodeListGetString() can return NULL
Fixes: NULL pointer dereference
Fixes: 60166/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5998301577871360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-25 23:17:29 +02:00
Hendrik Leppkes
6dd5f95093 avformat/flvdec: fix size desync when reading timestamp offsets
The size offset was previously being accounted for in flv_set_video_codec
for h264 and mpeg4, instead of being directly accounted for in the spot
where its read, which desynced on HEVC streams.

For clarity, move the size offset directly to the parsing, similar to
how its done for all other header fields.
2023-07-25 13:37:32 +02:00
Timo Rothenpieler
f8035bc426 avformat/flvenc: write proper timestamps when muxing hevc 2023-07-25 02:13:37 +02:00
Michael Niedermayer
c41ab871c7
avformat/id3v2: Free buffer in decode_str()
Fixes: memleak
Fixes: 60058/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-5665259244093440

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-22 17:05:47 +02:00
Michael Niedermayer
167b4f56f1
avformat/rka: bps < 8 is invalid
Fixes: division by zero
Fixes: 57828/clusterfuzz-testcase-minimized-ffmpeg_dem_RKA_fuzzer-6571818338353152

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-22 16:18:39 +02:00
Stephen Hutchinson
1e36e1f258 avisynth: pass audio channel layout
Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
2023-07-19 19:33:20 -04:00
Zhao Zhili
be7ac511a6 avformat/mov: avss box should be AV_CODEC_ID_CAVS
I cannot find the spec, but according to the original commit
d4fdba0df7, it's CAVS. e571305a71 changed it to AVS by
accident. Ten years on, nothing happened. We still have the
sample [1], however, since there is no cavs_mp4tofoobar bsf, the
cavs decoder doesn't work. I don't know if there is any use case.

[1] https://samples.ffmpeg.org/AVS/AVSFileFormat/AVSFileFormat.mp4

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-07-19 22:43:33 +08:00
Steven Liu
2cd09fec9f avformat/flvdec: support demux vp9 in enhanced flv
Tested-by: Tristan Matthews <tmatth@videolan.org>
Tested-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Tristan Matthews <tmatth@videolan.org>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2023-07-18 09:46:37 +08:00
Steven Liu
0693a2a86e avformat/flvenc: support mux vp9 in enhanced flv
Tested-by: Tristan Matthews <tmatth@videolan.org>
Tested-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Tristan Matthews <tmatth@videolan.org>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2023-07-18 09:46:29 +08:00
Steven Liu
23b02557e9 avformat/flvdec: support demux av1 in enhanced flv
Tested-by: Tristan Matthews <tmatth@videolan.org>
Tested-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Tristan Matthews <tmatth@videolan.org>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2023-07-18 09:46:22 +08:00
Steven Liu
7a5e9a68b0 avformat/flvenc: support mux av1 in enhanced flv
Tested-by: Tristan Matthews <tmatth@videolan.org>
Tested-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Tristan Matthews <tmatth@videolan.org>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2023-07-18 09:46:16 +08:00
Steven Liu
ac5cc66f9e avformat/flvdec: support demux hevc in enhanced flv
Tested-by: Tristan Matthews <tmatth@videolan.org>
Tested-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Tristan Matthews <tmatth@videolan.org>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2023-07-18 09:46:06 +08:00
Steven Liu
aa83654d94 avformat/flvenc: support mux hevc in enhanced flv
Tested-by: Tristan Matthews <tmatth@videolan.org>
Tested-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Tristan Matthews <tmatth@videolan.org>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2023-07-18 09:45:57 +08:00
Marton Balint
36f4e6f8f4 avformat/hlsenc: use av_random_bytes() for generating AES128 key
av_random_bytes() can use OS provided strong random functions and does not
depend soley on openssl/gcrypt external libraries.

Fixes ticket #10441.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-07-16 11:48:31 +02:00
Dai, Jianhui J
3b358f151d avformat/ivfenc: Set the "number of frames" in IVF header
Should set "number of frames" to bytes 24-27 of IVF header, not
duration.
It is described by [1], and confirmed by parsing all IVF files in [2].

This commit also updates the md5sum of refs to pass fate-cbs.

[1] Duck IVF - MultimediaWiki
https://wiki.multimedia.cx/index.php/Duck_IVF

[2] webm/vp8-test-vectors
https://chromium.googlesource.com/webm/vp8-test-vectors

Signed-off-by: Jianhui Dai <jianhui.j.dai@intel.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2023-07-09 16:56:58 -04:00
Andreas Rheinhardt
e52676e20b avformat/evc: Don't cast const away, avoid loop
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-09 03:05:00 +02:00
Andreas Rheinhardt
e5ab2dab2c avformat/evcdec: Check that enough data has been read
Fixes potential use of uninitialized values
in evc_read_nal_unit_length().

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-09 02:40:14 +02:00
Anton Khirnov
ac616afa62 lavf/dv: stop setting a random video bitrate
A real value is determined from the bytestream.
2023-07-07 12:13:05 +02:00
Andreas Rheinhardt
83c0f7b046 avformat/evcdec: Avoid nonsense casts
For uint8_t buf[EVC_NALU_LENGTH_PREFIX_SIZE], &buf still points
to the beginning of buf, but it is of type "pointer to array of
EVC_NALU_LENGTH_PREFIX_SIZE uint8_t" (i.e. pointer arithmetic
would operate on blocks of size EVC_NALU_LENGTH_PREFIX_SIZE).
This is of course a different type than uint8_t*, which is why
there have been casts in evc_read_packet(). But these are unnecessary
if one justs removes the unnecessary address-of operator.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-07 03:47:29 +02:00
Zhao Zhili
d4b989c94d avformat/asfdec_f: fix need_parsing flag for codec mpeg4
AVSTREAM_PARSE_FULL_ONCE is only implemented for H.264.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-07-04 04:49:48 +08:00
Zhao Zhili
3eb7968ed9 avformat/asfdec_f: support bmp_tags_unofficial
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-07-04 04:49:48 +08:00
Kacper Michajłow
0cd2e7dcfb
avformat/http: copy only mime type from Content-Type
Content-Type can include charset and boundary which is not a part of
mime type and shouldn't be copied as such.

Fixes HLS playback when the Content-Type includes additional fields.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2023-06-29 17:28:46 -04:00
Andreas Rheinhardt
f780e07149 avformat/ac4dec: Constify demuxer
The discrepancy between the definition and the declaration
in allformats.c is actually UB.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-06-29 20:22:58 +02:00
James Almer
05186be641 avformat/version: bump minor after recent additions
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-29 14:12:50 -03:00
Thomas Siedel
45a8a62df9 avformat/rawenc: add H266/VVC muxer
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-29 14:12:50 -03:00
Thomas Siedel
ac2b25f4e5 avformat: add demuxer and probe support for H266/VVC
Add demuxer to probe raw vvc and parse vvcc byte stream format.

Co-authored-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-29 14:12:50 -03:00
James Almer
6ff95758e6 avformat/evc: use get_ue_golomb_long()
This partially reverts commit d0fc1b3507, which reintroduced a regression
originally fixed in 5e9986fd2d.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-27 12:52:38 -03:00
Zhao Zhili
af3f120785 avformat/mov: fix overallocation when reading pssh/saiz
mov_try_read_block() allocates 1MB at least, which can be more than
enough. It was called when reading saiz box, which can appear
periodically inside fmp4. This consumes a lot of memory.

We can fix mov_try_read_block() by clamp 'block_size' with 'size'.
However, the function is harmful than helpful. It avoids allocating
large memory when the real data is small. Even in that case, if
allocating large memory directly failed, it's fine to return ENOMEM;
if allocating success and reading doesn't match the given size, it's
fine to free and return AVERROR_INVALIDDATA. In other cases, it's a
waste of CPU and memory.

So I decided to remove the function, and replace it by call
av_malloc() and avio_read() directly.

mov_read_saiz() and mov_read_pssh() need more check, but they don't
belong to this patch.

Fixes #7641 and #9243.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-24 12:58:15 +08:00
James Almer
528dd5637d avformat/evc: remove duplicate defines
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-23 08:37:23 -03:00
James Almer
3d1199dff6 avformat/evc: add range checks to evcc_parse_sps and return proper error codes
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-23 08:37:23 -03:00
James Almer
552879d621 avformat/evc: remove duplicate check
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-23 08:37:23 -03:00
James Almer
d0fc1b3507 avformat/evc: remove unnecessary struct
And don't use get_ue_golomb_long() for known small values.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-23 08:37:23 -03:00
James Almer
25ce1c8333 avformat/id3v2: check the return value of avio_close_dyn_buf()
Fixes ticket #10424.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-22 21:00:15 -03:00
James Almer
c7183a22db avformat/evc: move NALU length and type parsing functions to a header
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-21 13:31:14 -03:00
James Almer
d0d20f16ce avformat/evcdec: use an unsigned type for nalu_size
But ensure the value returned by evc_read_nal_unit_length() fits in an int.
Should prevent integer overflows later in the code.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-21 13:31:14 -03:00
James Almer
a6a5e53595 avformat/evcdec: flush the bsf on EOF
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-21 13:31:14 -03:00
James Almer
43ace56c7e avformat/evcdec: remove unnecessary av_packet_unref() calls
And return proper error codes.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-21 13:31:14 -03:00
James Almer
2276bcc52a avformat/evcdec: ensure there are enough bytes to seekback
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-21 13:31:14 -03:00
Romain Beauxis
468615f204 libavformat/mpegts.c: fix hardcoded 5-bytes skip for metadata streams.
Before the introduction of AV_CODEC_ID_TIMED_ID3 for timed_id3 metadata streams
in mpegts (commit 4a4437c0fb), AV_CODEC_ID_SMPTE_KLV
was the only existing codec for metadata.

It seems that this codec has a 5-bytes metadata header[1] that, for some reason,
was always skipped when decoding data packets.

However, when working with a AV_CODEC_ID_TIMED_ID3 streams, this results in the
5 first bytes of the payload being cut-off, which includes essential informations
such as the ID3 tag version.

This patch fixes the issue by keeping the 5-bytes skip only for AV_CODEC_ID_SMPTE_KLV
streams.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-20 21:08:06 -03:00
Michael Niedermayer
6a9d13acc2
avformat/jpegxl_anim_dec: fix out of array read using buffer padding
Fixes: out of array read
Fixes: 59828/clusterfuzz-testcase-minimized-ffmpeg_dem_JPEGXL_ANIM_fuzzer-5029813220671488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-20 12:47:31 -04:00
James Almer
3f48815501 avformat/evcdec: don't set AVCodecParameters.framerate
It's not necessary. Setting AVStream.avg_frame_rate is enough.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-20 11:35:21 -03:00
James Almer
5a2ff43384 avformat/evcdec: simplify au_end_found check
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-20 11:35:21 -03:00
James Almer
ca8a660176 avformat/evcdec: simplify probe function
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-20 11:35:21 -03:00
Andreas Rheinhardt
43991dbd05 avformat/assenc: Fix potential NULL + 1
Incrementing a NULL pointer is undefined behaviour,
yet this is what would happen in case trailer were NULL
before the check.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-06-20 16:15:08 +02:00
Tomas Härdin
4cc40c050a lavc/riffenc: Fix msrle support on Windows 95 2023-06-20 14:35:35 +02:00
Paul B Mahol
2cac3fd744 avformat: add raw AC-4 muxer 2023-06-20 12:47:00 +02:00
Yeoh, Hoong Tee
da4b2549c6 lavf/rtpenc_jpeg: Retrieve sampling factor from SOF0
In ff_rtp_send_jpeg, the type is defined based on PIX_FMT and
color-range parsed in. There is limitation on current design
where need to include support newly introduced PIX_FMT such as
AV_PIX_FMT_QSV and there might be more and more in future. Hence,
retrive the sampling factor from SOF0 in JPEG compressed header
directly. This introduces flexibility to handle different type of
new codec introduced in future.

Signed-off-by: Yeoh, Hoong Tee <hoong.tee.yeoh@intel.com>
2023-06-20 09:52:43 +08:00
Aman Karmani
961b17eace avformat/mpegts: add AC-4 2023-06-20 01:13:38 +02:00
Paul B Mahol
293e353460 avformat/isom_tags: add AC-4 2023-06-20 01:13:38 +02:00
Paul B Mahol
9c6538d4c2 avformat: add raw AC-4 demuxer 2023-06-20 01:13:38 +02:00
James Almer
17499f43b1 avformat/evc: remove unused variable
And check the correct one. Should fix use of uninitialized value warnings.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-19 17:34:15 -03:00
James Almer
e81eafcb97 avformat/evc: skip nalu header size bytes before parsing sps
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-19 17:21:19 -03:00
James Almer
048b8bdd5e avformat/evc: use get_bits_long() where needed
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-19 17:21:19 -03:00
James Almer
5e9986fd2d avformat/evc: use get_ue_golomb_long()
Fixes compilation of shared libraries, as well as correctly parses
width and height values.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-18 23:40:46 -03:00
Michael Niedermayer
9fc141f32d
avformat/jpegxl_anim_dec: Perform operations in a different order
Fixes: OOM
Fixes: 59802/clusterfuzz-testcase-minimized-ffmpeg_dem_JPEGXL_ANIM_fuzzer-5681765466112000

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-18 17:54:19 -04:00
Leo Izen
61047f0f82
avformat/jpegxl_anim_dec: avoid overrun with jxlp boxes in container
This switches the jpegxl_collect_codestream_header function to use
avcodec/bytestream2, which better enforces barriers, and should avoid
overrunning buffers with jxlp boxes if the size is zero or if the size
is so small the box is invalid.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-06-18 10:31:05 -04:00
Armin Hasitzka
f2349e7e62 avformat/hls: Forward stream metadata from subdemuxer
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-06-17 18:06:33 +02:00
James Almer
a734fa92c8 avformat/evcdec: set the demuxer as AVFMT_NOTIMESTAMPS
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-16 09:57:35 -03:00
James Almer
81b4e4abb0 avformt/version: bump minor after evc muxer and demuxer additions
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-15 11:44:37 -03:00
Dawid Kozinski
091705cd55 avformat/mov_demuxer: Extended MOV demuxer to handle EVC video content
- Added evc extension to the list of extensions for ff_mov_demuxer

Signed-off-by: Dawid Kozinski <d.kozinski@samsung.com>
2023-06-15 09:57:41 -03:00
Dawid Kozinski
a04ca05f4c avformat/mov_muxer: Extended MOV muxer to handle EVC video content
- Changes in mov_write_video_tag function to handle EVC elementary stream
- Provided structure EVCDecoderConfigurationRecord that specifies the decoder configuration information for ISO/IEC 23094-1 video content

Signed-off-by: Dawid Kozinski <d.kozinski@samsung.com>
2023-06-15 09:57:41 -03:00
Dawid Kozinski
ab2671c5f2 avformat/evc_demuxer: Added demuxer to handle reading EVC video files
- Provided AVInputFormat struct describing EVC input format (ff_evc_demuxer)

Signed-off-by: Dawid Kozinski <d.kozinski@samsung.com>
2023-06-15 09:57:35 -03:00
Dawid Kozinski
3069a8fe3c avformat/evc_muxer: Added muxer to handle writing EVC encoded data into file or output bytestream
- Provided AVOutputFormat structure describing EVC output format (ff_evc_muxer)
- Added documentation for EVC muxer

Signed-off-by: Dawid Kozinski <d.kozinski@samsung.com>
2023-06-15 09:51:13 -03:00
Paul B Mahol
2d59ca0a66 avcodec: add VMX1 decoder 2023-06-12 23:43:05 +02:00
Zhao Zhili
1460acc2ac avformat/hlsenc: fix CODECS attribute of H.264
1. Add avcc extradata support.
2. Add non-standard annexb support with 0 0 1 as prefix for SPS.

Reviewed-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-12 20:09:33 +08:00
Michael Niedermayer
09621fd7d9
avformat/jpegxl_probe: Forward error codes
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-11 21:11:39 -04:00
Michael Niedermayer
1ec4553e35
avformat/jpegxl_probe: check length instead of blindly reading
Enable the checked bitreader to avoid overread.
Also add a few checks in loops and between blocks so we exit instead of continued
execution.
Alternatively we could add manual checks so that no overread can happen. This would be
slightly faster but a bit more work and a bit more fragile

Fixes: Out of array accesses
Fixes: 59640/clusterfuzz-testcase-minimized-ffmpeg_dem_JPEGXL_ANIM_fuzzer-6584117345779712

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-11 21:11:21 -04:00
Michael Niedermayer
25c937c0e0
avformat/jpegxl_probe: Remove intermediate macro obfuscation around get_bits*()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-11 21:11:02 -04:00
Zhao Zhili
b7e79ba395 avformat/mov: decrease probe score for a random tag
The tag comes from samples/ffmpeg/mov/unrecognized/bartjones.mov
really looks like some random data. Now the random tag matched
another file, which isn't a mov.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 11:16:46 +08:00
Paul B Mahol
f11515c77f avcodec: add RTV1 decoder 2023-06-07 09:00:18 +02:00
James Almer
20584cdd89 avformat/av1: reduce the scope of a variable
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-06 09:26:19 -03:00
James Almer
a5e45988ac avformat/av1dec: don't return EIO when the input file is truncated
There was no problem reading the file, so EIO is not correct.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-06 09:26:19 -03:00
James Almer
da61ed80fd avformat/av1dec: fix EOF check in Annex-B demuxer
And return any packet buffered by the bsf.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-06 09:26:19 -03:00
Leo Izen
fa11c4c7fa
avformat/jpegxl_anim_dec: add animated JPEG XL demuxer
Animated JPEG XL files requires a separate demuxer than image2, because
the timebase information is set by the demuxer. Should the timebase of
an animated JPEG XL file be incompatible with the timebase set by the
image2pipe demuxer (usually 1/25 unless set otherwise), rescaling will
fail. Adding a separate demuxer for animated JPEG XL files allows the
timebase to be set correctly.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-06-05 12:15:05 -04:00
Michael Niedermayer
b1c3d81e71
avformat/oggparsetheora: clip duration within 64bit
Fixes: signed integer overflow: 9079256848778919936 - -288230376151711746 cannot be represented in type 'long'
Fixes: 58248/clusterfuzz-testcase-minimized-ffmpeg_dem_OGG_fuzzer-6326851353313280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-04 18:21:25 +02:00
James Almer
da23151eaf avformat/oggparseflac: use the GetByteContext API
All but one read are byte aligned, so there's no point in using the
GetBitContext API.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-01 19:51:06 -03:00
Pierre-Anthony Lemieux
0f2f0dd5b4
avformat/imf: clean-up logging
* remove logging to NULL
 * remove extraneous logging
2023-05-31 09:03:58 -07:00
Paul Arzelier
a9042db1d3 avformat/oggparseflac: check init_get_bits' result
Check init_get_bits' result for NULL, to avoid dereferencing a NULL
pointer later (CWE-476).
Without this, a segfault happens when trying to decode a handcrafted
ogg-flac file with an absurdly long (e.g. 268435455 bytes) ogg header.

Co-authored-by: James Almer <jamrial@gmail.com>
Signed-off-by: Paul Arzelier <paul.arzelier@free.fr>
2023-05-30 18:26:32 -03:00
Michael Niedermayer
0c78b0dd3b
avformat/mov: creation time should be non negative
Fixes: signed integer overflow: -9223372036854775808 - 2082844800 cannot be represented in type 'long'
Fixes: 58384/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6428383700713472

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-29 00:43:39 +02:00
Paul B Mahol
c6b6356635 avformat/gifdec: switch to using gif parser
Update fate test, more correct as last packet is not truncated.
2023-05-25 19:51:56 +02:00
Paul B Mahol
e7cadd0ee5 avformat/demux: add support to derive timestamps from packet durations for video 2023-05-25 19:51:47 +02:00
Michael Niedermayer
a76efafdb9
avformat/wavdec: Check that smv block fits in available space
Fixes: OOM
Fixes: 56271/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-5290810045497344

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-22 02:49:58 +02:00
Michael Niedermayer
d09f50c0f5
avformat/hls: remove non standard hls extension
Suggested-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-22 02:49:58 +02:00
Michael Niedermayer
5b630743c6
avformat/hls: Better message from hls_probe()
Found-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-22 02:49:58 +02:00
Michael Niedermayer
a0cb5722fd
avformat/hls: Check mime_ok first
This should be a few nano seconds faster (not measureable)
But Collectively the whole humankind watching hls will safe a minute

Found-by: Leo Izen

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-22 02:49:57 +02:00
Michael Niedermayer
19a74bc794
avformat/format: Remove redundant FFMIN() in ff_match_url_ext()
Found-by: Leo Izen

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-22 02:49:48 +02:00
Paul B Mahol
a6068c8700 avformat/fits*: format does not store timestamps 2023-05-21 20:59:23 +02:00
Paul B Mahol
02823703f4 avformat/fitsdec: stop creating pts, instead set packet duration 2023-05-21 20:59:06 +02:00
Paul B Mahol
fd2ca3d4c5 avformat/fitsenc: reindent switch 2023-05-21 20:43:52 +02:00
Paul B Mahol
8a49341666 avformat/fitsdec: fix demuxer class category 2023-05-21 20:41:19 +02:00
Paul B Mahol
a28df1faa9 avformat/fitsdec: remove .raw_codec_id
This non-raw demuxer does not have parser.
2023-05-21 20:40:17 +02:00
James Almer
efdc6e8200 avformat/matroskaenc: remove accidental variable shadowing
Should fix use of uninitialized value in a failure path.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-20 09:28:46 -03:00
Paul B Mahol
ff72256235 avformat/gif: use last frame duration 2023-05-20 13:06:38 +02:00
Pierre-Anthony Lemieux
2838138975
fate/imf: remove redundant code 2023-05-18 15:03:34 -07:00
Pierre-Anthony Lemieux
dbe43bca25
fate/imf: fix memory leak 2023-05-18 15:03:15 -07:00
James Almer
a2a0a81184 avformat/yuvmpegenc: add support for rawvideo input
The demuxer exports rawvideo, so there's no reason for the muxer to only
work with wrapped_avframe.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-18 17:31:37 -03:00
Anton Khirnov
7d1d61cc5f lavc: deprecate AVCodecContext.ticks_per_frame
For encoding, this field is entirely redundant with
AVCodecContext.framerate.

For decoding, this field is entirely redundant with
AV_CODEC_PROP_FIELDS.
2023-05-15 10:56:18 +02:00
Anton Khirnov
e930b834a9 lavf: use AV_CODEC_PROP_FIELDS where appropriate
H.264 and mpeg12 parsers need to be adjusted at the same time to stop
using the value of AVCodecContext.ticks_per_frame, because it is not set
correctly unless the codec has been opened. Previously this would result
in both the parser and lavf seeing the same incorrect value, which would
cancel out.
Updating lavf and not the parsers would result in correct value in lavf,
but the wrong one in parsers, which would break some tests.
2023-05-15 10:31:55 +02:00
Michael Niedermayer
954d16fa3f
avformat/hls: Try to implement RFC8216 playlist refusal
This should fix the regression since 6b1f68ccb0

Should fix Ticket10353 (please test and report cases that still fail)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-15 03:02:28 +02:00
Michael Niedermayer
a7b06bfc5d
avformat: add ff_match_url_ext()
Match url against a list of extensions similar to av_match_ext()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-15 03:02:28 +02:00
Ammon Riley
4373dadc39 avformat/mxfdec: recognize AAC per SMPTE ST 381-4
This patch simply recognizes the AAC audio track during
decode -- it does not add functionality to encode AAC in
MXF.

Signed-off-by: Ammon Riley <ammon.riley@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-05-11 22:37:41 +02:00
Pierre-Anthony Lemieux
21696f6122
avformat/tests/imf: add invalid resource test 2023-05-11 09:04:44 -07:00
Pierre-Anthony Lemieux
23d968d55a
avformat/imf: fix invalid resource handling 2023-05-11 09:04:37 -07:00
Anton Khirnov
6deaf1e409 lavf/demux: export codec-level framerate in avformat_find_stream_info() 2023-05-07 15:47:25 +02:00
Michael Niedermayer
6b1f68ccb0
avformat/hls: fail on probing non hls/m3u8 file extensions
Its unexpected that a .avi or other "standard" file turns into a playlist.
The goal of this patch is to avoid this unexpected behavior and possible
privacy or security differences.

Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-06 00:22:24 +02:00
Anton Khirnov
60ecf44b03 lavf/av1dec: stop setting codec context framerate
Demuxers are not supposed to do this.
2023-05-05 14:49:40 +02:00
Anton Khirnov
e43be84c0f lavf/av1dec: mark as notimestamps 2023-05-05 14:49:40 +02:00
Anton Khirnov
2850584876 lavf/rawdec: stop setting codec context framerate
Demuxers are not supposed to do this.
2023-05-05 14:49:40 +02:00
Anton Khirnov
e38e9f3d54 lavf/demux: use avg_frame_rate for packet durations for notimestamps formats
avg_frame_rate, if set, should be more reliable than stream timebase in
this case.
2023-05-05 14:49:40 +02:00
Anton Khirnov
0ed1eeb744 lavf/dv: use a more granular timebase for audio
One that is fine enough to represent all DV audio sample rates. Audio
packet durations are now sample-accurate.

This largely undoes commit 76fbb0052d. To
avoid breaking the issue fixed by that commit, resync audio timestamps
against video if they get more than one frame apart. The sample from
issue #8762 still works correctly after this commit.

Slightly changes the results of the lavf-dv seektest, due to the audio
timebase being more granular.
2023-05-02 10:57:21 +02:00
Anton Khirnov
aae5ba31ca lavf/dv: shorten code by using a local variable 2023-05-02 10:57:21 +02:00
Anton Khirnov
c7a852b638 lavf/dv: do not set video timebase more than once
Current code will call avpriv_set_pts_info() for each video frame,
possibly setting a different timebase if the stream framerate changes.
This violates API conventions, as the timebase is supposed to stay
constant after stream creation.

Change the demuxer to set a single timebase that is fine enough to
handle all supported DV framerates.

The seek tests change slightly because the new timebase is more
granular.
2023-05-02 10:57:21 +02:00
Anton Khirnov
af8be7bf43 lavf/dauddec: set timebase to 1/samplerate
Prevents lavf from generating inexact timestamps with the default
timebase of 1/90000.
2023-04-28 14:31:55 +02:00
Paul B Mahol
44c8f7df03 avformat/adtsenc: do not pass NULL to av_log() 2023-04-27 21:38:21 +02:00
Derek Buitenhuis
f7d64881f8 mov: Do not blindly disable advanced edit lists if use_mfra_for is set
This was a bug/mistake in dae3679a9b.

use_mfra_for by defintion only has an effect on fragmented MP4 files,
making the check not only redundant, but also broken if a user used
the option globally (i.e. set on non-fragmented MP4s).

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2023-04-25 20:44:23 +01:00
Marton Balint
ace9459c41 tests: do not override movflags defaults
It does not matter if the default is 0, but still it is cleaner that way.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-04-24 23:00:50 +02:00
Marton Balint
f2d0138f70 avformat/smoothstreamingenc: do not override movflag defaults
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-04-24 23:00:50 +02:00
Marton Balint
8d8feea0a6 avformat/movenc: factorize determining mdhd/mvhd/tkhd version
Also make duration check for mvhd more consistent with the others, write
version 1 of mvhd if duration is at least INT32_MAX instead of UINT32_MAX.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-04-24 23:00:50 +02:00
Marton Balint
5cdbf817c9 avformat/mov: restrict unix timestamp hack to version 0 mdhd/mvhd
Commit 23eeffcd48 added a hack to support invalid
files where the creation date was encoded as a classic unix timestamp. Let's
reduce the scope of the hack by only applying it to version 0 mdhd/mvhd atoms.
Also warn the user of such possibly broken files.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-04-24 23:00:50 +02:00
Marton Balint
bbb885e6a5 avformat/mov: factorize reading creation time metadata
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-04-24 23:00:50 +02:00
Wang Yaqiang
734a61d282 avformat/movenc: fixed fmp4 packets containing incorrect flags after transcoding
When write multi-trun box, the MOV_TRUN_FIRST_SAMPLE_FLAGS flag
need judge by first param, not 0.
If the original video contains consecutive I frames,
this will cause the packets of fmp4 have error sample_flags ,
and then incorrect keyframes were generated,
and then error packet will be seeked.

Signed-off-by: Wang Yaqiang <wangyaqiang03@kuaishou.com>
Signed-off-by: Steven Liu <liuqi05@chinaffmpeg.org>
2023-04-24 09:46:10 +08:00
Paul B Mahol
dc2da568cf avformat: add PDV demuxer 2023-04-20 16:11:18 +02:00
Ronald S. Bultje
989ff02472 yuv4mpegenc: add bitdepth multiplier after rounding width.
Fixes output of HBD odd-width chroma.
2023-04-19 09:49:09 -04:00
James Almer
19c2dc677f avformat/concatf: check if any nodes were allocated
Fixes ticket #10304

Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-14 10:04:47 -03:00
Zhao Zhili
c8e1955408 avformat/flvenc: avoid an extra allocate
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-04-15 04:21:33 +08:00
Zhao Zhili
d5fdfbac4a avformat/flvenc: use local variable to shorten code
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-04-15 04:21:33 +08:00
Anton Khirnov
be3b1e27e5 lavf/rawdec: mark raw demuxers as having no timestamps
Changes the result of the h264_redundant_pps-mov test, where the output
timebase is now 1001/24000 instead of 1/24. This is more correct, as the
source file actually is 23.98fps.
2023-04-13 15:34:07 +02:00
Anton Khirnov
7b827a0293 lavf/demux: treat streams with AVSTREAM_PARSE_FULL_RAW as having timestamps
In this case the timestamps are set by the parser.
Cf. a6b3471c44

Required by the following commit.
2023-04-13 15:34:07 +02:00
Anton Khirnov
ba4b73c977 lavf/rawdec: set avg_frame_rate
Timestamps in two FATE H.264 conformance tests now start at 1 instead
of 0, which also happens in some other H.264 tests before this commit
and so is not a big issue.
Conversely, timestamps in some HEVC conformance tests start from a
smaller value now.
Ideally this should be addressed later in a more general way.

h264-conformance-frext-frext2_panasonic_b no longer requires -vsync
passthrough.
2023-04-13 15:34:07 +02:00
James Almer
1a7df525f6 avformat/matroskaenc: fix memory leak in fail codepath
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-10 22:12:13 -03:00
James Almer
c558fcf41e avformat/matroskadec: also export non-HDR10+ ITU-T T.35 payloads as BlockAdditional side data
Partially reverts a change from 88de01d878, and
2133cadfcf.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-10 18:52:08 -03:00
Zhao Zhili
34b8af7963 avformat/flvenc: use extract_extradata bsf when necessary
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-04-09 21:44:29 +08:00
James Almer
82a14f3602 avformat/matroskadec: also validate the mapping when BlockAddIDType is 0
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-08 15:24:44 -03:00
James Almer
bda44f0f39 avformat/matroskaenc: support writing Dynamic HDR10+ packet side data
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-08 10:28:41 -03:00
James Almer
e1f691b2e8 avformat/matroskadec: remove itu_t_t35 flag from MatroskaTrack
It's no longer needed after 88de01d878.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-08 10:21:56 -03:00
James Almer
6d31619af2 avformat/matroskadec: validate MaxBlockAdditionID in the presence of BlockAdditions
The Matroska spec requires it to be equal to the highest BlockAddID value in a
BlockAdditions, but being purely an informative element, only abort if strict
compliance is requested, as demuxing is otherwise unaffected.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-07 14:13:03 -03:00
James Almer
2133cadfcf avformat/matroskadec: reindent after the previous commit
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-07 11:57:17 -03:00
James Almer
88de01d878 avformat/matroskadec: parse all BlockAdditionMapping elements and export the correct value as BlockAdditional side data
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-07 11:55:47 -03:00
Jerome Martinez
feeeefc3db
avformat/mxfenc: reject unsupported ffv1 versions
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-06 00:50:01 +02:00
Marton Balint
8f534618b5 avformat/mxfdec: treat Random Index Pack as end of file
RIP, if exists is the last KLV item in the MXF files therefore we can stop
parsing the file if it is encountered. This allows us to support files created by
broken muxers such as OpenCube MXFTk Advanced 2.8.0.0.1. which dumps some extra
garbage after the RIP.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-04-06 00:40:42 +02:00