Uncategorized
add_metadata_resolver
Deprecated: use decoder.metadata.add.
Type:
(string, ((metadata : [string * string], string) -> [string * string])) ->
unit
Arguments:
(unlabeled)(of typestring)(unlabeled)(of type(metadata : [string * string], string) -> [string * string])
add_playlist_parser
Deprecated: use playlist.parse.register instead
Type:
(name : string, mimes : [string], strict : bool,
((?pwd : string, string) -> [[string * string] * string])) -> unit
Arguments:
name(of typestring)mimes(of type[string])strict(of typebool)(unlabeled)(of type(?pwd : string, string) -> [[string * string] * string])
add_protocol
Deprecated: use protocol.add.
Type:
(?temporary : bool, ?static : ((string) -> bool), ?syntax : string,
?doc : string, string,
((rlog : ((string) -> unit), maxtime : float, string) -> string?)) -> unit
Arguments:
temporary(of typebool, which defaults tofalse)static(of type(string) -> bool, which defaults tofun (_) -> false)syntax(of typestring, which defaults to"Undocumented")doc(of typestring, which defaults to"Undocumented")(unlabeled)(of typestring)(unlabeled)(of type(rlog : ((string) -> unit), maxtime : float, string) -> string?)
add_timeout
Deprecated: this function has been replaced by thread.run.recurrent.
Type:
(?fast : bool, float, (() -> float)) -> unit
Arguments:
fast(of typebool, which defaults totrue)(unlabeled)(of typefloat)(unlabeled)(of type() -> float)
at
Deprecated: use at instead.
Type:
({bool}, source('a)) -> source('a)
Composition:
This source inherits composition from its effective source.
Arguments:
(unlabeled)(of type{bool})(unlabeled)(of typesource('a))
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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)): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
audio_to_stereo
Deprecated: use source.stereo
Type:
(?id : string?, source(audio=pcm('a), 'b)) -> source(audio=pcm(stereo), 'b)
where 'b is a set of tracks to be muxed into a source
Composition:
This source uses file composition by default.
Arguments:
id(of typestring?, which defaults tonull)(unlabeled)(of typesource(audio=pcm('a), 'b) where 'b is a set of tracks to be muxed into a source)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source(audio=pcm(stereo), 'A), track_sensitive : bool}) -> unit where 'A is a set of tracks to be muxed into a source): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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(audio=pcm(stereo), 'A)?, replay_metadata : bool, starting : source(audio=pcm(stereo), 'A) }) -> source(audio=pcm(stereo), 'A) where 'A is a set of tracks to be muxed into a source): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
base64.decode
Deprecated: this function has been replaced by string.base64.decode.
Type:
(string) -> string
Arguments:
(unlabeled)(of typestring)
base64.encode
Deprecated: this function has been replaced by string.base64.encode.
Type:
(string) -> string
Arguments:
(unlabeled)(of typestring)
compress.old
Deprecated: use compress
Type:
(?id : string?, source(audio=pcm('a), 'b)) -> source(audio=pcm('a)
.{gain? : never, rms? : never}, 'b)
where 'b is a set of tracks to be muxed into a source
Composition:
This source uses file composition by default.
Arguments:
id(of typestring?, which defaults tonull)(unlabeled)(of typesource(audio=pcm('a), 'b) where 'b is a set of tracks to be muxed into a source)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.gain(of type() -> float):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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.rms(of type() -> float):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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type( { source : source(audio=pcm('B) .{gain? : never, rms? : never }, 'A), track_sensitive : bool }) -> unit where 'A is a set of tracks to be muxed into a source): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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(audio=pcm('B) .{gain? : never, rms? : never }, 'A)?, replay_metadata : bool, starting : source(audio=pcm('B) .{gain? : never, rms? : never }, 'A) }) -> source(audio=pcm('B).{gain? : never, rms? : never}, 'A) where 'A is a set of tracks to be muxed into a source): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
cue_cut
Deprecated: integrated into requests resolution.
Type:
(?id : string?, ?cue_in_metadata : string, ?cue_out_metadata : string,
?on_cue_in : (() -> unit), ?on_cue_out : (() -> unit), 'a) -> 'a
Arguments:
id(of typestring?, which defaults to"")cue_in_metadata(of typestring, which defaults to"")cue_out_metadata(of typestring, which defaults to"")on_cue_in(of type() -> unit, which defaults to{()})on_cue_out(of type() -> unit, which defaults to{()})(unlabeled)(of type'a)
drop_audio
Deprecated: use source.drop.audio
Type:
(?id : string?, source(audio='a, 'b)) -> source(audio='a, 'b)
where 'b is a set of tracks to be muxed into a source
Composition:
This source uses file composition by default.
Arguments:
id(of typestring?, which defaults tonull)(unlabeled)(of typesource(audio='a, 'b) where 'b is a set of tracks to be muxed into a source)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source(audio='B, 'A), track_sensitive : bool}) -> unit where 'A is a set of tracks to be muxed into a source): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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(audio='B, 'A)?, replay_metadata : bool, starting : source(audio='B, 'A) }) -> source(audio='B, 'A) where 'A is a set of tracks to be muxed into a source): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
drop_metadata
Deprecated: use source.drop.metadata
Type:
(?id : string?, source('a)) -> source('a)
where 'a is a set of tracks to be muxed into a source
Composition:
This source uses file composition by default.
Arguments:
id(of typestring?, which defaults tonull)(unlabeled)(of typesource('a) where 'a is a set of tracks to be muxed into a source)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source('A), track_sensitive : bool}) -> unit where 'A is a set of tracks to be muxed into a source): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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 tracks to be muxed into a source): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
drop_midi
Deprecated: use source.drop.midi
Type:
(?id : string?, source(midi='a, 'b)) -> source(midi='a, 'b)
where 'b is a set of tracks to be muxed into a source
Composition:
This source uses file composition by default.
Arguments:
id(of typestring?, which defaults tonull)(unlabeled)(of typesource(midi='a, 'b) where 'b is a set of tracks to be muxed into a source)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source(midi='B, 'A), track_sensitive : bool}) -> unit where 'A is a set of tracks to be muxed into a source): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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(midi='B, 'A)?, replay_metadata : bool, starting : source(midi='B, 'A) }) -> source(midi='B, 'A) where 'A is a set of tracks to be muxed into a source): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
drop_video
Deprecated: use source.drop.video
Type:
(?id : string?, source(video='a, 'b)) -> source(video='a, 'b)
where 'b is a set of tracks to be muxed into a source
Composition:
This source uses file composition by default.
Arguments:
id(of typestring?, which defaults tonull)(unlabeled)(of typesource(video='a, 'b) where 'b is a set of tracks to be muxed into a source)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source(video='B, 'A), track_sensitive : bool}) -> unit where 'A is a set of tracks to be muxed into a source): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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='B, 'A)?, replay_metadata : bool, starting : source(video='B, 'A) }) -> source(video='B, 'A) where 'A is a set of tracks to be muxed into a source): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
eat_blank
Deprecated: use blank.eat instead
Type:
(?id : string?, ?at_beginning : bool, ?max_blank : {float},
?min_noise : {float}, ?start_blank : bool, ?threshold : {float},
?track_sensitive : {bool}, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)
Composition:
This source inherits composition from its effective source.
Arguments:
id(of typestring?, which defaults tonull)at_beginning(of typebool, which defaults tofalse)max_blank(of type{float}, which defaults to20.0)min_noise(of type{float}, which defaults to0.0)start_blank(of typebool, which defaults tofalse)threshold(of type{float}, which defaults to-40.0)track_sensitive(of type{bool}, which defaults totrue)(unlabeled)(of typesource(audio=pcm('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 typeclock): The source's clockdB_levels(of type() -> [float]?): Return the detected dB level for each channel.duration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_blank(of type() -> bool): Indicate whether blank was detected.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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(audio=pcm('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 withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
empty
Deprecated: this function has been replaced by source.fail.
Type:
(?id : string?) -> source('a)
Composition:
This source uses file composition by default.
Arguments:
id(of typestring?, which defaults tonull)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source('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 withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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)): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
exec_at
Deprecated: this function has been replaced by thread.when.
Type:
(?freq : float, pred : (() -> bool), (() -> 'a)) -> unit
Arguments:
freq(of typefloat, which defaults to1.0)pred(of type() -> bool)(unlabeled)(of type() -> 'a)
fade.final
Deprecated: was designed for transitions only and is not needed anymore. Use file.out instead.
Type:
(?id : string, ?duration : float, ?type : string, source(audio='a, 'b)) ->
source(audio='a, 'b)
where 'b is a set of tracks to be muxed into a source,
'a is a track and a track of type: pcm, pcm_s16 or pcm_f32
Composition:
This source inherits composition from its effective source.
Arguments:
id(of typestring, which defaults to"fade.final")duration(of typefloat, which defaults to3.0)type(of typestring, which defaults to"lin")(unlabeled)(of typesource(audio='a, 'b) where 'b is a set of tracks to be muxed into a source, 'a is a track and a track of type: pcm, pcm_s16 or pcm_f32)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).selected(of type() -> source(audio='B, 'A)? where 'A is a set of tracks to be muxed into a source, 'B is a track and a track of type: pcm, pcm_s16 or pcm_f32): Currently selected source.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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(audio='B, 'A), track_sensitive : bool}) -> unit where 'A is a set of tracks to be muxed into a source, 'B is a track and a track of type: pcm, pcm_s16 or pcm_f32): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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(audio='B, 'A)?, replay_metadata : bool, starting : source(audio='B, 'A) }) -> source(audio='B, 'A) where 'A is a set of tracks to be muxed into a source, 'B is a track and a track of type: pcm, pcm_s16 or pcm_f32): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
fade.initial
Deprecated: was designed for transitions only and is not needed anymore. Use fade.in instead.
Type:
(?id : string, ?duration : float, ?type : string, source(audio='a, 'b)) ->
source(audio='a, 'b)
where 'b is a set of tracks to be muxed into a source,
'a is a track and a track of type: pcm, pcm_s16 or pcm_f32
Composition:
This source uses file composition by default.
Arguments:
id(of typestring, which defaults to"fade.initial")duration(of typefloat, which defaults to3.0)type(of typestring, which defaults to"lin")(unlabeled)(of typesource(audio='a, 'b) where 'b is a set of tracks to be muxed into a source, 'a is a track and a track of type: pcm, pcm_s16 or pcm_f32)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source(audio='B, 'A), track_sensitive : bool}) -> unit where 'A is a set of tracks to be muxed into a source, 'B is a track and a track of type: pcm, pcm_s16 or pcm_f32): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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(audio='B, 'A)?, replay_metadata : bool, starting : source(audio='B, 'A) }) -> source(audio='B, 'A) where 'A is a set of tracks to be muxed into a source, 'B is a track and a track of type: pcm, pcm_s16 or pcm_f32): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
file.unlink
Deprecated: use file.remove instead.
Type:
(string) -> unit
Arguments:
(unlabeled)(of typestring)
garbage_collect
Deprecated: use runtime.gc.full_major instead
Type:
() -> unit
get_mime
Deprecated: use file.mime
Type:
(string) -> string
Arguments:
(unlabeled)(of typestring)
get_process_lines
Deprecated: use process.read.lines instead.
Type:
(?timeout : float, ?env : [string * string], ?inherit_env : bool,
?log_errors : bool, string) -> [string]
Arguments:
timeout(of typefloat, which defaults to-1.0)env(of type[string * string], which defaults to[])inherit_env(of typebool, which defaults totrue)log_errors(of typebool, which defaults totrue)(unlabeled)(of typestring)
get_process_output
Deprecated: use process.read instead.
Type:
(?timeout : float, ?env : [string * string], ?inherit_env : bool,
?log_errors : bool, string) -> string
Arguments:
timeout(of typefloat, which defaults to-1.0)env(of type[string * string], which defaults to[])inherit_env(of typebool, which defaults totrue)log_errors(of typebool, which defaults totrue)(unlabeled)(of typestring)
getenv
Deprecated: use environment.get
Type:
(?string, string) -> string
Arguments:
(unlabeled)(of typestring, which defaults to"")(unlabeled)(of typestring)
getpid
Deprecated: use getpid
Type:
() -> int
gettimeofday
Deprecated: use time instead
Type:
() -> float
gmtime
Deprecated: use time.utc instead
Type:
(float?) -> unit
Arguments:
(unlabeled)(of typefloat?)
Methods:
day(of typeint): Day of month.dst(of typebool): Daylight time savings in effect.hour(of typeint): Hours.min(of typeint): Minutes.month(of typeint): Month of year.sec(of typeint): Seconds.week_day(of typeint): Day of week (Sunday is 0 or 7, Saturday is 6).year(of typeint): Year.year_day(of typeint): Day of year, between1and366.
https.delete
Deprecated: use http.delete instead.
Type:
(?headers : [string * string], ?http_version : string?, ?redirect : bool,
?timeout : float?, ?normalize_url : bool?, string) -> unit
Arguments:
headers(of type[string * string], which defaults to[])http_version(of typestring?, which defaults tonull)redirect(of typebool, which defaults totrue)timeout(of typefloat?, which defaults to10.0)normalize_url(of typebool?, which defaults tonull)(unlabeled)(of typestring)
Methods:
headers(of type[string * string]): HTTP headers.http_version(of typestring): Version of the HTTP protocol.status_code(of typeint): Status code.status_message(of typestring): Status message.
https.get
Deprecated: use http.get instead.
Type:
(?headers : [string * string], ?http_version : string?, ?redirect : bool,
?timeout : float?, ?normalize_url : bool?, string) -> string
Arguments:
headers(of type[string * string], which defaults to[])http_version(of typestring?, which defaults tonull)redirect(of typebool, which defaults totrue)timeout(of typefloat?, which defaults to10.0)normalize_url(of typebool?, which defaults tonull)(unlabeled)(of typestring)
Methods:
headers(of type[string * string]): HTTP headers.http_version(of typestring): Version of the HTTP protocol.status_code(of typeint): Status code.status_message(of typestring): Status message.
https.head
Deprecated: use http.head instead.
Type:
(?headers : [string * string], ?http_version : string?, ?redirect : bool,
?timeout : float?, ?normalize_url : bool?, string) -> unit
Arguments:
headers(of type[string * string], which defaults to[])http_version(of typestring?, which defaults tonull)redirect(of typebool, which defaults totrue)timeout(of typefloat?, which defaults to10.0)normalize_url(of typebool?, which defaults tonull)(unlabeled)(of typestring)
Methods:
headers(of type[string * string]): HTTP headers.http_version(of typestring): Version of the HTTP protocol.status_code(of typeint): Status code.status_message(of typestring): Status message.
https.post
Deprecated: use http.post instead.
Type:
(?data : {string}, ?headers : [string * string], ?http_version : string?,
?redirect : bool, ?timeout : float?, ?normalize_url : bool?, string) ->
string
Arguments:
data(of type{string}, which defaults to"")headers(of type[string * string], which defaults to[])http_version(of typestring?, which defaults tonull)redirect(of typebool, which defaults totrue)timeout(of typefloat?, which defaults to10.0)normalize_url(of typebool?, which defaults tonull)(unlabeled)(of typestring)
Methods:
headers(of type[string * string]): HTTP headers.http_version(of typestring): Version of the HTTP protocol.status_code(of typeint): Status code.status_message(of typestring): Status message.
https.put
Deprecated: use http.put instead.
Type:
(?data : {string}, ?headers : [string * string], ?http_version : string?,
?redirect : bool, ?timeout : float?, ?normalize_url : bool?, string) ->
string
Arguments:
data(of type{string}, which defaults to"")headers(of type[string * string], which defaults to[])http_version(of typestring?, which defaults tonull)redirect(of typebool, which defaults totrue)timeout(of typefloat?, which defaults to10.0)normalize_url(of typebool?, which defaults tonull)(unlabeled)(of typestring)
Methods:
headers(of type[string * string]): HTTP headers.http_version(of typestring): Version of the HTTP protocol.status_code(of typeint): Status code.status_message(of typestring): Status message.
id
Deprecated: this function will be removed in a future release
Type:
(?id : 'a?, 'b) -> 'b
Arguments:
id(of type'a?, which defaults tonull)(unlabeled)(of type'b)
in
Deprecated: use input instead.
Type:
(?id : string?, ?start : bool, ?fallible : bool) -> source(audio=pcm('A))
Synchronization:
This source uses the PulseAudio clock as synchronization source when self_sync=true and the stream is open.
Composition:
This source uses live composition by default.
Arguments:
id(of typestring?, which defaults tonull)start(of typebool, which defaults totrue)fallible(of typebool, which defaults tofalse)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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): This source uses the PulseAudio clock as synchronization source whenself_sync=trueand the stream is open.skip(of type() -> unit): Skip to the next track.start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when source startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when source stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses live composition by default.on_leave(of type({source : source(audio=pcm('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 withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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(audio=pcm('A))?, replay_metadata : bool, starting : source(audio=pcm('A)) }) -> source(audio=pcm('A))): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
input.external
Deprecated: this function has been replaced by input.external.rawaudio.
Type:
(?id : string?, ?buffer : float, ?channels : int, ?max : float,
?restart : bool, ?restart_delay_on_error : float, ?restart_on_error : bool,
?samplerate : int, {string}) -> source(audio=pcm('a))
Composition:
This source uses file composition by default.
Arguments:
id(of typestring?, which defaults tonull)buffer(of typefloat, which defaults to2.0)channels(of typeint, which defaults to2)max(of typefloat, which defaults to10.0)restart(of typebool, which defaults totrue)restart_delay_on_error(of typefloat, which defaults to0.1)restart_on_error(of typebool, which defaults tofalse)samplerate(of typeint, which defaults to44100)(unlabeled)(of type{string})
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source(audio=pcm('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 withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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(audio=pcm('A))?, replay_metadata : bool, starting : source(audio=pcm('A)) }) -> source(audio=pcm('A))): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
input.https
Deprecated: use input.http instead
Type:
(?id : string?, ?debug : bool, ?deduplicate_metadata : bool,
?float_args : [string * float], ?format : string?,
?int_args : [string * int], ?max_buffer : float,
?metadata_filter : (([string * string]) -> [string * string])?,
?new_track_on_metadata : bool, ?on_connect : (([string * string]) -> unit)?,
?on_disconnect : (() -> unit)?, ?on_error : ((error) -> unit)?,
?on_start : (() -> unit)?, ?on_stop : (() -> unit)?, ?poll_delay : float,
?self_sync : {bool?}, ?start : bool, ?string_args : [string * string],
?timeout : float, ?trim_url : bool, ?user_agent : string, {string}) ->
source('a)
Synchronization:
This source uses the FFmpeg input stream as synchronization source when self_sync=true and connected.
Composition:
This source uses live composition by default.
Arguments:
id(of typestring?, which defaults tonull)debug(of typebool, which defaults tofalse)deduplicate_metadata(of typebool, which defaults totrue)float_args(of type[string * float], which defaults to[])format(of typestring?, which defaults tonull)int_args(of type[string * int], which defaults to[])max_buffer(of typefloat, which defaults to5.0)metadata_filter(of type(([string * string]) -> [string * string])?, which defaults tonull)new_track_on_metadata(of typebool, which defaults totrue)on_connect(of type(([string * string]) -> unit)?, which defaults tonull)on_disconnect(of type(() -> unit)?, which defaults tonull)on_error(of type((error) -> unit)?, which defaults tonull)on_start(of type(() -> unit)?, which defaults tonull)on_stop(of type(() -> unit)?, which defaults tonull)poll_delay(of typefloat, which defaults to2.0)self_sync(of type{bool?}, which defaults tonull)start(of typebool, which defaults totrue)string_args(of type[string * string], which defaults to[])timeout(of typefloat, which defaults to10.0)trim_url(of typebool, which defaults totrue)user_agent(of typestring, which defaults to"Liquidsoap/2.5.0+git@93bb67a (Unix; OCaml 5.4.0)")(unlabeled)(of type{string})
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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): This source uses the FFmpeg input stream as synchronization source whenself_sync=trueand connected.set_url(of type({string}) -> unit): Set the source's url.skip(of type() -> unit): Skip to the next track.start(of type() -> unit): Ask the source or output to start.status(of type() -> string): Return the current status of the source, either "stopped" (the source isn't trying to relay the HTTP stream), "starting" (polling task is about to begin) "polling" (attempting to connect to the HTTP stream), "connected" (connected to , buffering or playing back the stream) or "stopping" (source is stopping). stop(of type() -> unit): Ask the source or output to stop.time(of type() -> float): Get a source's time, based on its assigned clock.url(of type() -> string): Return the source's current url.
Callbacks:
on_collect(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collectedon_connect(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler when a source is connected. Its receives the list of ICY-specific headers, if available.on_disconnect(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when a source is disconnected.on_error(of type(synchronous : bool, ((error) -> unit)) -> unit): Call a given handler when an error occurs.on_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when source startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when source stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses live composition by default.on_leave(of type({source : source('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 withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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)): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
insert_metadata
Deprecated: use the insert_metadata source method
Type:
(?id : 'a?, source('b)) -> source('b)
Arguments:
id(of type'a?, which defaults tonull)(unlabeled)(of typesource('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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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:
on_leave(of type({source : source('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 withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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)): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
json
Deprecated: use json.object
Type:
() -> json
Methods:
add(of type(string, 'a) -> unit): Add or replace a newkey/valuepair to the object.remove(of type(string) -> unit): Remove a key from the object. Does not nothing if the key does not exist.stringify(of type(?compact : bool, ?json5 : bool) -> string): Render object as json string.
json_of
Deprecated: use json.stringify instead
Type:
(?compact : bool, ?json5 : bool, 'a) -> string
Arguments:
compact(of typebool, which defaults tofalse): Output compact text.json5(of typebool, which defaults tofalse): Use json5 extended spec.(unlabeled)(of type'a)
list.mem_assoc
Deprecated: use list.assoc.mem instead
Type:
('a, ['a * 'b]) -> bool where 'a is an orderable type
Arguments:
(unlabeled)(of typeanything that is an orderable type)(unlabeled)(of type['a * 'b] where 'a is an orderable type)
localtime
Deprecated: use time.local instead
Type:
(float?) -> unit
Arguments:
(unlabeled)(of typefloat?)
Methods:
day(of typeint): Day of month.dst(of typebool): Daylight time savings in effect.hour(of typeint): Hours.min(of typeint): Minutes.month(of typeint): Month of year.sec(of typeint): Seconds.week_day(of typeint): Day of week (Sunday is 0 or 7, Saturday is 6).year(of typeint): Year.year_day(of typeint): Day of year, between1and366.
map_metadata
Deprecated: use metadata.map
Type:
(?id : string?, ?update : bool, ?strip : bool?, ?insert_missing : bool?,
(([string * string]) -> [string * string]), source('a)) -> source('a)
where 'a is a set of tracks to be muxed into a source
Composition:
This source uses file composition by default.
Arguments:
id(of typestring?, which defaults to"metadata.map")update(of typebool, which defaults totrue)strip(of typebool?, which defaults tonull)insert_missing(of typebool?, which defaults tonull)(unlabeled)(of type([string * string]) -> [string * string])(unlabeled)(of typesource('a) where 'a is a set of tracks to be muxed into a source)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source('A), track_sensitive : bool}) -> unit where 'A is a set of tracks to be muxed into a source): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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 tracks to be muxed into a source): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
merge_tracks
Deprecated: use source.tracks and source
Type:
(?id : string?, source('a)) -> source('a)
where 'a is a set of tracks to be muxed into a source
Composition:
This source uses file composition by default.
Arguments:
id(of typestring?, which defaults tonull)(unlabeled)(of typesource('a) where 'a is a set of tracks to be muxed into a source)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source('A), track_sensitive : bool}) -> unit where 'A is a set of tracks to be muxed into a source): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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 tracks to be muxed into a source): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
mkavailable
Deprecated: use source.available instead.
Type:
(?id : string, ?active : {bool}, ?available : {bool}, source('a)
.{
on_leave? : ({source : source('a), track_sensitive : bool}) -> unit,
on_select? : (
{
ending : source('a)?,
replay_metadata : bool,
starting : source('a)
}) -> source('a),
replay_metadata? : {bool},
single? : bool,
track_sensitive? : {bool}
}) -> source('a)
Composition:
This source inherits composition from its effective source.
Arguments:
id(of typestring, which defaults to"mkavailable")active(of type{bool}, which defaults tofalse)available(of type{bool}, which defaults totrue)(unlabeled)(of typesource('a) .{ on_leave? : ({source : source('a), track_sensitive : bool}) -> unit, on_select? : ( { ending : source('a)?, replay_metadata : bool, starting : source('a) }) -> source('a), replay_metadata? : {bool}, single? : bool, track_sensitive? : {bool} })
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).selected(of type() -> source('A)?): Currently selected source.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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)): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
mux_audio
Deprecated: use source.mux.audio.
Type:
(?id : string?, audio : source(audio='A, 'B), source('a)) -> source(audio='A,
'a) where 'a is a set of tracks to be muxed into a source, 'A is a track
Composition:
This source uses file composition by default.
Arguments:
id(of typestring?, which defaults tonull)audio(of typesource(audio='B, 'A) where 'B is a track)(unlabeled)(of typesource('a) where 'a is a set of tracks to be muxed into a source)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source(audio='B, 'A), track_sensitive : bool}) -> unit where 'A is a set of tracks to be muxed into a source, 'B is a track): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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(audio='B, 'A)?, replay_metadata : bool, starting : source(audio='B, 'A) }) -> source(audio='B, 'A) where 'A is a set of tracks to be muxed into a source, 'B is a track): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
mux_midi
Deprecated: use source.mux.midi
Type:
(?id : string?, midi : source(midi='A, 'B), source('a)) -> source(midi='A,
'a) where 'a is a set of tracks to be muxed into a source, 'A is a track
Composition:
This source uses file composition by default.
Arguments:
id(of typestring?, which defaults tonull)midi(of typesource(midi='B, 'A) where 'B is a track)(unlabeled)(of typesource('a) where 'a is a set of tracks to be muxed into a source)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source(midi='B, 'A), track_sensitive : bool}) -> unit where 'A is a set of tracks to be muxed into a source, 'B is a track): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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(midi='B, 'A)?, replay_metadata : bool, starting : source(midi='B, 'A) }) -> source(midi='B, 'A) where 'A is a set of tracks to be muxed into a source, 'B is a track): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
mux_video
Deprecated: use source.mux.video.
Type:
(?id : string?, video : source(video='A, 'B), source('a)) -> source(video='A,
'a) where 'a is a set of tracks to be muxed into a source, 'A is a track
Composition:
This source uses file composition by default.
Arguments:
id(of typestring?, which defaults tonull)video(of typesource(video='B, 'A) where 'B is a track)(unlabeled)(of typesource('a) where 'a is a set of tracks to be muxed into a source)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source(video='B, 'A), track_sensitive : bool}) -> unit where 'A is a set of tracks to be muxed into a source, 'B is a track): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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='B, 'A)?, replay_metadata : bool, starting : source(video='B, 'A) }) -> source(video='B, 'A) where 'A is a set of tracks to be muxed into a source, 'B is a track): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
of_json
Deprecated: use json.parse instead
Type:
(default : 'a, string) -> 'a
Arguments:
default(of type'a): Default value if string cannot be parsed.(unlabeled)(of typestring)
on_blank
Deprecated: use blank.detect instead
Type:
(?id : string?, ?max_blank : {float}, ?min_noise : {float},
?start_blank : bool, ?threshold : {float}, ?track_sensitive : {bool},
(() -> unit), source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)
Composition:
This source inherits composition from its effective source.
Arguments:
id(of typestring?, which defaults tonull)max_blank(of type{float}, which defaults to20.0)min_noise(of type{float}, which defaults to0.0)start_blank(of typebool, which defaults tofalse)threshold(of type{float}, which defaults to-40.0)track_sensitive(of type{bool}, which defaults totrue)(unlabeled)(of type() -> unit)(unlabeled)(of typesource(audio=pcm('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 typeclock): The source's clockdB_levels(of type() -> [float]?): Return the detected dB level for each channel.duration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_blank(of type() -> bool): Indicate whether blank was detected.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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_blank(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when detecting a blank.on_collect(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_noise(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when noise is detected.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. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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(audio=pcm('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 withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
on_metadata
Deprecated: use the on_metadata source method
Type:
(id : 'a, source('b), (([string * string]) -> unit)) -> source('b)
Arguments:
id(of type'a)(unlabeled)(of typesource('b))(unlabeled)(of type([string * string]) -> unit)
on_track
Deprecated: use the on_track source method
Type:
(id : 'a, source('b), (([string * string]) -> unit)) -> source('b)
Arguments:
id(of type'a)(unlabeled)(of typesource('b))(unlabeled)(of type([string * string]) -> unit)
out
Deprecated: use output instead.
Type:
(source(audio=pcm('A))) -> unit
Synchronization:
This output uses the PulseAudio clock as synchronization source when self_sync=true and the stream is open. Otherwise, the synchronization follows the underlying source.
Arguments:
(unlabeled)(of typesource(audio=pcm('A)))
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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): This output uses the PulseAudio clock as synchronization source whenself_sync=trueand the stream is open. Otherwise, the synchronization follows the underlying source.shutdown(of type() -> unit): Shutdown the output.skip(of type() -> unit): Skip to the next track.start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
output.preferred
Type:
(?id : string?, ?fallible : bool, ?start : bool, source(audio=pcm('A))) ->
unit
Synchronization:
This output uses the PulseAudio clock as synchronization source when self_sync=true and the stream is open. Otherwise, the synchronization follows the underlying source.
Arguments:
id(of typestring?, which defaults tonull)fallible(of typebool, which defaults tofalse)start(of typebool, which defaults totrue)(unlabeled)(of typesource(audio=pcm('A)))
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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_started(of type() -> bool):trueif the output or source is started.is_up(of type() -> bool): Indicate that the source can be asked to produce some data at any time. This istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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): This output uses the PulseAudio clock as synchronization source whenself_sync=trueand the stream is open. Otherwise, the synchronization follows the underlying source.shutdown(of type() -> unit): Shutdown the output.skip(of type() -> unit): Skip to the next track.start(of type() -> unit): Ask the source or output to start.stop(of type() -> unit): Ask the source or output to stop.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_start(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output startson_stop(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stopson_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_wake_up(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready
playlist.once
Deprecated: this function has been replaced with playlist, setting reload_mode argument to "never" and loop to false.
Type:
(?id : string?, ?random : bool, ?reload_mode : string, ?prefetch : int,
?filter : ((request) -> bool), string) -> source('a)
Composition:
This source uses file composition by default.
Arguments:
id(of typestring?, which defaults tonull)random(of typebool, which defaults tofalse)reload_mode(of typestring, which defaults to"")prefetch(of typeint, which defaults to1)filter(of type(request) -> bool, which defaults tofun (_) -> true)(unlabeled)(of typestring)
Methods:
add(of type(request) -> bool): Add a request to the queue. Requests are resolved before being added. Returnstrueif the request was successfully added.buffered(of type() -> [string * float]): Length of buffered data.clear_last_metadata(of type() -> unit): Clear the last metadata from the source.clock(of typeclock): The source's clockcurrent(of type() -> request?): Get the request currently being played.duration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.fetch(of type() -> unit): Notify the source to queue a new request. Ifsynchronousisfalse(the default), this method returns immediately and a new request is fetched in the background. Ifsynchronousistrue, can take long to return and should usually be run in a separate thread.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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.length(of type() -> int):log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.queue(of type() -> [request]): Get the requests currently in the queue.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.reload(of type(?empty_queue : bool, ?uri : string?) -> unit):remaining(of type() -> float): Estimation of remaining time in the current track.remaining_files(of type() -> [string]):reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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):set_queue(of type([request]) -> unit): Set the queue of requests. Requests are resolved before being added to the queue. You are responsible for destroying the requests currently in the queue.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source('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 withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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)): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
playlist.reloadable
Deprecated: use playlist instead
Type:
(?id : string?, ?mime_type : string, ?mode : string,
?on_track : (() -> unit), ?prefix : string, ?reload : int,
?reload_mode : string, string) -> source('a)
Composition:
This source uses file composition by default.
Arguments:
id(of typestring?, which defaults tonull)mime_type(of typestring, which defaults to"")mode(of typestring, which defaults to"randomize")on_track(of type() -> unit, which defaults to{()})prefix(of typestring, which defaults to"")reload(of typeint, which defaults to0)reload_mode(of typestring, which defaults to"seconds")(unlabeled)(of typestring)
Methods:
add(of type(request) -> bool): Add a request to the queue. Requests are resolved before being added. Returnstrueif the request was successfully added.buffered(of type() -> [string * float]): Length of buffered data.clear_last_metadata(of type() -> unit): Clear the last metadata from the source.clock(of typeclock): The source's clockcurrent(of type() -> request?): Get the request currently being played.duration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.fetch(of type() -> unit): Notify the source to queue a new request. Ifsynchronousisfalse(the default), this method returns immediately and a new request is fetched in the background. Ifsynchronousistrue, can take long to return and should usually be run in a separate thread.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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.last_metadata(of type() -> [string * string]?): Return the last metadata from the source.length(of type() -> int):log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.queue(of type() -> [request]): Get the requests currently in the queue.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.reload(of type(?empty_queue : bool, ?uri : string?) -> unit):remaining(of type() -> float): Estimation of remaining time in the current track.remaining_files(of type() -> [string]):reset_last_metadata_on_track(of type(() -> bool).{set : (bool) -> unit}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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):set_queue(of type([request]) -> unit): Set the queue of requests. Requests are resolved before being added to the queue. You are responsible for destroying the requests currently in the queue.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source('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 withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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)): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
playlist.safe
Deprecated: use mksafe and playlist instead.
Type:
(?id : string?, ?mime_type : string, ?mode : string,
?on_track : (() -> unit), ?prefix : string, ?reload : int,
?reload_mode : string, string) -> source('a)
where 'a is a set of internal tracks
Composition:
This source inherits composition from its effective source.
Arguments:
id(of typestring?, which defaults tonull)mime_type(of typestring, which defaults to"")mode(of typestring, which defaults to"randomize")on_track(of type() -> unit, which defaults to{()})prefix(of typestring, which defaults to"")reload(of typeint, which defaults to0)reload_mode(of typestring, which defaults to"seconds")(unlabeled)(of typestring)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).selected(of type() -> source('A)? where 'A is a set of internal tracks): Currently selected source.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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 withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
quote
Deprecated: this function has been replaced by string.quote.
Type:
(string) -> string
Arguments:
(unlabeled)(of typestring)
replaygain
Deprecated: use normalize_track_gain
Type:
(?id : string?, source(audio='a, 'b)) -> source(audio='a, 'b)
where 'b is a set of tracks to be muxed into a source,
'a is a track and a track of type: pcm, pcm_s16 or pcm_f32
Composition:
This source uses file composition by default.
Arguments:
id(of typestring?, which defaults tonull)(unlabeled)(of typesource(audio='a, 'b) where 'b is a set of tracks to be muxed into a source, 'a is a track and a track of type: pcm, pcm_s16 or pcm_f32)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source(audio='B, 'A), track_sensitive : bool}) -> unit where 'A is a set of tracks to be muxed into a source, 'B is a track and a track of type: pcm, pcm_s16 or pcm_f32): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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(audio='B, 'A)?, replay_metadata : bool, starting : source(audio='B, 'A) }) -> source(audio='B, 'A) where 'A is a set of tracks to be muxed into a source, 'B is a track and a track of type: pcm, pcm_s16 or pcm_f32): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
request.create.raw
Deprecated: use request.create instead.
Type:
(?cue_in_metadata : string?, ?cue_out_metadata : string?, ?persistent : bool,
?resolve_metadata : bool, ?excluded_metadata_resolvers : [string],
?temporary : bool, string) -> request
Arguments:
cue_in_metadata(of typestring?, which defaults to"liq_cue_in")cue_out_metadata(of typestring?, which defaults to"liq_cue_out")persistent(of typebool, which defaults tofalse)resolve_metadata(of typebool, which defaults totrue)excluded_metadata_resolvers(of type[string], which defaults to[])temporary(of typebool, which defaults tofalse)(unlabeled)(of typestring)
request.dynamic.list
Deprecated: use request.dynamic instead
Type:
(?id : string?, ?available : {bool}, ?prefetch : int?,
?retry_delay : {float}, ?synchronous : bool, ?timeout : float?,
?native : bool, (() -> [request])) -> source('a)
Composition:
This source uses file composition by default.
Arguments:
id(of typestring?, which defaults tonull)available(of type{bool}, which defaults totrue)prefetch(of typeint?, which defaults tonull)retry_delay(of type{float}, which defaults to0.1)synchronous(of typebool, which defaults tofalse)timeout(of typefloat?, which defaults tonull)native(of typebool, which defaults tofalse)(unlabeled)(of type() -> [request])
Methods:
add(of type(request) -> bool): Add a request to the queue. Requests are resolved before being added. Returnstrueif the request was successfully added.buffered(of type() -> [string * float]): Length of buffered data.clear_last_metadata(of type() -> unit): Clear the last metadata from the source.clock(of typeclock): The source's clockcurrent(of type() -> request?): Get the request currently being played.duration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.fetch(of type() -> unit): Notify the source to queue a new request. Ifsynchronousisfalse(the default), this method returns immediately and a new request is fetched in the background. Ifsynchronousistrue, can take long to return and should usually be run in a separate thread.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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.queue(of type() -> [request]): Get the requests currently in the queue.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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):set_queue(of type([request]) -> unit): Set the queue of requests. Requests are resolved before being added to the queue. You are responsible for destroying the requests currently in the queue.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source('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 withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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)): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
request.ready
Deprecated: use request.resolved
Type:
(request) -> bool
Arguments:
(unlabeled)(of typerequest)
rewrite_metadata
Deprecated: this function has been replaced by metadata.map.
Type:
([string * string], ?insert_missing : bool, ?update : bool, ?strip : bool,
source('a)) -> source('a)
where 'a is a set of tracks to be muxed into a source
Composition:
This source uses file composition by default.
Arguments:
(unlabeled)(of type[string * string])insert_missing(of typebool, which defaults totrue)update(of typebool, which defaults totrue)strip(of typebool, which defaults tofalse)(unlabeled)(of typesource('a) where 'a is a set of tracks to be muxed into a source)
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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 uses file composition by default.on_leave(of type({source : source('A), track_sensitive : bool}) -> unit where 'A is a set of tracks to be muxed into a source): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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 tracks to be muxed into a source): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
run_process
Deprecated: use process.run instead
Type:
(?env : [string * string], ?inherit_env : bool, ?stdin : string,
?rwdirs : [string], ?rodirs : [string], ?network : bool?, ?timeout : float?,
string) -> string * string * (string * string)
Arguments:
env(of type[string * string], which defaults to[])inherit_env(of typebool, which defaults totrue)stdin(of typestring, which defaults to"")rwdirs(of type[string], which defaults to["default"])rodirs(of type[string], which defaults to["default"])network(of typebool?, which defaults tonull)timeout(of typefloat?, which defaults tonull)(unlabeled)(of typestring)
say_metadata
Deprecated: use source.say_metadata instead
Type:
(source('a), pattern : string) -> source('a) where 'a is an orderable type
Composition:
This source inherits composition from its effective source.
Arguments:
(unlabeled)(of typesource('a) where 'a is an orderable type)pattern(of typestring)
Methods:
buffered(of type() -> [string * float]): Length of buffered data.cancel_pending(of type() -> unit):clear_last_metadata(of type() -> unit): Clear the last metadata from the source.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.pending(of type() -> source('A)? where 'A is an orderable type):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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.seek(of type(float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).selected(of type() -> source('A)? where 'A is an orderable type): Currently selected source.self_sync(of type() -> bool): Is the source currently controlling its own real-time loop.self_sync_description(of type() -> string):set_pending(of type(source('A)?) -> unit where 'A is an orderable type):skip(of type(?cancel_pending : bool) -> unit):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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 an orderable type): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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 an orderable type): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
setenv
Deprecated: use environment.set
Type:
(string, string) -> unit
Arguments:
(unlabeled)(of typestring)(unlabeled)(of typestring)
skip_blank
Deprecated: use blank.skip instead
Type:
(?id : string?, ?threshold : float, ?max_blank : float, ?min_noise : float,
?track_sensitive : bool, source(audio=pcm('a), 'b)) -> source(audio=pcm('a),
'b)
Composition:
This source inherits composition from its effective source.
Arguments:
id(of typestring?, which defaults to"blank.skip")threshold(of typefloat, which defaults to-40.0)max_blank(of typefloat, which defaults to20.0)min_noise(of typefloat, which defaults to0.0)track_sensitive(of typebool, which defaults totrue)(unlabeled)(of typesource(audio=pcm('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 typeclock): The source's clockdB_levels(of type() -> [float]?): Return the detected dB level for each channel.duration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_blank(of type() -> bool): Indicate whether blank was detected.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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_blank(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when detecting a blank.on_collect(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_noise(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler when noise is detected.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. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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(audio=pcm('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 withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
sleep
Deprecated: use thread.pause
Type:
(float) -> unit
Arguments:
(unlabeled)(of typefloat)
source.last_metadata
Deprecated: use the last_metadata source method
Type:
(id : 'a, source('b)) -> [string * string]?
Arguments:
id(of type'a)(unlabeled)(of typesource('b))
source.on_end
Deprecated: use the on_position source method
Type:
(id : 'a, delay : {float}, source('b), ((float, [string * string]) -> unit)) ->
unit
Arguments:
id(of type'a)delay(of type{float})(unlabeled)(of typesource('b))(unlabeled)(of type(float, [string * string]) -> unit)
source.on_frame
Deprecated: use the on_frame source method
Type:
(id : 'a, ?before : bool, source('b), (() -> unit)) -> unit
Arguments:
id(of type'a)before(of typebool, which defaults totrue)(unlabeled)(of typesource('b))(unlabeled)(of type() -> unit)
source.on_offset
Deprecated: use the on_position source method
Type:
(id : 'a, ?force : bool, offset : {float},
((float, [string * string]) -> unit), source('b)) -> unit
Arguments:
id(of type'a)force(of typebool, which defaults tofalse)offset(of type{float})(unlabeled)(of type(float, [string * string]) -> unit)(unlabeled)(of typesource('b))
string.utf8.escape
Deprecated: this function has been replaced by string.escape.
Type:
(string) -> string
Arguments:
(unlabeled)(of typestring)
string_of
Deprecated: use string.
Type:
('a) -> string
Arguments:
(unlabeled)(of type'a)
string_of_float
Deprecated: use string.float.
Type:
(float) -> string
Arguments:
(unlabeled)(of typefloat)
strip_blank
Deprecated: use blank.strip instead
Type:
(?id : string?, ?max_blank : {float}, ?min_noise : {float},
?start_blank : bool, ?threshold : {float}, ?track_sensitive : {bool},
source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)
Composition:
This source inherits composition from its effective source.
Arguments:
id(of typestring?, which defaults tonull)max_blank(of type{float}, which defaults to20.0)min_noise(of type{float}, which defaults to0.0)start_blank(of typebool, which defaults tofalse)threshold(of type{float}, which defaults to-40.0)track_sensitive(of type{bool}, which defaults totrue)(unlabeled)(of typesource(audio=pcm('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 typeclock): The source's clockdB_levels(of type() -> [float]?): Return the detected dB level for each channel.duration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.http.is_blank(of type() -> bool): Indicate whether blank was detected.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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(audio=pcm('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 withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
system
Deprecated: use process.run instead.
Type:
(string) -> unit
Arguments:
(unlabeled)(of typestring)
Methods:
status(of typestring.{code : int, description : string}): Status when process ended, can be one of"exit"(the program exited, thestatuscode is then relevant),"killed"(the program was killed by signal given instatuscode),"stopped"(the program was stopped by signal given instatuscode) or"exception"(the program raised and exception detailed in thedescription).stderr(of typestring): Messages written by process on standard error stream.stdout(of typestring): Messages written by process on standard output stream.
test_process
Deprecated: use process.test instead.
Type:
(?timeout : float, ?env : [string * string], ?inherit_env : bool, string) ->
bool
Arguments:
timeout(of typefloat, which defaults to-1.0)env(of type[string * string], which defaults to[])inherit_env(of typebool, which defaults totrue)(unlabeled)(of typestring)
video.line
Deprecated: use video.add_line.
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 typestring?, which defaults tonull)alpha(of type{float}, which defaults to1.0)color(of type{int}, which defaults to0)(unlabeled)(of type{int * int})(unlabeled)(of type{int * int})(unlabeled)(of typesource(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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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 withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
video.rectangle
Deprecated: use video.add_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 typestring?, which defaults tonull)alpha(of type{float}, which defaults to1.0)color(of type{int}, which defaults to0)height(of type{int})width(of type{int})x(of type{int}, which defaults to0)y(of type{int}, which defaults to0)(unlabeled)(of typesource(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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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 withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
video.transparent
Deprecated: use video.alpha.of_color
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 typestring?, which defaults tonull)color(of typeint, which defaults to0)precision(of typefloat, which defaults to0.2)(unlabeled)(of typesource(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 typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): 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 ason_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 ifnew_trackistrue. Whenoverrideisfalse, metadata that the source provides itself takes precedence over the inserted one.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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 collectedon_frame(of type(?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. Whenbeforeistrue, callback is executed before computing the frame and after otherwiseon_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. Thebeforecallback is called before computing the frame with the checksum of the cached frame (if any,nullotherwise). 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 metadataon_position(of type(position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. Ifremainingisfalse, callback is executed when position in track is more or equal toposition. Ifremainingistrue, callback is executed when remaining time in the current track is less or equal toposition. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. Whenallow_partialistrue, if the current track ends before theoffsetposition is reached, callback is still executedon_shutdown(of type(synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts downon_track(of type(synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track markson_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 withsource(the source being left) andtrack_sensitive(trueif the ending source's last frame had a track mark, i.e. it finished naturally;falseif 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 withstarting(the incoming source) andending(the previous source, ornullwhen the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade outendingwhen non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).replay_metadata(of type{bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults totrue. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).single(of typebool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults tofalse.track_sensitive(of type{bool}): Whether this source insists on track boundaries in switch operators: whentrue, 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 hastrack_sensitiveset tofalse; otherwise it waits for the playing source to reach a track boundary. File-based sources default totrue; live network and hardware inputs default tofalse. The value is looked up at runtime from the active composition profile (source.composition.fileorsource.composition.livedepending oncomposition_type).
which
Deprecated: this function has been replaced by file.which.
Type:
(string) -> string
Arguments:
(unlabeled)(of typestring)