74 while (len > 0 && isspace(buf[len - 1]))
102 int key_len,
char **dest,
int *dest_len)
104 if (!strncmp(key,
"BANDWIDTH=", key_len)) {
114 int ret = 0,
duration = 0, is_segment = 0, is_variant = 0, bandwidth = 0;
123 if (strcmp(line,
"#EXTM3U"))
130 if (
av_strstart(line,
"#EXT-X-STREAM-INF:", &ptr)) {
136 }
else if (
av_strstart(line,
"#EXT-X-TARGETDURATION:", &ptr)) {
138 }
else if (
av_strstart(line,
"#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
140 }
else if (
av_strstart(line,
"#EXT-X-ENDLIST", &ptr)) {
147 }
else if (line[0]) {
158 }
else if (is_variant) {
192 const char *nested_url;
201 }
else if (
av_strstart(uri,
"hls://", &nested_url)) {
203 "No nested protocol specified. Specify e.g. hls+http://%s\n",
207 #if FF_API_APPLEHTTP_PROTO
208 }
else if (
av_strstart(uri,
"applehttp+", &nested_url)) {
211 "The applehttp protocol is deprecated, use hls+%s as url "
212 "instead.\n", nested_url);
213 }
else if (
av_strstart(uri,
"applehttp://", &nested_url)) {
217 "The applehttp protocol is deprecated, use hls+http://%s as url "
218 "instead.\n", nested_url);
226 "Using the hls protocol is discouraged, please try using the "
227 "hls demuxer instead. The hls demuxer should be more complete "
228 "and work as well as the protocol implementation. (If not, "
229 "please report it.) To use the demuxer, simply use %s as url.\n",
270 int64_t reload_interval;
286 reload_interval *= 1000000;
301 "skipping %d segments ahead, expired from playlist\n",
329 #if FF_API_APPLEHTTP_PROTO
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int is_streamed
true if streamed (no seek possible), default = false
AVIOInterruptCB interrupt_callback
int av_usleep(unsigned usec)
Sleep for a period of time.
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
static uint64_t max_bandwidth
static void free_variant_list(HLSContext *s)
char playlisturl[MAX_URL_SIZE]
struct variant ** variants
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
struct HLSContext HLSContext
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
static int parse_playlist(URLContext *h, const char *url)
#define URL_PROTOCOL_FLAG_NESTED_SCHEME
void av_log(void *avcl, int level, const char *fmt,...)
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
static void handle_variant_args(struct variant_info *info, const char *key, int key_len, char **dest, int *dest_len)
URLProtocol ff_hls_protocol
static int hls_read(URLContext *h, uint8_t *buf, int size)
int ff_get_line(AVIOContext *s, char *buf, int maxlen)
Read a whole line of text from AVIOContext.
int64_t av_gettime(void)
Get the current time in microseconds.
int ff_check_interrupt(AVIOInterruptCB *cb)
Check if the user has requested to interrup a blocking function associated with cb.
static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
int avio_open2(AVIOContext **s, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create and initialize a AVIOContext for accessing the resource indicated by url.
size_t av_strlcat(char *dst, const char *src, size_t size)
Append the string src to the string dst, but to a total length of no more than size - 1 bytes...
int ffurl_close(URLContext *h)
Close the resource accessed by the URLContext h, and free the memory used by it.
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
struct segment ** segments
int ffurl_open(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create an URLContext for accessing to the resource indicated by url, and open it. ...
static void free_segment_list(HLSContext *s)
#define AVERROR_INVALIDDATA
int eof_reached
true if eof reached
static int hls_open(URLContext *h, const char *uri, int flags)
static int hls_close(URLContext *h)
unbuffered private I/O API
int ffurl_read(URLContext *h, unsigned char *buf, int size)
Read up to size bytes from the resource accessed by h, and store the read bytes in buf...