82 if (memcmp(buf,
"FLV", 3))
86 while (buf_size >= 11 + 4) {
91 if (type == 8 || type == 9) {
100 }
else if (type == 0x12) {
163 char filename[1024], temp_filename[1024];
171 snprintf(temp_filename,
sizeof(temp_filename),
"%s/index.f4m.tmp", s->
filename);
178 avio_printf(out,
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
179 avio_printf(out,
"<manifest xmlns=\"http://ns.adobe.com/f4m/1.0\">\n");
181 avio_printf(out,
"\t<streamType>%s</streamType>\n",
182 final ?
"recorded" :
"live");
183 avio_printf(out,
"\t<deliveryType>streaming</deliveryType>\n");
185 avio_printf(out,
"\t<duration>%f</duration>\n", duration);
196 avio_printf(out,
"\t<bootstrapInfo profile=\"named\" url=\"stream%d.abst\" id=\"bootstrap%d\" />\n", i, i);
197 avio_printf(out,
"\t<media bitrate=\"%d\" url=\"stream%d\" bootstrapInfoId=\"bootstrap%d\">\n", os->
bitrate/1000, i, i);
198 avio_printf(out,
"\t\t<metadata>%s</metadata>\n", base64);
205 return ff_rename(temp_filename, filename, s);
223 char filename[1024], temp_filename[1024];
225 int64_t asrt_pos, afrt_pos;
226 int start = 0, fragments;
228 int64_t cur_media_time = 0;
237 snprintf(filename,
sizeof(filename),
238 "%s/stream%d.abst", s->
filename, index);
239 snprintf(temp_filename,
sizeof(temp_filename),
240 "%s/stream%d.abst.tmp", s->
filename, index);
251 avio_w8(out,
final ? 0 : 0x20);
286 return ff_rename(temp_filename, filename, s);
321 if (mkdir(s->
filename, 0777) == -1 && errno != EEXIST) {
415 "%s/stream%d_temp", s->
filename, i);
422 "No video stream in output stream %d and no min frag duration set\n", i);
469 char target_filename[1024];
479 snprintf(target_filename,
sizeof(target_filename),
497 for (i = 0; i <
remove; i++) {
566 #define OFFSET(x) offsetof(HDSContext, x)
567 #define E AV_OPT_FLAG_ENCODING_PARAM
569 {
"window_size",
"number of fragments kept in the manifest",
OFFSET(window_size),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX,
E },
570 {
"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 },
571 {
"min_frag_duration",
"minimum fragment duration (in microseconds)",
OFFSET(min_frag_duration),
AV_OPT_TYPE_INT64, { .i64 = 10000000 }, 0, INT_MAX,
E },
572 {
"remove_at_exit",
"remove all fragments when finished",
OFFSET(remove_at_exit),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1,
E },
593 .priv_class = &hds_class,