libobs: Add obs_video_active() function
(This commit also modifies UI) Adds a universal function for determining whether video output is currently active, rather than having to use video_output_active() on the value returned by obs_get_video().
This commit is contained in:
11
libobs/obs.c
11
libobs/obs.c
@@ -1014,7 +1014,7 @@ int obs_reset_video(struct obs_video_info *ovi)
|
||||
if (!obs) return OBS_VIDEO_FAIL;
|
||||
|
||||
/* don't allow changing of video settings if active. */
|
||||
if (obs->video.video && video_output_active(obs->video.video))
|
||||
if (obs->video.video && obs_video_active())
|
||||
return OBS_VIDEO_CURRENTLY_ACTIVE;
|
||||
|
||||
if (!size_valid(ovi->output_width, ovi->output_height) ||
|
||||
@@ -2258,3 +2258,12 @@ obs_data_t *obs_get_private_data(void)
|
||||
obs_data_addref(private_data);
|
||||
return private_data;
|
||||
}
|
||||
|
||||
bool obs_video_active(void)
|
||||
{
|
||||
struct obs_core_video *video = &obs->video;
|
||||
if (!obs)
|
||||
return false;
|
||||
|
||||
return os_atomic_load_long(&video->raw_active) > 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user