|
@@ -25,6 +25,7 @@
|
|
|
#include <util/dstr.h>
|
|
|
#include <util/threading.h>
|
|
|
#include <util/buffered-file-serializer.h>
|
|
|
+#include <bpm.h>
|
|
|
|
|
|
#include <opts-parser.h>
|
|
|
|
|
@@ -49,6 +50,8 @@ struct mp4_output {
|
|
|
size_t chunk_size;
|
|
|
struct serializer serializer;
|
|
|
|
|
|
+ bool enable_bpm;
|
|
|
+
|
|
|
volatile bool active;
|
|
|
volatile bool stopping;
|
|
|
uint64_t stop_ts;
|
|
@@ -298,6 +301,8 @@ static void parse_custom_options(struct mp4_output *out, const char *opts_str)
|
|
|
out->buffer_size = strtoull(opt.value, 0, 10) * 1048576ULL;
|
|
|
} else if (strcmp(opt.name, "chunk_size") == 0) {
|
|
|
out->chunk_size = strtoull(opt.value, 0, 10) * 1048576ULL;
|
|
|
+ } else if (strcmp(opt.name, "bpm") == 0) {
|
|
|
+ out->enable_bpm = !!atoi(opt.value);
|
|
|
} else {
|
|
|
blog(LOG_WARNING, "Unknown muxer option: %s = %s", opt.name, opt.value);
|
|
|
}
|
|
@@ -343,6 +348,11 @@ static bool mp4_output_start(void *data)
|
|
|
|
|
|
obs_data_release(settings);
|
|
|
|
|
|
+ if (out->enable_bpm) {
|
|
|
+ info("Enabling BPM");
|
|
|
+ obs_output_add_packet_callback(out->output, bpm_inject, NULL);
|
|
|
+ }
|
|
|
+
|
|
|
if (!buffered_file_serializer_init(&out->serializer, out->path.array, out->buffer_size, out->chunk_size)) {
|
|
|
warn("Unable to open file '%s'", out->path.array);
|
|
|
return false;
|
|
@@ -503,6 +513,11 @@ static void mp4_output_actual_stop(struct mp4_output *out, int code)
|
|
|
|
|
|
mp4_mux_finalise(out->muxer);
|
|
|
|
|
|
+ if (out->enable_bpm) {
|
|
|
+ obs_output_remove_packet_callback(out->output, bpm_inject, NULL);
|
|
|
+ bpm_destroy(out->output);
|
|
|
+ }
|
|
|
+
|
|
|
if (code) {
|
|
|
obs_output_signal_stop(out->output, code);
|
|
|
} else {
|