42 #define INITIAL_BUFFER_SIZE 32768
44 #define MAX_FIELD_LEN 64
45 #define MAX_CHARACTERISTICS_LEN 512
47 #define MPEG_TIME_BASE 90000
48 #define MPEG_TIME_BASE_Q (AVRational){1, MPEG_TIME_BASE}
290 const char *
url,
const char *base)
316 int key_len,
char **dest,
int *dest_len)
318 if (!strncmp(key,
"BANDWIDTH=", key_len)) {
321 }
else if (!strncmp(key,
"AUDIO=", key_len)) {
323 *dest_len =
sizeof(info->
audio);
324 }
else if (!strncmp(key,
"VIDEO=", key_len)) {
326 *dest_len =
sizeof(info->
video);
327 }
else if (!strncmp(key,
"SUBTITLES=", key_len)) {
340 int key_len,
char **dest,
int *dest_len)
342 if (!strncmp(key,
"METHOD=", key_len)) {
344 *dest_len =
sizeof(info->
method);
345 }
else if (!strncmp(key,
"URI=", key_len)) {
347 *dest_len =
sizeof(info->
uri);
348 }
else if (!strncmp(key,
"IV=", key_len)) {
350 *dest_len =
sizeof(info->
iv);
367 const char *url_base)
371 char *characteristic;
375 if (!strcmp(info->
type,
"AUDIO"))
377 else if (!strcmp(info->
type,
"VIDEO"))
379 else if (!strcmp(info->
type,
"SUBTITLES"))
381 else if (!strcmp(info->
type,
"CLOSED-CAPTIONS"))
417 int langlen = strlen(rend->
language);
418 if (langlen <
sizeof(rend->
language) - 3) {
421 sizeof(rend->
language) - langlen - 2);
427 if (!strcmp(info->
forced,
"YES"))
431 while ((characteristic =
av_strtok(chr_ptr,
",", &saveptr))) {
432 if (!strcmp(characteristic,
"public.accessibility.describes-music-and-sound"))
434 else if (!strcmp(characteristic,
"public.accessibility.describes-video"))
444 int key_len,
char **dest,
int *dest_len)
446 if (!strncmp(key,
"TYPE=", key_len)) {
448 *dest_len =
sizeof(info->
type);
449 }
else if (!strncmp(key,
"URI=", key_len)) {
451 *dest_len =
sizeof(info->
uri);
452 }
else if (!strncmp(key,
"GROUP-ID=", key_len)) {
455 }
else if (!strncmp(key,
"LANGUAGE=", key_len)) {
458 }
else if (!strncmp(key,
"ASSOC-LANGUAGE=", key_len)) {
461 }
else if (!strncmp(key,
"NAME=", key_len)) {
463 *dest_len =
sizeof(info->
name);
464 }
else if (!strncmp(key,
"DEFAULT=", key_len)) {
467 }
else if (!strncmp(key,
"FORCED=", key_len)) {
469 *dest_len =
sizeof(info->
forced);
470 }
else if (!strncmp(key,
"CHARACTERISTICS=", key_len)) {
500 int ret = 0, is_segment = 0, is_variant = 0;
509 int64_t seg_offset = 0;
510 int64_t seg_size = -1;
537 if (strcmp(line,
"#EXTM3U")) {
549 if (
av_strstart(line,
"#EXT-X-STREAM-INF:", &ptr)) {
551 memset(&variant_info, 0,
sizeof(variant_info));
554 }
else if (
av_strstart(line,
"#EXT-X-KEY:", &ptr)) {
560 if (!strcmp(info.
method,
"AES-128"))
562 if (!strcmp(info.
method,
"SAMPLE-AES"))
564 if (!strncmp(info.
iv,
"0x", 2) || !strncmp(info.
iv,
"0X", 2)) {
569 }
else if (
av_strstart(line,
"#EXT-X-MEDIA:", &ptr)) {
574 }
else if (
av_strstart(line,
"#EXT-X-TARGETDURATION:", &ptr)) {
579 }
else if (
av_strstart(line,
"#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
584 }
else if (
av_strstart(line,
"#EXT-X-PLAYLIST-TYPE:", &ptr)) {
588 if (!strcmp(ptr,
"EVENT"))
590 else if (!strcmp(ptr,
"VOD"))
592 }
else if (
av_strstart(line,
"#EXT-X-ENDLIST", &ptr)) {
598 }
else if (
av_strstart(line,
"#EXT-X-BYTERANGE:", &ptr)) {
599 seg_size = atoi(ptr);
600 ptr = strchr(ptr,
'@');
602 seg_offset = atoi(ptr+1);
605 }
else if (line[0]) {
630 memcpy(seg->
iv, iv,
sizeof(iv));
633 memset(seg->
iv, 0,
sizeof(seg->
iv));
661 seg->
size = seg_size;
664 seg_offset += seg_size;
715 static const char id3_priv_owner_ts[] =
"com.apple.streaming.transportStreamTimestamp";
719 for (meta = *extra_meta; meta; meta = meta->
next) {
720 if (!strcmp(meta->
tag,
"PRIV")) {
722 if (priv->
datasize == 8 && !strcmp(priv->
owner, id3_priv_owner_ts)) {
726 if ((ts & ~((1ULL << 33) - 1)) == 0)
731 }
else if (!strcmp(meta->
tag,
"APIC") && apic)
745 if (!oldentry || strcmp(oldentry->
value, entry->
value) != 0)
773 parse_id3(pls->
ctx, pb, &metadata, ×tamp, &apic, &extra_meta);
809 int buf_size,
int *
len)
831 }
else if (*len <= 0) {
843 int64_t maxsize = seg->
size >= 0 ? seg->
size : 1024*1024;
845 int tag_got_bytes =
FFMIN(taglen, *len);
846 int remaining = taglen - tag_got_bytes;
848 if (taglen > maxsize) {
864 memcpy(pls->
id3_buf + id3_buf_pos, buf, tag_got_bytes);
865 id3_buf_pos += tag_got_bytes;
868 *len -= tag_got_bytes;
869 memmove(buf, buf + tag_got_bytes, *len);
876 id3_buf_pos += remaining;
887 if (*len >= 0 && (fill_buf || *len == 0)) {
912 if (*dest && !strlen(*dest))
932 if (seg->
size >= 0) {
953 !=
sizeof(pls->
key)) {
968 iv[32] = key[32] =
'\0';
969 if (strstr(seg->
url,
"://"))
987 "SAMPLE-AES encryption is not supported yet\n");
1025 int just_opened = 0;
1032 int64_t reload_interval;
1070 "skipping %d segments ahead, expired from playlists\n",
1117 int variant_count = 0;
1120 for (i = 0; i < c->
n_variants && variant_count < 2; i++) {
1131 return variant_count >= 2;
1142 if (rend->
type == type && !strcmp(rend->
group_id, group_id)) {
1173 if (rend->
type != type)
1191 int64_t timestamp,
int *seq_no)
1197 if (timestamp < pos) {
1259 int ret = 0, i, j, stream_offset = 0;
1263 c->first_packet = 1;
1282 if (
c->n_variants == 0) {
1289 if (
c->n_playlists > 1 ||
c->playlists[0]->n_segments == 0) {
1290 for (i = 0; i <
c->n_playlists; i++) {
1297 if (
c->variants[0]->playlists[0]->n_segments == 0) {
1305 if (
c->variants[0]->playlists[0]->finished) {
1307 for (i = 0; i <
c->variants[0]->playlists[0]->n_segments; i++)
1308 duration +=
c->variants[0]->playlists[0]->segments[i]->duration;
1313 for (i = 0; i <
c->n_variants; i++) {
1314 struct variant *var =
c->variants[i];
1325 for (i = 0; i <
c->n_playlists; i++) {
1415 for (i = 0; i <
c->n_variants; i++) {
1524 int64_t ts_b,
struct playlist *pls_b)
1535 int ret, i, minplaylist = -1;
1593 struct playlist *minpls = minplaylist < 0 ?
1595 if (minplaylist < 0) {
1598 int64_t dts = pls->
pkt.
dts;
1599 int64_t mindts = minpls->
pkt.
dts;
1609 if (minplaylist >= 0) {
1636 int64_t timestamp,
int flags)
1658 if (0 < duration && duration < seek_timestamp - first_timestamp)
1699 if (pls != seek_pls) {
1719 if (strncmp(p->
buf,
"#EXTM3U", 7))
1721 if (strstr(p->
buf,
"#EXT-X-STREAM-INF:") ||
1722 strstr(p->
buf,
"#EXT-X-TARGETDURATION:") ||
1723 strstr(p->
buf,
"#EXT-X-MEDIA-SEQUENCE:"))
1728 #define OFFSET(x) offsetof(HLSContext, x)
1729 #define FLAGS AV_OPT_FLAG_DECODING_PARAM
1731 {
"live_start_index",
"segment index to start live streams at (negative values are from the end)",
1744 .
name =
"hls,applehttp",
void ff_make_absolute_url(char *buf, int size, const char *base, const char *rel)
Convert a relative url into an absolute url, given a base url.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
void av_free_packet(AVPacket *pkt)
Free a packet.
char * headers
holds HTTP headers set as an AVOption to the HTTP protocol context
char assoc_language[MAX_FIELD_LEN]
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
AVDictionary * id3_initial
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
Rescale a 64-bit integer with specified rounding.
#define AV_LOG_WARNING
Something somehow does not look correct.
unsigned int id3_buf_size
ID3v2ExtraMeta * id3_deferred_extra
#define LIBAVUTIL_VERSION_INT
unsigned char * buf_ptr
Current position in the buffer.
unsigned char * buf_end
End of the data, may be less than buffer+buffer_size if the read function returned less data than req...
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
int ffurl_connect(URLContext *uc, AVDictionary **options)
Connect an URLContext that has been allocated by ffurl_alloc.
static struct rendition * new_rendition(HLSContext *c, struct rendition_info *info, const char *url_base)
static int64_t default_reload_interval(struct playlist *pls)
#define ID3v2_DEFAULT_MAGIC
Default magic bytes for ID3v2 header: "ID3".
#define AVIO_FLAG_READ
read-only
struct URLProtocol * prot
char language[MAX_FIELD_LEN]
unsigned char * buffer
Start of the buffer.
static void fill_buf(uint8_t *data, int w, int h, int linesize, uint8_t v)
void * opaque
A private pointer, passed to the read/write/seek/...
int av_usleep(unsigned usec)
Sleep for a period of time.
char * user_agent
holds HTTP user agent set as an AVOption to the HTTP protocol context
static void handle_rendition_args(struct rendition_info *info, const char *key, int key_len, char **dest, int *dest_len)
#define MAX_CHARACTERISTICS_LEN
int ctx_flags
Flags signalling stream properties.
int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta **extra_meta)
Create a stream for each APIC (attached picture) extracted from the ID3v2 header. ...
static void reset_packet(AVPacket *pkt)
int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
Copy the settings of the source AVCodecContext into the destination AVCodecContext.
const AVClass * priv_data_class
static int id3_has_changed_values(struct playlist *pls, AVDictionary *metadata, ID3v2ExtraMetaAPIC *apic)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define ID3v2_HEADER_SIZE
static int read_from_url(struct playlist *pls, uint8_t *buf, int buf_size, enum ReadFromURLMode mode)
int av_isspace(int c)
Locale-independent conversion of ASCII isspace.
char group_id[MAX_FIELD_LEN]
char audio[MAX_FIELD_LEN]
static void free_rendition_list(HLSContext *c)
int id
Format-specific stream ID.
static void intercept_id3(struct playlist *pls, uint8_t *buf, int buf_size, int *len)
static struct playlist * new_playlist(HLSContext *c, const char *url, const char *base)
AVInputFormat ff_hls_demuxer
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
AVStream ** streams
A list of all streams in the file.
static void handle_id3(AVIOContext *pb, struct playlist *pls)
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int flags
Flags modifying the (de)muxer behaviour.
AVProgram * av_new_program(AVFormatContext *s, int id)
static int read_data(void *opaque, uint8_t *buf, int buf_size)
#define AVERROR_EOF
End of file.
static av_cold int read_close(AVFormatContext *ctx)
#define AV_LOG_VERBOSE
Detailed information.
struct rendition ** renditions
static void add_metadata_from_renditions(AVFormatContext *s, struct playlist *pls, enum AVMediaType type)
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
void av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
static void free_playlist_list(HLSContext *c)
struct rendition ** renditions
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
struct variant ** variants
static AVRational get_timebase(struct playlist *pls)
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Callback for checking whether to abort blocking functions.
int ffurl_alloc(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb)
Create a URLContext for accessing to the resource indicated by url, but do not initiate the connectio...
static int compare_ts_with_wrapdetect(int64_t ts_a, struct playlist *pls_a, int64_t ts_b, struct playlist *pls_b)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
AVDictionary * metadata
Metadata that applies to the whole file.
char video_group[MAX_FIELD_LEN]
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given block if it is not large enough, otherwise do nothing.
static const AVClass hls_class
AVIOInterruptCB * interrupt_callback
static void handle_key_args(struct key_info *info, const char *key, int key_len, char **dest, int *dest_len)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int64_t id3_mpegts_timestamp
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
static void free_segment_list(struct playlist *pls)
void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta)
Free memory allocated parsing special (non-text) metadata.
simple assert() macros that are a bit more flexible than ISO C assert().
static int find_timestamp_in_playlist(HLSContext *c, struct playlist *pls, int64_t timestamp, int *seq_no)
New fields can be added to the end with minor version bumps.
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.
int flags
A combination of AV_PKT_FLAG values.
AVCodecContext * codec
Codec context associated with this stream.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
char group_id[MAX_FIELD_LEN]
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
char filename[1024]
input or output filename
#define AV_TIME_BASE
Internal time base represented as integer.
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size)
Like av_probe_input_buffer2() but returns 0 on success.
static void add_renditions_to_variant(HLSContext *c, struct variant *var, enum AVMediaType type, const char *group_id)
static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
static struct variant * new_variant(HLSContext *c, struct variant_info *info, const char *url, const char *base)
int ff_get_line(AVIOContext *s, char *buf, int maxlen)
Read a whole line of text from AVIOContext.
Usually treated as AVMEDIA_TYPE_DATA.
static void fill_timing_for_id3_timestamped_stream(struct playlist *pls)
struct segment ** segments
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
char * cookies
holds HTTP cookie values set in either the initial response or as an AVOption to the HTTP protocol co...
char subtitles_group[MAX_FIELD_LEN]
static int read_header(FFV1Context *f)
static void update_options(char **dest, const char *name, void *src)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
int avformat_queue_attached_pictures(AVFormatContext *s)
static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
static void parse_id3(AVFormatContext *s, AVIOContext *pb, AVDictionary **metadata, int64_t *dts, ID3v2ExtraMetaAPIC **apic, ID3v2ExtraMeta **extra_meta)
#define AV_LOG_INFO
Standard information.
char subtitles[MAX_FIELD_LEN]
enum AVMediaType codec_type
int ff_check_interrupt(AVIOInterruptCB *cb)
Check if the user has requested to interrup a blocking function associated with cb.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
char * av_strdup(const char *s)
Duplicate the string s.
AVIOContext * pb
I/O context.
static int parse_playlist(HLSContext *c, const char *url, struct playlist *pls, AVIOContext *in)
uint8_t * data
The data buffer.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
static const AVOption hls_options[]
static int hls_read_header(AVFormatContext *s)
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
struct playlist ** playlists
Describe the class of an AVClass context structure.
rational number numerator/denominator
struct playlist * playlist
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.
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
This structure contains the data a format has to probe a file.
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
static void handle_variant_args(struct variant_info *info, const char *key, int key_len, char **dest, int *dest_len)
int size
Size of data in bytes.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
char audio_group[MAX_FIELD_LEN]
int64_t av_gettime_relative(void)
Get the current time in microseconds since some unspecified starting point.
int ffurl_close(URLContext *h)
static int recheck_discard_flags(AVFormatContext *s, int first)
char characteristics[MAX_CHARACTERISTICS_LEN]
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok()...
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
static int open_input(HLSContext *c, struct playlist *pls)
char language[MAX_FIELD_LEN]
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_RB64
#define INITIAL_BUFFER_SIZE
int64_t ffurl_seek(URLContext *h, int64_t pos, int whence)
Change the position that will be used by the next read/write operation on the resource accessed by h...
int ff_id3v2_match(const uint8_t *buf, const char *magic)
Detect ID3v2 Header.
int ffio_init_context(AVIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
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. ...
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags)
Convenience wrapper for av_dict_set that converts the value to a string and stores it...
int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
Read as many bytes as possible (up to size), calling the read function multiple times if necessary...
int disposition
AV_DISPOSITION_* bit field.
int64_t pos
position in the file of the current buffer
int pts_wrap_bits
number of bits in pts (used for wrapping control)
static int playlist_in_multiple_variants(HLSContext *c, struct playlist *pls)
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
static int hls_probe(AVProbeData *p)
static int ensure_playlist(HLSContext *c, struct playlist **pls, const char *url)
static int hls_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
static av_always_inline int diff(const uint32_t a, const uint32_t b)
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
void ff_id3v2_read_dict(AVIOContext *pb, AVDictionary **metadata, const char *magic, ID3v2ExtraMeta **extra_meta)
Read an ID3v2 tag into specified dictionary and retrieve supported extra metadata.
int eof_reached
true if eof reached
int ff_id3v2_tag_len(const uint8_t *buf)
Get the length of an ID3v2 tag.
void * priv_data
Format private data.
struct playlist ** playlists
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
char video[MAX_FIELD_LEN]
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key, ignoring the suffix of the found key string.
unbuffered private I/O API
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
static void free_variant_list(HLSContext *c)
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
char key_url[MAX_URL_SIZE]
static int hls_close(AVFormatContext *s)
This structure stores compressed data.
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
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...
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
AVPacket attached_pic
For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet will contain the attached pictu...
#define AV_NOPTS_VALUE
Undefined timestamp value.
static av_cold void cleanup(FlashSV2Context *s)
int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod)
Compare 2 integers modulo mod.
static int select_cur_seq_no(HLSContext *c, struct playlist *pls)