summaryrefslogtreecommitdiff
path: root/libavformat/hls.c
Commit message (Collapse)AuthorAge
* avformat/hls: add #EXT-X-START tag support by prefer_x_start optLi Kai2022-06-29
| | | | | 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-23
| | | | | | | | | | | 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-16
| | | | | | | | | | | | | | | | | 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-10
| | | | | | 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-23
| | | | | | 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-21
| | | | | | | | | 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-21
| | | | | | | After d6ac6650b91, ffplay failed to seek HLS stream with AVSEEK_FLAG_BYTE enabled by default. Signed-off-by: Marton Balint <cus@passwd.hu>
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-16
| | | | | | | | This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. Signed-off-by: Martin Storsjö <martin@martin.st>
* avformat/hls: Use unsigned for iv computationMichael Niedermayer2022-02-09
| | | | | | | | | Fixes: signed integer overflow: 9223372036854775748 + 60 cannot be represented in type 'long' Fixes: 44417/clusterfuzz-testcase-minimized-ffmpeg_dem_HLS_fuzzer-5802443881971712 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: Implement support for using AVSEEK_FLAG_BACKWARD when seekingGustav Grusell2022-02-09
| | | | | | | | | Before, seeking in hls streams would always seek to the next keyframe after the given timestamp. With this fix, if seeking in videostream and AVSEEK_FLAG_BACKWARD is set, seeking will be to the first keyframe of the segment containing the given timestamp. This fixes #7485. Signed-off-by: Gustav Grusell <gustav.grusell@gmail.com>
* avformat/hls: Remove redundant castAndreas Rheinhardt2022-01-21
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/aviobuf: ffio_copy_url_optionsPierre-Anthony Lemieux2021-12-19
| | | | | Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat/utils: Make ff_data_to_hex() zero-terminate the stringAndreas Rheinhardt2021-12-08
| | | | | | Most callers want it that way anyway. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* libavformat/hls: correct indentationNachiket Tarate2021-10-13
| | | | | Signed-off-by: Nachiket Tarate <nachiket.programmer@gmail.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* libavformat/hls: add support for decryption of HLS media segments encrypted ↵Nachiket Tarate2021-10-13
| | | | | | | | | | | 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>
* avformat: Avoid allocation for AVStreamInternalAndreas Rheinhardt2021-09-17
| | | | | | | | | | Do this by allocating AVStream together with the data that is currently in AVStreamInternal; or rather: Put AVStream at the beginning of a new structure called FFStream (which encompasses more than just the internal fields and is a proper context in its own right, hence the name) and remove AVStreamInternal altogether. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/avio: Move internal AVIOContext fields to avio_internal.hAndreas Rheinhardt2021-08-25
| | | | | | | | | | | | | | Currently AVIOContext's private fields are all over AVIOContext. This commit moves them into a new structure in avio_internal.h instead. Said structure contains the public AVIOContext as its first element in order to avoid having to allocate a separate AVIOContextInternal which is costly for those use cases where one just wants to access an already existing buffer via the AVIOContext-API. For these cases ffio_init_context() can't fail and always returned zero, which was typically not checked. Therefore it has been made to not return anything. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/hls: Simplify cleanup after read_header failureAndreas Rheinhardt2021-07-07
| | | | | | by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/hls: relay format options to segment demuxerGyan Doshi2021-05-30
| | | | | Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro> Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hls: use av_strncasecmp()Limin Wang2021-05-07
| | | | | Reviewed-by: Steven Liu <lq@chinaffmpeg.org> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat: Constify all muxer/demuxersAndreas Rheinhardt2021-04-27
| | | | | | | This is possible now that the next-API is gone. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: Constify the API wrt AV(In|Out)putFormatAndreas Rheinhardt2021-04-27
| | | | | | | Also constify AVProbeData. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/hls: check return value of new_init_section()Marton Balint2021-04-18
| | | | | | Fixes part of ticket #8931. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/hls: use av_packet_alloc() to allocate packetsJames Almer2021-03-17
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* libavformat/hls: Reset options after open_url_keepalive() failsEd Martin2021-03-15
| | | | | | | | | | | | | | open_url_keepalive() unsets the options when it uses them, this includes the offsets for the Range: header. When using the HLS tag #EXT-X-BYTERANGE along with multiple files, the range options must be preserved after open_url_keepalive() returns EOF so that the new file can be opened. Failure to do this results in ignoring the #EXT-X-BYTERANGE tag and reading the wrong bytes of the file. To fix it, reset the options before calling io_open() following open_url_keepalive() reaching EOF Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
* avformat/hls: change sequence number type to int64_tZhao Zhili2021-01-24
| | | | | | | | Fix atoi() overflow for large EXT-X-MEDIA-SEQUENCE. The spec says the type of sequence number is uint64_t. Use int64_t here since current implementation requires it to be signed integer, and hlsenc use int64_t too.
* avformat/hls: update comment of file descriptionSteven Liu2020-12-28
| | | | | | reference link to rfc8216 Signed-off-by: liuqi05 <liuqi05@kuaishou.com>
* libavformat/hls: use local var url for log to avoid crashbevis2020-10-22
| | | | | | | | | During operation, the user exits and interrupts, causing pls->segment to be released, resulting in a null pointer crash Signed-off-by: bevis <javashu2012@gmail.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* lavf/hls: add AC-3/EAC-3 to allowed extensions file listJun Zhao2020-09-28
| | | | | | | | | | Add AC-3/EAC-3 to allowed extensions file list. From HTTP Live Streaming 2nd Edition draft-pantos-hls-rfc8216bis-07 section 3.1.3.Packed Audio, HLS demuxer need to support MP3/AC-3/EAC-3. Reviewd-by: Steven Liu <liuqi05@kuaishou.com> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avformat/dashdec, hls: Update correct pointer to AVDictionaryAndreas Rheinhardt2020-09-21
| | | | | | | | | | | | | | | | | | | | | | open_url() in the DASH as well in the hls demuxer share a common bug: They modify an AVDictionary (i.e. set a new entry) given to them as AVDictionary *, yet if this new entry leads to reallocation and relocation of the AVDictionary, the caller's pointer will become dangling, leading to use-after-frees. So pass an AVDictionary **. (With the current implementation of AVDictionary the above can only happen if the AVDictionary was empty initially (in which case the new AVDictionary leaks); furthermore if the I/O is ordinary (i.e. opened by avio_open2() or ffio_open_whitelist()), the dict is never empty (it contains an rw_timeout entry from save_avio_options()). So this issue could only happen if the caller sets a nondefault io_open callback, but no AVIOContext (the AVFMT_FLAG_CUSTOM_IO flag won't be set in this case). In case of the HLS demuxer, it was also necessary that setting the "seekable" entry failed. Yet one should simply not rely on internals of the AVDict API.) Reviewed-by: Steven Liu <lq@chinaffmpeg.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/hls: Use av_init_pkt() directlyAndreas Rheinhardt2020-08-18
| | | | | | | | | 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>
* avformat/hls: Remove redundant resetting of AVPacketAndreas Rheinhardt2020-08-18
| | | | | | | 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>
* avformat/hls: Fix memleak when url is emptyAndreas Rheinhardt2020-08-18
| | | | | | | Fixes Coverity ID 1465888. Reviewed-by: Steven Liu <lingjiujianke@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/hls: support avio_seek in encryption modeSteven Liu2020-08-10
| | | | Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
* lavf/hls: enable custom interrup callback in sub-demuxerJun Zhao2020-07-20
| | | | | | | Enable the custom callback in sub-demuxer Reviewed-by: Steven Liu <lq@chinaffmpeg.org> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avformat/hls: Pass a copy of the URL for probingMichael Niedermayer2020-07-01
| | | | | | | | | | The segments / url can be modified by the io read when reloading This may be an alternative or additional fix for Ticket8673 as a further alternative the reload stuff could be disabled during probing Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/hls: Add missed side data/dispositionvacingfang2020-06-18
| | | | | | | | | hls demuxer get the stream info from sub-stream, but missed side data/disposition part, e,g, missed the DOVI side data when the stream is Dolby Vision streams. Reviewed-by <liuqi05@kuaishou.com> Signed-off-by: vacingfang <vacingfang@tencent.com>
* avformat/hls: check segment duration value of EXTINFSteven Liu2020-06-10
| | | | | | | fix ticket: 8673 set the default EXTINF duration to 1ms if duration is smaller than 1ms Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hls: check output string is usable of ff_make_absolute_urlSteven Liu2020-06-10
| | | | | | | fix ticket: 8688 should goto failed workflow if cannot get usable string by ff_make_absolute_url Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/id3v2: Remove unnecessary indirectionAndreas Rheinhardt2020-05-25
| | | | | | | | | ff_id3v2_parse_apic/chapters/priv/priv_dict all had a parameter extra_meta of type ID3v2ExtraMeta ** as if the functions wanted to make *extra_meta point to something else. But they don't, so just use an ID3v2ExtraMeta *. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/id3v2: Avoid allocations for ID3v2ExtraMetaAndreas Rheinhardt2020-05-25
| | | | | | | | | | | | Up until now, the ID3v2ExtraMeta structure (which is used when parsing ID3v2 tags containing attached pictures, chapters etc.) contained a pointer to separately allocated data that depended on the type of the tag. Yet the difference of the sizes of the largest and the smallest of these structures is fairly small, so that it is better to simply include a union of all the possible types of tag-dependent structures in ID3v2ExtraMeta. This commit implements this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/hls: Remove redundant resetting of pointerAndreas Rheinhardt2020-05-20
| | | | | | | | ff_id3v2_free_extra_meta() takes a ID3V2ExtraMeta ** so that it can already reset the pointer. Reviewed-by: Jun Zhao <mypopy@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/hls: Don't strdup non-null-terminated stringAndreas Rheinhardt2020-03-24
| | | | | | | | | | | | | | | | If an URI indicated that the data protocol was in use, it would be copied into a temporary buffer via strncpy(dst, src, strlen(src)), thereby ensuring that the trailing \0 would not be copied, despite dst being uninitialized. dst would then be av_strdup'ed, leading to potential segfaults. The solution to this is simple: Don't copy the URI in the temporary buffer at all, instead av_strdup it directly. This fixes a -Wstringop-truncation warning emitted by GCC 9.2. Reviewed-by: Steven Liu <lq@chinaffmpeg.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat: Remove unnecessary av_packet_unref()Andreas Rheinhardt2020-02-10
| | | | | | | | | Since bae8844e the packet will always be unreferenced when a demuxer returns an error, so that a lot of calls to av_packet_unref() in lots of demuxers are now redundant and can be removed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/hls: support data protocol in uri for EXT-X-MAPSteven Liu2020-01-18
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hls: propagate icy to child AVIOContextsMarvin Scholz2019-12-27
| | | | | | | | | | | When the user decides they do not want to to send the Icy-MetaData header, this should be respected for all requests, not just the first one. Fix #5578 Reviewed-by: Liu Steven <lq@chinaffmpeg.org> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/hls: Use av_packet_move_ref() for packet ownership transferAndreas Rheinhardt2019-12-23
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/hls: correct grammatical errors of m3u8_hold_counters optionSteven Liu2019-11-27
| | | | | | Suggested-by: Gyan <ffmpeg@gyani.pro> Suggested-by: Rodney Baker <rodney.baker@iinet.net.au> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hls: add option for the m3u8 list load max timesSteven Liu2019-11-25
| | | | | | | set max times for load m3u8 when the m3u8 list refresh do not with new segments any times. Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hls: continue to play enabled playlist when have failed playlistSteven Liu2019-11-13
| | | | | | fix ticket: 7811 Signed-off-by: Steven Liu <lq@chinaffmpeg.org>