39 char *filename,
int name_id,
int is_default) {
40 if (!out || !agroup || !filename)
43 avio_printf(out,
"#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"group_%s\"", agroup);
44 avio_printf(out,
",NAME=\"audio_%d\",DEFAULT=%s,URI=\"%s\"\n", name_id,
45 is_default ?
"YES" :
"NO", filename);
49 int bandwidth,
char *filename,
char *agroup,
50 char *
codecs,
char *ccgroup) {
52 if (!out || !filename)
57 "Bandwidth info not available, set audio and video bitrates\n");
61 avio_printf(out,
"#EXT-X-STREAM-INF:BANDWIDTH=%d", bandwidth);
65 if (codecs && strlen(codecs) > 0)
67 if (agroup && strlen(agroup) > 0)
69 if (ccgroup && strlen(ccgroup) > 0)
70 avio_printf(out,
",CLOSED-CAPTIONS=\"%s\"", ccgroup);
75 int target_duration, int64_t sequence,
76 uint32_t playlist_type) {
80 if (allowcache == 0 || allowcache == 1) {
81 avio_printf(out,
"#EXT-X-ALLOW-CACHE:%s\n", allowcache == 0 ?
"NO" :
"YES");
83 avio_printf(out,
"#EXT-X-TARGETDURATION:%d\n", target_duration);
84 avio_printf(out,
"#EXT-X-MEDIA-SEQUENCE:%"PRId64
"\n", sequence);
95 int byterange_mode, int64_t
size, int64_t pos) {
96 avio_printf(out,
"#EXT-X-MAP:URI=\"%s\"", filename);
98 avio_printf(out,
",BYTERANGE=\"%"PRId64
"@%"PRId64
"\"", size, pos);
105 double duration,
int round_duration,
106 int64_t
size, int64_t pos,
108 char *filename,
double *prog_date_time) {
109 if (!out || !filename)
112 if (insert_discont) {
120 avio_printf(out,
"#EXT-X-BYTERANGE:%"PRId64
"@%"PRId64
"\n", size, pos);
122 if (prog_date_time) {
123 time_t tt, wrongsecs;
125 struct tm *tm, tmpbuf;
126 char buf0[128], buf1[128];
127 tt = (int64_t)*prog_date_time;
128 milli = av_clip(
lrint(1000*(*prog_date_time - tt)), 0, 999);
130 if (!strftime(buf0,
sizeof(buf0),
"%Y-%m-%dT%H:%M:%S", tm)) {
134 if (!strftime(buf1,
sizeof(buf1),
"%z", tm) || buf1[1]<
'0' ||buf1[1]>
'2') {
135 int tz_min, dst = tm->tm_isdst;
138 wrongsecs = mktime(tm);
139 tz_min = (
FFABS(wrongsecs - tt) + 30) / 60;
142 wrongsecs <= tt ?
'+' :
'-',
146 avio_printf(out,
"#EXT-X-PROGRAM-DATE-TIME:%s.%03d%s\n", buf0, milli, buf1);
#define AV_LOG_WARNING
Something somehow does not look correct.
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, char *baseurl, char *filename, double *prog_date_time)
static struct codec_string codecs[]
#define AV_LOG_VERBOSE
Detailed information.
void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup, char *filename, int name_id, int is_default)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static struct tm * gmtime_r(const time_t *clock, struct tm *result)
void ff_hls_write_playlist_header(AVIOContext *out, int version, int allowcache, int target_duration, int64_t sequence, uint32_t playlist_type)
static struct tm * localtime_r(const time_t *clock, struct tm *result)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
void ff_hls_write_playlist_version(AVIOContext *out, int version)
void ff_hls_write_stream_info(AVStream *st, AVIOContext *out, int bandwidth, char *filename, char *agroup, char *codecs, char *ccgroup)
void ff_hls_write_init_file(AVIOContext *out, char *filename, int byterange_mode, int64_t size, int64_t pos)
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
void ff_hls_write_end_list(AVIOContext *out)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int avio_printf(AVIOContext *s, const char *fmt,...) av_printf_format(2