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-frontend-api: Add event for video reset #11685

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions UI/obs-frontend-api/obs-frontend-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ enum obs_frontend_event {
OBS_FRONTEND_EVENT_SCENE_COLLECTION_RENAMED,
OBS_FRONTEND_EVENT_THEME_CHANGED,
OBS_FRONTEND_EVENT_SCREENSHOT_TAKEN,
OBS_FRONTEND_EVENT_VIDEO_RESET,
};

/* ------------------------------------------------------------------------- */
Expand Down
2 changes: 2 additions & 0 deletions UI/window-basic-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4516,6 +4516,8 @@ int OBSBasic::ResetVideo()
migrationBaseResolution->second != ovi.base_height));
ui->actionRemigrateSceneCollection->setEnabled(canMigrate);

OnEvent(OBS_FRONTEND_EVENT_VIDEO_RESET);

emit CanvasResized(ovi.base_width, ovi.base_height);
emit OutputResized(ovi.output_width, ovi.output_height);
}
Expand Down
12 changes: 12 additions & 0 deletions libobs/obs.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ static THREAD_LOCAL bool is_ui_thread = false;
extern void add_default_module_paths(void);
extern char *find_libobs_data_file(const char *file);

static inline void obs_video_dosignal(const char *signal_obs)
{
struct calldata params = {0};
signal_handler_signal(obs->signals, signal_obs, &params);
}

static inline void make_video_info(struct video_output_info *vi, struct obs_video_info *ovi)
{
vi->name = "video";
Expand Down Expand Up @@ -695,6 +701,7 @@ static int obs_init_video(struct obs_video_info *ovi)

video->thread_initialized = true;

obs_video_dosignal("core_video_ready");
return OBS_VIDEO_SUCCESS;
}

Expand Down Expand Up @@ -820,6 +827,8 @@ static void obs_free_video(void)
pthread_mutex_destroy(&obs->video.task_mutex);
pthread_mutex_init_value(&obs->video.task_mutex);
deque_free(&obs->video.tasks);

obs_video_dosignal("core_video_released");
}

static void obs_free_graphics(void)
Expand Down Expand Up @@ -1053,6 +1062,9 @@ static const char *obs_signals[] = {
"void hotkey_unregister(ptr hotkey)",
"void hotkey_bindings_changed(ptr hotkey)",

"void core_video_ready()",
"void core_video_released()",

NULL,
};

Expand Down
Loading