From d7e673d23d8735f8efa6d42bfe5b9b852939e59a Mon Sep 17 00:00:00 2001 From: Maya Venkatraman Date: Tue, 13 Oct 2020 13:20:30 -0700 Subject: [PATCH] obs-ffmpeg: Allow specifying mux settings directly (Jim) Allows the ability to specify mux settings directly on the output's structure itself rather than just via settings. This is useful for network-based muxer outputs (such as HLS). --- plugins/obs-ffmpeg/obs-ffmpeg-mux.c | 12 +++++++++--- plugins/obs-ffmpeg/obs-ffmpeg-mux.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-mux.c b/plugins/obs-ffmpeg/obs-ffmpeg-mux.c index d5d45782f..bfcf8acc5 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-mux.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg-mux.c @@ -71,6 +71,7 @@ static void ffmpeg_mux_destroy(void *data) os_process_pipe_destroy(stream->pipe); dstr_free(&stream->path); dstr_free(&stream->printable_path); + dstr_free(&stream->muxer_settings); bfree(stream); } @@ -201,15 +202,20 @@ static void log_muxer_params(struct ffmpeg_muxer *stream, const char *settings) static void add_muxer_params(struct dstr *cmd, struct ffmpeg_muxer *stream) { - obs_data_t *settings = obs_output_get_settings(stream->output); struct dstr mux = {0}; - dstr_copy(&mux, obs_data_get_string(settings, "muxer_settings")); + if (dstr_is_empty(&stream->muxer_settings)) { + obs_data_t *settings = obs_output_get_settings(stream->output); + dstr_copy(&mux, + obs_data_get_string(settings, "muxer_settings")); + obs_data_release(settings); + } else { + dstr_copy(&mux, stream->muxer_settings.array); + } log_muxer_params(stream, mux.array); dstr_replace(&mux, "\"", "\\\""); - obs_data_release(settings); dstr_catf(cmd, "\"%s\" ", mux.array ? mux.array : ""); diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-mux.h b/plugins/obs-ffmpeg/obs-ffmpeg-mux.h index 92a2a9640..9810f4971 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-mux.h +++ b/plugins/obs-ffmpeg/obs-ffmpeg-mux.h @@ -21,6 +21,7 @@ struct ffmpeg_muxer { volatile bool stopping; struct dstr path; struct dstr printable_path; + struct dstr muxer_settings; /* replay buffer */ int64_t cur_size;