*/
typedef struct mk_chapter {
TAILQ_ENTRY(mk_chapter) link;
- int uuid;
+ uint32_t uuid;
int64_t ts;
} mk_chapter_t;
}
+/**
+ *
+ */
+static void
+mk_add_chapter0(mk_muxer_t *mk, uint32_t uuid, int64_t ts)
+{
+ mk_chapter_t *ch;
+
+ ch = malloc(sizeof(mk_chapter_t));
+
+ ch->uuid = uuid;
+ ch->ts = ts;
+
+ TAILQ_INSERT_TAIL(&mk->chapters, ch, link);
+}
+
/**
*
*/
ch = TAILQ_LAST(&mk->chapters, mk_chapter_queue);
if(ch) {
- // don't add a new chapter if the previous one was
- // added less than 10s ago
- if(ts - ch->ts < 10000)
+ /* don't add a new chapter if the previous one was added less than 5s ago */
+ if(ts - ch->ts < 5000)
return;
uuid = ch->uuid + 1;
- }
- else {
+ } else {
uuid = 1;
+ /* create first chapter at zero position */
+ if (ts >= 5000) {
+ mk_add_chapter0(mk, uuid++, ts);
+ } else {
+ ts = 0;
+ }
}
-
- ch = malloc(sizeof(mk_chapter_t));
-
- ch->uuid = uuid;
- ch->ts = ts;
-
- TAILQ_INSERT_TAIL(&mk->chapters, ch, link);
+ mk_add_chapter0(mk, uuid, ts);
}
/**
mk->filename = strdup("Live stream");
mk->fd = fd;
mk->cluster_maxsize = 0;
+ mk->totduration = 0;
return 0;
}
mk->fd = fd;
mk->cluster_maxsize = 2000000;
mk->seekable = 1;
+ mk->totduration = 0;
return 0;
}