View Source Membrane.VideoCompositor.Handler behaviour (Membrane Video Compositor plugin v0.7.0)
Module defining behaviour of handlers.
Implementing handler allows to provide custom implementation and react to various events, among others by setting a new scene and the inner custom state.
Summary
Types
Contains state of VC before handling event invoking callback.
Type of a valid return value from the callback. By returning this type, the scene will be changed immediate, i.e. at the moment when the event happens.
Describe all VC input videos used in composition.
Type of user-managed inner state of the handler.
Module implementing Membrane.VideoCompositor.Handler
behaviour.
Type of a valid return value from callback allowing to pick start time of a new scene.
Callbacks
Callback invoked when video compositor receives a message that is not recognized as an internal membrane message.
Callback invoked upon initialization of Video Compositor.
Callback invoked upon change of VC t:inputs()
.
Types
@type context() :: %{ scene: Membrane.VideoCompositor.Scene.t(), inputs: inputs(), next_frame_pts: Membrane.Time.non_neg(), scenes_queue: [ {start_pts :: Membrane.Time.non_neg(), new_scene :: Membrane.VideoCompositor.Scene.t()} ] }
Contains state of VC before handling event invoking callback.
@type immediate_callback_return() :: {scene :: Membrane.VideoCompositor.Scene.t(), state :: state()}
Type of a valid return value from the callback. By returning this type, the scene will be changed immediate, i.e. at the moment when the event happens.
@type inputs() :: %{ required(Membrane.Pad.ref()) => Membrane.VideoCompositor.Handler.InputProperties.t() }
Describe all VC input videos used in composition.
@type state() :: any()
Type of user-managed inner state of the handler.
@type t() :: module()
Module implementing Membrane.VideoCompositor.Handler
behaviour.
@type timed_callback_return() :: {{scene :: Membrane.VideoCompositor.Scene.t(), start_pts :: Membrane.Time.non_neg()}, state :: state()}
Type of a valid return value from callback allowing to pick start time of a new scene.
Callbacks
@callback handle_info( msg :: any(), ctx :: context(), state :: state() ) :: immediate_callback_return() | timed_callback_return()
Callback invoked when video compositor receives a message that is not recognized as an internal membrane message.
This callback allows one to communicate with a Video Compositor by sending custom messages and reacting to them.
@callback handle_init(init_options :: Membrane.VideoCompositor.init_options()) :: state()
Callback invoked upon initialization of Video Compositor.
@callback handle_inputs_change( inputs :: inputs(), ctx :: context(), state :: state() ) :: immediate_callback_return()
Callback invoked upon change of VC t:inputs()
.
inputs
changing input videos:
- video added
- video removed
- video stream format change