From 6e1bbbc058325b3a872f0c35fbf3aa3384625fc8 Mon Sep 17 00:00:00 2001 From: Clayton Groeneveld Date: Fri, 21 Feb 2020 23:20:20 -0600 Subject: [PATCH] obs-browser: Update default size --- obs-browser-plugin.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/obs-browser-plugin.cpp b/obs-browser-plugin.cpp index d035baaf8..62f73e8dd 100644 --- a/obs-browser-plugin.cpp +++ b/obs-browser-plugin.cpp @@ -133,6 +133,17 @@ static void browser_source_get_defaults(obs_data_t *settings) obs_data_set_default_bool(settings, "reroute_audio", false); } +static void browser_source_get_defaults_v2(obs_data_t *settings) +{ + browser_source_get_defaults(settings); + + struct obs_video_info ovi; + obs_get_video_info(&ovi); + + obs_data_set_default_int(settings, "width", ovi.base_width); + obs_data_set_default_int(settings, "height", ovi.base_height); +} + static bool is_local_file_modified(obs_properties_t *props, obs_property_t *, obs_data_t *settings) { @@ -441,7 +452,8 @@ void RegisterBrowserSource() OBS_SOURCE_AUDIO | #endif OBS_SOURCE_CUSTOM_DRAW | OBS_SOURCE_INTERACTION | - OBS_SOURCE_DO_NOT_DUPLICATE | OBS_SOURCE_SRGB; + OBS_SOURCE_DO_NOT_DUPLICATE | OBS_SOURCE_SRGB | + OBS_SOURCE_CAP_OBSOLETE; info.get_properties = browser_source_get_properties; info.get_defaults = browser_source_get_defaults; info.icon_type = OBS_ICON_TYPE_BROWSER; @@ -522,6 +534,16 @@ void RegisterBrowserSource() }; obs_register_source(&info); + + info.version = 2; + info.output_flags = OBS_SOURCE_VIDEO | +#if CHROME_VERSION_BUILD >= 3683 + OBS_SOURCE_AUDIO | +#endif + OBS_SOURCE_CUSTOM_DRAW | OBS_SOURCE_INTERACTION | + OBS_SOURCE_DO_NOT_DUPLICATE | OBS_SOURCE_SRGB; + info.get_defaults = browser_source_get_defaults_v2; + obs_register_source(&info); } /* ========================================================================= */