libobs: Add manual transitioning support (T-bar)
Allows the ability to manually specify the transitioning point so the user can transition at a custom rate, usually done by a device that can be used as a T-bar Co-authored-by: Jim <obs.jim@gmail.com>
This commit is contained in:
parent
ef116f9e5f
commit
a97039db64
@ -700,6 +700,7 @@ struct obs_source {
|
||||
gs_texrender_t *transition_texrender[2];
|
||||
pthread_mutex_t transition_mutex;
|
||||
obs_source_t *transition_sources[2];
|
||||
float transition_manual_val;
|
||||
bool transitioning_video;
|
||||
bool transitioning_audio;
|
||||
bool transition_source_active[2];
|
||||
|
@ -351,6 +351,7 @@ bool obs_transition_start(obs_source_t *transition,
|
||||
bool active;
|
||||
bool same_as_source;
|
||||
bool same_as_dest;
|
||||
bool same_mode;
|
||||
|
||||
if (!transition_valid(transition, "obs_transition_start"))
|
||||
return false;
|
||||
@ -358,11 +359,20 @@ bool obs_transition_start(obs_source_t *transition,
|
||||
lock_transition(transition);
|
||||
same_as_source = dest == transition->transition_sources[0];
|
||||
same_as_dest = dest == transition->transition_sources[1];
|
||||
same_mode = mode == transition->transition_mode;
|
||||
active = transition_active(transition);
|
||||
unlock_transition(transition);
|
||||
|
||||
if (same_as_source && !active)
|
||||
return false;
|
||||
if (active && mode == OBS_TRANSITION_MODE_MANUAL && same_mode &&
|
||||
same_as_dest)
|
||||
return true;
|
||||
|
||||
lock_transition(transition);
|
||||
transition->transition_mode = mode;
|
||||
transition->transition_manual_val = 0.0f;
|
||||
unlock_transition(transition);
|
||||
|
||||
if (transition->info.transition_start)
|
||||
transition->info.transition_start(transition->context.data);
|
||||
@ -389,11 +399,16 @@ bool obs_transition_start(obs_source_t *transition,
|
||||
recalculate_transition_size(transition);
|
||||
recalculate_transition_matrices(transition);
|
||||
|
||||
/* TODO: Add mode */
|
||||
UNUSED_PARAMETER(mode);
|
||||
return true;
|
||||
}
|
||||
|
||||
void obs_transition_set_manual_time(obs_source_t *transition, float t)
|
||||
{
|
||||
lock_transition(transition);
|
||||
transition->transition_manual_val = t;
|
||||
unlock_transition(transition);
|
||||
}
|
||||
|
||||
void obs_transition_set(obs_source_t *transition, obs_source_t *source)
|
||||
{
|
||||
obs_source_t *s[2];
|
||||
@ -429,6 +444,9 @@ void obs_transition_set(obs_source_t *transition, obs_source_t *source)
|
||||
|
||||
static float calc_time(obs_source_t *transition, uint64_t ts)
|
||||
{
|
||||
if (transition->transition_mode == OBS_TRANSITION_MODE_MANUAL)
|
||||
return transition->transition_manual_val;
|
||||
|
||||
uint64_t end;
|
||||
|
||||
if (ts <= transition->transition_start_time)
|
||||
|
@ -1333,6 +1333,7 @@ EXPORT obs_source_t *obs_transition_get_active_source(obs_source_t *transition);
|
||||
|
||||
enum obs_transition_mode {
|
||||
OBS_TRANSITION_MODE_AUTO,
|
||||
OBS_TRANSITION_MODE_MANUAL,
|
||||
};
|
||||
|
||||
EXPORT bool obs_transition_start(obs_source_t *transition,
|
||||
@ -1341,6 +1342,8 @@ EXPORT bool obs_transition_start(obs_source_t *transition,
|
||||
|
||||
EXPORT void obs_transition_set(obs_source_t *transition, obs_source_t *source);
|
||||
|
||||
EXPORT void obs_transition_set_manual_time(obs_source_t *transition, float t);
|
||||
|
||||
enum obs_transition_scale_type {
|
||||
OBS_TRANSITION_SCALE_MAX_ONLY,
|
||||
OBS_TRANSITION_SCALE_ASPECT,
|
||||
|
Loading…
x
Reference in New Issue
Block a user