Source / Liquidsoap
buffer
Create a buffer between two different clocks.
Type:
(?id : string?, ?buffer : float, ?fallible : bool, ?max : float,
?on_start : (() -> unit), ?on_stop : (() -> unit), ?register_telnet : bool,
?start : bool, source('a)) -> source('a)
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.buffer(of typefloat, which defaults to1.0): Amount of data to pre-buffer, in seconds.fallible(of typebool, which defaults totrue): Allow the child source to fail.max(of typefloat, which defaults to10.0): Maximum amount of buffered data, in seconds.on_start(of type() -> unit, which defaults to{()}): Callback executed when output starts.on_stop(of type() -> unit, which defaults to{()}): Callback executed when output stops.register_telnet(of typebool, which defaults totrue): Register telnet commands for this output.start(of typebool, which defaults totrue): Start output as soon as it is available.(unlabeled)(of typesource('a))
Methods:
buffer_length(of type() -> int): Buffer length, in main ticksbuffered(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.
buffer.adaptative
Create a buffer between two different clocks. The speed of the output is adapted so that no buffer underrun or overrun occurs. This wonderful behavior has a cost: the pitch of the sound might be changed a little.
Type:
(?id : string?, ?averaging : float, ?buffer : float, ?fallible : bool,
?limit : float, ?max : float, ?on_start : (() -> unit),
?on_stop : (() -> unit), ?register_telnet : bool, ?resample : bool,
?reset : bool, ?start : bool, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)
Arguments:
id(of typestring?, which defaults tonull): Force the value of the source ID.averaging(of typefloat, which defaults to30.0): Length of the buffer averaging, in seconds (the time constant of the smoothing to be precise). The greater this is, the less reactive to local variations we are.buffer(of typefloat, which defaults to1.0): Amount of data to prebuffer, in seconds.fallible(of typebool, which defaults tofalse): Allow the child source to fail, in which case the output will be stopped until the source is available again.limit(of typefloat, which defaults to1.25): Maximum acceleration or deceleration factor, ie how fast or slow we can be compared to realtime.max(of typefloat, which defaults to10.0): Maximum amount of buffered data, in seconds.on_start(of type() -> unit, which defaults to{()}): Callback executed when output starts.on_stop(of type() -> unit, which defaults to{()}): Callback executed when output stops.register_telnet(of typebool, which defaults totrue): Register telnet commands for this output.resample(of typebool, which defaults totrue): Use proper resampling instead of simply duplicating samples.reset(of typebool, which defaults tofalse): Reset speed estimation to 1 when the source becomes available again (resuming from a buffer underflow).start(of typebool, which defaults totrue): Start output as soon as it is available.(unlabeled)(of typesource(audio=pcm('a), 'b))
Methods:
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Current buffer duration, in seconds.elapsed(of type() -> float): Elapsed time in the current track.estimated(of type() -> float): Current smoothed buffer duration, in seconds.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.ratio(of type() -> float): Get the current scaling ratio.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.
request.dump
Immediately encode the whole contents of a request into a file.
Type:
(format('a), string, request, ?ratio : float, ?timeout : float,
?sleep_latency : float) -> unit
Arguments:
(unlabeled)(of typeformat('a)): Encoding format.(unlabeled)(of typestring): Name of the file.(unlabeled)(of typerequest): Request to encode.ratio(of typefloat, which defaults to50.0): Time ratio. A value of50means process data at50xreal rate, when possible.timeout(of typefloat, which defaults to1.0): Stop processing the source if it has not started after the given timeout.sleep_latency(of typefloat, which defaults to0.1): How much time ahead, in seconds, should we should be before pausing the processing.
This function is experimental.
request.process
Given a request and an optional function to process this request, animate the source as fast as possible until the request is fully processed.
Type:
(request, ?process : ((source('a)) -> source('b)), ?ratio : float,
?timeout : float, ?sleep_latency : float) -> unit
Arguments:
(unlabeled)(of typerequest): Request to processprocess(of type(source('a)) -> source('b), which defaults to<fun>): Callback to create the source to animate.ratio(of typefloat, which defaults to50.0): Time ratio. A value of50means process data at50xreal rate, when possible.timeout(of typefloat, which defaults to1.0): Stop processing the source if it has not started after the given timeout.sleep_latency(of typefloat, which defaults to0.1): How much time ahead, in seconds, should we should be before pausing the processing.
source.duration
Estimation of the duration in the current track.
Type:
(source('a)) -> float
Arguments:
(unlabeled)(of typesource('a))
source.elapsed
Elapsed time in the current track.
Type:
(source('a)) -> float
Arguments:
(unlabeled)(of typesource('a))
source.fallible
Indicate if a source may fail, i.e. may not be ready to stream.
Type:
(source('a)) -> bool
Arguments:
(unlabeled)(of typesource('a))
source.id
Get the identifier of a source.
Type:
(source('a)) -> string
Arguments:
(unlabeled)(of typesource('a))
source.is_ready
Indicate if a source is ready to stream (we also say that it is available), or currently streaming.
Type:
(source('a)) -> bool
Arguments:
(unlabeled)(of typesource('a))
source.last_metadata
Return the last metadata from the source.
Type:
(source('a)) -> [string * string]?
Arguments:
(unlabeled)(of typesource('a))
source.on_shutdown
Register a function to be called when source is not used anymore by another source.
Type:
(source('a), (() -> unit)) -> unit
Arguments:
(unlabeled)(of typesource('a))(unlabeled)(of type() -> unit)
source.remaining
Estimation of remaining time in the current track.
Type:
(source('a)) -> float
Arguments:
(unlabeled)(of typesource('a))
source.seek
Seek forward, in seconds. Returns the amount of time effectively seeked.
Type:
(source('a), float) -> float
Arguments:
(unlabeled)(of typesource('a))(unlabeled)(of typefloat)
source.set_id
Set the id of an operator.
Type:
(source('a), string) -> unit
Arguments:
(unlabeled)(of typesource('a))(unlabeled)(of typestring)
source.skip
Skip to the next track.
Type:
(source('a)) -> unit
Arguments:
(unlabeled)(of typesource('a))
source.time
Get a source's time, based on its assigned clock
Type:
(source('a)) -> float
Arguments:
(unlabeled)(of typesource('a))