If custom transforms were used, the very first frame after starting
would always render with the previous transform before calculating the
new transform.
If a transition had a fixed size, it would not render itself or its
sub-sources according to that fixed size. The fixed size value was
essentially being ignored.
This fixes a bug where the sub-sources on a transition wouldn't render
with the expected size when the transition had a different size from its
sub-sources
Transition audio was programmed to stop if there is no queued audio from
both sources. Because of that, when a source's audio started after the
transition started, it would cause audio from the source to be excluded
from the transition until the transition had completed because the audio
had already been marked as stopped.
Instead, if there's no audio from the transition sources, the audio
should only be marked as stopped when video has stopped. This allows
the to/from sources to have an opportunity to start/restart audio during
the transition safely.
Sometimes the A and B sources of a transition would a large difference
in their timestamps, and the calculation of where to start the audio
data for one of the sources could be above the tick size, which could
cause a crash.
Transition sources are implemented by registering a source type as
OBS_SOURCE_TYPE_TRANSITION. They're automatically marked as video
composite sources, and video_render/audio_render callbacks must be set
when registering the source. get_width and get_height callbacks are
unused for these types of sources, as transitions automatically handle
width/height behind the scenes with the transition settings.
In the video_render callback, the helper function
obs_transition_video_render is used to assist in automatically
processing and rendering the audio. A render callback is passed to the
function, which in turn passes to/from textures that are automatically
rendered in the back-end.
Similarly, in the audio_render callback, the helper function
obs_transition_audio_render is used to assist in automatically
processing and rendering the audio. Two mix callbacks are used to
handle how the source/destination sources are mixed together. To ensure
the best possible quality, audio processing is per-sample.
Transitions can be set to automatically resize, or they can be set to
have a fixed size. Sources within transitions can be made to scale to
the transition size (with or without aspect ratio), or to not scale
unless they're bigger than the transition. They can have a specific
alignment within the transition, or they just default to top-left.
These features are implemented for the purpose of extending transitions
to also act as "switch" sources later, where you can switch to/from two
different sources using the transition animation.
Planned (but not yet implemented and lower priority) features:
- "Switch" transitions which allow the ability to switch back and forth
between two sources with a transitioning animation without discarding
the references
- Easing options to allow the option to transition with a bezier or
custom curve
- Manual transitioning to allow the front-end/user to manually control
the transition offset