summaryrefslogtreecommitdiff
path: root/libavformat/hls.c
Commit message (Collapse)AuthorAge
* avformat/hls: correct comment for ensure_playlist()Ganesh Ajjanagadde2015-08-21
| | | | | | | | Comment was previously slightly incorrect. Also, it was placed in the wrong location. Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* FF_OPT_TYPE_* -> AV_OPT_TYPE_*.Ronald S. Bultje2015-08-18
|
* Merge commit '0c73a5a53cc97f4291bbe9e1e68226edf6161744'Michael Niedermayer2015-07-30
|\ | | | | | | | | | | | | | | | | | | * commit '0c73a5a53cc97f4291bbe9e1e68226edf6161744': hls: Save and forward avio options Conflicts: libavformat/hls.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
| * hls: Save and forward avio optionsLuca Barbato2015-07-30
| | | | | | | | | | | | Make possible to send the custom headers and override the user agent. Reported-by: BenWonder
* | Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'Michael Niedermayer2015-07-27
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '059a934806d61f7af9ab3fd9f74994b838ea5eba': lavc: Consistently prefix input buffer defines Conflicts: doc/examples/decoding_encoding.c libavcodec/4xm.c libavcodec/aac_adtstoasc_bsf.c libavcodec/aacdec.c libavcodec/aacenc.c libavcodec/ac3dec.h libavcodec/asvenc.c libavcodec/avcodec.h libavcodec/avpacket.c libavcodec/dvdec.c libavcodec/ffv1enc.c libavcodec/g2meet.c libavcodec/gif.c libavcodec/h264.c libavcodec/h264_mp4toannexb_bsf.c libavcodec/huffyuvdec.c libavcodec/huffyuvenc.c libavcodec/jpeglsenc.c libavcodec/libxvid.c libavcodec/mdec.c libavcodec/motionpixels.c libavcodec/mpeg4videodec.c libavcodec/mpegvideo.c libavcodec/noise_bsf.c libavcodec/nuv.c libavcodec/nvenc.c libavcodec/options.c libavcodec/parser.c libavcodec/pngenc.c libavcodec/proresenc_kostya.c libavcodec/qsvdec.c libavcodec/svq1enc.c libavcodec/tiffenc.c libavcodec/truemotion2.c libavcodec/utils.c libavcodec/utvideoenc.c libavcodec/vc1dec.c libavcodec/wmalosslessdec.c libavformat/adxdec.c libavformat/aiffdec.c libavformat/apc.c libavformat/apetag.c libavformat/avidec.c libavformat/bink.c libavformat/cafdec.c libavformat/flvdec.c libavformat/id3v2.c libavformat/isom.c libavformat/matroskadec.c libavformat/mov.c libavformat/mpc.c libavformat/mpc8.c libavformat/mpegts.c libavformat/mvi.c libavformat/mxfdec.c libavformat/mxg.c libavformat/nutdec.c libavformat/oggdec.c libavformat/oggparsecelt.c libavformat/oggparseflac.c libavformat/oggparseopus.c libavformat/oggparsespeex.c libavformat/omadec.c libavformat/rawdec.c libavformat/riffdec.c libavformat/rl2.c libavformat/rmdec.c libavformat/rtpdec_latm.c libavformat/rtpdec_mpeg4.c libavformat/rtpdec_qdm2.c libavformat/rtpdec_svq3.c libavformat/sierravmd.c libavformat/smacker.c libavformat/smush.c libavformat/spdifenc.c libavformat/takdec.c libavformat/tta.c libavformat/utils.c libavformat/vqf.c libavformat/westwood_vqa.c libavformat/xmv.c libavformat/xwma.c libavformat/yop.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/hls: do not iterate to next sequence number if interruption is ↵schenk michael2015-06-26
| | | | | | | | | | | | requested Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/hls: Handle read_buffer allocation failureMichael Niedermayer2015-05-12
| | | | | | | | | | | | Fixes CID1297576 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hls: skip to next segment if the current is unavailablewm42015-04-17
| | | | | | | | | | | | | | | | | | Apparently, some live streams can delete segments too early, maybe because the client is too far behind. In this case, it's better to skip the segment, instead of returning EOF. (Yes, the HLS demuxer actually returns AVERROR_EOF if opening the segment returns a 404 HTTP error.) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | libavformat/hls: add an option to start from a given segment in a live streamRodger Combs2015-03-29
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/hls: refactor repeated HLS option updatesMicah Galizia2015-03-16
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/hls: store cookies returned in HLS key responseMicah Galizia2015-03-16
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hls: detect SAMPLE-AES encryptionselsta2015-03-05
| | | | | | | | | | | | | | | | SAMPLE-AES encryption is not commonly used yet, but without this patch ffmpeg is thinking that the hls segments are not encrypted which produces broken files. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hls: fix a null pointer dereferencewm42015-02-16
| | | | | | | | | | | | | | | | | | Not allocating the pls->ctx will crash in libavformat/hls.c:1410, where it tries to dereference the field. Sample: http://ec24.rtp.pt/liverepeater/rtpn.smil/playlist.m3u8 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat: Add and use ff_copy_whitelists()Michael Niedermayer2014-10-24
| | | | | | | | | | | | | | Fixes potential security issue in case of running out of memory Found-by: ubitux Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '6df9d9b55d3f56ee7782639a7678eeeaf77f14ea'Michael Niedermayer2014-10-24
|\| | | | | | | | | | | | | | | | | | | | | * commit '6df9d9b55d3f56ee7782639a7678eeeaf77f14ea': lavf: Use av_gettime_relative Conflicts: libavformat/hls.c See: f78bc96b7c1c74caf99a7139cf81ce1110404965 Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavf: Use av_gettime_relativeMartin Storsjö2014-10-24
| | | | | | | | | | | | | | | | | | The ones left using av_gettime are NTP timestamps (for RTCP, which is specified to send the actual current realtime clock in RTCP SR packets), and the NUT muxer timestamper, which is documented as using wallclock time. Signed-off-by: Martin Storsjö <martin@martin.st>
* | avformat/hls: forward whitelists to mpegts demuxerMichael Niedermayer2014-10-23
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/hls: use av_freep(), do not leave stale pointers in memoryMichael Niedermayer2014-10-07
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Use new av_dict_set_int helper function.Reimar Döffinger2014-08-16
| | | | | | | | | | | | | | Get rid of the many, slightly differing, implementations of basically the same thing. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
* | replace calls to url_feof() with avio_feof()James Almer2014-08-08
| | | | | | | | | | Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/hls: reduce memory usage by using dynamically allocated url/keyMichael Schenk2014-04-12
| | | | | | | | Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | avformat/hls: do not call ffurl_seek/ffurl_size on crypto protocolAnssi Hannula2014-04-11
| | | | | | | | | | | | | | | | | | | | ffurl_seek() will not work even when it should be a no-op, so do not call it on crypto protocol. Also replace use of ffurl_size() for the same reason. Reported-by: Michael Schenk <Michael.Schenk@albistechnologies.com> Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | avformat/hls: support for seeking on event playlistsVladlen Y. Koshelev2014-04-06
| | | | | | | | | | This allows clients to seek between first played segment and the last one in the live stream playlist with #EXT-X-PLAYLIST-TYPE:EVENT attribute.
* | avformat/hls: flush the subdemuxer when seekingAnssi Hannula2014-04-06
| | | | | | | | | | | | | | | | Since we are basically seeking the AVIOContext under the subdemuxer, we need to flush the subdemuxer to avoid old packets from being read from the packet queue after the seek. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | avformat/hls: properly take stream_index into account when seekingAnssi Hannula2014-04-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Properly take stream_index into account so that a keyframe will be looked for in the specified stream_index only. Similarly, only check timestamp validity against the specified stream_index. Also remove code for stream_index == -1 case which does not actually happen as it is handled by generic code. This is based on an initial patch by James Deng. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | avformat/hls: open playlists immediately when AVDISCARD_ALL is droppedAnssi Hannula2014-04-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not try to delay opening newly required playlists until a segment switch. Applications expect that newly selected undiscarded streams are available immediately, especially with alternative rendition streams (selectable audio/subtitle tracks). One might think that delaying variant stream switch until a segment switch would allow a "seamless" switch without us having to download a specific segment from two different variant playlists. However, that is not the case, since the application would have to keep the previous stream available (undiscarded) until the first packet of the newly selected stream arrives, but by that time the demuxer would have already downloaded the next segment of both variants. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | avformat/hls: factor identical playlist allocations out of parse_playlistAnssi Hannula2014-04-06
| | | | | | | | Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | avformat/hls: do not use sequence numbers for packet orderingAnssi Hannula2014-04-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As per spec 3.4.3 ("A client MUST NOT assume that segments with the same sequence number in different Media Playlists contain matching content.") we cannot use sequence numbers for packet ordering. This can be seen e.g. in the subtitle streams of bipbop_16x9_variant.m3u8 that have considerably longer segments and therefore different numbering. Since the code now exclusively syncs using timestamps that may wrap, add some additional checking for that. According to the HLS spec all the timestamps should be in 33-bit MPEG format and synced together. v2: cleaner wrap detection v3: further wrap detection improvements Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | avformat/hls: do not care about stream start timestampsAnssi Hannula2014-04-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While selecting a packet to return to caller in read_packet(), the code corrects the timestamps for starting timestamps. However, this is wrong, since for live streams the initial timestamps might differ just because of the time delay between the retrieval of the various Media Playlists. Fortunately, spec 6.2.4 mandates that all variant streams must have matching timestamps, so we do not need to correct for initial timestamps. Drop the correction code. Note that ID3 timestamps were previously ignored, so this code was previously actually needed. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | avformat/hls: avoid unnecessary segment retrievalsAnssi Hannula2014-04-06
| | | | | | | | | | | | | | Check if the playlist is still needed just before requesting the next segment instead of after exhausting the previous segment. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | avformat/hls: improve segment selection when restarting list receptionAnssi Hannula2014-04-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve selection of the segment sequence number when restarting the reception of a playlist after it was suspended due to being unneeded (due to discard flags). The current code assumes that each playlist contains matching data with the same sequence number, while spec 3.4.3 specifically says that that is not the case. Often subtitle playlists also have longer target durations as well, causing the selection to be completely wrong. Instead prefer using the playlist segment duration information for non-live playlists, and other means if that is not possible. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | avformat/hls: track seeking on a per-playlist basisAnssi Hannula2014-04-06
| | | | | | | | | | | | | | | | Seeking needs to be tracked on a per-playlist basis, since the resyncing code in hls_read_packet() has to sync each playlist to the seek timestamp instead of stopping after the first playlist has reached it. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | avformat/hls: parse ID3 timestamps for elementary audio streamsAnssi Hannula2014-04-06
| | | | | | | | | | | | | | | | | | HLS provides MPEG TS timestamps via ID3 tags in the beginning of each segment of elementary audio streams. v2: fix issues with streams that have multiple ID3 tags Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | avformat/hls: split read_from_url() out of read_data()Anssi Hannula2014-04-06
| | | | | | | | | | | | Useful for ID3 parsing. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | avformat/hls: add some logging messagesAnssi Hannula2014-04-06
| | | | | | | | Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | avformat/hls: add support for byte-ranged segmentsAnssi Hannula2014-04-06
| | | | | | | | | | | | | | | | | | Add support for EXT-X-BYTERANGE added in HLS protocol v4. v2: Better comment explaining ffurl_seek call and fix cur_seg_offset not being updated. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | avformat/hls: always return EOF for unneeded playlist streamsAnssi Hannula2014-04-06
| | | | | | | | | | | | | | | | Even if we returned AVERROR_EOF previously due to playlist no longer being needed, we may still be called again, and we do not want to trigger a segment download in that case. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | avformat/hls: add support for alternative renditionsAnssi Hannula2014-04-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HLS protocol version 4 added alternative renditions to the specification (e.g. alternative audio tracks). The EXT-X-MEDIA tags can also contain metadata for "renditions" (i.e. tracks) of the main Media Playlist. Add support for those. Note that the same rendition (AVStream) may be associated with multiple variants (AVPrograms). Alternative subtitle tracks will require additional work and are therefore not enabled yet. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | avformat/hls: Fix cookies and user agent with encrypted HLS streamsMikael Finstad2014-01-28
| | | | | | | | | | | | | | Session data (cookies, user-agent) is not being sent on payload requests with encrypted HLS streams This causes services like Akamai to give a 403 forbidden when requesting the TS files, because they expect the same cookies and user-agent on all requests
* | avformat/hls: decouple playlists from variantsAnssi Hannula2014-01-03
| | | | | | | | | | | | | | | | | | | | | | | | Not all "sub-playlists" are variant playlists (containing the same content with a different bitrate, etc) in the current version of the HLS specification. They can now also be alternative renditions, containing e.g. alternative audio tracks etc. Decouple playlists from variants to prepare for handling the new features. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2013-11-22
|\| | | | | | | | | | | | | * qatar/master: hls: Avoid reading outside of the allocated array Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * hls: Avoid reading outside of the allocated arrayMartin Storsjö2013-11-22
| | | | | | | | | | CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit '8c929098141ebc94ad3f303521c520bb3dc6d8f6'Michael Niedermayer2013-11-22
|\| | | | | | | | | | | | | * commit '8c929098141ebc94ad3f303521c520bb3dc6d8f6': hls: Check whether the AVIOContext contains a new redirected URL Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * hls: Check whether the AVIOContext contains a new redirected URLMartin Storsjö2013-11-22
| | | | | | | | | | | | | | This allows both the main playlist itself as well as the variant playlists to handle redirects combined with relative URLs. Signed-off-by: Martin Storsjö <martin@martin.st>
* | avformat/hls: fixed bug where custom http headers weren't kept for hls streamskowalsky2013-11-07
| | | | | | | | See: https://trac.ffmpeg.org/ticket/3024
* | avformat/hls: do not limit manifest lines to 1024 charsMichael Niedermayer2013-09-21
| | | | | | | | | | | | Fixes Ticket2976 Debuged-by: jaimeMF Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2013-07-31
|\| | | | | | | | | | | | | | | | | | | * qatar/master: hls: Call avformat_find_stream_info() on the chained demuxers Conflicts: libavformat/hls.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * hls: Call avformat_find_stream_info() on the chained demuxersMichael Niedermayer2013-07-30
| | | | | | | | | | | | | | | | | | This allows the chained demuxer (or more precisely, the lavf utility code) to better fill in timestamps on packets from these, especially for cases where one stream is a raw ADTS stream. Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit '06205b5efdcf0bc4c5463bfdd02f09b5f79fc4cd'Michael Niedermayer2013-07-30
|\| | | | | | | | | | | | | * commit '06205b5efdcf0bc4c5463bfdd02f09b5f79fc4cd': hls: Free packets when skipping packets when seeking Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * hls: Free packets when skipping packets when seekingMartin Storsjö2013-07-29
| | | | | | | | | | | | This fixes memory leaks present since 2b3d041cdc. Signed-off-by: Martin Storsjö <martin@martin.st>