Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

obs-outputs: Attempt to generate path if one is not specified #11517

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions plugins/obs-outputs/mp4-output.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ static int parse_custom_options(const char *opts_str)
return flags;
}

static void generate_filename(struct mp4_output *out, struct dstr *dst, bool overwrite);

static bool mp4_output_start(void *data)
{
struct mp4_output *out = data;
Expand All @@ -250,17 +252,22 @@ static bool mp4_output_start(void *data)

os_atomic_set_bool(&out->stopping, false);

/* get path */
obs_data_t *settings = obs_output_get_settings(out->output);
const char *path = obs_data_get_string(settings, "path");
dstr_copy(&out->path, path);

out->max_time = obs_data_get_int(settings, "max_time_sec") * 1000000LL;
out->max_size = obs_data_get_int(settings, "max_size_mb") * 1024 * 1024;
out->split_file_enabled = obs_data_get_bool(settings, "split_file");
out->allow_overwrite = obs_data_get_bool(settings, "allow_overwrite");
out->cur_size = 0;

/* Get path */
const char *path = obs_data_get_string(settings, "path");
if (path && *path) {
Comment on lines +263 to +264
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this could be replaced with if (obs_data_has_user_value(settings, "path")) { but it's probably fine either way.

dstr_copy(&out->path, path);
} else {
generate_filename(out, &out->path, out->allow_overwrite);
info("Output path not specified. Using generated path '%s'", out->path.array);
}

/* Allow skipping the remux step for debugging purposes. */
const char *muxer_settings = obs_data_get_string(settings, "muxer_settings");
out->flags = parse_custom_options(muxer_settings);
Expand Down
Loading