Skip to main content
Version: 2.5.x (dev)

Source / Video processing

video.add_line

Draw a line on the video.

Type:

(?id : string?, ?alpha : {float}, ?color : {int}, {int * int}, {int * int},
source(video=yuv420p('a), 'b)) -> source(video=yuv420p('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • alpha (of type {float}, which defaults to 1.0): Transparency of the color between 0 and 1 (0 is fully transparent and 1 is fully opaque).
  • color (of type {int}, which defaults to 0): Color to fill the image with (0xRRGGBB).
  • (unlabeled) (of type {int * int}): Start point.
  • (unlabeled) (of type {int * int}): End point.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.add_rectangle

Draw a rectangle.

Type:

(?id : string?, ?alpha : {float}, ?color : {int}, height : {int},
width : {int}, ?x : {int}, ?y : {int}, source(video=yuv420p('a), 'b)) ->
source(video=yuv420p('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • alpha (of type {float}, which defaults to 1.0): Transparency of the color between 0 and 1 (0 is fully transparent and 1 is fully opaque).
  • color (of type {int}, which defaults to 0): Color to fill the image with (0xRRGGBB).
  • height (of type {int}): Height.
  • width (of type {int}): Width.
  • x (of type {int}, which defaults to 0): Horizontal offset.
  • y (of type {int}, which defaults to 0): Vertical offset.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.align

Translate the video so that it is aligned on boundaries.

Type:

(?id : string?, ?bottom : bool, ?left : bool, ?right : bool, ?top : bool,
source(video=yuv420p('a), 'b)) -> source(video=yuv420p('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • bottom (of type bool, which defaults to false): Align bottom.
  • left (of type bool, which defaults to false): Align left.
  • right (of type bool, which defaults to false): Align right.
  • top (of type bool, which defaults to false): Align top.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.alpha.movement

Make moving parts visible and non-moving parts transparent. A cheap way to have a bluescreen.

Type:

(?id : string?, ?precision : float, source(video=yuv420p('a), 'b)) ->
source(video=yuv420p('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • precision (of type float, which defaults to 0.2): Precision when comparing pixels to those of previous image (between 0 and 1).
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.alpha.of_color

Set a color to be transparent.

Type:

(?id : string?, ?color : int, ?precision : float, source(video=yuv420p('a),
'b)) -> source(video=yuv420p('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • color (of type int, which defaults to 0): Color which should be transparent (in 0xRRGGBB format).
  • precision (of type float, which defaults to 0.2): Precision in color matching (0. means match precisely the color and 1. means match every color).
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.alpha.remove

Remove α channel.

Type:

(?id : string?, source(video=yuv420p('a), 'b)) -> source(video=yuv420p('a),
'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.alpha.to_y

Convert the α channel to Y channel, thus converting opaque (resp. transparent) pixels to bright (resp. dark) ones. This is useful to observe the α channel.

Type:

(?id : string?, source(video=yuv420p('a), 'b)) -> source(video=yuv420p('a),
'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.board

A plane where one can draw.

Type:

(?id : string?, ?height : int?, ?width : int?) -> source('a)
where 'a is a set of internal tracks

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • height (of type int?, which defaults to null): Initial height of the video (defaults to the same as frame).
  • width (of type int?, which defaults to null): Initial width of the video (defaults to the same as frame).

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear (of type () -> unit): Clear the board.
  • clear_and_copy (of type (?x : int, ?y : int) -> unit): Clear the board and copy the old board to the new one, translated.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • fill (of type (int) -> unit): Fill with given color (0xRRGGBB).
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • height (of type () -> int): Current height of the board.
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • line_to (of type (?color : int, int, int) -> unit): Draw a line from the last point.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • pixel (of type (int, int) -> (() -> int).{set : (int) -> unit}): Retrieve a pixel whose contents is a color (in 0xRRGGBB format).
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.
  • width (of type () -> int): Current width of the board.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source('A), track_sensitive : bool}) -> unit where 'A is a set of internal tracks): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ({ending : source('A)?, replay_metadata : bool, starting : source('A)}) -> source('A) where 'A is a set of internal tracks): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.bounding_box

Retrieve the origin (methods x / y) and the dimensions (methods width / height) of the bounding box of the video.

Type:

(?id : string?, source(video=yuv420p('a), 'b)) -> source(video=yuv420p('a),
'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • height (of type () -> int): Height of video.
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.
  • width (of type () -> int): Width of video.
  • x (of type () -> int): x offset of video.
  • y (of type () -> int): y offset of video.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.crop

Make the viewport of the current video match its bounding box.

Type:

(?id : string?, source(video=yuv420p('a), 'b)) -> source(video=yuv420p('a),
'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.fade.in

Fade the beginning of tracks. Metadata 'liq_video_fade_in' can be used to set the duration for a specific track (float in seconds).

Type:

(?id : string?, ?duration : float, ?override : string, ?transition : string,
?type : string, source(video=yuv420p('a), 'b)) -> source(video=yuv420p('a),
'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • duration (of type float, which defaults to 3.0): Duration of the fading. This value can be set on a per-file basis using the metadata field passed as override.
  • override (of type string, which defaults to "liq_video_fade_in"): Metadata field which, if present and containing a float, overrides the 'duration' parameter for current track.
  • transition (of type string, which defaults to "fade"): Kind of transition (fade|slide_left|slide_right|slide_up|slide_down|grow|disc|random).
  • type (of type string, which defaults to "lin"): Fader shape (lin|sin|log|exp): linear, sinusoidal, logarithmic or exponential.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.fade.out

Fade the end of tracks. Metadata 'liq_video_fade_out' can be used to set the duration for a specific track (float in seconds).

Type:

(?id : string?, ?duration : float, ?override : string, ?transition : string,
?type : string, source(video=yuv420p('a), 'b)) -> source(video=yuv420p('a),
'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • duration (of type float, which defaults to 3.0): Duration of the fading. This value can be set on a per-file basis using the metadata field passed as override.
  • override (of type string, which defaults to "liq_video_fade_out"): Metadata field which, if present and containing a float, overrides the 'duration' parameter for current track.
  • transition (of type string, which defaults to "fade"): Kind of transition (fade|slide_left|slide_right|slide_up|slide_down|grow|disc|random).
  • type (of type string, which defaults to "lin"): Fader shape (lin|sin|log|exp): linear, sinusoidal, logarithmic or exponential.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.fill

Fill frame with a color.

Type:

(?id : string?, ?alpha : {float}, ?color : {int}, source(video=yuv420p('a),
'b)) -> source(video=yuv420p('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • alpha (of type {float}, which defaults to 1.0): Transparency of the color between 0 and 1 (0 is fully transparent and 1 is fully opaque).
  • color (of type {int}, which defaults to 0): Color to fill the image with (0xRRGGBB).
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.greyscale

Convert video to greyscale.

Type:

(?id : string?, source(video=yuv420p('a), 'b)) -> source(video=yuv420p('a),
'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.hmirror

Flip image horizontally.

Type:

(?id : string?, source(video=yuv420p('a), 'b)) -> source(video=yuv420p('a),
'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.info

Compute various information about the video (dimension, size, etc.). Those are accessible through the methods attached to the source.

Type:

(?id : string?, source(video=yuv420p('a), 'b)) -> source(video=yuv420p('a),
'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • height (of type () -> int): Height of video.
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • planes (of type () -> int): Number of planes in a video frame.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • size (of type () -> int): Size of a video frame (in bytes).
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.
  • width (of type () -> int): Width of video.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.invert

Invert video.

Type:

(?id : string?, source(video=yuv420p('a), 'b)) -> source(video=yuv420p('a),
'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.lomo

Emulate the "Lomo effect".

Type:

(?id : string?, source(video=yuv420p('a), 'b)) -> source(video=yuv420p('a),
'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.opacity

Scale opacity of video.

Type:

(?id : string?, {float}, source(video=yuv420p('a), 'b)) ->
source(video=yuv420p('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • (unlabeled) (of type {float}): Coefficient to scale opacity with: from 0 (fully transparent) to 1 (fully opaque).
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.opacity.box

Set alpha value on a given box inside the image.

Type:

(?id : string?, alpha : {float}, height : {int}, width : {int}, ?x : {int},
?y : {int}, source(video=yuv420p('a), 'b)) -> source(video=yuv420p('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • alpha (of type {float}): alpha value.
  • height (of type {int}): Box height.
  • width (of type {int}): Box width.
  • x (of type {int}, which defaults to 0): x offset.
  • y (of type {int}, which defaults to 0): y offset.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.persistence

Make images of the video persistent.

Type:

(?id : string?, ?duration : {float}, source(video=yuv420p('a), 'b)) ->
source(video=yuv420p('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • duration (of type {float}, which defaults to 1.0): Persistence duration in seconds.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.render

Render the video by computing the result of its canvas images.

Type:

(?id : string?, ?transparent : bool, source(video=yuv420p('a), 'b)) ->
source(video=yuv420p('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • transparent (of type bool, which defaults to true): Make uncovered portions of the image transparent (they are black by default).
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.resize

Resize and translate video.

Type:

(?id : string?, ?height : {int}?, ?proportional : bool, ?width : {int}?,
?x : {int}, ?y : {int}, source(video=yuv420p('a), 'b)) ->
source(video=yuv420p('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • height (of type {int}?, which defaults to null): Target height (null means original height).
  • proportional (of type bool, which defaults to true): Keep original proportions.
  • width (of type {int}?, which defaults to null): Target width (null means original width).
  • x (of type {int}, which defaults to 0): x offset.
  • y (of type {int}, which defaults to 0): y offset.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.rotate

Rotate video.

Type:

(?id : string?, ?angle : {float}, source(video=yuv420p('a), 'b)) ->
source(video=yuv420p('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • angle (of type {float}, which defaults to 0.0): Angle in radians.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.scale

Scale and translate video.

Type:

(?id : string?, ?scale : {float}, ?x : {int}, ?xscale : {float}, ?y : {int},
?yscale : {float}, source(video=yuv420p('a), 'b)) ->
source(video=yuv420p('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • scale (of type {float}, which defaults to 1.0): Scaling coefficient in both directions.
  • x (of type {int}, which defaults to 0): x offset.
  • xscale (of type {float}, which defaults to 1.0): x scaling.
  • y (of type {int}, which defaults to 0): y offset.
  • yscale (of type {float}, which defaults to 1.0): y scaling.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.sepia

Convert video to sepia.

Type:

(?id : string?, source(video=yuv420p('a), 'b)) -> source(video=yuv420p('a),
'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.still_frame

Take still frames from a video source by calling the save method. For now only bitmap output is supported.

Type:

(?id : string?, source(video=yuv420p('a), 'b)) -> source(video=yuv420p('a),
'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • save (of type (string) -> unit): Save current image, argument is the file name to save to.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.text.native

Display a text.

Type:

(?id : string?, ?color : {int}, ?duration : float?, ?font : {string}?,
?size : {int}, {string}) -> source(video=yuv420p('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • color (of type {int}, which defaults to 0xffffff): Text color (in 0xRRGGBB format).
  • duration (of type float?, which defaults to null): Duration in seconds (null means infinite).
  • font (of type {string}?, which defaults to null): Path to ttf font file (default is "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf").
  • size (of type {int}, which defaults to 18): Font size.
  • (unlabeled) (of type {string}): Text to display.

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.text.sdl

Display a text.

Type:

(?id : string?, ?color : {int}, ?duration : float?, ?font : {string}?,
?size : {int}, {string}) -> source(video=yuv420p('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • color (of type {int}, which defaults to 0xffffff): Text color (in 0xRRGGBB format).
  • duration (of type float?, which defaults to null): Duration in seconds (null means infinite).
  • font (of type {string}?, which defaults to null): Path to ttf font file (default is "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf").
  • size (of type {int}, which defaults to 18): Font size.
  • (unlabeled) (of type {string}): Text to display.

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.translate

Translate video.

Type:

(?id : string?, ?x : {int}, ?y : {int}, source(video=yuv420p('a), 'b)) ->
source(video=yuv420p('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • x (of type {int}, which defaults to 0): x offset.
  • y (of type {int}, which defaults to 0): y offset.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

video.viewport

Set the viewport for the current video.

Type:

(?id : string?, ?height : int?, ?width : int?, ?x : int, ?y : int,
source(video=yuv420p('a), 'b)) -> source(video=yuv420p('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • height (of type int?, which defaults to null): height (default is frame height).
  • width (of type int?, which defaults to null): Width (default is frame width).
  • x (of type int, which defaults to 0): Horizontal offset.
  • y (of type int, which defaults to 0): Vertical offset.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(video=yuv420p('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(video=yuv420p('B), 'A)?, replay_metadata : bool, starting : source(video=yuv420p('B), 'A) }) -> source(video=yuv420p('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).