Source / Input
blank
Produce silence and blank images.
Type:
(?id : string?, ?duration : {float}) -> source('a)
where 'a is a set of internal tracks
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.duration(of type{float}, which defaults to-1.0): Duration of blank tracks in seconds, Negative value means forever.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
debug.is_ready
A source that always produces an empty frame when the underlying source is not ready, used for testing and debugging.
Type:
(?id : string?, source('a)) -> source('a)
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.(unlabeled)(of typesource('a))
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
This function is experimental.
input
Input an audio stream using the default operator.
Type:
(?id : string?, ?start : bool, ?on_start : (() -> unit),
?on_stop : (() -> unit), ?fallible : bool) -> source(audio=pcm('A))
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.start(of typebool, which defaults totrue): Automatically start outputting whenever possible. Iftrue, an infallible (normal) output will start outputting as soon as it is created, and a fallible output will (re)start as soon as its source becomes available for streaming.on_start(of type() -> unit, which defaults to{()}): Callback executed when outputting starts.on_stop(of type() -> unit, which defaults to{()}): Callback executed when outputting stops.fallible(of typebool, which defaults tofalse): Allow the child source to fail, in which case the output will be (temporarily) stopped.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.shutdown(of type() -> unit): Shutdown the output or source.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.
input.alsa
Stream from an ALSA input device.
Type:
(?id : string?, ?buffer_size : float?, ?device : string, ?fallible : bool,
?on_start : (() -> unit), ?on_stop : (() -> unit), ?self_sync : bool,
?start : bool) -> source(audio=pcm('a))
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.buffer_size(of typefloat?, which defaults tonull): ALSA buffer size in seconds. Defaults to frame duration whennull.device(of typestring, which defaults to"default"): Alsa device to usefallible(of typebool, which defaults tofalse): Allow the source to fail. If set tofalse,startmust betrueandstopmethod raises an error.on_start(of type() -> unit, which defaults to{()}): Callback executed when input starts.on_stop(of type() -> unit, which defaults to{()}): Callback executed when input stops.self_sync(of typebool, which defaults totrue): Mark the source as being synchronized by the ALSA driver.start(of typebool, which defaults totrue): Start input as soon as it is available.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.shutdown(of type() -> unit): Shutdown the output or source.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.
input.external.avi
Stream data from an external application.
Type:
(?id : string?, ?buffer : float, ?max : float, ?restart : bool,
?restart_on_error : bool, {string}) -> source(audio=pcm('a),
video=canvas('b))
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.buffer(of typefloat, which defaults to1.0): Duration of the pre-buffered data.max(of typefloat, which defaults to10.0): Maximum duration of the buffered data.restart(of typebool, which defaults totrue): Restart process when exited.restart_on_error(of typebool, which defaults tofalse): Restart process when exited with error.(unlabeled)(of type{string}): Command to execute.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
This function is experimental.
input.external.rawaudio
Stream raw PCM data (interleaved signed 16 bits little endian integers) from an external application.
Type:
(?id : string?, ?buffer : float, ?channels : int, ?max : float,
?restart : bool, ?restart_on_error : bool, ?samplerate : int, {string}) ->
source(audio=pcm('a))
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.buffer(of typefloat, which defaults to2.0): Duration of the pre-buffered data.channels(of typeint, which defaults to2): Number of channels.max(of typefloat, which defaults to10.0): Maximum duration of the buffered data.restart(of typebool, which defaults totrue): Restart process when exited.restart_on_error(of typebool, which defaults tofalse): Restart process when exited with error.samplerate(of typeint, which defaults to44100): Samplerate.(unlabeled)(of type{string}): Command to execute.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
input.external.rawvideo
Stream data from an external application.
Type:
(?id : string?, ?buffer : float, ?max : float, ?restart : bool,
?restart_on_error : bool, {string}) -> source(video=canvas('a))
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.buffer(of typefloat, which defaults to1.0): Duration of the pre-buffered data.max(of typefloat, which defaults to10.0): Maximum duration of the buffered data.restart(of typebool, which defaults totrue): Restart process when exited.restart_on_error(of typebool, which defaults tofalse): Restart process when exited with error.(unlabeled)(of type{string}): Command to execute.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
This function is experimental.
input.external.wav
Stream WAV data from an external application.
Type:
(?id : string?, ?buffer : float, ?max : float, ?restart : bool,
?restart_on_error : bool, {string}) -> source(audio=pcm('a))
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.buffer(of typefloat, which defaults to2.0): Duration of the pre-buffered data.max(of typefloat, which defaults to10.0): Maximum duration of the buffered data.restart(of typebool, which defaults totrue): Restart process when exited.restart_on_error(of typebool, which defaults tofalse): Restart process when exited with error.(unlabeled)(of type{string}): Command to execute.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
input.ffmpeg
Create a stream using ffmpeg
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 : (() -> unit),
?on_disconnect : (() -> unit),
?on_error : ((error
.{
kind : string,
message : string,
trace : [
{
cstart : int,
cstop : int,
filename : string,
lstart : int,
lstop : int,
to_string : (?prefix : string) -> string
}]
}) -> unit),
?on_start : (() -> unit), ?on_stop : (() -> unit), ?poll_delay : float,
?self_sync : {bool}, ?start : bool, ?string_args : [string * string],
?trim_url : bool, {string}) -> source('a)
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.debug(of typebool, which defaults tofalse): Run in debugging mode, not catching some exceptions.deduplicate_metadata(of typebool, which defaults totrue): Prevent duplicated metadata.float_args(of type[string * float], which defaults to[])format(of typestring?, which defaults tonull): Force a specific input format. Autodetected when passed a null argumentint_args(of type[string * int], which defaults to[])max_buffer(of typefloat, which defaults to5.0): Maximum uration of buffered datametadata_filter(of type(([string * string]) -> [string * string])?, which defaults tonull): Metadata filter function. Returned metadata are set a metadata. Default: filterid3v2_privmetadata.new_track_on_metadata(of typebool, which defaults totrue): Treat new metadata as new track.on_connect(of type() -> unit, which defaults to{()}): Function to execute when a source is connected.on_disconnect(of type() -> unit, which defaults to{()}): Function to execute when a source is disconnectedon_error(of type(error .{ kind : string, message : string, trace : [ { cstart : int, cstop : int, filename : string, lstart : int, lstop : int, to_string : (?prefix : string) -> string }] }) -> unit, which defaults tofun (_) -> ()): Callback executed when an error occurs.on_start(of type() -> unit, which defaults to{()}): Callback executed when input starts.on_stop(of type() -> unit, which defaults to{()}): Callback executed when input stops.poll_delay(of typefloat, which defaults to2.0): Polling delay when trying to connect to the stream.self_sync(of type{bool}, which defaults tofalse): Should the source control its own timing? Set totrueif you are having synchronization issues. Should befalsefor most typical cases.start(of typebool, which defaults totrue): Start input as soon as it is available.string_args(of type[string * string], which defaults to[])trim_url(of typebool, which defaults totrue): Trim input URL.(unlabeled)(of type{string}): URL to decode.
Methods:
buffer_length(of type() -> float): Get the buffer's length in seconds.buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.set_url(of type({string}) -> unit): Set the source's url.shutdown(of type() -> unit): Shutdown the output or source.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.
input.harbor
Create a source that receives a http/icecast stream and forwards it as a stream.
Type:
(?id : string?,
?auth : (({address : string, password : string, user : string}) -> bool)?,
?buffer : float, ?debug : bool, ?dumpfile : string?, ?icy : bool,
?icy_metadata_charset : string?, ?logfile : string?, ?max : float,
?metadata_charset : string?, ?on_connect : (([string * string]) -> unit),
?on_disconnect : (() -> unit), ?password : string, ?port : int,
?replay_metadata : bool, ?timeout : float, ?transport : http_transport,
?user : string, string) -> source('a)
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.auth(of type(({address : string, password : string, user : string}) -> bool)?, which defaults tonull): Authentication function. Receives a record with:user,passwordandaddress(client network address) and returnstrueif the user should be granted access for this login. Override any other method if used.buffer(of typefloat, which defaults to12.0): Duration of the pre-buffered data (in seconds). Default value is set to make it possible to usecrossfadetransitions withinput.harbor. You might be able to reduce it but, in this case, make sure to not use the operator withcrossfadeor make sure that it has enough buffered data for it.debug(of typebool, which defaults tofalse): Run in debugging mode by not catching some exceptions.dumpfile(of typestring?, which defaults tonull): Dump stream to file, for debugging purpose. Disabled if null.icy(of typebool, which defaults tofalse): Enable ICY (shoutcast) protocol.icy_metadata_charset(of typestring?, which defaults tonull): ICY (shoutcast) metadata charset. Guessed if null. Default for shoutcast is ISO-8859-1. Set to that value if all your clients send metadata using this charset and automatic detection is not working for you.logfile(of typestring?, which defaults tonull): Log buffer status to file, for debugging purpose. Disabled if null.max(of typefloat, which defaults to20.0): Maximum duration of the buffered data (in seconds).metadata_charset(of typestring?, which defaults tonull): Metadata charset for non-ICY (shoutcast) source protocols. Guessed if null.on_connect(of type([string * string]) -> unit, which defaults tofun (_) -> ()): Function to execute when a source is connected. Its receives the list of headers, of the form: (on_disconnect(of type() -> unit, which defaults to{()}): Functions to execute when a source is disconnectedpassword(of typestring, which defaults to"hackme"): Source password.port(of typeint, which defaults to8005): Port used to connect to the source.replay_metadata(of typebool, which defaults tofalse): Replay last known metadata when switching back to this source. This helps when source has dropped due to temporary connection issues.timeout(of typefloat, which defaults to30.0): Timeout for source connectionn.transport(of typehttp_transport, which defaults to<unix_transport>): Http transport. Usehttp.transport.sslorhttp.transport.secure_transport, when available, to enable HTTPS outputuser(of typestring, which defaults to"source"): Source user.(unlabeled)(of typestring): Mountpoint to look for.
Methods:
buffer_length(of type() -> float): Length of the buffer (in seconds).buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockconnected_client(of type() -> string?): Returns the address of the client currently connected, if there is one.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.shutdown(of type() -> unit): Shutdown the output or source.skip(of type() -> unit): Skip to the next track.status(of type() -> string): Current status of the input.stop(of type() -> unit): Disconnect the client currently connected to the harbor. Does nothing if no client is connected.time(of type() -> float): Get a source's time, based on its assigned clock.
input.hls
Play an HLS stream.
Type:
(?id : string?, {string}) -> source('A)
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.(unlabeled)(of type{string}): Playlist URI.
Methods:
buffer_length(of type() -> float): Get the buffer's length in seconds.buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.set_url(of type({string}) -> unit): Set the source's url.shutdown(of type() -> unit): Shutdown the output or source.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.
input.hls.native
Play an HLS stream.
Type:
(?id : string?, ?reload : float, string) -> source('a)
where 'a is a set of tracks to be muxed into a source
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.reload(of typefloat, which defaults to10.0): How often (in seconds) the playlist should be reloaded.(unlabeled)(of typestring): Playlist URI.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
This function is experimental.
input.http
Create a http stream using ffmpeg
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
.{
kind : string,
message : string,
trace : [
{
cstart : int,
cstop : int,
filename : string,
lstart : int,
lstop : int,
to_string : (?prefix : string) -> string
}]
}) -> 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)
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.debug(of typebool, which defaults tofalse): Run in debugging mode, not catching some exceptions.deduplicate_metadata(of typebool, which defaults totrue): Prevent duplicated metadata.float_args(of type[string * float], which defaults to[])format(of typestring?, which defaults tonull): Force a specific input format. Autodetected when passed a null argumentint_args(of type[string * int], which defaults to[])max_buffer(of typefloat, which defaults to5.0): Maximum uration of buffered datametadata_filter(of type(([string * string]) -> [string * string])?, which defaults tonull): Metadata filter function. Returned metadata are set a metadata. Default: filterid3v2_privmetadata.new_track_on_metadata(of typebool, which defaults totrue): Treat new metadata as new track.on_connect(of type([string * string]) -> unit, which defaults tofun (_) -> ()): Function to execute when a source is connected. Its receives the list of ICY-specific headers, if available.on_disconnect(of type() -> unit, which defaults to{()}): Function to execute when a source is disconnectedon_error(of type(error .{ kind : string, message : string, trace : [ { cstart : int, cstop : int, filename : string, lstart : int, lstop : int, to_string : (?prefix : string) -> string }] }) -> unit, which defaults tofun (_) -> ()): Callback executed when an error occurs.on_start(of type() -> unit, which defaults to{()}): Callback executed when input starts.on_stop(of type() -> unit, which defaults to{()}): Callback executed when input stops.poll_delay(of typefloat, which defaults to2.0): Polling delay when trying to connect to the stream.self_sync(of type{bool?}, which defaults tonull): Should the source control its own timing? Ifnull, the source will control its latency if it can be detected that it is connecting to anicecastorshoutcastserver. Otherwise, seeinput.ffmpegfor more details about this option.start(of typebool, which defaults totrue): Start input as soon as it is available.string_args(of type[string * string], which defaults to[])timeout(of typefloat, which defaults to10.0): Timeout for source connection.trim_url(of typebool, which defaults totrue): Trim input URL.user_agent(of typestring, which defaults to"Liquidsoap/2.3.3 (Unix; OCaml 4.14.2)"): User agent.(unlabeled)(of type{string}): URL to decode.
Methods:
buffer_length(of type() -> float): Get the buffer's length in seconds.buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.set_url(of type({string}) -> unit): Set the source's url.shutdown(of type() -> unit): Shutdown the output or source.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.
input.jack
Get stream from jack.
Type:
(?id : string?, ?fallible : bool, ?on_start : (() -> unit),
?on_stop : (() -> unit), ?self_sync : bool, ?server : string, ?start : bool) ->
source(audio=pcm('a))
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.fallible(of typebool, which defaults tofalse): Allow the source to fail. If set tofalse,startmust betrueandstopmethod raises an error.on_start(of type() -> unit, which defaults to{()}): Callback executed when input starts.on_stop(of type() -> unit, which defaults to{()}): Callback executed when input stops.self_sync(of typebool, which defaults totrue): Mark the source as being synchronized by the jack server.server(of typestring, which defaults to""): Jack server to connect to.start(of typebool, which defaults totrue): Start input as soon as it is available.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.shutdown(of type() -> unit): Shutdown the output or source.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.
input.keyboard.sdl
Play notes from the keyboard.
Type:
(?id : string?, ?velocity : float) -> source(midi=midi('a))
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.velocity(of typefloat, which defaults to0.8): Velocity of notes.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
This function is experimental.
input.oss
Stream from an OSS input device.
Type:
(?id : string?, ?device : string, ?fallible : bool, ?on_start : (() -> unit),
?on_stop : (() -> unit), ?self_sync : bool, ?start : bool) ->
source(audio=pcm('a))
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.device(of typestring, which defaults to"/dev/dsp"): OSS device to use.fallible(of typebool, which defaults tofalse): Allow the source to fail. If set tofalse,startmust betrueandstopmethod raises an error.on_start(of type() -> unit, which defaults to{()}): Callback executed when input starts.on_stop(of type() -> unit, which defaults to{()}): Callback executed when input stops.self_sync(of typebool, which defaults totrue): Mark the source as being synchronized by the OSS driver.start(of typebool, which defaults totrue): Start input as soon as it is available.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.shutdown(of type() -> unit): Shutdown the output or source.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.
input.portaudio
Stream from a portaudio input device.
Type:
(?id : string?, ?buflen : int, ?device_id : int?, ?fallible : bool,
?latency : float?, ?on_start : (() -> unit), ?on_stop : (() -> unit),
?self_sync : bool, ?start : bool) -> source(audio=pcm('a))
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.buflen(of typeint, which defaults to256): Length of a buffer in samples.device_id(of typeint?, which defaults tonull): Device ID. Uses default device ifnull.fallible(of typebool, which defaults tofalse): Allow the source to fail. If set tofalse,startmust betrueandstopmethod raises an error.latency(of typefloat?, which defaults tonull): Device latency. Only used when specifying device ID.on_start(of type() -> unit, which defaults to{()}): Callback executed when input starts.on_stop(of type() -> unit, which defaults to{()}): Callback executed when input stops.self_sync(of typebool, which defaults totrue): Mark the source as being synchronized by the portaudio driver.start(of typebool, which defaults totrue): Start input as soon as it is available.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.shutdown(of type() -> unit): Shutdown the output or source.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.
input.pulseaudio
Stream from a pulseaudio input device.
Type:
(?id : string?, ?client : string, ?device : string?, ?fallible : bool,
?on_error : ((string) -> unit), ?on_start : (() -> unit),
?on_stop : (() -> unit), ?retry_delay : float, ?self_sync : bool,
?start : bool) -> source(audio=pcm('a))
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.client(of typestring, which defaults to"liquidsoap")device(of typestring?, which defaults tonull): Device to use. Uses default if set tonull.fallible(of typebool, which defaults totrue): Allow the source to fail. If set tofalse,startmust betrueandstopmethod raises an error.on_error(of type(string) -> unit, which defaults tofun (_) -> ()): Function executed when an operation with the pulseaudio server returns an error.on_start(of type() -> unit, which defaults to{()}): Callback executed when input starts.on_stop(of type() -> unit, which defaults to{()}): Callback executed when input stops.retry_delay(of typefloat, which defaults to1.0): When fallible, time to wait before trying to connect again.self_sync(of typebool, which defaults totrue): Mark the source as being synchronized by the pulseaudio driver.start(of typebool, which defaults totrue): Start input as soon as it is available.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.shutdown(of type() -> unit): Shutdown the output or source.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.
input.rtmp
Read an RTMP stream.
Type:
(?id : string?, ?max_buffer : float, ?listen : bool, {string}) -> source('a)
Arguments:
id(of typestring?, which defaults tonull)max_buffer(of typefloat, which defaults to5.0): Maximum data buffer in secondslisten(of typebool, which defaults totrue): Act as a RTMP server and wait for incoming connection(unlabeled)(of type{string}): URL to read RTMP from, in the formrtmp://IP:PORT/ENDPOINT
Methods:
buffer_length(of type() -> float): Get the buffer's length in seconds.buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.set_url(of type({string}) -> unit): Set the source's url.shutdown(of type() -> unit): Shutdown the output or source.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.
input.srt
Receive a SRT stream from a distant agent.
Type:
(?id : string?, ?bind_address : string, ?connection_timeout : float?,
?content_type : string, ?dump : string, ?enforced_encryption : bool?,
?host : string, ?ipv6only : bool?,
?listen_callback : ((hs_version : int, peeraddr : string,
streamid : string?, srt_socket) -> bool)?,
?max : float, ?messageapi : bool, ?mode : string,
?on_connect : (() -> unit), ?on_disconnect : (() -> unit),
?on_socket : ((mode : string, srt_socket) -> unit)?,
?on_start : (() -> unit), ?on_stop : (() -> unit), ?passphrase : string?,
?payload_size : int, ?pbkeylen : int?, ?polling_delay : float, ?port : int,
?prefer_address : string?, ?read_timeout : float?, ?self_sync : bool,
?start : bool, ?streamid : string?, ?write_timeout : float?) -> source('a)
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.bind_address(of typestring, which defaults to"0.0.0.0"): Address to bind on the local machine. Used only in listener modeconnection_timeout(of typefloat?, which defaults tonull): Timeout, in seconds, after which initial connection operations are aborted if no data was received. Uses library's default ifnull. Used only inclientmode.content_type(of typestring, which defaults to"application/ffmpeg"): Content-Type (mime type) used to find a decoder for the input stream.dump(of typestring, which defaults to""): Dump received data to the given file for debugging. Unused is empty.enforced_encryption(of typebool?, which defaults tonull): Enforces that both connection parties have the same passphrase set, or both do not set the passphrase, otherwise the connection is rejected.host(of typestring, which defaults to"localhost"): Address to connect to. Used only in caller mode.ipv6only(of typebool?, which defaults tonull): Iftrueandmodeis set tolisten, only ipv6 connections are accepted. Whennull, defaults totruewhen thebind_addressis a ipv6 address and system defaults otherwise.listen_callback(of type((hs_version : int, peeraddr : string, streamid : string?, srt_socket) -> bool)?, which defaults tonull): Callback used to decide whether to accept new incoming connections. Used in listener mode only.max(of typefloat, which defaults to10.0): Maximum duration of the buffered data.messageapi(of typebool, which defaults totrue): Use message apimode(of typestring, which defaults to"listener"): Mode to operate on. One of:"listener"(waits for connection to come in) or"caller"(initiate connection to a remote server)on_connect(of type() -> unit, which defaults to{()}): Function to execute when connected.on_disconnect(of type() -> unit, which defaults to{()}): Function to execute when disconnectedon_socket(of type((mode : string, srt_socket) -> unit)?, which defaults tonull): Callback executed when a new SRT socket is created to set additional options, add monitoring, etc.modeshould be one of:"connect"(socket created before connecting to a remote address),"listen"(socket created before binding for receiving new incoming connections),"incoming"(socket received as incoming connection) or"close"(socket is about to closed).on_start(of type() -> unit, which defaults to{()}): Callback executed when input starts.on_stop(of type() -> unit, which defaults to{()}): Callback executed when input stops.passphrase(of typestring?, which defaults tonull): When set to a non-empty string, this option enables encryption and sets the passphrase for it. Seelibsrtdocumentation for more details.payload_size(of typeint, which defaults to1316): Payload size.pbkeylen(of typeint?, which defaults tonull): Set encryption key length. Seelibsrtdocumentation for more details.polling_delay(of typefloat, which defaults to2.0): Delay between connection attempts. Used only in caller mode.port(of typeint, which defaults to8000): Port to bind on the local machine (listener mode) or to connect to (caller mode). The termportas used in SRT is occasionally identical to the termUDP port. However SRT offers more flexibility than UDP because it manages ports as its own resources. For example, one port may be shared between various services.prefer_address(of typestring?, which defaults tonull): Preferred address type when resolving hostnames. One of:"system","ipv4"or"ipv6". Defaults to globalsrt.prefer_connectionsettings whennull.read_timeout(of typefloat?, which defaults to1.0): Timeout, in seconds, after which read operations are aborted if no data was received, indefinite ifnull.self_sync(of typebool, which defaults totrue):trueif the source controls its own latency (i.e. the SRT stream is inlivemode),falseotherwise (i.e. the stream is infilemode.start(of typebool, which defaults totrue): Start input as soon as it is available.streamid(of typestring?, which defaults tonull): Setstreamid. This value can be retrieved by the listener side when connecting to it. Used in caller mode only.write_timeout(of typefloat?, which defaults to1.0): Timeout, in seconds, after which write operations are aborted if no data was received, indefinite ifnull.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockconnect(of type() -> unit): In sender mode, connect to remote server. In listener mode, setup listening socket.disconnect(of type() -> unit): Disconnect all connected socket.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.shutdown(of type() -> unit): Shutdown the output or source.skip(of type() -> unit): Skip to the next track.sockets(of type() -> [string * srt_socket]): List of(connected_address, connected_socket)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.
input.v4l2
Stream from a video4linux2 input device, such as a webcam.
Type:
(?id : string?, ?max_buffer : float, ?device : string) ->
source(video=canvas('a))
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.max_buffer(of typefloat, which defaults to0.5): Maximum data buffer in secondsdevice(of typestring, which defaults to"/dev/video0"): V4L2 device to use.
native.request.dynamic
Play request dynamically created by a given function.
Type:
(?id : string?, ?available : {bool}, ?prefetch : int?,
?retry_delay : {float}, ?synchronous : bool, ?timeout : float?,
?native : bool, (() -> request?)) -> source('a)
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.available(of type{bool}, which defaults totrue): Whether some new requests are available (when set to false, it stops after current playing request).prefetch(of typeint?, which defaults tonull): How many requests should be queued in advance.retry_delay(of type{float}, which defaults to0.1): Retry after a given time (in seconds) when callback returnsnullor an error occurs while resolving a returned request.synchronous(of typebool, which defaults tofalse): Iftrue, new requests are prepared as needed instead of using an asynchronous queue.timeout(of typefloat?, which defaults tonull): Timeout (in sec.) to resolve the request. Defaults tosettings.request.timeoutwhennull.native(of typebool, which defaults tofalse)(unlabeled)(of type() -> request?)
Methods:
add(of type(request) -> bool):buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockcurrent(of type() -> request?):current_source(of type() -> source('A)?): Return the source currently selected.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() -> bool):id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.prepare(of type(source('A)) -> unit): Prepare a source that will be returned later.queue(of type() -> [request]):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.set_queue(of type([request]) -> unit):skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
noise
Generate audio/video noise source.
Type:
(?id : string?, ?duration : float?) -> source('a)
where 'a is a set of internal tracks
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.duration(of typefloat?, which defaults tonull): Duration in seconds (nullmeans infinite).
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
playlist
Read a playlist or a directory and play all files.
Type:
(?id : string?, ?check_next : ((request) -> bool)?, ?prefetch : int?,
?loop : bool, ?max_fail : int, ?mime_type : string?, ?mode : string,
?native : bool, ?on_done : (() -> unit), ?on_fail : (() -> [string])?,
?on_reload : ((string) -> unit), ?prefix : string, ?reload : int,
?reload_mode : string, ?timeout : float?, ?cue_in_metadata : string?,
?cue_out_metadata : string?, ?register_server_commands : bool, string) ->
source('a)
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.check_next(of type((request) -> bool)?, which defaults tonull): Function used to filter next tracks. A candidate track is only validated if the function returns true on it. The function is called before resolution, hence metadata will only be available for requests corresponding to local files. This is typically used to avoid repetitions, but be careful: if the function rejects all attempts, the playlist will enter into a consuming loop and stop playing anything.prefetch(of typeint?, which defaults tonull): How many requests should be queued in advance.loop(of typebool, which defaults totrue): Loop on the playlist.max_fail(of typeint, which defaults to10): When this number of requests fail to resolve, the whole playlists is considered as failed andon_failis called.mime_type(of typestring?, which defaults tonull): Default MIME type for the playlist.nullmeans automatic detection.mode(of typestring, which defaults to"randomize"): Play the files in the playlist either in the order ("normal" mode), or shuffle the playlist each time it is loaded, and play it in this order for a whole round ("randomize" mode), or pick a random file in the playlist each time ("random" mode).native(of typebool, which defaults tofalse): Use native implementation.on_done(of type() -> unit, which defaults to{()}): Function executed when the playlist is finished.on_fail(of type(() -> [string])?, which defaults tonull): Function executed when too many requests failed and returning the contents of a fixed playlist.on_reload(of type(string) -> unit, which defaults tofun (_) -> ()): Callback called after playlist has reloaded.prefix(of typestring, which defaults to""): Add a constant prefix to all requests. Useful for passing extra information using annotate, or for resolution through a particular protocol, such as replaygain.reload(of typeint, which defaults to0): Amount of time (in seconds or rounds), when applicable, before which the playlist is reloaded; 0 means never.reload_mode(of typestring, which defaults to"seconds"): Unit of the reload parameter, either "never" (never reload the playlist), "rounds", "seconds" or "watch" (reload the file whenever it is changed).timeout(of typefloat?, which defaults tonull): Timeout (in sec.) to resolve the request. Defaults tosettings.request.timeoutwhennull.cue_in_metadata(of typestring?, which defaults to"liq_cue_in"): Metadata for cue in points. Disabled ifnull.cue_out_metadata(of typestring?, which defaults to"liq_cue_out"): Metadata for cue out points. Disabled ifnull.register_server_commands(of typebool, which defaults totrue): Register corresponding server commands(unlabeled)(of typestring): Playlist URI.
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.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() -> bool): Try feeding the queue with a new request. Returnstrueif successful. This method can take long to return and should usually be run in a separate thread.id(of type() -> string): Identifier of the source.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): Length of the of the playlist (the number of songs it contains).log(of type{level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from1to5.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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): Reload the playlist.remaining(of type() -> float): Estimation of remaining time in the current track.remaining_files(of type() -> [string]): Songs remaining to be played.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.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.
playlist.list
Play a list of files.
Type:
(?id : string?, ?check_next : ((request) -> bool)?, ?prefetch : int?,
?loop : bool, ?mode : string, ?native : bool, ?on_loop : (() -> unit),
?on_done : (() -> unit), ?max_fail : int, ?on_fail : (() -> [string])?,
?timeout : float?, ?cue_in_metadata : string?, ?cue_out_metadata : string?,
[string]) -> source('a)
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.check_next(of type((request) -> bool)?, which defaults tonull): Function used to filter next tracks. A candidate track is only validated if the function returns true on it. The function is called before resolution, hence metadata will only be available for requests corresponding to local files. This is typically used to avoid repetitions, but be careful: if the function rejects all attempts, the playlist will enter into a consuming loop and stop playing anything.prefetch(of typeint?, which defaults tonull): How many requests should be queued in advance.loop(of typebool, which defaults totrue): Loop on the playlist.mode(of typestring, which defaults to"normal"): Play the files in the playlist either in the order ("normal" mode), or shuffle the playlist each time it is loaded, and play it in this order for a whole round ("randomize" mode), or pick a random file in the playlist each time ("random" mode).native(of typebool, which defaults tofalse): Use native implementation, when available.on_loop(of type() -> unit, which defaults to{()}): Function executed when the playlist is about to loop.on_done(of type() -> unit, which defaults to{()}): Function executed when the playlist is finished.max_fail(of typeint, which defaults to10): When this number of requests fail to resolve, the whole playlists is considered as failed andon_failis called.on_fail(of type(() -> [string])?, which defaults tonull): Function executed when too many requests failed and returning the contents of a fixed playlist.timeout(of typefloat?, which defaults tonull): Timeout (in sec.) to resolve the request. Defaults tosettings.request.timeoutwhennull.cue_in_metadata(of typestring?, which defaults to"liq_cue_in"): Metadata for cue in points. Disabled ifnull.cue_out_metadata(of typestring?, which defaults to"liq_cue_out"): Metadata for cue out points. Disabled ifnull.(unlabeled)(of type[string]): Playlist.
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.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() -> bool): Try feeding the queue with a new request. Returnstrueif successful. This method can take long to return and should usually be run in a separate thread.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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, [string]) -> unit): Reload the playlist with given list of songs.remaining(of type() -> float): Estimation of remaining time in the current track.remaining_files(of type() -> [string]): Songs remaining to be played.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.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.
request.dynamic
Play request dynamically created by a given function.
Type:
(?id : string?, ?available : {bool}, ?prefetch : int?,
?retry_delay : {float}, ?synchronous : bool, ?timeout : float?,
?native : bool, (() -> request?)) -> source('a)
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.available(of type{bool}, which defaults totrue): Whether some new requests are available (when set to false, it stops after current playing request).prefetch(of typeint?, which defaults tonull): How many requests should be queued in advance.retry_delay(of type{float}, which defaults to0.1): Retry after a given time (in seconds) when callback returnsnullor an error occurs while resolving a returned request.synchronous(of typebool, which defaults tofalse): Iftrue, new requests are prepared as needed instead of using an asynchronous queue.timeout(of typefloat?, which defaults tonull): Timeout (in sec.) to resolve the request. Defaults tosettings.request.timeoutwhennull.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.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() -> bool): Try feeding the queue with a new request. Returnstrueif successful. This method can take long to return and should usually be run in a separate thread.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.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.
request.once
Play a request once and become unavailable.
Type:
(?id : string?, ?timeout : float?, request) -> source('a)
Arguments:
id(of typestring?, which defaults to"request.once")timeout(of typefloat?, which defaults tonull): Timeout in seconds for resolving the request.(unlabeled)(of typerequest): Request to play.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.request(of typerequest):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`.resolve(of type() -> bool):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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
request.single
Loop on a request. It never fails if the request is static, meaning that it can be fetched once. Typically, http, ftp, say requests are static, and time is not.
Type:
(?id : string?, ?prefetch : int?, ?timeout : float?, ?fallible : bool?,
{request}) -> source('a)
Arguments:
id(of typestring?, which defaults to"request.single")prefetch(of typeint?, which defaults tonull): How many requests should be queued in advance.timeout(of typefloat?, which defaults tonull): Timeout (in sec.) to resolve the request.fallible(of typebool?, which defaults tonull): Enforce fallibility of the request.(unlabeled)(of type{request}): Request
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
saw
Generate a saw wave.
Type:
(?id : string?, ?amplitude : {float}, ?duration : float?, ?{float}) ->
source(audio=pcm*)
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.amplitude(of type{float}, which defaults to1.0): Maximal value of the waveform.duration(of typefloat?, which defaults tonull): Duration in seconds (nullmeans infinite).(unlabeled)(of type{float}, which defaults to440.0): Frequency of the saw.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
sine
Generate a sine wave.
Type:
(?id : string?, ?amplitude : {float}, ?duration : float?, ?{float}) ->
source(audio=pcm*)
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.amplitude(of type{float}, which defaults to1.0): Maximal value of the waveform.duration(of typefloat?, which defaults tonull): Duration in seconds (nullmeans infinite).(unlabeled)(of type{float}, which defaults to440.0): Frequency of the sine.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
single
Loop on a URI. It never fails if the request is static, meaning that it can be fetched once. Typically, http, ftp, say requests are static, and time is not.
Type:
(?prefetch : int?, ?timeout : float?, ?id : string?, ?fallible : bool,
?cue_in_metadata : string?, ?cue_out_metadata : string?, string) ->
source('a)
Arguments:
prefetch(of typeint?, which defaults tonull): How many requests should be queued in advance.timeout(of typefloat?, which defaults tonull): Timeout (in sec.) to resolve the request.id(of typestring?, which defaults to"single")fallible(of typebool, which defaults tofalse): Enforce fallibility of the request.cue_in_metadata(of typestring?, which defaults to"liq_cue_in"): Metadata for cue in points. Disabled ifnull.cue_out_metadata(of typestring?, which defaults to"liq_cue_out"): Metadata for cue out points. Disabled ifnull.(unlabeled)(of typestring): URI where to find the file
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
source
Create a source that muxes the given tracks.
Type:
(?id : string?, 'a.{metadata? : metadata, track_marks? : track_marks}) ->
source('a) where 'a is a set of tracks to be muxed into a source
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.(unlabeled)(of type'a.{metadata? : metadata, track_marks? : track_marks} where 'a is a set of tracks to be muxed into a source): Tracks to mux
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
source.fail
A source that does not produce anything. No silence, no track at all.
Type:
(?id : string?) -> source('a)
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
source.fail.init
A source that errors during its initialization phase, used for testing and debugging.
Type:
(?id : string?) -> source('a)
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
This function is experimental.
square
Generate a square wave.
Type:
(?id : string?, ?amplitude : {float}, ?duration : float?, ?{float}) ->
source(audio=pcm*)
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.amplitude(of type{float}, which defaults to1.0): Maximal value of the waveform.duration(of typefloat?, which defaults tonull): Duration in seconds (nullmeans infinite).(unlabeled)(of type{float}, which defaults to440.0): Frequency of the square.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
video.testsrc
Generate a test video.
Type:
(?id : string?, ?height : int, ?width : int) -> source('a)
where 'a is a set of internal tracks
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.height(of typeint, which defaults to-1)width(of typeint, which defaults to-1)
Methods:
buffered(of type() -> [string * float]): Length of buffered data.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.id(of type() -> string): Identifier of the source.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.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.