82 if (memcmp(buf,
"FLV", 3))
86 while (buf_size >= 11 + 4) {
91 if (type == 8 || type == 9) {
100 }
else if (type == 0x12) {
165 char filename[1024], temp_filename[1024];
173 snprintf(temp_filename,
sizeof(temp_filename),
"%s/index.f4m.tmp", s->
filename);
180 avio_printf(out,
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
181 avio_printf(out,
"<manifest xmlns=\"http://ns.adobe.com/f4m/1.0\">\n");
183 avio_printf(out,
"\t<streamType>%s</streamType>\n",
184 final ?
"recorded" :
"live");
185 avio_printf(out,
"\t<deliveryType>streaming</deliveryType>\n");
187 avio_printf(out,
"\t<duration>%f</duration>\n", duration);
198 avio_printf(out,
"\t<bootstrapInfo profile=\"named\" url=\"stream%d.abst\" id=\"bootstrap%d\" />\n", i, i);
199 avio_printf(out,
"\t<media bitrate=\"%d\" url=\"stream%d\" bootstrapInfoId=\"bootstrap%d\">\n", os->
bitrate/1000, i, i);
200 avio_printf(out,
"\t\t<metadata>%s</metadata>\n", base64);
207 if (rename(temp_filename, filename) == -1) {
229 char filename[1024], temp_filename[1024];
231 int64_t asrt_pos, afrt_pos;
232 int start = 0, fragments;
234 int64_t cur_media_time = 0;
243 snprintf(filename,
sizeof(filename),
244 "%s/stream%d.abst", s->
filename, index);
245 snprintf(temp_filename,
sizeof(temp_filename),
246 "%s/stream%d.abst.tmp", s->
filename, index);
257 avio_w8(out,
final ? 0 : 0x20);
292 if (rename(temp_filename, filename) == -1) {
332 if (mkdir(s->
filename, 0777) == -1 && errno != EEXIST) {
424 "%s/stream%d_temp", s->
filename, i);
431 "No video stream in output stream %d and no min frag duration set\n", i);
478 char target_filename[1024];
488 snprintf(target_filename,
sizeof(target_filename),
507 for (i = 0; i <
remove; i++) {
576 #define OFFSET(x) offsetof(HDSContext, x)
577 #define E AV_OPT_FLAG_ENCODING_PARAM
579 {
"window_size",
"number of fragments kept in the manifest",
OFFSET(window_size),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX,
E },
580 {
"extra_window_size",
"number of fragments kept outside of the manifest before removing from disk",
OFFSET(extra_window_size),
AV_OPT_TYPE_INT, { .i64 = 5 }, 0, INT_MAX,
E },
581 {
"min_frag_duration",
"minimum fragment duration (in microseconds)",
OFFSET(min_frag_duration),
AV_OPT_TYPE_INT64, { .i64 = 10000000 }, 0, INT_MAX,
E },
582 {
"remove_at_exit",
"remove all fragments when finished",
OFFSET(remove_at_exit),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1,
E },
603 .priv_class = &hds_class,