41 const char *filename,
const char *language,
42 int name_id,
int is_default,
int nb_channels)
44 if (!
out || !agroup || !filename)
47 avio_printf(
out,
"#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"group_%s\"", agroup);
48 avio_printf(
out,
",NAME=\"audio_%d\",DEFAULT=%s,", name_id, is_default ?
"YES" :
"NO");
59 const char *filename,
const char *language,
60 const char *sname,
int name_id,
int is_default)
62 if (!
out || !filename)
65 avio_printf(
out,
"#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"%s\"", sgroup);
80 const char *filename,
const char *agroup,
81 const char *
codecs,
const char *ccgroup,
84 if (!
out || !filename)
89 "Bandwidth info not available, set audio and video bitrates\n");
101 if (agroup && agroup[0])
103 if (ccgroup && ccgroup[0])
105 if (sgroup && sgroup[0])
111 int target_duration,
int64_t sequence,
112 uint32_t playlist_type,
int iframe_mode)
117 if (allowcache == 0 || allowcache == 1) {
118 avio_printf(
out,
"#EXT-X-ALLOW-CACHE:%s\n", allowcache == 0 ?
"NO" :
"YES");
138 if (byterange_mode) {
145 int byterange_mode,
double duration,
148 const char *baseurl ,
149 const char *filename,
double *prog_date_time,
152 if (!
out || !filename)
155 if (insert_discont) {
165 if (prog_date_time) {
166 time_t tt, wrongsecs;
168 struct tm *tm, tmpbuf;
169 char buf0[128], buf1[128];
171 milli =
av_clip(
lrint(1000*(*prog_date_time - tt)), 0, 999);
173 if (!strftime(buf0,
sizeof(buf0),
"%Y-%m-%dT%H:%M:%S", tm)) {
177 if (!strftime(buf1,
sizeof(buf1),
"%z", tm) || buf1[1]<
'0' ||buf1[1]>
'2') {
178 int tz_min,
dst = tm->tm_isdst;
181 wrongsecs = mktime(tm);
182 tz_min = (
FFABS(wrongsecs - tt) + 30) / 60;
185 wrongsecs <= tt ?
'+' :
'-',
189 avio_printf(
out,
"#EXT-X-PROGRAM-DATE-TIME:%s.%03d%s\n", buf0, milli, buf1);
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
int avio_printf(AVIOContext *s, const char *fmt,...) av_printf_format(2
Writes a formatted string to the context.
static const struct codec_string codecs[]
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
void ff_hls_write_playlist_version(AVIOContext *out, int version)
void ff_hls_write_playlist_header(AVIOContext *out, int version, int allowcache, int target_duration, int64_t sequence, uint32_t playlist_type, int iframe_mode)
void ff_hls_write_audio_rendition(AVIOContext *out, const char *agroup, const char *filename, const char *language, int name_id, int is_default, int nb_channels)
void ff_hls_write_init_file(AVIOContext *out, const char *filename, int byterange_mode, int64_t size, int64_t pos)
void ff_hls_write_subtitle_rendition(AVIOContext *out, const char *sgroup, const char *filename, const char *language, const char *sname, int name_id, int is_default)
void ff_hls_write_end_list(AVIOContext *out)
int ff_hls_write_file_entry(AVIOContext *out, int insert_discont, int byterange_mode, double duration, int round_duration, int64_t size, int64_t pos, const char *baseurl, const char *filename, double *prog_date_time, int iframe_mode)
void ff_hls_write_stream_info(AVStream *st, AVIOContext *out, int bandwidth, int avg_bandwidth, const char *filename, const char *agroup, const char *codecs, const char *ccgroup, const char *sgroup)
int height
The height of the video frame in pixels.
int width
The width of the video frame in pixels.
AVCodecParameters * codecpar
Codec parameters associated with this stream.