aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/hls.c
Commit message (Collapse)AuthorAgeFilesLines
* avformat/hls: add cmfv/cmfa exceptionsMichael Niedermayer8 hours1-2/+2
| | | | | | Fixes: Ticket11526 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* all: fix typos found by codespellTimo Rothenpieler40 hours1-1/+1
|
* avformat/hls: fix typo in Range header comment (chore)Jack Lau2025-06-151-1/+1
| | | | Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/hls: Return error code when read key file failedZhao Zhili2025-05-121-13/+34
| | | | Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avformat/hls: Fix flash1.bogulus.cfd supportMichael Niedermayer2025-05-031-2/+6
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls: Split allowed_segment_extensions off allowed_extensionsMichael Niedermayer2025-05-031-4/+13
| | | | | | | This allows the user to set only the one that is needed to ALL or a specific "wrong" extension like html Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls: Fix Youtube AACMichael Niedermayer2025-04-301-1/+2
| | | | | | | Fixes: Ticket11435 Fixes: yt-dlp -f 234+270 https://www.youtube.com/live/l8PMl7tUDIE Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls: add fmp4 to allowed_extensionsMichael Niedermayer2025-04-291-0/+1
| | | | | | Fixes: yt-dlp/issues/12700 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls: Add ec3 to allowed_extensionsMichael Niedermayer2025-04-291-0/+1
| | | | | | | Fixes part of Ticket11435 Fixes: Elisa Viihde (Finnish online recording service) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls: Point user to how to easily contribute a fix for missing ↵Michael Niedermayer2025-04-291-1/+1
| | | | | | extensions Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls: Add cmfv and cmfa to allowed_extensionsMichael Niedermayer2025-04-291-1/+3
| | | | | | Fixes: www.nicovideo.jp Fixes: Ticket11526 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls: Fix get key file errorZhao Zhili2025-04-291-1/+1
| | | | | | The offset and end_offset options are meant for segment, not for key. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avformat/hls demuxer: Add WebVTT subtitle supportsoftworkz2025-04-191-37/+176
| | | | | | | | | | | | | This add support for WebVTT subtitles in HLS streams. Just like for separate audio streams, it supports all available WebVTT streams in all renditions. No new options are added, it just works and provides subtitles streams like any other demuxer. The code prevents downloading subtitle segments which are farther in the future than the main segments, to avoid loading hundreds of subtitle segments in advance. Signed-off-by: softworkz <softworkz@hotmail.com>
* avformat/hls: Partially revert "reduce default max reload to 3"softworkz2025-03-011-1/+1
| | | | | | | | | | | | | | | | (setting to 100 as a reasonable compromise) The change has caused regressions for many users and consumers. Playlist reloads only happen when a playlist doesn't indicate that it has ended (via #EXT-X-ENDLIST), which means that the addition of future segments is still expected. It is well possible that an HLS server is temporarily unable to serve further segments but resumes after some time, either indicating a discontinuity or even by fully catching up. With a segment length of 3s, a max_reload value of 1000 corresponds to a duration of 50 minutes which appears to be a reasonable default. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls: Fix twitterMichael Niedermayer2025-02-061-2/+2
| | | | | | | | Allow mp4 with all mpegts extensions Fixes: Ticket11435 Reviewed-by: Steven Liu <lingjiujianke@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavformat/hls: Be more restrictive on mpegts extensionsMichael Niedermayer2025-02-021-2/+4
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls: .ts is always ok even if its a mov/mp4Michael Niedermayer2025-02-021-0/+4
| | | | | | Maybe fixes: 11435 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls: Print input format in error messageMichael Niedermayer2025-01-311-1/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls: Be more picky on extensionsMichael Niedermayer2025-01-261-0/+50
| | | | | | | | | | | | | | | | | | This blocks disallowed extensions from probing It also requires all available segments to have matching extensions to the format mpegts is treated independent of the extension It is recommended to set the whitelists correctly instead of depending on extensions, but this should help a bit, and this is easier to backport Fixes: CVE-2023-6602 II. HLS Force TTY Demuxer Fixes: CVE-2023-6602 IV. HLS XBIN Demuxer DoS Amplification The other parts of CVE-2023-6602 have been fixed by prior commits Found-by: Harvey Phillips of Amazon Element55 (element55) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls: improve commentvectronic2024-11-101-1/+1
| | | | Signed-off-by: vectronic <hello.vectronic@gmail.com>
* avformat/hls: update current segment reference before useKacper Michajłow2024-05-281-0/+3
| | | | | | | | | It may be invalidated by the time it is used. Fixes use after free when accessing current segment. Fixes: #10825 Signed-off-by: J. Dekker <jdek@itanimul.li>
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-311-0/+1
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/internal: Move FF_FMT_INIT_CLEANUP to demux.hAndreas Rheinhardt2024-03-261-1/+1
| | | | | | | | | and rename it to FF_INFMT_INIT_CLEANUP. This flag is demuxer-only, so this is the more appropriate place for it. This does not preclude adding internal flags common to both demuxer and muxer in the future. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/hls: Don't access FFInputFormat.raw_codec_idAndreas Rheinhardt2024-03-261-4/+6
| | | | | | | | It is an implementation detail of other input formats whether they use raw_codec_id or not. The HLS demuxer should not rely on this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/avformat: Add FFInputFormat, hide internals of AVInputFormatAndreas Rheinhardt2024-03-071-6/+6
| | | | | | | | | | | | | | | | | | | | | This commit does for AVInputFormat what commit 59c9dc82f450638a3068deeb1db5c56f6d155752 did for AVOutputFormat: It adds a new type FFInputFormat, moves all the internals of AVInputFormat to it and adds a now reduced AVInputFormat as first member. This does not affect/improve extensibility of both public or private fields for demuxers (it is still a mess due to lavd). This is possible since 50f34172e0cca2cabc5836308ec66dbf93f5f2a3 (which removed the last usage of an internal field of AVInputFormat in fftools). (Hint: tools/probetest.c accesses the internals of FFInputFormat as well, but given that it is a testing tool this is not considered a problem.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Revert "all: Don't set AVClass.item_name to its default value"Anton Khirnov2024-01-201-0/+1
| | | | | | | Some callers assume that item_name is always set, so this may be considered an API break. This reverts commit 0c6203c97a99f69dbaa6e4011d48c331e1111f5e.
* all: Don't set AVClass.item_name to its default valueAndreas Rheinhardt2023-12-221-1/+0
| | | | | | | | Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9; also avoids relocations. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/hls: use av_strlcopy instead of strncpyLeo Izen2023-12-161-3/+8
| | | | | | | | Avoids a -Wstringop-truncation warning by using av_strlcopy instead of strncpy. Additionally, prints a warning to the log context if this truncation occurred. Signed-off-by: Leo Izen <leo.izen@gmail.com>
* avformat/avformat: use the side data from AVStream.codecparJames Almer2023-10-061-11/+0
| | | | | | | | | | | | Deprecate AVStream.side_data and its helpers in favor of the AVStream's codecpar.coded_side_data. This will considerably simplify the propagation of global side data to decoders and from encoders. Instead of having to do it inside packets, it will be available during init(). Global and frame specific side data will therefore be distinct. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/hls: reduce default max reload to 3Michael Niedermayer2023-09-161-1/+1
| | | | | | | | | | | | | | | | The 1000 did result in the appearance of a never ending reload loop The RFC mandates that "If the client reloads a Playlist file and finds that it has not changed, then it MUST wait for a period of one-half the target duration before retrying." and if it has changed "the client MUST wait for at least the target duration before attempting to reload the Playlist file again" Trying to reload 3 times seems a better default than 1000 given these durations Issue found by: Сергей Колесников Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/avio_internal: Don't include url.hAndreas Rheinhardt2023-09-101-0/+1
| | | | | | | | | | It is only included because two very rarely used functions use pointers to URLContexts; use struct URLContext instead. Also move ffio_geturlcontext() so that one can avoid a forward declaration of struct URLContext (which would be necessary as soon as FF_API_AVIODIRCONTEXT is no more). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/aviobuf: Add ffio_init_(read|write)_context()Andreas Rheinhardt2023-09-071-1/+1
| | | | | | | | | | | | | | Most users of ffio_init_context() simply want to wrap a buffer into an AVIOContext; they do not provide function pointers at all. Therefore this commit adds shortcuts for these two common operations. This also allows to accept const data when reading (i.e. the const is now cast away at a central place in ffio_init_read_context() instead of at several callers). This also allows to constify the data in ff_text_init_buf(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/hls: reset the playlist init segment on seekTimo Rothenpieler2023-08-221-0/+3
| | | | | The mp4 demuxer gets very upset when it gets flushed and not re-fed this data.
* avformat/hls: Forward stream metadata from subdemuxerArmin Hasitzka2023-06-171-0/+2
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avformat/hls: remove non standard hls extensionMichael Niedermayer2023-05-221-2/+2
| | | | | Suggested-by: Kacper Michajlow <kasper93@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls: Better message from hls_probe()Michael Niedermayer2023-05-221-2/+8
| | | | | Found-by: Kacper Michajlow <kasper93@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls: Check mime_ok firstMichael Niedermayer2023-05-221-3/+3
| | | | | | | | | 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>
* avformat/hls: Try to implement RFC8216 playlist refusalMichael Niedermayer2023-05-151-1/+10
| | | | | | | | This should fix the regression since 6b1f68ccb04d791f0250e05687c346a99ff47ea1 Should fix Ticket10353 (please test and report cases that still fail) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls: fail on probing non hls/m3u8 file extensionsMichael Niedermayer2023-05-061-1/+8
| | | | | | | | | 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>
* avformat/hls: Add option to retry failed segments for hlsgnattu2023-02-091-1/+14
| | | | | | | | | | | Current HLS implementation simply skip a failed segment to catch up the stream, but this is not optimal for some use cases like livestream recording. Add an option to retry a failed segment to ensure the output file is a complete stream. Signed-off-by: gnattu <gnattuoc@me.com> Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
* avformat/hls: use av_dict_iterateMarvin Scholz2022-12-011-3/+3
| | | | | | And constify oldentry too while at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/hls: fix spelling and grammar on wrap warningTristan Matthews2022-10-201-1/+1
|
* libavformat/hls: Free keysMichael Niedermayer2022-09-101-0/+1
| | | | | | | | | Fixes: memleak Fixes: 50703/clusterfuzz-testcase-minimized-ffmpeg_dem_HLS_fuzzer-6399058578636800 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Steven Liu <lingjiujianke@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls: add #EXT-X-START tag support by prefer_x_start optLi Kai2022-06-291-2/+58
| | | | | Reviewed-by: Steven Liu <liuqi05@kuaishou.com> Signed-off-by: Li Kai <wolfleekay@gmail.com>
* avformat/hls: Limit start_seq_no to one bit lessMichael Niedermayer2022-06-231-3/+3
| | | | | | | | | | | This avoids overflow checks on additions with 32bit numbers Fixes: signed integer overflow: 9223372036854775806 + 2 cannot be represented in type 'long' Fixes: 44012/clusterfuzz-testcase-minimized-ffmpeg_dem_HLS_fuzzer-4747770734444544 Fixes: 48065/clusterfuzz-testcase-minimized-ffmpeg_dem_HLS_fuzzer-5372410355908608 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls, dashdec: Don't use AV_OPT flags in av_dict_set()Andreas Rheinhardt2022-05-161-1/+1
| | | | | | | | | | | | | | | | | av_dict_set() expects a different set of flags, namely the AV_DICT_* flags. Using AV_OPT_FLAG_DECODING_PARAM (or any AV_OPT_FLAG_*) ic av_dict_set() is therefore completely wrong and given that av_dict_set() just doesn't care about whether the string it receives has anything to do with a decoding parameter or not, it should just be removed without replacement. (The numerical value of AV_OPT_FLAG_DECODING_PARAM currently coincides with AV_DICT_IGNORE_SUFFIX. Given that the dictionaries we are dealing with here are always empty (i.e. NULL) before the calls to av_dict_set(), this flag changes nothing. It would be different if it were equal to one of the AV_DICT_DONT_STRDUP_* values.) Reviewed-by: Jan Ekström <jeebjp@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/demux: Add new demux.h headerAndreas Rheinhardt2022-05-101-0/+1
| | | | | | And move those stuff already in demuxer-only files to it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: Remove unnecessary inclusions from libavcodecAndreas Rheinhardt2022-03-231-0/+1
| | | | | | Also improve the other headers a bit while at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/hls: Check target_durationMichael Niedermayer2022-03-211-1/+7
| | | | | | | | | Fixes: signed integer overflow: 77777777777777 * 1000000 cannot be represented in type 'long long' Fixes: 45545/clusterfuzz-testcase-minimized-ffmpeg_dem_HLS_fuzzer-6438101247983616 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Steven Liu <lingjiujianke@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls: add AVFMT_NO_BYTE_SEEK flagZhao Zhili2022-03-211-1/+1
| | | | | | | After d6ac6650b91, ffplay failed to seek HLS stream with AVSEEK_FLAG_BYTE enabled by default. Signed-off-by: Marton Balint <cus@passwd.hu>