Liquidsoap scripting language reference

The Source / … categories contain all functions that return sources. The Input functions are those which build elementary sources (playing files, synthesizing sound, etc.). The Output functions are those which take a source and register it for being streamed to the outside (file, soundcard, audio server, etc.). The Visualization functions are experimental ones that let you visualize in real-time some aspects of the audio stream. The Sound Processing functions are those which basically work on the source as a continuous audio stream. They would typically be mixers of streams, audio effects or analysis. Finally, Track Processing functions are basically all others, often having a behaviour that depends on or affects the extra information that liquidsoap puts in streams: track limits and metadata.

Bool

!=

Comparison of comparable values.

Type:

('a, 'a) -> bool where 'a is an orderable type

Arguments:

  • (unlabeled) (of type anything that is an orderable type)
  • (unlabeled) (of type anything that is an orderable type)

<

Comparison of comparable values.

Type:

('a, 'a) -> bool where 'a is an orderable type

Arguments:

  • (unlabeled) (of type anything that is an orderable type)
  • (unlabeled) (of type anything that is an orderable type)

<=

Comparison of comparable values.

Type:

('a, 'a) -> bool where 'a is an orderable type

Arguments:

  • (unlabeled) (of type anything that is an orderable type)
  • (unlabeled) (of type anything that is an orderable type)

==

Comparison of comparable values.

Type:

('a, 'a) -> bool where 'a is an orderable type

Arguments:

  • (unlabeled) (of type anything that is an orderable type)
  • (unlabeled) (of type anything that is an orderable type)

>

Comparison of comparable values.

Type:

('a, 'a) -> bool where 'a is an orderable type

Arguments:

  • (unlabeled) (of type anything that is an orderable type)
  • (unlabeled) (of type anything that is an orderable type)

>=

Comparison of comparable values.

Type:

('a, 'a) -> bool where 'a is an orderable type

Arguments:

  • (unlabeled) (of type anything that is an orderable type)
  • (unlabeled) (of type anything that is an orderable type)

and

Return the conjunction of its arguments

Type:

({bool}, {bool}) -> bool

Arguments:

  • (unlabeled) (of type {bool})
  • (unlabeled) (of type {bool})

not

Returns the negation of its argument.

Type:

(bool) -> bool

Arguments:

  • (unlabeled) (of type bool)

or

Return the disjunction of its arguments

Type:

({bool}, {bool}) -> bool

Arguments:

  • (unlabeled) (of type {bool})
  • (unlabeled) (of type {bool})

random.bool

Generate a random boolean.

Type:

() -> bool

Configuration

configure.bindir

Liquidsoap’s Internal script directory.

Type:

string

configure.libdir

Liquidsoap’s library directory.

Type:

string

configure.logdir

Liquidsoap’s logging directory.

Type:

string

configure.rundir

Liquidsoap’s PID file directory.

Type:

string

liquidsoap.build_config.architecture

Build-time configuration value for architecture

Type:

string

liquidsoap.build_config.git_sha

Git sha used to compile liquidsoap.

Type:

string?

liquidsoap.build_config.host

Build-time configuration value for host

Type:

string

liquidsoap.build_config.is_release

Is this build a release build?

Type:

bool

liquidsoap.build_config.is_snapshot

Is this build a development snapshot?

Type:

bool

liquidsoap.build_config.native_c_compiler

Build-time configuration value for native_c_compiler

Type:

string

liquidsoap.build_config.native_c_libraries

Build-time configuration value for native_c_libraries

Type:

string

liquidsoap.build_config.ocaml_version

OCaml version used to compile liquidspap.

Type:

string

liquidsoap.build_config.ocamlopt_cflags

Build-time configuration value for ocamlopt_cflags

Type:

string

liquidsoap.build_config.optionals.alsa

Build-time configuration for alsa

Type:

bool

liquidsoap.build_config.optionals.ao

Build-time configuration for ao

Type:

bool

liquidsoap.build_config.optionals.camlimages

Build-time configuration for camlimages

Type:

bool

liquidsoap.build_config.optionals.dssi

Build-time configuration for dssi

Type:

bool

liquidsoap.build_config.optionals.faad

Build-time configuration for faad

Type:

bool

liquidsoap.build_config.optionals.fdkaac

Build-time configuration for fdkaac

Type:

bool

liquidsoap.build_config.optionals.ffmpeg

Build-time configuration for ffmpeg

Type:

bool

liquidsoap.build_config.optionals.flac

Build-time configuration for flac

Type:

bool

liquidsoap.build_config.optionals.frei0r

Build-time configuration for frei0r

Type:

bool

liquidsoap.build_config.optionals.gd

Build-time configuration for gd

Type:

bool

liquidsoap.build_config.optionals.graphics

Build-time configuration for graphics

Type:

bool

liquidsoap.build_config.optionals.inotify

Build-time configuration for inotify

Type:

bool

liquidsoap.build_config.optionals.irc

Build-time configuration for irc

Type:

bool

liquidsoap.build_config.optionals.jack

Build-time configuration for jack

Type:

bool

liquidsoap.build_config.optionals.ladspa

Build-time configuration for ladspa

Type:

bool

liquidsoap.build_config.optionals.lame

Build-time configuration for lame

Type:

bool

liquidsoap.build_config.optionals.lilv

Build-time configuration for lilv

Type:

bool

liquidsoap.build_config.optionals.lo

Build-time configuration for lo

Type:

bool

liquidsoap.build_config.optionals.mad

Build-time configuration for mad

Type:

bool

liquidsoap.build_config.optionals.memtrace

Build-time configuration for memtrace

Type:

bool

liquidsoap.build_config.optionals.ogg

Build-time configuration for ogg

Type:

bool

liquidsoap.build_config.optionals.opus

Build-time configuration for opus

Type:

bool

liquidsoap.build_config.optionals.osc

Build-time configuration for osc

Type:

bool

liquidsoap.build_config.optionals.oss

Build-time configuration for oss

Type:

bool

liquidsoap.build_config.optionals.portaudio

Build-time configuration for portaudio

Type:

bool

liquidsoap.build_config.optionals.posix_time2

Build-time configuration for posix_time2

Type:

bool

liquidsoap.build_config.optionals.prometheus

Build-time configuration for prometheus

Type:

bool

liquidsoap.build_config.optionals.pulseaudio

Build-time configuration for pulseaudio

Type:

bool

liquidsoap.build_config.optionals.samplerate

Build-time configuration for samplerate

Type:

bool

liquidsoap.build_config.optionals.sdl

Build-time configuration for sdl

Type:

bool

liquidsoap.build_config.optionals.shine

Build-time configuration for shine

Type:

bool

liquidsoap.build_config.optionals.soundtouch

Build-time configuration for soundtouch

Type:

bool

liquidsoap.build_config.optionals.speex

Build-time configuration for speex

Type:

bool

liquidsoap.build_config.optionals.srt

Build-time configuration for srt

Type:

bool

liquidsoap.build_config.optionals.ssl

Build-time configuration for ssl

Type:

bool

liquidsoap.build_config.optionals.syslog

Build-time configuration for syslog

Type:

bool

liquidsoap.build_config.optionals.theora

Build-time configuration for theora

Type:

bool

liquidsoap.build_config.optionals.tls

Build-time configuration for tls

Type:

bool

liquidsoap.build_config.optionals.vorbis

Build-time configuration for vorbis

Type:

bool

liquidsoap.build_config.optionals.winsvc

Build-time configuration for winsvc

Type:

bool

liquidsoap.build_config.optionals.xmlplaylist

Build-time configuration for xmlplaylist

Type:

bool

liquidsoap.build_config.system

Build-time configuration value for system

Type:

string

liquidsoap.build_config.target

Build-time configuration value for target

Type:

string

liquidsoap.cache

Liquidsoap cache directory.

Type:

(mode : string) -> string?

Arguments:

  • mode (of type string): Cache mode, one of: “user” or “system”

liquidsoap.cache.maintenance

Execute cache maintenance routine.

Type:

(mode : string) -> unit

Arguments:

  • mode (of type string): Cache mode, one of: “user” or “system”

liquidsoap.version

Liquidsoap version string.

Type:

string

File

file.copy

Copy a file. Arguments and implementation follows the POSIX cp command line specifications.

Type:

(?recursive : bool, ?force : bool, ?preserve : bool, string, string) -> unit

Arguments:

  • recursive (of type bool, which defaults to false): Copy file hierarchies.
  • force (of type bool, which defaults to true): If a file descriptor for a destination file cannot be obtained attempt to unlink the destination file and proceed.
  • preserve (of type bool, which defaults to false): Duplicate source files attributes in the destination file.
  • (unlabeled) (of type string): Source
  • (unlabeled) (of type string): Destination

file.digest

Return an MD5 digest for the given file.

Type:

(string) -> string

Arguments:

  • (unlabeled) (of type string)

file.exists

Returns true if the file or directory exists.

Type:

(string) -> bool

Arguments:

  • (unlabeled) (of type string)

file.extension

Returns a file’s extension.

Type:

(?dir_sep : string, ?leading_dot : bool, string) -> string

Arguments:

  • dir_sep (of type string, which defaults to "/"): Directory separator.
  • leading_dot (of type bool, which defaults to true): Return extension with a leading dot, e.g. .foo.
  • (unlabeled) (of type string)

file.is_directory

Returns true if the file exists and is a directory.

Type:

(string) -> bool

Arguments:

  • (unlabeled) (of type string)

file.ls

List all the files in a directory.

Type:

(?absolute : bool, ?recursive : bool, ?pattern : string?, ?sorted : bool,
 string) -> [string]

Arguments:

  • absolute (of type bool, which defaults to false): Whether to return absolute paths.
  • recursive (of type bool, which defaults to false): Whether to look recursively in subdirectories.
  • pattern (of type string?, which defaults to null): Pattern that the filenames should match (e.g. "*.mp3").
  • sorted (of type bool, which defaults to false): Return results in a sorted order.
  • (unlabeled) (of type string): Directory to look in.

file.metadata

Read metadata from a file.

Type:

(string, ?exclude : [string]) -> [string * string]

Arguments:

  • (unlabeled) (of type string): File from which the metadata should be read.
  • exclude (of type [string], which defaults to []): Decoders to exclude

file.metadata.ffmpeg

Read metadata from a file using the ffmpeg decoder.

Type:

(string) -> [string * string]

Arguments:

  • (unlabeled) (of type string): File from which the metadata should be read.

file.metadata.flac

Read metadata from a file using the flac decoder.

Type:

(string) -> [string * string]

Arguments:

  • (unlabeled) (of type string): File from which the metadata should be read.

file.metadata.flac_native

Read metadata from a file using the flac_native decoder.

Type:

(string) -> [string * string]

Arguments:

  • (unlabeled) (of type string): File from which the metadata should be read.

file.metadata.id3

Read metadata from a file using the id3 decoder.

Type:

(string) -> [string * string]

Arguments:

  • (unlabeled) (of type string): File from which the metadata should be read.

file.metadata.id3v1

Read metadata from a file using the id3v1 decoder.

Type:

(string) -> [string * string]

Arguments:

  • (unlabeled) (of type string): File from which the metadata should be read.

file.metadata.id3v2

Read metadata from a file using the id3v2 decoder.

Type:

(string) -> [string * string]

Arguments:

  • (unlabeled) (of type string): File from which the metadata should be read.

file.metadata.image

Read metadata from a file using the image decoder.

Type:

(string) -> [string * string]

Arguments:

  • (unlabeled) (of type string): File from which the metadata should be read.

file.metadata.mp4

Read metadata from a file using the mp4 decoder.

Type:

(string) -> [string * string]

Arguments:

  • (unlabeled) (of type string): File from which the metadata should be read.

file.metadata.native

Read metadata from a file using the native decoder.

Type:

(string) -> [string * string]

Arguments:

  • (unlabeled) (of type string): File from which the metadata should be read.

file.metadata.ogg

Read metadata from a file using the ogg decoder.

Type:

(string) -> [string * string]

Arguments:

  • (unlabeled) (of type string): File from which the metadata should be read.

file.metadata.ogg_native

Read metadata from a file using the ogg_native decoder.

Type:

(string) -> [string * string]

Arguments:

  • (unlabeled) (of type string): File from which the metadata should be read.

file.metadata.video-metadata

Read metadata from a file using the video-metadata decoder.

Type:

(string) -> [string * string]

Arguments:

  • (unlabeled) (of type string): File from which the metadata should be read.

file.mime.magic

Get the MIME type of a file.

Type:

(string) -> string

Arguments:

  • (unlabeled) (of type string)

file.mkdir

Create a directory.

Type:

(?parents : bool, ?perms : int, string) -> unit

Arguments:

  • parents (of type bool, which defaults to false): Also create parent directories if they do not exist.
  • perms (of type int, which defaults to 0o755): Default file rights if created.
  • (unlabeled) (of type string)

file.move

Move a file

Type:

(?force : bool, ?atomic : bool, string, string) -> unit

Arguments:

  • force (of type bool, which defaults to false): Do not prompt for confirmation if the destination path exists.
  • atomic (of type bool, which defaults to false): Move the file atomically. Implies force and raises error.file.cross_device if atomic move fails because the source and destination files are not on the same partition.
  • (unlabeled) (of type string): Source
  • (unlabeled) (of type string): Destination

file.mtime

Last modification time.

Type:

(string) -> float

Arguments:

  • (unlabeled) (of type string)

file.open

Open a file.

Type:

(?write : bool, ?create : bool?, ?append : bool, ?non_blocking : bool,
 ?perms : int, string) -> socket

Arguments:

  • write (of type bool, which defaults to false): Open file for writing
  • create (of type bool?, which defaults to null): Create if nonexistent. Default: false in read-only mode, true when writing.
  • append (of type bool, which defaults to false): Append data if file exists.
  • non_blocking (of type bool, which defaults to false): Open in non-blocking mode.
  • perms (of type int, which defaults to 0o644): Default file rights if created.
  • (unlabeled) (of type string)

Methods:

  • close (of type () -> unit): Close the socket.
  • closed (of type () -> bool): true if the socket is already closed.
  • non_blocking (of type (bool) -> unit): Set the non-blocking flag on the socket
  • read (of type ((?timeout : float?) -> string) .{wait : (?timeout : float?, (() -> unit)) -> unit}): Read data from a socket. Reading is done when the function returns an empty string "".
  • type (of type string): Socket type
  • write (of type ((?timeout : float?, string) -> unit) .{wait : (?timeout : float?, (() -> unit)) -> unit}): Write data to a socket

file.remove

Remove a file.

Type:

(string) -> unit

Arguments:

  • (unlabeled) (of type string)

file.rmdir

Remove a directory and its content.

Type:

(string) -> unit

Arguments:

  • (unlabeled) (of type string)

file.size

File size in bytes.

Type:

(string) -> int

Arguments:

  • (unlabeled) (of type string)

file.temp

Return a fresh temporary filename. The temporary file is created empty, with permissions 0o600 (readable and writable only by the file owner).

Type:

(?directory : string?, string, string) -> string

Arguments:

  • directory (of type string?, which defaults to null): Directory where to create the file.
  • (unlabeled) (of type string): File prefix
  • (unlabeled) (of type string): File suffix

file.temp_dir

Return a fresh temporary directory name. The temporary directory is created empty, in the default tmp directory, with permissions 0o700 (readable, writable and listable only by the file owner).

Type:

(string, ?string) -> string

Arguments:

  • (unlabeled) (of type string): Directory name prefix.
  • (unlabeled) (of type string, which defaults to ""): Directory name suffix.

file.umask

Get the process’s file mode creation mask.

Type:

() -> int

file.umask.set

Set process’s file mode creation mask.

Type:

(int) -> unit

Arguments:

  • (unlabeled) (of type int)

file.watch

Call a function when a file is modified. Returns unwatch function in unwatch method.

Type:

(string, (() -> unit)) -> unit

Arguments:

  • (unlabeled) (of type string): File to watch.
  • (unlabeled) (of type () -> unit): Handler function.

Methods:

  • unwatch (of type () -> unit): Function to remove the watch on the file.

file.which

file.which("progname") looks for an executable named “progname” using directories from the PATH environment variable and returns “” if it could not find one.

Type:

(string) -> string?

Arguments:

  • (unlabeled) (of type string)

path.basename

Get the base name of a path, i.e. the name of the file without the full path. For instance file.basename("/tmp/folder/bla.mp3") returns "bla.mp3".

Type:

(string) -> string

Arguments:

  • (unlabeled) (of type string)

path.concat

Concatenate two paths, using the appropriate directory separator.

Type:

(string, string) -> string

Arguments:

  • (unlabeled) (of type string)
  • (unlabeled) (of type string)

path.dirname

Get the directory name of a path.

Type:

(string) -> string

Arguments:

  • (unlabeled) (of type string)

path.home.unrelate

Expand path that start with ‘~’ with the current home directory.

Type:

(string) -> string

Arguments:

  • (unlabeled) (of type string)

path.remove_extension

Remove the file extension from a path.

Type:

(string) -> string

Arguments:

  • (unlabeled) (of type string)

Getter

getter

Create a getter.

Type:

({'a}) -> {'a}

Arguments:

  • (unlabeled) (of type {'a}): Value from which the getter should be created.

getter.case

Return a value depending on whether the getter is constant or not.

Type:

({'a}, (('a) -> 'b), (((() -> 'a)) -> 'b)) -> 'b

Arguments:

  • (unlabeled) (of type {'a}): Getter to inspect.
  • (unlabeled) (of type ('a) -> 'b)
  • (unlabeled) (of type ((() -> 'a)) -> 'b)

getter.get

Get the value of a getter.

Type:

({'a}) -> 'a

Arguments:

  • (unlabeled) (of type {'a})

getter.map

Apply a function on a getter.

Type:

((('a) -> 'b), {'a}) -> {'b}

Arguments:

  • (unlabeled) (of type ('a) -> 'b): Function to apply.
  • (unlabeled) (of type {'a})

getter.map.memoize

Apply a function on a getter. If the input value has not changed compared to last call, the previous result is returned without computing the function again.

Type:

((('a) -> 'b), {'a}) -> {'b} where 'a is an orderable type

Arguments:

  • (unlabeled) (of type ('a) -> 'b where 'a is an orderable type): Function to apply.
  • (unlabeled) (of type {'a} where 'a is an orderable type)

Interaction

icy.update_metadata

Update metata on an icecast mountpoint using the ICY protocol.

Type:

(?host : string, ?port : int, ?user : string, ?transport : http_transport,
 ?password : string, ?mount : string, ?icy_id : int, ?protocol : string,
 ?encoding : string?, ?headers : [string * string], [string * string]) ->
unit

Arguments:

  • host (of type string, which defaults to "localhost")
  • port (of type int, which defaults to 8000)
  • user (of type string, which defaults to "source")
  • transport (of type http_transport, which defaults to <unix_transport>): Http transport. Use http.transport.ssl or http.transport.secure_transport, when available, to enable HTTPS output
  • password (of type string, which defaults to "hackme")
  • mount (of type string, which defaults to ""): Source mount point. Mandatory when streaming to icecast.
  • icy_id (of type int, which defaults to 1): Shoutcast source ID. Only supported by Shoutcast v2.
  • protocol (of type string, which defaults to "http"): Protocol to use. One of: “icy”, “http” or “https”
  • encoding (of type string?, which defaults to null): Encoding used to send metadata, default (UTF-8) if null.
  • headers (of type [string * string], which defaults to [("User-Agent", "Liquidsoap/2.5.0+git@e72712d (Unix; OCaml 5.4.0)")]): Additional headers.
  • (unlabeled) (of type [string * string])

osc.bool

Read from an OSC path.

Type:

(string, bool) -> () -> bool

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type bool): Initial value.

osc.float

Read from an OSC path.

Type:

(string, float) -> () -> float

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type float): Initial value.

osc.float_pair

Read from an OSC path.

Type:

(string, (float * float)) -> () -> float * float

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type float * float): Initial value.

osc.int

Read from an OSC path.

Type:

(string, int) -> () -> int

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type int): Initial value.

osc.int_pair

Read from an OSC path.

Type:

(string, (int * int)) -> () -> int * int

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type int * int): Initial value.

osc.native.float

Read from an OSC path.

Type:

(string, float) -> () -> float

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type float): Initial value.

osc.native.float_pair

Read from an OSC path.

Type:

(string, (float * float)) -> () -> float * float

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type float * float): Initial value.

osc.native.int

Read from an OSC path.

Type:

(string, int) -> () -> int

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type int): Initial value.

osc.native.int_pair

Read from an OSC path.

Type:

(string, (int * int)) -> () -> int * int

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type int * int): Initial value.

osc.native.on_float

Register a callback on OSC messages.

Type:

(string, ((float) -> unit)) -> unit

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type (float) -> unit): Callback function.

osc.native.on_float_pair

Register a callback on OSC messages.

Type:

(string, (((float * float)) -> unit)) -> unit

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type ((float * float)) -> unit): Callback function.

osc.native.on_int

Register a callback on OSC messages.

Type:

(string, ((int) -> unit)) -> unit

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type (int) -> unit): Callback function.

osc.native.on_int_pair

Register a callback on OSC messages.

Type:

(string, (((int * int)) -> unit)) -> unit

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type ((int * int)) -> unit): Callback function.

osc.native.on_string

Register a callback on OSC messages.

Type:

(string, ((string) -> unit)) -> unit

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type (string) -> unit): Callback function.

osc.native.on_string_pair

Register a callback on OSC messages.

Type:

(string, (((string * string)) -> unit)) -> unit

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type ((string * string)) -> unit): Callback function.

osc.native.send_float

Send a value to an OSC client.

Type:

(host : string, port : int, string, float) -> unit

Arguments:

  • host (of type string): OSC client address.
  • port (of type int): OSC client port.
  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type float): Value to send.

osc.native.send_float_pair

Send a value to an OSC client.

Type:

(host : string, port : int, string, (float * float)) -> unit

Arguments:

  • host (of type string): OSC client address.
  • port (of type int): OSC client port.
  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type float * float): Value to send.

osc.native.send_int

Send a value to an OSC client.

Type:

(host : string, port : int, string, int) -> unit

Arguments:

  • host (of type string): OSC client address.
  • port (of type int): OSC client port.
  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type int): Value to send.

osc.native.send_int_pair

Send a value to an OSC client.

Type:

(host : string, port : int, string, (int * int)) -> unit

Arguments:

  • host (of type string): OSC client address.
  • port (of type int): OSC client port.
  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type int * int): Value to send.

osc.native.send_string

Send a value to an OSC client.

Type:

(host : string, port : int, string, string) -> unit

Arguments:

  • host (of type string): OSC client address.
  • port (of type int): OSC client port.
  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type string): Value to send.

osc.native.send_string_pair

Send a value to an OSC client.

Type:

(host : string, port : int, string, (string * string)) -> unit

Arguments:

  • host (of type string): OSC client address.
  • port (of type int): OSC client port.
  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type string * string): Value to send.

osc.native.string

Read from an OSC path.

Type:

(string, string) -> () -> string

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type string): Initial value.

osc.native.string_pair

Read from an OSC path.

Type:

(string, (string * string)) -> () -> string * string

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type string * string): Initial value.

osc.on_bool

Register a callback on OSC messages.

Type:

(string, ((bool) -> unit)) -> unit

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type (bool) -> unit): Callback function.

osc.on_float

Register a callback on OSC messages.

Type:

(string, ((float) -> unit)) -> unit

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type (float) -> unit): Callback function.

osc.on_float_pair

Register a callback on OSC messages.

Type:

(string, (((float * float)) -> unit)) -> unit

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type ((float * float)) -> unit): Callback function.

osc.on_int

Register a callback on OSC messages.

Type:

(string, ((int) -> unit)) -> unit

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type (int) -> unit): Callback function.

osc.on_int_pair

Register a callback on OSC messages.

Type:

(string, (((int * int)) -> unit)) -> unit

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type ((int * int)) -> unit): Callback function.

osc.on_string

Register a callback on OSC messages.

Type:

(string, ((string) -> unit)) -> unit

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type (string) -> unit): Callback function.

osc.on_string_pair

Register a callback on OSC messages.

Type:

(string, (((string * string)) -> unit)) -> unit

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type ((string * string)) -> unit): Callback function.

osc.send_bool

Send a value to an OSC client.

Type:

(host : string, port : int, string, bool) -> unit

Arguments:

  • host (of type string): OSC client address.
  • port (of type int): OSC client port.
  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type bool): Value to send.

osc.send_float

Send a value to an OSC client.

Type:

(host : string, port : int, string, float) -> unit

Arguments:

  • host (of type string): OSC client address.
  • port (of type int): OSC client port.
  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type float): Value to send.

osc.send_float_pair

Send a value to an OSC client.

Type:

(host : string, port : int, string, (float * float)) -> unit

Arguments:

  • host (of type string): OSC client address.
  • port (of type int): OSC client port.
  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type float * float): Value to send.

osc.send_int

Send a value to an OSC client.

Type:

(host : string, port : int, string, int) -> unit

Arguments:

  • host (of type string): OSC client address.
  • port (of type int): OSC client port.
  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type int): Value to send.

osc.send_int_pair

Send a value to an OSC client.

Type:

(host : string, port : int, string, (int * int)) -> unit

Arguments:

  • host (of type string): OSC client address.
  • port (of type int): OSC client port.
  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type int * int): Value to send.

osc.send_string

Send a value to an OSC client.

Type:

(host : string, port : int, string, string) -> unit

Arguments:

  • host (of type string): OSC client address.
  • port (of type int): OSC client port.
  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type string): Value to send.

osc.send_string_pair

Send a value to an OSC client.

Type:

(host : string, port : int, string, (string * string)) -> unit

Arguments:

  • host (of type string): OSC client address.
  • port (of type int): OSC client port.
  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type string * string): Value to send.

osc.string

Read from an OSC path.

Type:

(string, string) -> () -> string

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type string): Initial value.

osc.string_pair

Read from an OSC path.

Type:

(string, (string * string)) -> () -> string * string

Arguments:

  • (unlabeled) (of type string): OSC path.
  • (unlabeled) (of type string * string): Initial value.

prometheus.counter

Register a prometheus counter

Type:

(help : string, ?namespace : string, ?subsystem : string, labels : [string],
 string) -> (label_values : [string]) -> (float) -> unit

Arguments:

  • help (of type string): Help of the metric
  • namespace (of type string, which defaults to ""): namespace of the metric
  • subsystem (of type string, which defaults to ""): subsystem of the metric
  • labels (of type [string]): labels for the metric
  • (unlabeled) (of type string): Name of the metric

prometheus.gauge

Register a prometheus gauge

Type:

(help : string, ?namespace : string, ?subsystem : string, labels : [string],
 string) -> (label_values : [string]) -> (float) -> unit

Arguments:

  • help (of type string): Help of the metric
  • namespace (of type string, which defaults to ""): namespace of the metric
  • subsystem (of type string, which defaults to ""): subsystem of the metric
  • labels (of type [string]): labels for the metric
  • (unlabeled) (of type string): Name of the metric

prometheus.summary

Register a prometheus summary

Type:

(help : string, ?namespace : string, ?subsystem : string, labels : [string],
 string) -> (label_values : [string]) -> (float) -> unit

Arguments:

  • help (of type string): Help of the metric
  • namespace (of type string, which defaults to ""): namespace of the metric
  • subsystem (of type string, which defaults to ""): subsystem of the metric
  • labels (of type [string]): labels for the metric
  • (unlabeled) (of type string): Name of the metric

server.register

Register a command. You can then execute this function through the server, either telnet or socket.

Type:

(?namespace : string?, ?description : string, ?usage : string?, string,
 ((string) -> string)) -> unit

Arguments:

  • namespace (of type string?, which defaults to null): Used to group multiple commands for the same functionality. If specified, the command will be named namespace.command.
  • description (of type string, which defaults to "No documentation available."): A description of your command.
  • usage (of type string?, which defaults to null): Description of how the command should be used.
  • (unlabeled) (of type string): Name of the command.
  • (unlabeled) (of type (string) -> string): Function called when the command is executed. It takes as argument the argument passed on the commandline and returns the message which will be printed on the commandline.

Internet

harbor.http.register

Low-level harbor handler registration. Overridden in standard library.

Type:

(?port : int, ?transport : http_transport
 .{default_port : int, name : string, protocol : string}, ?method : string,
 regexp,
 ((
   {
     data : (?timeout : float) -> string,
     headers : [string * string],
     http_version : string,
     method : string,
     path : string,
     query : [string * string],
     socket : socket
     .{
       close : () -> unit,
       closed : () -> bool,
       non_blocking : (bool) -> unit,
       read : ((?timeout : float?) -> string)
       .{wait : (?timeout : float?, (() -> unit)) -> unit
       },
       type : string,
       write : ((?timeout : float?, string) -> unit)
       .{wait : (?timeout : float?, (() -> unit)) -> unit
       }
     }
   }) -> {string}?)) -> unit

Arguments:

  • port (of type int, which defaults to 8000): Port to serve.
  • transport (of type http_transport.{default_port : int, name : string, protocol : string}, which defaults to <unix_transport>.{default_port=80, protocol="http", name="unix"}): Http transport. Use http.transport.ssl or http.transport.secure_transport, when available, to enable HTTPS output
  • method (of type string, which defaults to "GET"): Accepted method (“GET” / “POST” / “PUT” / “DELETE” / “HEAD” / “OPTIONS”).
  • (unlabeled) (of type regexp): path to serve.
  • (unlabeled) (of type ( { data : (?timeout : float) -> string, headers : [string * string], http_version : string, method : string, path : string, query : [string * string], socket : socket .{ close : () -> unit, closed : () -> bool, non_blocking : (bool) -> unit, read : ((?timeout : float?) -> string) .{wait : (?timeout : float?, (() -> unit)) -> unit }, type : string, write : ((?timeout : float?, string) -> unit) .{wait : (?timeout : float?, (() -> unit)) -> unit } } }) -> {string}?): Handler function

harbor.remove

Remove a registered handler on the harbor.

Type:

(?port : int, ?method : string, regexp) -> unit

Arguments:

  • port (of type int, which defaults to 8000): Port to serve.
  • method (of type string, which defaults to "GET"): Method served.
  • (unlabeled) (of type regexp): URI served.

host.of_internet_address

Find a host by internet address

Type:

(internet_address) -> 
{
  addresses : [internet_address.{is_ipv6 : bool, to_string : () -> string}],
  aliases : [string],
  domain : socket_domain,
  name : string}?

Arguments:

  • (unlabeled) (of type internet_address)

host.of_name

Find a host by name

Type:

(string) -> 
{
  addresses : [internet_address.{is_ipv6 : bool, to_string : () -> string}],
  aliases : [string],
  domain : socket_domain,
  name : string}?

Arguments:

  • (unlabeled) (of type string): hostname

http.delete

Perform a full http DELETE request.

Type:

(?headers : [string * string], ?http_version : string?, ?redirect : bool,
 ?timeout : float?, ?normalize_url : bool?, string) -> unit

Arguments:

  • headers (of type [string * string], which defaults to []): Additional headers.
  • http_version (of type string?, which defaults to null): Http request version.
  • redirect (of type bool, which defaults to true): Perform redirections if needed.
  • timeout (of type float?, which defaults to 10.0): Timeout for network operations in seconds.
  • normalize_url (of type bool?, which defaults to null): Normalize url, replacing spaces with %20 and more. Defaults to settings.http.normalize_url when null.
  • (unlabeled) (of type string): Requested URL, e.g. "http://www.liquidsoap.info/".

Methods:

  • headers (of type [string * string]): HTTP headers.
  • http_version (of type string): Version of the HTTP protocol.
  • status_code (of type int): Status code.
  • status_message (of type string): Status message.

http.delete.stream

Perform a full http DELETE request.

Type:

(?headers : [string * string], ?http_version : string?, ?redirect : bool,
 ?timeout : float?, ?normalize_url : bool?, string,
 on_body_data : ((string?) -> unit)) -> unit

Arguments:

  • headers (of type [string * string], which defaults to []): Additional headers.
  • http_version (of type string?, which defaults to null): Http request version.
  • redirect (of type bool, which defaults to true): Perform redirections if needed.
  • timeout (of type float?, which defaults to 10.0): Timeout for network operations in seconds.
  • normalize_url (of type bool?, which defaults to null): Normalize url, replacing spaces with %20 and more. Defaults to settings.http.normalize_url when null.
  • (unlabeled) (of type string): Requested URL, e.g. "http://www.liquidsoap.info/".
  • on_body_data (of type (string?) -> unit): function called when receiving response body data. null or "" means that all the data has been passed.

Methods:

  • headers (of type [string * string]): HTTP headers.
  • http_version (of type string): Version of the HTTP protocol.
  • status_code (of type int): Status code.
  • status_message (of type string): Status message.

http.get

Perform a full http GET request.

Type:

(?headers : [string * string], ?http_version : string?, ?redirect : bool,
 ?timeout : float?, ?normalize_url : bool?, string) -> string

Arguments:

  • headers (of type [string * string], which defaults to []): Additional headers.
  • http_version (of type string?, which defaults to null): Http request version.
  • redirect (of type bool, which defaults to true): Perform redirections if needed.
  • timeout (of type float?, which defaults to 10.0): Timeout for network operations in seconds.
  • normalize_url (of type bool?, which defaults to null): Normalize url, replacing spaces with %20 and more. Defaults to settings.http.normalize_url when null.
  • (unlabeled) (of type string): Requested URL, e.g. "http://www.liquidsoap.info/".

Methods:

  • headers (of type [string * string]): HTTP headers.
  • http_version (of type string): Version of the HTTP protocol.
  • status_code (of type int): Status code.
  • status_message (of type string): Status message.

http.get.stream

Perform a full http GET request.

Type:

(?headers : [string * string], ?http_version : string?, ?redirect : bool,
 ?timeout : float?, ?normalize_url : bool?, string,
 on_body_data : ((string?) -> unit)) -> unit

Arguments:

  • headers (of type [string * string], which defaults to []): Additional headers.
  • http_version (of type string?, which defaults to null): Http request version.
  • redirect (of type bool, which defaults to true): Perform redirections if needed.
  • timeout (of type float?, which defaults to 10.0): Timeout for network operations in seconds.
  • normalize_url (of type bool?, which defaults to null): Normalize url, replacing spaces with %20 and more. Defaults to settings.http.normalize_url when null.
  • (unlabeled) (of type string): Requested URL, e.g. "http://www.liquidsoap.info/".
  • on_body_data (of type (string?) -> unit): function called when receiving response body data. null or "" means that all the data has been passed.

Methods:

  • headers (of type [string * string]): HTTP headers.
  • http_version (of type string): Version of the HTTP protocol.
  • status_code (of type int): Status code.
  • status_message (of type string): Status message.

http.head

Perform a full http HEAD request.

Type:

(?headers : [string * string], ?http_version : string?, ?redirect : bool,
 ?timeout : float?, ?normalize_url : bool?, string) -> unit

Arguments:

  • headers (of type [string * string], which defaults to []): Additional headers.
  • http_version (of type string?, which defaults to null): Http request version.
  • redirect (of type bool, which defaults to true): Perform redirections if needed.
  • timeout (of type float?, which defaults to 10.0): Timeout for network operations in seconds.
  • normalize_url (of type bool?, which defaults to null): Normalize url, replacing spaces with %20 and more. Defaults to settings.http.normalize_url when null.
  • (unlabeled) (of type string): Requested URL, e.g. "http://www.liquidsoap.info/".

Methods:

  • headers (of type [string * string]): HTTP headers.
  • http_version (of type string): Version of the HTTP protocol.
  • status_code (of type int): Status code.
  • status_message (of type string): Status message.

http.head.stream

Perform a full http HEAD request.

Type:

(?headers : [string * string], ?http_version : string?, ?redirect : bool,
 ?timeout : float?, ?normalize_url : bool?, string,
 on_body_data : ((string?) -> unit)) -> unit

Arguments:

  • headers (of type [string * string], which defaults to []): Additional headers.
  • http_version (of type string?, which defaults to null): Http request version.
  • redirect (of type bool, which defaults to true): Perform redirections if needed.
  • timeout (of type float?, which defaults to 10.0): Timeout for network operations in seconds.
  • normalize_url (of type bool?, which defaults to null): Normalize url, replacing spaces with %20 and more. Defaults to settings.http.normalize_url when null.
  • (unlabeled) (of type string): Requested URL, e.g. "http://www.liquidsoap.info/".
  • on_body_data (of type (string?) -> unit): function called when receiving response body data. null or "" means that all the data has been passed.

Methods:

  • headers (of type [string * string]): HTTP headers.
  • http_version (of type string): Version of the HTTP protocol.
  • status_code (of type int): Status code.
  • status_message (of type string): Status message.

http.post

Perform a full http POST request.

Type:

(?data : {string}, ?headers : [string * string], ?http_version : string?,
 ?redirect : bool, ?timeout : float?, ?normalize_url : bool?, string) ->
string

Arguments:

  • data (of type {string}, which defaults to ""): POST data. Use a string getter to stream data and return "" when all data has been passed.
  • headers (of type [string * string], which defaults to []): Additional headers.
  • http_version (of type string?, which defaults to null): Http request version.
  • redirect (of type bool, which defaults to true): Perform redirections if needed.
  • timeout (of type float?, which defaults to 10.0): Timeout for network operations in seconds.
  • normalize_url (of type bool?, which defaults to null): Normalize url, replacing spaces with %20 and more. Defaults to settings.http.normalize_url when null.
  • (unlabeled) (of type string): Requested URL, e.g. "http://www.liquidsoap.info/".

Methods:

  • headers (of type [string * string]): HTTP headers.
  • http_version (of type string): Version of the HTTP protocol.
  • status_code (of type int): Status code.
  • status_message (of type string): Status message.

http.post.stream

Perform a full http POST request.

Type:

(?data : {string}, ?headers : [string * string], ?http_version : string?,
 ?redirect : bool, ?timeout : float?, ?normalize_url : bool?, string,
 on_body_data : ((string?) -> unit)) -> unit

Arguments:

  • data (of type {string}, which defaults to ""): POST data. Use a string getter to stream data and return "" when all data has been passed.
  • headers (of type [string * string], which defaults to []): Additional headers.
  • http_version (of type string?, which defaults to null): Http request version.
  • redirect (of type bool, which defaults to true): Perform redirections if needed.
  • timeout (of type float?, which defaults to 10.0): Timeout for network operations in seconds.
  • normalize_url (of type bool?, which defaults to null): Normalize url, replacing spaces with %20 and more. Defaults to settings.http.normalize_url when null.
  • (unlabeled) (of type string): Requested URL, e.g. "http://www.liquidsoap.info/".
  • on_body_data (of type (string?) -> unit): function called when receiving response body data. null or "" means that all the data has been passed.

Methods:

  • headers (of type [string * string]): HTTP headers.
  • http_version (of type string): Version of the HTTP protocol.
  • status_code (of type int): Status code.
  • status_message (of type string): Status message.

http.put

Perform a full http PUT request.

Type:

(?data : {string}, ?headers : [string * string], ?http_version : string?,
 ?redirect : bool, ?timeout : float?, ?normalize_url : bool?, string) ->
string

Arguments:

  • data (of type {string}, which defaults to ""): POST data. Use a string getter to stream data and return "" when all data has been passed.
  • headers (of type [string * string], which defaults to []): Additional headers.
  • http_version (of type string?, which defaults to null): Http request version.
  • redirect (of type bool, which defaults to true): Perform redirections if needed.
  • timeout (of type float?, which defaults to 10.0): Timeout for network operations in seconds.
  • normalize_url (of type bool?, which defaults to null): Normalize url, replacing spaces with %20 and more. Defaults to settings.http.normalize_url when null.
  • (unlabeled) (of type string): Requested URL, e.g. "http://www.liquidsoap.info/".

Methods:

  • headers (of type [string * string]): HTTP headers.
  • http_version (of type string): Version of the HTTP protocol.
  • status_code (of type int): Status code.
  • status_message (of type string): Status message.

http.put.stream

Perform a full http PUT request.

Type:

(?data : {string}, ?headers : [string * string], ?http_version : string?,
 ?redirect : bool, ?timeout : float?, ?normalize_url : bool?, string,
 on_body_data : ((string?) -> unit)) -> unit

Arguments:

  • data (of type {string}, which defaults to ""): POST data. Use a string getter to stream data and return "" when all data has been passed.
  • headers (of type [string * string], which defaults to []): Additional headers.
  • http_version (of type string?, which defaults to null): Http request version.
  • redirect (of type bool, which defaults to true): Perform redirections if needed.
  • timeout (of type float?, which defaults to 10.0): Timeout for network operations in seconds.
  • normalize_url (of type bool?, which defaults to null): Normalize url, replacing spaces with %20 and more. Defaults to settings.http.normalize_url when null.
  • (unlabeled) (of type string): Requested URL, e.g. "http://www.liquidsoap.info/".
  • on_body_data (of type (string?) -> unit): function called when receiving response body data. null or "" means that all the data has been passed.

Methods:

  • headers (of type [string * string]): HTTP headers.
  • http_version (of type string): Version of the HTTP protocol.
  • status_code (of type int): Status code.
  • status_message (of type string): Status message.

http.transport.ssl

Https transport using libssl

Type:

(?read_timeout : float?, ?write_timeout : float?, ?password : string?,
 ?min_protocol : string?, ?max_protocol : string?, ?certificate : string?,
 ?key : string?) -> http_transport

Arguments:

  • read_timeout (of type float?, which defaults to null): Read timeout
  • write_timeout (of type float?, which defaults to null): Write timeout
  • password (of type string?, which defaults to null): SSL certificate password
  • min_protocol (of type string?, which defaults to null): Minimal accepted SSL protocol. One of, from least recent to most recent: "ssl.3", "tls.1", "tls.1.1", "tls.1.2" or "tls.1.3". The most recent available protocol between client and server is negotiated when initiating communication between minimal and maximal protocol version. All protocols up to "tls.1.2" and above are now deprecated so you might want to set this value to one of those two. Default to lowest support protocol if not set.
  • max_protocol (of type string?, which defaults to null): Maximal accepted SSL protocol. One of, from least recent to most recent: "ssl.3", "tls.1", "tls.1.1", "tls.1.2" or "tls.1.3". The most recent available protocol between client and server is negotiated when initiating communication between minimal and maximal protocol version. Defaults to highest protocol supported if not set.
  • certificate (of type string?, which defaults to null): Path to certificate file. Required in server mode, e.g. input.harbor, etc. If passed in client mode, certificate is added to the list of valid certificates.
  • key (of type string?, which defaults to null): Path to certificate private key. Required in server mode, e.g. input.harbor, etc., unless the certificate file also contains the private key.

Methods:

  • default_port (of type int): Transport default port
  • name (of type string): Transport name
  • protocol (of type string): Transport protocol

http.transport.tls

Https transport using libtls

Type:

(?read_timeout : float?, ?write_timeout : float?, ?certificate : string?,
 ?key : string?, ?client_certificate : string?, ?client_key : string?) ->
http_transport

Arguments:

  • read_timeout (of type float?, which defaults to null): Read timeout. Defaults to harbor’s timeout if null.
  • write_timeout (of type float?, which defaults to null): Write timeout. Defaults to harbor’s timeout if null.
  • certificate (of type string?, which defaults to null): Path to certificate file. Required in server mode, e.g. input.harbor, etc. If passed in client mode, certificate is added to the list of valid certificates.
  • key (of type string?, which defaults to null): Path to certificate private key. Required in server mode, e.g. input.harbor, etc., unless the certificate file also contains the private key. Unused in client mode.
  • client_certificate (of type string?, which defaults to null): Path to client certificate file. If passed in server mode, clients will be required to present a certificate from this file. If passed in client mode, the first certificate in this file will be presented to the server.
  • client_key (of type string?, which defaults to null): Path to client certificate private key. Required in client mode if a client certificate is passed. Unused in server mode.

Methods:

  • default_port (of type int): Transport default port
  • name (of type string): Transport name
  • protocol (of type string): Transport protocol

http.transport.unix

Http unencrypted transport

Type:

http_transport.{default_port : int, name : string, protocol : string}

http.user_agent

Default user-agent

Type:

string

socket.address.internet_address

Create a socket address for a internet address.

Type:

(internet_address.{is_ipv6 : bool, to_string : () -> string}, int) ->
socket_address

Arguments:

  • (unlabeled) (of type internet_address.{is_ipv6 : bool, to_string : () -> string}): Internet address.
  • (unlabeled) (of type int): port

Methods:

  • domain (of type socket_domain): Socket domain
  • internet_address (of type internet_address.{is_ipv6 : bool, to_string : () -> string}): Internet address
  • port (of type int): Port

socket.address.unix

Create a socket address for a unix file socket.

Type:

(string) -> socket_address

Arguments:

  • (unlabeled) (of type string): Unix socket path

Methods:

  • domain (of type socket_domain): Socket domain
  • path (of type string): Unix socket path

socket.domain.inet

Inet socket domain

Type:

socket_domain

socket.domain.inet6

Inet6 socket domain

Type:

socket_domain

socket.domain.unix

Unix socket domain

Type:

socket_domain

socket.internet_address

Return an internet address from its string representation.

Type:

(string) -> internet_address

Arguments:

  • (unlabeled) (of type string): Socket internet address.

Methods:

  • is_ipv6 (of type bool): Is the internet address a ipv6 address?
  • to_string (of type () -> string): String representation of the internet address

socket.internet_address.any

A special IPv4 address, for use only with socket.bind, representing all the Internet addresses that the host machine possesses.

Type:

internet_address.{is_ipv6 : bool, to_string : () -> string}

socket.internet_address.ipv6.any

A special IPv6 address, for use only with socket.bind, representing all the Internet addresses that the host machine possesses.

Type:

internet_address.{is_ipv6 : bool, to_string : () -> string}

socket.internet_address.ipv6.loopback

A special IPv6 address representing the host machine (::1).

Type:

internet_address.{is_ipv6 : bool, to_string : () -> string}

socket.internet_address.loopback

A special IPv4 address representing the host machine (127.0.0.1).

Type:

internet_address.{is_ipv6 : bool, to_string : () -> string}

socket.pair

Create a pair of sockets connected together.

Type:

(?domain : socket_domain, ?type : socket_type, ?protocol : int) -> socket

Arguments:

  • domain (of type socket_domain, which defaults to socket.domain.inet): Socket domain.
  • type (of type socket_type, which defaults to socket.type.stream): Socket type
  • protocol (of type int, which defaults to 0): Protocol type. 0 selects the default protocol for that kind of sockets.

Methods:

  • close (of type () -> unit): Close the socket.
  • closed (of type () -> bool): true if the socket is already closed.
  • non_blocking (of type (bool) -> unit): Set the non-blocking flag on the socket
  • read (of type ((?timeout : float?) -> string) .{wait : (?timeout : float?, (() -> unit)) -> unit}): Read data from a socket. Reading is done when the function returns an empty string "".
  • type (of type string): Socket type
  • write (of type ((?timeout : float?, string) -> unit) .{wait : (?timeout : float?, (() -> unit)) -> unit}): Write data to a socket

socket.type.dgram

Dgram socket type

Type:

socket_type

socket.type.raw

Raw socket type

Type:

socket_type

socket.type.stream

Stream socket type

Type:

socket_type

socket.unix

Create a unix socket.

Type:

(?domain : socket_domain, ?type : socket_type, ?protocol : int) -> socket

Arguments:

  • domain (of type socket_domain, which defaults to socket.domain.inet): Socket domain.
  • type (of type socket_type, which defaults to socket.type.stream): Socket type
  • protocol (of type int, which defaults to 0): Protocol type. 0 selects the default protocol for that kind of sockets.

Methods:

  • accept (of type (?timeout : float?) -> socket .{ close : () -> unit, closed : () -> bool, non_blocking : (bool) -> unit, read : ((?timeout : float?) -> string) .{wait : (?timeout : float?, (() -> unit)) -> unit }, type : string, write : ((?timeout : float?, string) -> unit) .{wait : (?timeout : float?, (() -> unit)) -> unit } } * socket_address): Accept connections on the given socket. The returned socket is a socket connected to the client; the returned address is the address of the connecting client. Timeout defaults to harbor’s accept_timeout if null.
  • bind (of type (socket_address) -> unit): Bind a socket to an address.
  • close (of type () -> unit): Close the socket.
  • closed (of type () -> bool): true if the socket is already closed.
  • connect (of type (socket_address) -> unit): Connect a socket to an address.
  • listen (of type (int) -> unit): Set up a socket for receiving connection requests. The integer argument is the maximal number of pending requests.
  • non_blocking (of type (bool) -> unit): Set the non-blocking flag on the socket
  • read (of type ((?timeout : float?) -> string) .{wait : (?timeout : float?, (() -> unit)) -> unit}): Read data from a socket. Reading is done when the function returns an empty string "".
  • type (of type string): Socket type
  • write (of type ((?timeout : float?, string) -> unit) .{wait : (?timeout : float?, (() -> unit)) -> unit}): Write data to a socket

Liquidsoap

clock

Decorate a clock with all its methods.

Type:

(clock) -> clock

Arguments:

  • (unlabeled) (of type clock)

Methods:

  • active_sources (of type () -> [clock_source.{id : () -> string}]): List of active sources connected to the clock. This returns abstract sources for logging and etc. These sources cannot be used in operators.
  • dump (of type () -> string): Dump source graph for the clock.
  • id (of type (() -> string).{set : (string) -> unit}): The clock’s id
  • outputs (of type () -> [clock_source.{id : () -> string}]): List of outputs connected to the clock. This returns abstract sources for logging and etc. These sources cannot be used in operators.
  • passive_sources (of type () -> [clock_source.{id : () -> string}]): List of passive sources connected to the clock. This returns abstract sources for logging and etc. These sources cannot be used in operators.
  • self_sync (of type () -> bool): true if the clock is in control of its latency.
  • sources (of type () -> [clock_source.{id : () -> string}]): List of sources connected to the clock. This returns abstract sources for logging and etc. These sources cannot be used in operators.
  • start (of type (?force : bool) -> unit): Start the clock.
  • stop (of type () -> unit): Stop the clock. Does nothing if the clock is stopping or stopped.
  • sub_clocks (of type () -> [clock]): The list of sub-clocks for this clock.
  • sync (of type () -> string): The clock’s current sync mode. One of: "stopped", "stopping", "auto", "CPU", "unsynced" or "passive".
  • tick (of type () -> unit): Animate the clock and run one tick
  • ticks (of type () -> int): The total number of times the clock has ticked.
  • unify (of type (clock) -> unit): Unify the clock with another one. One of the two clocks should be in "stopped" sync mode.

clock.active

Return the list of clocks currently in use.

Type:

() -> [clock]

clock.create

Create a new clock

Type:

(?id : string?, ?on_error : ((error) -> unit)?, ?sync : string) -> clock

Arguments:

  • id (of type string?, which defaults to null): Identifier for the new clock.
  • on_error (of type ((error) -> unit)?, which defaults to null): Error callback executed when a streaming error occurs. When passed, all streaming errors are silenced. Intended mostly for debugging purposes.
  • sync (of type string, which defaults to "auto"): Clock sync mode. Should be one of: "auto", "CPU", "unsynced" or "passive". Defaults to "auto". Defaults to: “auto”

Methods:

  • active_sources (of type () -> [clock_source.{id : () -> string}]): List of active sources connected to the clock. This returns abstract sources for logging and etc. These sources cannot be used in operators.
  • dump (of type () -> string): Dump source graph for the clock.
  • id (of type (() -> string).{set : (string) -> unit}): The clock’s id
  • outputs (of type () -> [clock_source.{id : () -> string}]): List of outputs connected to the clock. This returns abstract sources for logging and etc. These sources cannot be used in operators.
  • passive_sources (of type () -> [clock_source.{id : () -> string}]): List of passive sources connected to the clock. This returns abstract sources for logging and etc. These sources cannot be used in operators.
  • self_sync (of type () -> bool): true if the clock is in control of its latency.
  • sources (of type () -> [clock_source.{id : () -> string}]): List of sources connected to the clock. This returns abstract sources for logging and etc. These sources cannot be used in operators.
  • start (of type (?force : bool) -> unit): Start the clock.
  • stop (of type () -> unit): Stop the clock. Does nothing if the clock is stopping or stopped.
  • sub_clocks (of type () -> [clock]): The list of sub-clocks for this clock.
  • sync (of type () -> string): The clock’s current sync mode. One of: "stopped", "stopping", "auto", "CPU", "unsynced" or "passive".
  • tick (of type () -> unit): Animate the clock and run one tick
  • ticks (of type () -> int): The total number of times the clock has ticked.
  • unify (of type (clock) -> unit): Unify the clock with another one. One of the two clocks should be in "stopped" sync mode.

clock.dump

Return a string description of the clocks currently being used.

Type:

() -> string

clock.dump_all_sources

Return a string description of all the streaming graph currently being used.

Type:

() -> string

decoder.add

Register an external decoder. The decoder receives a local file and produces another local file. Produced file can be any format decodable by liquidsoap and can also be a request uri. Recommended returned value is: annotate:metadata="value",..:/path/to/file.wav. File decoders are applied during the request resolution process.

Type:

(name : string, description : string, ?static : ((string) -> bool),
 ?mimes : [string], file_extensions : [string],
 ((rlog : ((string) -> unit), maxtime : float, string) -> string
  .{temporary? : bool}?)) -> unit

Arguments:

  • name (of type string)
  • description (of type string): Description of the decoder.
  • static (of type (string) -> bool, which defaults to fun (_) -> true): Return true, then requests can be resolved once and for all. Typically, static decoders can be used to create infallible sources.
  • mimes (of type [string], which defaults to []): List of mime types supported by this decoder. Empty means any mime type should be accepted.
  • file_extensions (of type [string]): List of file extensions. Should not be empty.
  • (unlabeled) (of type (rlog : ((string) -> unit), maxtime : float, string) -> string .{temporary? : bool}?): Resolution function. Returns null if no file could be decoded.

decoder.metadata.add

Register an external file metadata decoder.

Type:

(?priority : {int}, ?mime_types : [string]?, ?file_extensions : [string]?,
 ?reentrant : bool, string,
 ((metadata : [string * string], string) -> [string * string])) -> unit

Arguments:

  • priority (of type {int}, which defaults to 1): Resolver’s priority.
  • mime_types (of type [string]?, which defaults to null): Decode files that match the mime types in this list. Accept any file if null.
  • file_extensions (of type [string]?, which defaults to null): Decode files that have the file extensions in this list. Accept any file if null.
  • reentrant (of type bool, which defaults to false): Set to true to indicate that the decoder needs to resolve a request. Such decoders need to be mutually exclusive to avoid request resolution loops!
  • (unlabeled) (of type string): Format/resolver’s name.
  • (unlabeled) (of type (metadata : [string * string], string) -> [string * string]): Process to start. The function takes the format and filename as argument and returns a list of (name,value) fields.

decoder.metadata.reentrant

Return the list of reentrant decoders.

Type:

() -> [string]

encoder.content_type

Return the content-type (mime) of an encoder, if known.

Type:

(format('a)) -> string

Arguments:

  • (unlabeled) (of type format('a))

encoder.extension

Return the file extension of an encoder, if known.

Type:

(format('a)) -> string

Arguments:

  • (unlabeled) (of type format('a))

error.methods

Decorate an error with all its methods

Type:

(error) -> error

Arguments:

  • (unlabeled) (of type error)

Methods:

  • kind (of type string): Error kind.
  • message (of type string): Error message.
  • trace (of type [ { cstart : int, cstop : int, filename : string, lstart : int, lstop : int, to_string : (?prefix : string) -> string }]): Error stacktrace.

jack.server.buffer_size

Return the current buffer size of the JACK server.

Type:

(?server : string?) -> int

Arguments:

  • server (of type string?, which defaults to null): JACK server to query. Uses default server if null.

jack.server.connect

Connect a JACK output port to a JACK input port.

Type:

(?server : string?, jack_input_port, jack_output_port) -> unit

Arguments:

  • server (of type string?, which defaults to null): JACK server to query. Uses default server if null.
  • (unlabeled) (of type jack_input_port): Input port.
  • (unlabeled) (of type jack_output_port): Output port.

jack.server.get_input_ports

Return the JACK input ports matching the given pattern and type.

Type:

(?server : string?, ?pattern : string, ?type : string, ?flags : [string]) ->
[jack_input_port]

Arguments:

  • server (of type string?, which defaults to null): JACK server to query. Uses default server if null.
  • pattern (of type string, which defaults to ""): Port name pattern. Empty string matches all ports.
  • type (of type string, which defaults to "audio"): Port type to filter by: "audio" or "midi".
  • flags (of type [string], which defaults to []): Additional port flags to filter by. Valid values: "is_physical", "can_monitor", "is_terminal".

jack.server.get_output_ports

Return the JACK output ports matching the given pattern and type.

Type:

(?server : string?, ?pattern : string, ?type : string, ?flags : [string]) ->
[jack_output_port]

Arguments:

  • server (of type string?, which defaults to null): JACK server to query. Uses default server if null.
  • pattern (of type string, which defaults to ""): Port name pattern. Empty string matches all ports.
  • type (of type string, which defaults to "audio"): Port type to filter by: "audio" or "midi".
  • flags (of type [string], which defaults to []): Additional port flags to filter by. Valid values: "is_physical", "can_monitor", "is_terminal".

jack.server.sample_rate

Return the current sample rate of the JACK server.

Type:

(?server : string?) -> int

Arguments:

  • server (of type string?, which defaults to null): JACK server to query. Uses default server if null.

liquidsoap.executable

Path to the Liquidsoap executable.

Type:

string

liquidsoap.functions.count

Number of functions registered in the standard library.

Type:

() -> int

liquidsoap.script.path

Path to the current script, if available

Type:

string?

liquidsoap.version.at_least

Ensure that Liquidsoap version is greater or equal to given one.

Type:

(string) -> bool

Arguments:

  • (unlabeled) (of type string): Minimal version.

log

Log a message.

Type:

(?label : string, ?level : int, string) -> unit

Arguments:

  • label (of type string, which defaults to "lang")
  • level (of type int, which defaults to 3)
  • (unlabeled) (of type string)

log.flush

Flush all pending log messages.

Type:

() -> unit

playlist.parse

Try to parse a local playlist. Return a list of (metadata,URI) items, where metadata is a list of (key,value) bindings.

Type:

(?path : string, ?mime : string?, string) -> [[string * string] * string]

Arguments:

  • path (of type string, which defaults to ""): Default path for files.
  • mime (of type string?, which defaults to null): Mime type for the playlist
  • (unlabeled) (of type string)

playlist.parse.get_file

Resolve a uri relative to a given pwd.

Type:

(?pwd : string?, string) -> string

Arguments:

  • pwd (of type string?, which defaults to null): Current directory to use for relative file path.
  • (unlabeled) (of type string): URI

playlist.parse.m3u

Parse M3U playlists

Type:

(string, ?pwd : string?) -> [[string * string] * string]

Arguments:

  • (unlabeled) (of type string): Playlist file
  • pwd (of type string?, which defaults to null): Current directory to use for relative file path.

playlist.parse.register

Register a new playlist parser. An empty playlist is considered as a failure to resolve.

Type:

(name : string, mimes : [string], strict : bool,
 ((?pwd : string, string) -> [[string * string] * string])) -> unit

Arguments:

  • name (of type string): User-friendly format name
  • mimes (of type [string]): Supported mime formats.
  • strict (of type bool): True if playlist format can be detected unambiguously.
  • (unlabeled) (of type (?pwd : string, string) -> [[string * string] * string]): Playlist parser

playlist.parse.scpls

Parse SCPLS playlists

Type:

(string, ?pwd : string?) -> [[string * string] * string]

Arguments:

  • (unlabeled) (of type string): Playlist file
  • pwd (of type string?, which defaults to null): Current directory to use for relative file path.

playlist.parse.xml

Parse XML playlists

Type:

(string, ?pwd : string?) -> [[string * string] * string]

Arguments:

  • (unlabeled) (of type string): Playlist file
  • pwd (of type string?, which defaults to null): Current directory to use for relative file path.

profiler.disable

Record profiling statistics.

Type:

() -> unit

profiler.enable

Record profiling statistics.

Type:

() -> unit

profiler.run

Time a function with the profiler.

Type:

(string, (() -> 'a)) -> 'a

Arguments:

  • (unlabeled) (of type string): Name of the profiled function.
  • (unlabeled) (of type () -> 'a): Function to profile.

profiler.stats.string

Profiling statistics.

Type:

() -> string

prometheus.latency

Monitor a source’s internal latencies on Prometheus

Type:

(?window : float, ?prefix : string, labels : [string]) ->
(label_values : [string], source('a)) -> unit

Arguments:

  • window (of type float, which defaults to 5.0): Window over which mean and peak metrics are reported.
  • prefix (of type string, which defaults to "liquidsoap_"): Prefix for the metric’s name
  • labels (of type [string]): labels for the metric

protocol.add

Register a new protocol.

Type:

(?temporary : bool, ?static : ((string) -> bool), ?syntax : string,
 ?doc : string, string,
 ((rlog : ((string) -> unit), maxtime : float, string) -> string?)) -> unit

Arguments:

  • temporary (of type bool, which defaults to false): if true, file is removed when it is finished.
  • static (of type (string) -> bool, which defaults to fun (_) -> false): When given an uri for the protocol, if it returns true, then requests can be resolved once and for all. Typically, static protocols can be used to create infallible sources.
  • syntax (of type string, which defaults to "Undocumented"): URI syntax.
  • doc (of type string, which defaults to "Undocumented"): Protocol documentation.
  • (unlabeled) (of type string): Protocol name. Resolver will be called on uris of the form: <protocol name>:....
  • (unlabeled) (of type (rlog : ((string) -> unit), maxtime : float, string) -> string?): Protocol resolver. Receives a function to log protocol resolution, the <arg> in <protocol name>:<arg> and the max delay that resolution should take.

protocol.count

Number of registered protocols.

Type:

() -> int

request.all

Return all the requests currently available.

Type:

() -> [request]

request.create

Create a request from an URI.

Type:

(?cue_in_metadata : string?, ?cue_out_metadata : string?, ?persistent : bool,
 ?resolve_metadata : bool, ?excluded_metadata_resolvers : [string],
 ?temporary : bool, string) -> request

Arguments:

  • cue_in_metadata (of type string?, which defaults to "liq_cue_in"): Metadata for cue in points. Disabled if null.
  • cue_out_metadata (of type string?, which defaults to "liq_cue_out"): Metadata for cue out points. Disabled if null.
  • persistent (of type bool, which defaults to false): Indicate that the request is persistent, i.e. that it may be used again once it has been played.
  • resolve_metadata (of type bool, which defaults to true): Set to false to prevent metadata resolution on this request.
  • excluded_metadata_resolvers (of type [string], which defaults to []): List of metadata resolves to exclude when resolving metadata.
  • temporary (of type bool, which defaults to false): Indicate that the request is a temporary file: it will be destroyed after being played.
  • (unlabeled) (of type string)

request.destroy

Destroying a request causes any temporary associated file to be deleted, and releases its RID. Persistent requests resist to destroying, unless forced.

Type:

(?force : bool, request) -> unit

Arguments:

  • force (of type bool, which defaults to false): Destroy the request even if it is persistent.
  • (unlabeled) (of type request)

request.duration

Compute the duration in seconds of audio data contained in a request. The computation may be expensive. Returns null if computation failed, typically if the file was not recognized as valid audio.

Type:

(?resolvers : [string]?, ?resolve_metadata : bool,
 ?metadata : [string * string], ?timeout : float?, string) -> float?

Arguments:

  • resolvers (of type [string]?, which defaults to null): Set to a list of resolvers to only resolve duration using a specific decoder.
  • resolve_metadata (of type bool, which defaults to true): Set to false to prevent metadata resolution on this request.
  • metadata (of type [string * string], which defaults to []): Optional metadata used to decode the file, e.g. ffmpeg_options.
  • timeout (of type float?, which defaults to null): Limit in seconds to the duration of request resolution. Defaults to settings.request.timeout when null.
  • (unlabeled) (of type string)

request.duration.ffmpeg

Compute the duration in seconds of audio data contained in a request using the ffmpeg decoder. The computation may be expensive. Returns null if computation failed, typically if the file was not recognized as valid audio.

Type:

(?resolve_metadata : bool, ?metadata : [string * string], ?timeout : float?,
 string) -> float?

Arguments:

  • resolve_metadata (of type bool, which defaults to true): Set to false to prevent metadata resolution on this request.
  • metadata (of type [string * string], which defaults to []): Optional metadata used to decode the file, e.g. ffmpeg_options.
  • timeout (of type float?, which defaults to null): Limit in seconds to the duration of request resolution. Defaults to settings.request.timeout when null.
  • (unlabeled) (of type string)

request.duration.flac

Compute the duration in seconds of audio data contained in a request using the flac decoder. The computation may be expensive. Returns null if computation failed, typically if the file was not recognized as valid audio.

Type:

(?resolve_metadata : bool, ?metadata : [string * string], ?timeout : float?,
 string) -> float?

Arguments:

  • resolve_metadata (of type bool, which defaults to true): Set to false to prevent metadata resolution on this request.
  • metadata (of type [string * string], which defaults to []): Optional metadata used to decode the file, e.g. ffmpeg_options.
  • timeout (of type float?, which defaults to null): Limit in seconds to the duration of request resolution. Defaults to settings.request.timeout when null.
  • (unlabeled) (of type string)

request.duration.mad

Compute the duration in seconds of audio data contained in a request using the mad decoder. The computation may be expensive. Returns null if computation failed, typically if the file was not recognized as valid audio.

Type:

(?resolve_metadata : bool, ?metadata : [string * string], ?timeout : float?,
 string) -> float?

Arguments:

  • resolve_metadata (of type bool, which defaults to true): Set to false to prevent metadata resolution on this request.
  • metadata (of type [string * string], which defaults to []): Optional metadata used to decode the file, e.g. ffmpeg_options.
  • timeout (of type float?, which defaults to null): Limit in seconds to the duration of request resolution. Defaults to settings.request.timeout when null.
  • (unlabeled) (of type string)

request.duration.ogg_flac

Compute the duration in seconds of audio data contained in a request using the ogg_flac decoder. The computation may be expensive. Returns null if computation failed, typically if the file was not recognized as valid audio.

Type:

(?resolve_metadata : bool, ?metadata : [string * string], ?timeout : float?,
 string) -> float?

Arguments:

  • resolve_metadata (of type bool, which defaults to true): Set to false to prevent metadata resolution on this request.
  • metadata (of type [string * string], which defaults to []): Optional metadata used to decode the file, e.g. ffmpeg_options.
  • timeout (of type float?, which defaults to null): Limit in seconds to the duration of request resolution. Defaults to settings.request.timeout when null.
  • (unlabeled) (of type string)

request.duration.wav/aiff

Compute the duration in seconds of audio data contained in a request using the wav/aiff decoder. The computation may be expensive. Returns null if computation failed, typically if the file was not recognized as valid audio.

Type:

(?resolve_metadata : bool, ?metadata : [string * string], ?timeout : float?,
 string) -> float?

Arguments:

  • resolve_metadata (of type bool, which defaults to true): Set to false to prevent metadata resolution on this request.
  • metadata (of type [string * string], which defaults to []): Optional metadata used to decode the file, e.g. ffmpeg_options.
  • timeout (of type float?, which defaults to null): Limit in seconds to the duration of request resolution. Defaults to settings.request.timeout when null.
  • (unlabeled) (of type string)

request.filename

Return a valid local filename if the request is ready, and the empty string otherwise.

Type:

(request) -> string

Arguments:

  • (unlabeled) (of type request)

request.id

Identifier of a request.

Type:

(request) -> int

Arguments:

  • (unlabeled) (of type request)

request.is_static

true if the given URI is assumed to be static, e.g. a file.

Type:

(string) -> bool

Arguments:

  • (unlabeled) (of type string)

request.log

Get log data associated to a request.

Type:

(request) -> string

Arguments:

  • (unlabeled) (of type request)

request.metadata

Get the metadata associated to a request.

Type:

(request) -> [string * string]

Arguments:

  • (unlabeled) (of type request)

request.resolve

Resolve a request, i.e. attempt to get a valid local file. The operation can take some time. Return true if the resolving was successful, false otherwise (timeout or invalid URI).

Type:

(?timeout : float?, ?content_type : source('a)?, request) -> bool

Arguments:

  • timeout (of type float?, which defaults to null): Limit in seconds to the duration of the request resolution. Defaults to settings.request.timeout when null.
  • content_type (of type source('a)?, which defaults to null): Check that the request can decode content suitable for the given source.
  • (unlabeled) (of type request)

request.resolved

Check if a request is resolved, i.e. is associated to a valid local file.

Type:

(request) -> bool

Arguments:

  • (unlabeled) (of type request)

request.status

Current status of a request. Can be idle, resolving, ready, playing or destroyed.

Type:

(request) -> string

Arguments:

  • (unlabeled) (of type request)

request.uri

Initial URI of a request.

Type:

(request) -> string

Arguments:

  • (unlabeled) (of type request)

runtime.gc.compact

Perform a full major collection and compact the heap. Note that heap compaction is a lengthy operation.

Type:

() -> unit

runtime.gc.full_major

Trigger full major garbage collection.

Type:

() -> unit

runtime.gc.major

Trigger a minor collection and finish the current major collection cycle..

Type:

() -> unit

runtime.gc.major_slice

Do a minor collection and a slice of major collection. The optional argument n is the size of the slice: the GC will do enough work to free (on average) n words of memory. If 0 (its default), the GC will try to do enough work to ensure that the next automatic slice has no work to do.

Type:

(?int) -> unit

Arguments:

  • (unlabeled) (of type int, which defaults to 0): Size of the slice

runtime.gc.minor

Trigger full minor garbage collection.

Type:

() -> unit

seconds_of_main

Convert a number of main ticks to seconds. Sub-second precision is available as the fractional part (64-bit float).

Type:

(int) -> float

Arguments:

  • (unlabeled) (of type int)

server.execute

Execute a liquidsoap server command.

Type:

(string, ?string) -> [string]

Arguments:

  • (unlabeled) (of type string): Command to execute.
  • (unlabeled) (of type string, which defaults to ""): Argument for the command.

srt.socket

Decorate a srt socket with all its methods.

Type:

(srt_socket) -> srt_socket

Arguments:

  • (unlabeled) (of type srt_socket)

Methods:

  • bistats (of type (?clear : bool?, ?instantaneous : bool?) -> { byteAvailRcvBuf : int, byteAvailSndBuf : int, byteMSS : int, byteRcvBuf : int, byteRcvDrop : int, byteRcvDropTotal : int, byteRcvUndecrypt : int, byteRcvUndecryptTotal : int, byteRecv : int, byteRecvTotal : int, byteRetrans : int, byteRetransTotal : int, byteSent : int, byteSentTotal : int, byteSndBuf : int, byteSndDrop : int, byteSndDropTotal : int, mbpsBandwidth : float, mbpsMaxBW : float, mbpsRecvRate : float, mbpsSendRate : float, msRTT : float, msRcvBuf : int, msRcvTsbPdDelay : int, msSndBuf : int, msSndTsbPdDelay : int, msTimeStamp : int, pktCongestionWindow : int, pktFlightSize : int, pktFlowWindow : int, pktRcvAvgBelatedTime : float, pktRcvBelated : int, pktRcvBuf : int, pktRcvDrop : int, pktRcvDropTotal : int, pktRcvFilterExtra : int, pktRcvFilterExtraTotal : int, pktRcvFilterLoss : int, pktRcvFilterLossTotal : int, pktRcvFilterSupply : int, pktRcvFilterSupplyTotal : int, pktRcvLoss : int, pktRcvLossTotal : int, pktRcvRetrans : int, pktRcvUndecrypt : int, pktRcvUndecryptTotal : int, pktRecv : int, pktRecvACK : int, pktRecvACKTotal : int, pktRecvNAK : int, pktRecvNAKTotal : int, pktRecvTotal : int, pktReorderDistance : int, pktRetrans : int, pktRetransTotal : int, pktSent : int, pktSentACK : int, pktSentACKTotal : int, pktSentNAK : int, pktSentNAKTotal : int, pktSentTotal : int, pktSndBuf : int, pktSndDrop : int, pktSndDropTotal : int, pktSndFilterExtra : int, pktSndFilterExtraTotal : int, pktSndLoss : int, pktSndLossTotal : int, usPktSndPeriod : float, usSndDuration : int, usSndDurationTotal : int}): Socket bstats
  • bstats (of type (?clear : bool?) -> { byteAvailRcvBuf : int, byteAvailSndBuf : int, byteMSS : int, byteRcvBuf : int, byteRcvDrop : int, byteRcvDropTotal : int, byteRcvUndecrypt : int, byteRcvUndecryptTotal : int, byteRecv : int, byteRecvTotal : int, byteRetrans : int, byteRetransTotal : int, byteSent : int, byteSentTotal : int, byteSndBuf : int, byteSndDrop : int, byteSndDropTotal : int, mbpsBandwidth : float, mbpsMaxBW : float, mbpsRecvRate : float, mbpsSendRate : float, msRTT : float, msRcvBuf : int, msRcvTsbPdDelay : int, msSndBuf : int, msSndTsbPdDelay : int, msTimeStamp : int, pktCongestionWindow : int, pktFlightSize : int, pktFlowWindow : int, pktRcvAvgBelatedTime : float, pktRcvBelated : int, pktRcvBuf : int, pktRcvDrop : int, pktRcvDropTotal : int, pktRcvFilterExtra : int, pktRcvFilterExtraTotal : int, pktRcvFilterLoss : int, pktRcvFilterLossTotal : int, pktRcvFilterSupply : int, pktRcvFilterSupplyTotal : int, pktRcvLoss : int, pktRcvLossTotal : int, pktRcvRetrans : int, pktRcvUndecrypt : int, pktRcvUndecryptTotal : int, pktRecv : int, pktRecvACK : int, pktRecvACKTotal : int, pktRecvNAK : int, pktRecvNAKTotal : int, pktRecvTotal : int, pktReorderDistance : int, pktRetrans : int, pktRetransTotal : int, pktSent : int, pktSentACK : int, pktSentACKTotal : int, pktSentNAK : int, pktSentNAKTotal : int, pktSentTotal : int, pktSndBuf : int, pktSndDrop : int, pktSndDropTotal : int, pktSndFilterExtra : int, pktSndFilterExtraTotal : int, pktSndLoss : int, pktSndLossTotal : int, usPktSndPeriod : float, usSndDuration : int, usSndDurationTotal : int}): Socket bstats
  • close (of type () -> unit): Close socket
  • id (of type int): Socket ID
  • ipv6only (of type () -> bool): Get ipv6only option
  • latency (of type () -> int): Get latency option
  • pbkeylen (of type () -> int): Get pbkeylen option
  • peerlatency (of type () -> int): Get peerlatency option
  • rcvbuf (of type () -> int): Get rcvbuf option
  • rcvdata (of type () -> int): Get rcvdata option
  • rcvlatency (of type () -> int): Get rcvlatency option
  • rcvsyn (of type () -> bool): Get rcvsyn option
  • rcvtimeout (of type () -> int): Get rcvtimeout option
  • reuseaddr (of type () -> bool): Get reuseaddr option
  • set_conntimeo (of type (int) -> unit): Set conntimeo option
  • set_enforced_encryption (of type (bool) -> unit): Set enforced_encryption option
  • set_ipv6only (of type (bool) -> unit): Set ipv6only option
  • set_latency (of type (int) -> unit): Set latency option
  • set_messageapi (of type (bool) -> unit): Set messageapi option
  • set_passphrase (of type (string) -> unit): Set passphrase option
  • set_payloadsize (of type (int) -> unit): Set payloadsize option
  • set_pbkeylen (of type (int) -> unit): Set pbkeylen option
  • set_peerlatency (of type (int) -> unit): Set peerlatency option
  • set_rcvbuf (of type (int) -> unit): Set rcvbuf option
  • set_rcvlatency (of type (int) -> unit): Set rcvlatency option
  • set_rcvsyn (of type (bool) -> unit): Set rcvsyn option
  • set_rcvtimeout (of type (int) -> unit): Set rcvtimeout option
  • set_reuseaddr (of type (bool) -> unit): Set reuseaddr option
  • set_sndbuf (of type (int) -> unit): Set sndbuf option
  • set_sndsyn (of type (bool) -> unit): Set sndsyn option
  • set_sndtimeout (of type (int) -> unit): Set sndtimeout option
  • set_streamid (of type (string) -> unit): Set streamid option
  • set_udp_rcvbuf (of type (int) -> unit): Set udp_rcvbuf option
  • set_udp_sndbuf (of type (int) -> unit): Set udp_sndbuf option
  • sndbuf (of type () -> int): Get sndbuf option
  • sndsyn (of type () -> bool): Get sndsyn option
  • sndtimeout (of type () -> int): Get sndtimeout option
  • status (of type () -> string): Socket status
  • streamid (of type () -> string): Get streamid option
  • udp_rcvbuf (of type () -> int): Get udp_rcvbuf option
  • udp_sndbuf (of type () -> int): Get udp_sndbuf option

track.clock

Return the clock associated with the given track.

Type:

('a) -> clock where 'a is a track

Arguments:

  • (unlabeled) (of type anything that is a track)

track.format

Return the content format of a track. Use format.description to introspect the returned value.

Type:

('a) -> content_format where 'a is a track

Arguments:

  • (unlabeled) (of type anything that is a track)

List

_::_

Add an element at the top of a list.

Type:

('a, ['a]) -> ['a]

Arguments:

  • (unlabeled) (of type 'a)
  • (unlabeled) (of type ['a])

_[_]

l[k] returns the first v such that (k,v) is in the list l (or “” if no such v exists).

Type:

(['a * string], 'a) -> string where 'a is an orderable type

Arguments:

  • (unlabeled) (of type ['a * string] where 'a is an orderable type)
  • (unlabeled) (of type anything that is an orderable type)

list.add

Add an element at the top of a list.

Type:

('a, ['a]) -> ['a]

Arguments:

  • (unlabeled) (of type 'a)
  • (unlabeled) (of type ['a])

list.append

Concatenate two lists.

Type:

(['a], ['a]) -> ['a]

Arguments:

  • (unlabeled) (of type ['a])
  • (unlabeled) (of type ['a])

list.case

Define a function by case analysis, depending on whether a list is empty or not.

Type:

(['a], 'b, (('a, ['a]) -> 'b)) -> 'b

Arguments:

  • (unlabeled) (of type ['a]): List to perform case analysis on.
  • (unlabeled) (of type 'b): Result when the list is empty.
  • (unlabeled) (of type ('a, ['a]) -> 'b): Result when the list is non-empty.

list.ind

Define a function by induction on a list. This is slightly more efficient than defining a recursive function. The list is scanned from the right.

Type:

(['a], 'b, (('a, ['a], 'b) -> 'b)) -> 'b

Arguments:

  • (unlabeled) (of type ['a]): List to perform induction on.
  • (unlabeled) (of type 'b): Result when the list is empty.
  • (unlabeled) (of type ('a, ['a], 'b) -> 'b): Result when the list is non-empty, given the current element, the tail and the result of the recursive call on the tail.

list.init

Initialize a list.

Type:

(int, ((int) -> 'a)) -> ['a]

Arguments:

  • (unlabeled) (of type int): Number of elements in the list.
  • (unlabeled) (of type (int) -> 'a): Function such that f i is the ith element.

list.iteri

Call a function on every element of a list, along with its index.

Type:

(((int, 'a) -> unit), ['a]) -> unit

Arguments:

  • (unlabeled) (of type (int, 'a) -> unit)
  • (unlabeled) (of type ['a])

list.length

Compute the length of a list, i.e., the number of its elements.

Type:

(['a]) -> int

Arguments:

  • (unlabeled) (of type ['a])

list.map

Map a function on every element of a list.

Type:

((('a) -> 'b), ['a]) -> ['b]

Arguments:

  • (unlabeled) (of type ('a) -> 'b)
  • (unlabeled) (of type ['a])

list.nth

Get the n-th element of a list (the first element is at position 0), or default if element does not exist.

Type:

(?default : 'a?, ['a], int) -> 'a

Arguments:

  • default (of type 'a?, which defaults to null): Default element. Raises error.not_found if null and no element can be found in the list.
  • (unlabeled) (of type ['a])
  • (unlabeled) (of type int)

list.remove

Remove the first occurrence of a value from a list.

Type:

('a, ['a]) -> ['a]

Arguments:

  • (unlabeled) (of type 'a)
  • (unlabeled) (of type ['a])

list.rev

Revert list order.

Type:

(['a]) -> ['a]

Arguments:

  • (unlabeled) (of type ['a])

list.shuffle

Shuffle the content of a list. The function returns a list with the same elements but in different, random, order.

Type:

(['a]) -> ['a]

Arguments:

  • (unlabeled) (of type ['a])

list.slice

Return the sublist of length length starting with the element at index offset.

Type:

(?offset : int, ?length : int?, ['a]) -> ['a]

Arguments:

  • offset (of type int, which defaults to 0): Index of the first element.
  • length (of type int?, which defaults to null): Length of the returned list. Include all elements from offset if null.
  • (unlabeled) (of type ['a])

list.sort

Sort a list according to a comparison function.

Type:

((('a, 'a) -> int), ['a]) -> ['a]

Arguments:

  • (unlabeled) (of type ('a, 'a) -> int): Comparison function f such that f(x,y)<0 when x<y, f(x,y)=0 when x=y, and f(x,y)>0 when x>y.
  • (unlabeled) (of type ['a]): List to sort.

Math

*

Multiplication of numbers.

Type:

('a, 'a) -> 'a where 'a is a number type

Arguments:

  • (unlabeled) (of type anything that is a number type)
  • (unlabeled) (of type anything that is a number type)

+

Addition of numbers.

Type:

('a, 'a) -> 'a where 'a is a number type

Arguments:

  • (unlabeled) (of type anything that is a number type)
  • (unlabeled) (of type anything that is a number type)

-

Subtraction of numbers.

Type:

('a, 'a) -> 'a where 'a is a number type

Arguments:

  • (unlabeled) (of type anything that is a number type)
  • (unlabeled) (of type anything that is a number type)

/

Division of numbers.

Type:

('a, 'a) -> 'a where 'a is a number type

Arguments:

  • (unlabeled) (of type anything that is a number type)
  • (unlabeled) (of type anything that is a number type)

abs

Absolute value.

Type:

('a) -> 'a where 'a is a number type

Arguments:

  • (unlabeled) (of type anything that is a number type)

acos

Arc cosine. The argument must fall within the range [-1.0, 1.0]. Result is in radians and is between 0.0 and pi.

Type:

(float) -> float

Arguments:

  • (unlabeled) (of type float)

asin

Arc sine. The argument must fall within the range [-1.0, 1.0]. Result is in radians and is between -pi/2 and pi/2.

Type:

(float) -> float

Arguments:

  • (unlabeled) (of type float)

atan

Arc tangent. Result is in radians and is between -pi/2 and pi/2.

Type:

(float) -> float

Arguments:

  • (unlabeled) (of type float)

bool_of_float

Convert a float to a bool.

Type:

(float) -> bool

Arguments:

  • (unlabeled) (of type float)

bool_of_int

Convert an int to a bool.

Type:

(int) -> bool

Arguments:

  • (unlabeled) (of type int)

ceil

Round above to an integer value. ceil(x) returns the least integer whose value is greater than or equal to x. The result is returned as a float.

Type:

(float) -> float

Arguments:

  • (unlabeled) (of type float)

cos

Cosine. Argument is in radians.

Type:

(float) -> float

Arguments:

  • (unlabeled) (of type float)

cosh

Hyperbolic cosine. Argument is in radians.

Type:

(float) -> float

Arguments:

  • (unlabeled) (of type float)

exp

Exponential.

Type:

(float) -> float

Arguments:

  • (unlabeled) (of type float)

float

Convert a number to a float.

Type:

('a) -> float where 'a is a number type

Arguments:

  • (unlabeled) (of type anything that is a number type)

float.is_infinite

Return true if the floating point number is infinite.

Type:

(float) -> bool

Arguments:

  • (unlabeled) (of type float)

float.is_nan

Return true if the floating point number is NaN.

Type:

(float) -> bool

Arguments:

  • (unlabeled) (of type float)

float.truncate

Round a float to a given number of decimal digits. Mode can be "ceil" (round up), "floor" (round down), or "default" (round to nearest).

Type:

(?digits : int, ?mode : string, float) -> float

Arguments:

  • digits (of type int, which defaults to 0): Number of decimal digits to keep.
  • mode (of type string, which defaults to "default"): Rounding mode: "ceil", "floor", or "default".
  • (unlabeled) (of type float)

float_of_int

Convert an int to a float.

Type:

(int) -> float

Arguments:

  • (unlabeled) (of type int)

floor

Round below to an integer value. floor(x) returns the greatest integer whose value is less than or equal to x. The result is returned as a float.

Type:

(float) -> float

Arguments:

  • (unlabeled) (of type float)

infinity

Float representation of infinity.

Type:

float

int

Convert a number to an integer.

Type:

('a, ?raise : bool) -> int where 'a is a number type

Arguments:

  • (unlabeled) (of type anything that is a number type)
  • raise (of type bool, which defaults to false): Raise error.invalid if number is NaN or +/-infinity.

int_of_float

Convert a float to a int.

Type:

(float) -> int

Arguments:

  • (unlabeled) (of type float)

ln

Natural logarithm.

Type:

(float) -> float

Arguments:

  • (unlabeled) (of type float)

log10

Base 10 logarithm.

Type:

(float) -> float

Arguments:

  • (unlabeled) (of type float)

lsl

Logical shift left.

Type:

(int, int) -> int

Arguments:

  • (unlabeled) (of type int): Number to shift.
  • (unlabeled) (of type int): Number of bits to shift.

lsr

Logical shift right.

Type:

(int, int) -> int

Arguments:

  • (unlabeled) (of type int): Number to shift.
  • (unlabeled) (of type int): Number of bits to shift.

max_int

Maximal representable integer.

Type:

int

min_int

Minimal representable integer.

Type:

int

mod

Remainder of division of numbers.

Type:

('a, 'a) -> 'a where 'a is a number type

Arguments:

  • (unlabeled) (of type anything that is a number type)
  • (unlabeled) (of type anything that is a number type)

nan

A special floating-point value denoting the result of an undefined operation such as 0.0 /. 0.0. Stands for ‘not a number’. Any floating-point operation with nan as argument returns nan as result. As for floating-point comparisons, ==, <, <=, > and >= return false and != returns true if one or both of their arguments is nan.

Type:

float

pow

Exponentiation of numbers.

Type:

('a, 'a) -> 'a where 'a is a number type

Arguments:

  • (unlabeled) (of type anything that is a number type)
  • (unlabeled) (of type anything that is a number type)

random.float

Generate a random value between min (included) and max (excluded).

Type:

(?min : float, ?max : float) -> float

Arguments:

  • min (of type float, which defaults to 0.0)
  • max (of type float, which defaults to 1.0)

random.int

Generate a random value between min (included) and max (excluded).

Type:

(?min : int, ?max : int) -> int

Arguments:

  • min (of type int, which defaults to -536870911)
  • max (of type int, which defaults to 536870912)

round

Rounds x to the nearest integer with ties (fractional values of 0.5) rounded away from zero, regardless of the current rounding direction. If x is an integer, +0., -0., nan, or infinite, x itself is returned.

Type:

(float) -> float

Arguments:

  • (unlabeled) (of type float)

sign

Return 1. if the argument is positive and -1. otherwise.

Type:

(float) -> float

Arguments:

  • (unlabeled) (of type float)

sin

Sine. Argument is in radians.

Type:

(float) -> float

Arguments:

  • (unlabeled) (of type float)

sinh

Hyperbolic sine. Argument is in radians.

Type:

(float) -> float

Arguments:

  • (unlabeled) (of type float)

sqrt

Square root.

Type:

(float) -> float

Arguments:

  • (unlabeled) (of type float)

tan

Tangent. Argument is in radians.

Type:

(float) -> float

Arguments:

  • (unlabeled) (of type float)

tanh

Hyperbolic tangent. Argument is in radians.

Type:

(float) -> float

Arguments:

  • (unlabeled) (of type float)

~-

Returns the opposite of its argument.

Type:

('a) -> 'a where 'a is a number type

Arguments:

  • (unlabeled) (of type anything that is a number type)

Metadata

string.apic.parse

Parse APIC ID3v2 tags (such as those obtained in the APIC tag from file.metadata.id3v2). The returned values are: mime, picture type, description, and picture data.

Type:

(string) -> string

Arguments:

  • (unlabeled) (of type string): APIC data.

Methods:

  • description (of type string): Description
  • mime (of type string): Mime type
  • picture_type (of type int): Picture type

string.pic.parse

Parse PIC ID3v2 tags (such as those obtained in the PIC tag from file.metadata.id3v2). The returned values are: format, picture type, description, and picture data.

Type:

(string) -> string

Arguments:

  • (unlabeled) (of type string): PIC data.

Methods:

  • description (of type string): Description
  • format (of type string): Picture format
  • picture_type (of type int): Picture type

Programming

error.on_error

Register a callback to monitor errors raised during the execution of the program. The callback is allow to re-raise a different error if needed. The callback passed to this function is called on every errors, not just uncaught errors.

Type:

(((error
   .{
     kind : string,
     message : string,
     trace : [
              {
                cstart : int,
                cstop : int,
                filename : string,
                lstart : int,
                lstop : int,
                to_string : (?prefix : string) -> string
              }]
   }) -> unit)) -> unit

Arguments:

  • (unlabeled) (of type (error .{ kind : string, message : string, trace : [ { cstart : int, cstop : int, filename : string, lstart : int, lstop : int, to_string : (?prefix : string) -> string }] }) -> unit)

error.raise

Raise an error.

Type:

(error, ?string) -> 'a

Arguments:

  • (unlabeled) (of type error): Error kind.
  • (unlabeled) (of type string, which defaults to ""): Description of the error.

error.register

Register an error of the given kind

Type:

(string) -> error

Arguments:

  • (unlabeled) (of type string): Kind of the error

Methods:

  • kind (of type string): Error kind.
  • message (of type string): Error message.
  • trace (of type [ { cstart : int, cstop : int, filename : string, lstart : int, lstop : int, to_string : (?prefix : string) -> string }]): Error stacktrace.

fst

Get the first component of a pair.

Type:

(('a * 'b)) -> 'a

Arguments:

  • (unlabeled) (of type 'a * 'b)

ignore

Convert anything to unit, preventing warnings.

Type:

('a) -> unit

Arguments:

  • (unlabeled) (of type 'a)

null

Create a nullable value.

Type:

(?'a) -> 'a?

Arguments:

  • (unlabeled) (of type 'a, which defaults to null): Value to make nullable.

null.case

Return a result dending on whether a value is nothing or not.

Type:

('a?, (() -> 'b), (('a) -> 'b)) -> 'b

Arguments:

  • (unlabeled) (of type 'a?): Value to reason by case analysis on.
  • (unlabeled) (of type () -> 'b): Value to return in case we have nothing.
  • (unlabeled) (of type ('a) -> 'b): Value to return in case we have something.

null.default

Return a result dending on whether a value is nothing or not.

Type:

('a?, (() -> 'a)) -> 'a

Arguments:

  • (unlabeled) (of type 'a?): Value to reason by case analysis on.
  • (unlabeled) (of type () -> 'a): Value to return in case we have nothing.

position

Return the current position in the script

Type:

() -> unit

Methods:

  • cstart (of type int): Starting character
  • cstop (of type int): Stopping character
  • filename (of type string): Filename
  • lstart (of type int): Starting line
  • lstop (of type int): Stopping line
  • to_string (of type (?prefix : string) -> string): Render as string

print

Print on standard output.

Type:

(?newline : bool, 'a) -> unit

Arguments:

  • newline (of type bool, which defaults to true): If true, a newline is added after displaying the value.
  • (unlabeled) (of type 'a)

ref

Create a reference, i.e. a value which can be modified.

Type:

('a) -> () -> 'a

Arguments:

  • (unlabeled) (of type 'a)

Methods:

  • set (of type ('A) -> unit): Set the value of the reference.

snd

Get the second component of a pair.

Type:

(('a * 'b)) -> 'b

Arguments:

  • (unlabeled) (of type 'a * 'b)

sqlite

Manipulate an SQLITE database.

Type:

(string) -> unit

Arguments:

  • (unlabeled) (of type string): File where the data base is stored

Methods:

  • close (of type () -> unit): Close the database. It should not be accessed afterward.
  • exec (of type (string) -> unit): Execute an SQL operation.
  • insert (of type (table : string, ?replace : bool, 'A) -> unit where 'A is a record with int, float, string or null methods.): Insert a value represented as a record into a table.
  • iter (of type (((sqlite.row.{to_list : () -> [string * string?]}) -> unit), string) -> unit): Iterate a function over all the results of a query. Result can be parsed using let sqlite.row = ....
  • query (of type (string) -> [sqlite.row.{to_list : () -> [string * string?]}]): Execute an SQL operation returning the result. Result can be parsed using let sqlite.query = ....

sqlite.escape

Escape a string for use in a query.

Type:

(string) -> string

Arguments:

  • (unlabeled) (of type string): String to escape.

thread.delay

Delay the current thread by the given duration in seconds.

Type:

(float) -> unit

Arguments:

  • (unlabeled) (of type float)

thread.on_error

Register the function to be called when an error of the given kind is raised in a thread. Catches all errors if first argument is null.

Type:

(error?, ((backtrace : string, error) -> unit)) -> unit

Arguments:

  • (unlabeled) (of type error?)
  • (unlabeled) (of type (backtrace : string, error) -> unit)

thread.pause

Pause execution for a given amount of seconds. This puts the calling thread to sleep and should not be used in the main streaming loop.

Type:

(float) -> unit

Arguments:

  • (unlabeled) (of type float): Number of seconds of pause.

thread.run.recurrent

Run a recurrent function in a separate thread.

Type:

(?fast : bool, ?delay : float, ?on_error : ((error) -> float)?,
 (() -> float)) -> unit

Arguments:

  • fast (of type bool, which defaults to true): Whether the thread is supposed to return quickly or not. Typically, blocking tasks (e.g. fetching data over the internet) should not be considered to be fast. When set to false its priority will be lowered below that of request resolutions and fast timeouts. This is only effective if you set a dedicated queue for fast tasks, see the “scheduler” settings for more details.
  • delay (of type float, which defaults to 0.0): Delay (in sec.) after which the thread should be launched.
  • on_error (of type ((error) -> float)?, which defaults to null): Error callback executed when an error occurred while running the given function. When passed, all raised errors are silenced unless re-raised by the callback.
  • (unlabeled) (of type () -> float): Function to execute recurrently. The returned value is the delay (in sec.) in which the function should be run again (it won’t be run if the value is strictly negative).

while

A while loop.

Type:

({bool}, (() -> unit)) -> unit

Arguments:

  • (unlabeled) (of type {bool}): Condition guarding the loop.
  • (unlabeled) (of type () -> unit): Function to execute.

Source / Audio processing

add

Mix sources, with optional normalization. Metadata are relayed from all sources. Track marks are dropped from all sources.

Type:

(?id : string?, ?normalize : {bool}, ?power : {bool}, ?weights : [{float}],
 [source('a)]) -> source('a)
where 'a is a set of internal tracks

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • normalize (of type {bool}, which defaults to true): Divide by the sum of weights of ready sources (or by the number of ready sources if weights are not specified).
  • power (of type {bool}, which defaults to false): Perform constant-power normalization.
  • weights (of type [{float}], which defaults to []): Relative weight of the sources in the sum. The empty list stands for the homogeneous distribution. These are used as amplification coefficients if we are not normalizing.
  • (unlabeled) (of type [source('a)] where 'a is a set of internal tracks)

Methods:

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

Callbacks:

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

dtmf.detect

Detect DTMF tones.

Type:

(?id : string?, ?bands : int, ?debug : {bool}, ?duration : {float},
 ?smoothing : {float}, ?threshold : {float}, source(audio=pcm('a), 'b),
 ((string) -> unit)) -> source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • bands (of type int, which defaults to 1024): Number of frequency bands.
  • debug (of type {bool}, which defaults to false): Show internal values on standard output in order to fine-tune parameters: band number, band frequency, detected intensity and smoothed intensity.
  • duration (of type {float}, which defaults to 0.05): Duration for detecting a tone.
  • smoothing (of type {float}, which defaults to 0.01): Smoothing time (in seconds) for band indensity (the higher, the less sensitive we are to local variations, but the more time we take to detect a band).
  • threshold (of type {float}, which defaults to 50.0): Threshold for detecting a band.
  • (unlabeled) (of type source(audio=pcm('a), 'b)): Source on which DTMF tones should be detected.
  • (unlabeled) (of type (string) -> unit): Function called with detected key as argument.

Methods:

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

Callbacks:

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

echo

Add echo.

Type:

(?id : string?, ?delay : {float}, ?feedback : {float}, ?ping_pong : bool,
 source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • delay (of type {float}, which defaults to 0.5): Delay in seconds.
  • feedback (of type {float}, which defaults to -6.0): Feedback coefficient in dB (negative).
  • ping_pong (of type bool, which defaults to false): Use ping-pong delay.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

filter

Perform several kinds of filtering on the signal. Only frequencies below the sampling rate / 4 (generally 10 kHz) are handled well for the freq parameter.

Type:

(?id : string?, freq : {float}, mode : string, ?q : {float},
 ?wetness : {float}, source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • freq (of type {float}): Characteristic frequency of the filter.
  • mode (of type string): Available modes are ‘low’ (for low-pass filter), ‘high’ (for high-pass filter), ‘band’ (for band-pass filter) and ‘notch’ (for notch / band-stop / band-rejection filter).
  • q (of type {float}, which defaults to 1.0)
  • wetness (of type {float}, which defaults to 1.0): How much of the original signal should be added (1. means only filtered and 0. means only original signal).
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

filter.fir

Low-pass FIR filter.

Type:

(?id : string?, beta : float, ?coeffs : int, frequency : float,
 source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • beta (of type float): Beta should range between 0 and 1.
  • coeffs (of type int, which defaults to 255): Number of coefficients
  • frequency (of type float): Corner frequency in Hz (frequency at which the response is 0.5, that is -6 dB).
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

filter.iir.butterworth.bandpass

IIR filter

Type:

(?id : string?, frequency1 : float, frequency2 : float, ?order : int,
 source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency1 (of type float): First corner frequency
  • frequency2 (of type float): Second corner frequency
  • order (of type int, which defaults to 4): Filter order
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

filter.iir.butterworth.bandstop

IIR filter

Type:

(?id : string?, frequency1 : float, frequency2 : float, ?order : int,
 source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency1 (of type float): First corner frequency
  • frequency2 (of type float): Second corner frequency
  • order (of type int, which defaults to 4): Filter order
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

filter.iir.butterworth.high

IIR filter

Type:

(?id : string?, frequency : float, ?order : int, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type float): Corner frequency
  • order (of type int, which defaults to 4): Filter order
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

filter.iir.butterworth.low

IIR filter

Type:

(?id : string?, frequency : float, ?order : int, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type float): Corner frequency
  • order (of type int, which defaults to 4): Filter order
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

filter.iir.eq.allpass

All-pass biquad filter.

Type:

(?id : string?, ?bandwidth : {float}, frequency : {float}, source('a)) ->
source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • bandwidth (of type {float}, which defaults to 0.333333333333): Bandwidth (in octaves)
  • frequency (of type {float}): Center frequency
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

filter.iir.eq.bandpass

Band-pass biquad filter.

Type:

(?id : string?, frequency : {float}, ?q : {float}, source('a)) -> source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type {float}): Center frequency
  • q (of type {float}, which defaults to 1.0): Q
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

filter.iir.eq.high

High-pass biquad filter.

Type:

(?id : string?, frequency : {float}, ?q : {float}, source('a)) -> source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type {float}): Corner frequency
  • q (of type {float}, which defaults to 1.0): Q
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

filter.iir.eq.highshelf

High shelf biquad filter.

Type:

(?id : string?, frequency : {float}, ?slope : {float}, source('a)) ->
source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type {float}): Center frequency
  • slope (of type {float}, which defaults to 1.0): Shelf slope (in dB/octave)
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

filter.iir.eq.low

Low-pass biquad filter.

Type:

(?id : string?, frequency : {float}, ?q : {float}, source('a)) -> source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type {float}): Corner frequency
  • q (of type {float}, which defaults to 1.0): Q
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

filter.iir.eq.lowshelf

Low shelf biquad filter.

Type:

(?id : string?, frequency : {float}, ?slope : {float}, source('a)) ->
source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type {float}): Corner frequency
  • slope (of type {float}, which defaults to 1.0): Shelf slope (dB/octave)
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

filter.iir.eq.notch

Band-pass biquad filter.

Type:

(?id : string?, frequency : {float}, ?q : {float}, source('a)) -> source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type {float}): Center frequency
  • q (of type {float}, which defaults to 1.0): Q
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

filter.iir.eq.peak

Peak EQ biquad filter.

Type:

(?id : string?, frequency : {float}, ?gain : {float}, ?q : {float},
 source('a)) -> source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type {float}): Center frequency
  • gain (of type {float}, which defaults to 1.0): Gain (in dB)
  • q (of type {float}, which defaults to 1.0): Q
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

filter.iir.resonator.allpass

IIR filter

Type:

(?id : string?, frequency : float, ?q : float, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type float): Corner frequency
  • q (of type float, which defaults to 60.0): Quality factor
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

filter.iir.resonator.bandpass

IIR filter

Type:

(?id : string?, frequency : float, ?q : float, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type float): Corner frequency
  • q (of type float, which defaults to 60.0): Quality factor
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

filter.iir.resonator.bandstop

IIR filter

Type:

(?id : string?, frequency : float, ?q : float, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type float): Corner frequency
  • q (of type float, which defaults to 60.0): Quality factor
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

filter.rc

First-order filter (RC filter).

Type:

(?id : string?, frequency : {float}, mode : string, ?wetness : {float},
 source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type {float}): Cutoff frequency.
  • mode (of type string): Available modes are ‘low’ (for low-pass filter), ‘high’ (for high-pass filter).
  • wetness (of type {float}, which defaults to 1.0): How much of the original signal should be added (1. means only filtered and 0. means only original signal).
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

flanger

Flanger effect.

Type:

(?id : string?, ?delay : float, ?feedback : {float}, ?freq : {float},
 ?phase : {float}, source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • delay (of type float, which defaults to 0.001): Delay in seconds.
  • feedback (of type {float}, which defaults to 0.0): Feedback coefficient in dB.
  • freq (of type {float}, which defaults to 0.5): Frequency in Hz.
  • phase (of type {float}, which defaults to 1.0): Phase difference between channels in radians.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

gate

Reduce the volume when the stream is silent (typically in order to avoid low intensity noise).

Type:

(?id : string?, ?attack : {float}, ?hold : {float}, ?range : {float},
 ?release : {float}, ?threshold : {float}, ?window : {float},
 source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • attack (of type {float}, which defaults to 10.0): Time to fully open the gate (ms).
  • hold (of type {float}, which defaults to 1000.0): Minimum amount of time the gate stays open (ms).
  • range (of type {float}, which defaults to -30.0): Difference between closed and open level (dB).
  • release (of type {float}, which defaults to 2000.0): Time to fully close the gate (ms).
  • threshold (of type {float}, which defaults to -30.0): Threshold at which the gate will open (dB).
  • window (of type {float}, which defaults to 1.0): Duration for computing peak (ms).
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

normalize.old

Normalize the signal. Dynamic normalization of the signal is sometimes the only option, and can make a listening experience much nicer. However, its dynamic aspect implies some limitations which can go as far as creating saturation in some extreme cases. If possible, consider using some track-based normalization techniques such as those based on replay gain. See the documentation for more details. This is the implementation provided in Liquidsoap < 2.0. A new, better and more customizable one is now given in normalize.

Type:

(?id : string?, ?gain_max : {float}, ?gain_min : {float}, ?k_down : {float},
 ?k_up : {float}, ?target : {float}, ?threshold : {float},
 ?track_sensitive : bool, ?window : float, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • gain_max (of type {float}, which defaults to 6.0): Maximal gain value (dB).
  • gain_min (of type {float}, which defaults to -6.0): Minimal gain value (dB).
  • k_down (of type {float}, which defaults to 0.1): Coefficient when the power must go down (between 0 and 1, slowest to fastest).
  • k_up (of type {float}, which defaults to 0.005): Coefficient when the power must go up (between 0 and 1, slowest to fastest).
  • target (of type {float}, which defaults to -13.0): Desired RMS (dB).
  • threshold (of type {float}, which defaults to -40.0): Minimal RMS for activaing gain control (dB).
  • track_sensitive (of type bool, which defaults to true): Reset values on every track.
  • window (of type float, which defaults to 0.1): Duration of the window used to compute the current RMS power (second).
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

peak

Get current peak volume of the source. Returns the source with a method peak to compute the current peak volume of the source, with 0.0 <= peak volume <= 1.0.

Type:

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

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • duration (of type {float}, which defaults to 0.5): Duration of the window (in seconds). A value <= 0, means that computation should not be performed.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

peak.stereo

Get current peak volume of the source. Returns the source with a method peak to compute the current peak volume of the source, with 0.0 <= peak volume <= 1.0.

Type:

(?id : string?, ?duration : {float}, source(audio=pcm(stereo), 'a)) ->
source(audio=pcm(stereo), 'a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • duration (of type {float}, which defaults to 0.5): Duration of the window (in seconds). A value <= 0, means that computation should not be performed.
  • (unlabeled) (of type source(audio=pcm(stereo), 'a))

Methods:

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

Callbacks:

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

pipe

Process audio signal through a given process stdin/stdout.

Type:

(?id : string?, ?buffer : float, ?data_length : int?, ?max : float,
 process : string, ?replay_delay : float?, ?restart : bool,
 ?restart_on_error : bool, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • buffer (of type float, which defaults to 1.0): Duration of the pre-buffered data.
  • data_length (of type int?, which defaults to null): Length passed in the WAV data chunk. Data is streamed so no the consuming program should process it as it comes. Some program operate better when this value is set to 0, some other when it is set to the maximum length allowed by the WAV specs. Use any negative value to set to maximum length.
  • max (of type float, which defaults to 10.0): Maximum duration of the buffered data.
  • process (of type string): Process used to pipe data to.
  • replay_delay (of type float?, which defaults to null): Replay track marks and metadata from the input source on the output after a given delay. If null (default) close and flush the process on each track and metadata to get an exact timing. This parameter is typically used when integrating with stereotool.
  • restart (of type bool, which defaults to true): Restart process when exited.
  • restart_on_error (of type bool, which defaults to true): Restart process when exited with error.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

rms

Get current RMS volume of the source. Returns the source with a method rms to compute the current RMS volume of the source, with 0.0 <= RMS volume <= 1.0.

Type:

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

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • duration (of type {float}, which defaults to 0.5): Duration of the window (in seconds). A value <= 0, means that computation should not be performed.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

rms.stereo

Get current RMS volume of the source. Returns the source with a method rms to compute the current RMS volume of the source, with 0.0 <= RMS volume <= 1.0.

Type:

(?id : string?, ?duration : {float}, source(audio=pcm(stereo), 'a)) ->
source(audio=pcm(stereo), 'a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • duration (of type {float}, which defaults to 0.5): Duration of the window (in seconds). A value <= 0, means that computation should not be performed.
  • (unlabeled) (of type source(audio=pcm(stereo), 'a))

Methods:

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

Callbacks:

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

sine.detect

Detect sine waves.

Type:

(?id : string?, ?bands : int, ?debug : {bool}, ?duration : {float},
 ?smoothing : {float}, ?threshold : {float}, [float], source(audio=pcm('a),
 'b), ((float) -> unit)) -> source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • bands (of type int, which defaults to 1024): Number of frequency bands.
  • debug (of type {bool}, which defaults to false): Show internal values on standard output in order to fine-tune parameters: band number, band frequency, detected intensity and smoothed intensity.
  • duration (of type {float}, which defaults to 0.5): Duration for detecting a tone.
  • smoothing (of type {float}, which defaults to 0.01): Smoothing time (in seconds) for band indensity (the higher, the less sensitive we are to local variations, but the more time we take to detect a band).
  • threshold (of type {float}, which defaults to 50.0): Threshold for detecting a band.
  • (unlabeled) (of type [float]): List of frequencies to detect.
  • (unlabeled) (of type source(audio=pcm('a), 'b)): Source on which sines should be detected.
  • (unlabeled) (of type (float) -> unit): Function called with detected frequency as argument.

Methods:

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

Callbacks:

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

soundtouch

Change the rate, the tempo or the pitch of the sound.

Type:

(?id : string?, ?pitch : {float}, ?rate : {float}, ?tempo : {float},
 source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • pitch (of type {float}, which defaults to 1.0)
  • rate (of type {float}, which defaults to 1.0)
  • tempo (of type {float}, which defaults to 1.0)
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

This function is experimental.

source.replaygain.compute

Compute the ReplayGain of the source. Data is accumulated until the gain method is called, i.e. the gain is computed after the source has been played..

Type:

(?id : string?, source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Arguments:

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

Methods:

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

Callbacks:

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

Source / FFmpeg filter

ffmpeg.filter.audio.input

Attach an audio track to a filter’s input

Type:

(?id : string?, ?pass_metadata : bool, ffmpeg.filter.graph,
 ffmpeg.audio.raw('a)) -> ffmpeg.filter.audio

Arguments:

  • id (of type string?, which defaults to null)
  • pass_metadata (of type bool, which defaults to true): Pass liquidsoap’s metadata to this stream
  • (unlabeled) (of type ffmpeg.filter.graph)
  • (unlabeled) (of type ffmpeg.audio.raw('a))

ffmpeg.filter.create

Configure and launch a filter graph

Type:

(((ffmpeg.filter.graph) -> 'a)) -> 'a

Arguments:

  • (unlabeled) (of type (ffmpeg.filter.graph) -> 'a)

ffmpeg.filter.video.input

Attach a video track to a filter’s input

Type:

(?id : string?, ?pass_metadata : bool, ffmpeg.filter.graph,
 ffmpeg.video.raw('a)) -> ffmpeg.filter.video

Arguments:

  • id (of type string?, which defaults to null)
  • pass_metadata (of type bool, which defaults to true): Pass liquidsoap’s metadata to this stream
  • (unlabeled) (of type ffmpeg.filter.graph)
  • (unlabeled) (of type ffmpeg.video.raw('a))

Source / Fade

cross

Cross operator, allowing the composition of the n last seconds of a track with the beginning of the next track, using a transition function depending on the relative power of the signal before and after the end of track.

Type:

(?id : string?, ?duration : {float}, ?override_duration : string,
 ?persist_override : bool, ?width : float,
 ((
   {
     db_level : float,
     metadata : [string * string],
     source : source(audio=pcm('a),
     'b)
   }, 
   {
     db_level : float,
     metadata : [string * string],
     source : source(audio=pcm('a),
     'b)
   }) -> source(audio=pcm('a), 'b)),
 source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • duration (of type {float}, which defaults to 5.0): Duration (in seconds) of buffered data from the end and start of each track that is used to compute the transition between tracks.
  • override_duration (of type string, which defaults to "liq_cross_duration"): Metadata field which, if present and containing a float, overrides the ‘duration’ parameter for current track.
  • persist_override (of type bool, which defaults to false): Keep duration override on track change.
  • width (of type float, which defaults to 2.0): Width of the power computation window.
  • (unlabeled) (of type ( { db_level : float, metadata : [string * string], source : source(audio=pcm('a), 'b) }, { db_level : float, metadata : [string * string], source : source(audio=pcm('a), 'b) }) -> source(audio=pcm('a), 'b)): Transition function, composing from the end of a track and the next track. The sources corresponding to the two tracks are decorated with fields indicating the power of the signal before and after the transition (power), and the metadata (metadata).
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

Source / Input / Active

input.alsa

Stream from an ALSA input device.

Type:

(?id : string?, ?buffer_size : float?, ?device : string, ?fallible : bool,
 ?self_sync : bool, ?start : bool) -> source(audio=pcm('a))

Synchronization:

This source uses the ALSA hardware clock as synchronization source when self_sync=true and the device is open.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • buffer_size (of type float?, which defaults to null): ALSA buffer size in seconds. Defaults to frame duration when null.
  • device (of type string, which defaults to "default"): Alsa device to use
  • fallible (of type bool, which defaults to false): Allow the source to fail. If set to false, start must be true and stop method raises an error.
  • self_sync (of type bool, which defaults to true): Mark the source as being synchronized by the ALSA driver.
  • start (of type bool, which defaults to true): Start input as soon as it is available.

Methods:

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

Callbacks:

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

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, ?poll_delay : float, ?self_sync : {bool},
 ?start : bool, ?string_args : [string * string], ?trim_url : bool, {string}) ->
source('a)

Synchronization:

This source uses the FFmpeg input stream as synchronization source when self_sync=true and connected.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • debug (of type bool, which defaults to false): Run in debugging mode, not catching some exceptions.
  • deduplicate_metadata (of type bool, which defaults to true): Prevent duplicated metadata.
  • float_args (of type [string * float], which defaults to [])
  • format (of type string?, which defaults to null): Force a specific input format. Autodetected when passed a null argument
  • int_args (of type [string * int], which defaults to [])
  • max_buffer (of type float, which defaults to 5.0): Maximum uration of buffered data
  • metadata_filter (of type (([string * string]) -> [string * string])?, which defaults to null): Metadata filter function. Returned metadata are set a metadata. Default: filter id3v2_priv metadata.
  • new_track_on_metadata (of type bool, which defaults to true): Treat new metadata as new track.
  • poll_delay (of type float, which defaults to 2.0): Polling delay when trying to connect to the stream.
  • self_sync (of type {bool}, which defaults to false): Should the source control its own timing? Set to true if you are having synchronization issues. Should be false for most typical cases.
  • start (of type bool, which defaults to true): Start input as soon as it is available.
  • string_args (of type [string * string], which defaults to [])
  • trim_url (of type bool, which defaults to true): Trim input URL.
  • (unlabeled) (of type {string}): URL to decode.

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clock (of type clock): The source’s clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_started (of type () -> bool): true if 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 is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source’s log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source’s id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source’s last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomesnull`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string): This source uses the FFmpeg input stream as synchronization source when self_sync=true and connected.
  • set_url (of type ({string}) -> unit): Set the source’s url.
  • skip (of type () -> unit): Skip to the next track.
  • start (of type () -> unit): Ask the source or output to start.
  • status (of type () -> string): Return the current status of the source, either “stopped” (the source isn’t trying to relay the HTTP stream), “starting” (polling task is about to begin) “polling” (attempting to connect to the HTTP stream), “connected ” (connected to , buffering or playing back the stream) or “stopping” (source is stopping).
  • stop (of type () -> unit): Ask the source or output to stop.
  • time (of type () -> float): Get a source’s time, based on its assigned clock.
  • url (of type () -> string): Return the source’s current url.

Callbacks:

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

input.harbor

Create a source that receives a http/icecast stream and forwards it as a stream.

Type:

(?id : string?,
 ?auth : ((
           {
             address : string,
             method : string,
             password : string,
             query : [string * string],
             uri : string,
             user : string
           }) -> bool)?,
 ?buffer : float, ?debug : bool, ?dumpfile : string?, ?icy : bool,
 ?icy_metadata_charset : string?, ?logfile : string?, ?max : float,
 ?metadata_charset : string?, ?password : string, ?port : int,
 ?replay_metadata : bool, ?timeout : float, ?transport : http_transport,
 ?user : string, string) -> source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • auth (of type (( { address : string, method : string, password : string, query : [string * string], uri : string, user : string }) -> bool)?, which defaults to null): Authentication function. Receives a record with: user, password, uri (request URI), query (URL query parameters as a list of key-value pairs), address (client network address) and method (connection method: "PUT" or "POST" for HTTP source connections, "SOURCE" for Xaudiocast/ICE sources, "ICY" for Shoutcast/ICY sources, "WEBSOCKET" for WebSocket sources, "GET" for ICY metadata updates) and returns true if the user should be granted access for this login. Override any other method if used.
  • buffer (of type float, which defaults to 12.0): Duration of the pre-buffered data (in seconds). Default value is set to make it possible to use crossfade transitions with input.harbor. You might be able to reduce it but, in this case, make sure to not use the operator with crossfade or make sure that it has enough buffered data for it.
  • debug (of type bool, which defaults to false): Run in debugging mode by not catching some exceptions.
  • dumpfile (of type string?, which defaults to null): Dump stream to file, for debugging purpose. Disabled if null.
  • icy (of type bool, which defaults to false): Enable ICY (shoutcast) protocol.
  • icy_metadata_charset (of type string?, which defaults to null): 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 type string?, which defaults to null): Log buffer status to file, for debugging purpose. Disabled if null.
  • max (of type float, which defaults to 20.0): Maximum duration of the buffered data (in seconds).
  • metadata_charset (of type string?, which defaults to null): Metadata charset for non-ICY (shoutcast) source protocols. Guessed if null.
  • password (of type string, which defaults to "hackme"): Source password.
  • port (of type int, which defaults to 8005): Port used to connect to the source.
  • replay_metadata (of type bool, which defaults to false): Replay last known metadata when switching back to this source. This helps when source has dropped due to temporary connection issues.
  • timeout (of type float, which defaults to 30.0): Timeout for source connectionn.
  • transport (of type http_transport, which defaults to <unix_transport>): Http transport. Use http.transport.ssl or http.transport.secure_transport, when available, to enable HTTPS output
  • user (of type string, which defaults to "source"): Source user.
  • (unlabeled) (of type string): 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 type clock): The source’s clock
  • connected_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 type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source’s log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source’s id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source’s last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomesnull`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • 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.

Callbacks:

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

input.harbor.dynamic.regexp

Start a http/icecast receiver server. When a source connects, a new source is created and its description (URI, format, streams, headers) passed to the on_connect callback, which returns a function that receives the source. A copy_encoder is provided for passthrough remuxing.

Type:

(?buffer : float, ?max : float, ?timeout : float, ?user : string,
 ?password : string, ?port : int, ?transport : http_transport, ?icy : bool,
 ?icy_metadata_charset : string?, ?metadata_charset : string?,
 ?replay_metadata : bool,
 ?auth : ((
           {
             address : string,
             method : string,
             password : string,
             query : [string * string],
             uri : string,
             user : string
           }) -> bool)?,
 ?dumpfile : string?, ?logfile : string?, ?debug : bool, regexp,
 on_connect : ((
                {
                  copy_encoder : (?string?, ?options : [string * string]) ->
                                 format('a),
                  format : string?,
                  headers : [string * string],
                  mime_type : string?,
                  query : [string * string],
                  streams : [
                             {
                               channel_layout? : string,
                               channels? : int,
                               codec : string,
                               field : string,
                               frame_rate? : float?,
                               height? : int,
                               pixel_format? : string,
                               samplerate? : int,
                               type : string,
                               width? : int
                             }],
                  uri : string
                }) ->
               (source('a)
                .{
                  buffer_length : () -> float,
                  connected_client : () -> string?,
                  on_connect : (synchronous : bool,
                                (([string * string]) -> unit)) -> unit,
                  on_disconnect : (synchronous : bool, (() -> unit)) -> unit,
                  status : () -> string,
                  stop : () -> unit
                }) -> unit)) -> unit

Arguments:

  • buffer (of type float, which defaults to 12.0): Duration of the pre-buffered data (in seconds). Default value is set to make it possible to use crossfade transitions with input.harbor. You might be able to reduce it but, in this case, make sure to not use the operator with crossfade or make sure that it has enough buffered data for it.
  • max (of type float, which defaults to 20.0): Maximum duration of the buffered data (in seconds).
  • timeout (of type float, which defaults to 30.0): Timeout for source connectionn.
  • user (of type string, which defaults to "source"): Source user.
  • password (of type string, which defaults to "hackme"): Source password.
  • port (of type int, which defaults to 8005): Port used to connect to the source.
  • transport (of type http_transport, which defaults to <unix_transport>): Http transport. Use http.transport.ssl or http.transport.secure_transport, when available, to enable HTTPS output
  • icy (of type bool, which defaults to false): Enable ICY (shoutcast) protocol.
  • icy_metadata_charset (of type string?, which defaults to null): 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.
  • metadata_charset (of type string?, which defaults to null): Metadata charset for non-ICY (shoutcast) source protocols. Guessed if null.
  • replay_metadata (of type bool, which defaults to false): Replay last known metadata when switching back to this source. This helps when source has dropped due to temporary connection issues.
  • auth (of type (( { address : string, method : string, password : string, query : [string * string], uri : string, user : string }) -> bool)?, which defaults to null): Authentication function. Receives a record with: user, password, uri (request URI), query (URL query parameters as a list of key-value pairs), address (client network address) and method (connection method: "PUT" or "POST" for HTTP source connections, "SOURCE" for Xaudiocast/ICE sources, "ICY" for Shoutcast/ICY sources, "WEBSOCKET" for WebSocket sources, "GET" for ICY metadata updates) and returns true if the user should be granted access for this login. Override any other method if used.
  • dumpfile (of type string?, which defaults to null): Dump stream to file, for debugging purpose. Disabled if null.
  • logfile (of type string?, which defaults to null): Log buffer status to file, for debugging purpose. Disabled if null.
  • debug (of type bool, which defaults to false): Run in debugging mode by not catching some exceptions.
  • (unlabeled) (of type regexp): Mountpoint to look for.
  • on_connect (of type ( { copy_encoder : (?string?, ?options : [string * string]) -> format('a), format : string?, headers : [string * string], mime_type : string?, query : [string * string], streams : [ { channel_layout? : string, channels? : int, codec : string, field : string, frame_rate? : float?, height? : int, pixel_format? : string, samplerate? : int, type : string, width? : int }], uri : string }) -> (source('a) .{ buffer_length : () -> float, connected_client : () -> string?, on_connect : (synchronous : bool, (([string * string]) -> unit)) -> unit, on_disconnect : (synchronous : bool, (() -> unit)) -> unit, status : () -> string, stop : () -> unit }) -> unit): Callback when a source connects. Called with a connection record containing uri, query, format, mime_type, streams, headers and copy_encoder; returns a function that receives the source.

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, ?poll_delay : float, ?self_sync : {bool?},
 ?start : bool, ?string_args : [string * string], ?timeout : float,
 ?trim_url : bool, ?user_agent : string, {string}) -> source('a)

Synchronization:

This source uses the FFmpeg input stream as synchronization source when self_sync=true and connected.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • debug (of type bool, which defaults to false): Run in debugging mode, not catching some exceptions.
  • deduplicate_metadata (of type bool, which defaults to true): Prevent duplicated metadata.
  • float_args (of type [string * float], which defaults to [])
  • format (of type string?, which defaults to null): Force a specific input format. Autodetected when passed a null argument
  • int_args (of type [string * int], which defaults to [])
  • max_buffer (of type float, which defaults to 5.0): Maximum uration of buffered data
  • metadata_filter (of type (([string * string]) -> [string * string])?, which defaults to null): Metadata filter function. Returned metadata are set a metadata. Default: filter id3v2_priv metadata.
  • new_track_on_metadata (of type bool, which defaults to true): Treat new metadata as new track.
  • poll_delay (of type float, which defaults to 2.0): Polling delay when trying to connect to the stream.
  • self_sync (of type {bool?}, which defaults to null): Should the source control its own timing? If null, the source will control its latency if it can be detected that it is connecting to an icecast or shoutcast server. Otherwise, see input.ffmpeg for more details about this option.
  • start (of type bool, which defaults to true): Start input as soon as it is available.
  • string_args (of type [string * string], which defaults to [])
  • timeout (of type float, which defaults to 10.0): Timeout for source connection.
  • trim_url (of type bool, which defaults to true): Trim input URL.
  • user_agent (of type string, which defaults to "Liquidsoap/2.5.0+git@e72712d (Unix; OCaml 5.4.0)"): User agent.
  • (unlabeled) (of type {string}): URL to decode.

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clock (of type clock): The source’s clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_started (of type () -> bool): true if 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 is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source’s log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source’s id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source’s last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomesnull`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string): This source uses the FFmpeg input stream as synchronization source when self_sync=true and connected.
  • set_url (of type ({string}) -> unit): Set the source’s url.
  • skip (of type () -> unit): Skip to the next track.
  • start (of type () -> unit): Ask the source or output to start.
  • status (of type () -> string): Return the current status of the source, either “stopped” (the source isn’t trying to relay the HTTP stream), “starting” (polling task is about to begin) “polling” (attempting to connect to the HTTP stream), “connected ” (connected to , buffering or playing back the stream) or “stopping” (source is stopping).
  • stop (of type () -> unit): Ask the source or output to stop.
  • time (of type () -> float): Get a source’s time, based on its assigned clock.
  • url (of type () -> string): Return the source’s current url.

Callbacks:

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

input.jack

Get stream from JACK.

Type:

(?id : string?, ?server : string?, ?start : bool) -> source(audio=pcm('a))

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • server (of type string?, which defaults to null): JACK server to connect to.
  • start (of type bool, which defaults to true): Start input as soon as it is available.

Methods:

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

Callbacks:

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

input.keyboard.sdl

Play notes from the keyboard.

Type:

(?id : string?, ?velocity : float) -> source(midi=midi('a))

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • velocity (of type float, which defaults to 0.8): Velocity of notes.

Methods:

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

Callbacks:

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

This function is experimental.

input.oss

Stream from an OSS input device.

Type:

(?id : string?, ?device : string, ?fallible : bool, ?self_sync : bool,
 ?start : bool) -> source(audio=pcm('a))

Synchronization:

This source uses the OSS hardware clock as synchronization source when self_sync=true and the device is open.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • device (of type string, which defaults to "/dev/dsp"): OSS device to use.
  • fallible (of type bool, which defaults to false): Allow the source to fail. If set to false, start must be true and stop method raises an error.
  • self_sync (of type bool, which defaults to true): Mark the source as being synchronized by the OSS driver.
  • start (of type bool, which defaults to true): Start input as soon as it is available.

Methods:

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

Callbacks:

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

input.portaudio

Stream from a portaudio input device.

Type:

(?id : string?, ?buflen : int, ?device_id : int?, ?device_name : string?,
 ?fallible : bool, ?latency : float?, ?self_sync : bool, ?start : bool) ->
source(audio=pcm('a))

Synchronization:

This source uses the PortAudio clock as synchronization source when self_sync=true and the stream is open.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • buflen (of type int, which defaults to 256): Length of a buffer in samples.
  • device_id (of type int?, which defaults to null): Device ID. Uses default device if null.
  • device_name (of type string?, which defaults to null): Device name.
  • fallible (of type bool, which defaults to false): Allow the source to fail. If set to false, start must be true and stop method raises an error.
  • latency (of type float?, which defaults to null): Device latency. Only used when specifying device ID.
  • self_sync (of type bool, which defaults to true): Mark the source as being synchronized by the portaudio driver.
  • start (of type bool, which defaults to true): Start input as soon as it is available.

Methods:

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

Callbacks:

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

input.pulseaudio

Stream from a pulseaudio input device.

Type:

(?id : string?, ?client : string, ?device : string?, ?fallible : bool,
 ?on_error : ((string) -> unit), ?retry_delay : float, ?self_sync : bool,
 ?start : bool) -> source(audio=pcm('a))

Synchronization:

This source uses the PulseAudio clock as synchronization source when self_sync=true and the stream is open.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • client (of type string, which defaults to "liquidsoap")
  • device (of type string?, which defaults to null): Device to use. Uses default if set to null.
  • fallible (of type bool, which defaults to true): Allow the source to fail. If set to false, start must be true and stop method raises an error.
  • on_error (of type (string) -> unit, which defaults to fun (_) -> ()): Function executed when an operation with the pulseaudio server returns an error.
  • retry_delay (of type float, which defaults to 1.0): When fallible, time to wait before trying to connect again.
  • self_sync (of type bool, which defaults to true): Mark the source as being synchronized by the pulseaudio driver.
  • start (of type bool, which defaults to true): Start input as soon as it is available.

Methods:

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

Callbacks:

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

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, ?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)

Synchronization:

This source uses the SRT stream as synchronization source when self_sync=true and connected.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • bind_address (of type string, which defaults to "0.0.0.0"): Address to bind on the local machine. Used only in listener mode
  • connection_timeout (of type float?, which defaults to null): Timeout, in seconds, after which initial connection operations are aborted if no data was received. Uses library’s default if null. Used only in client mode.
  • content_type (of type string, which defaults to "application/ffmpeg"): Content-Type (mime type) used to find a decoder for the input stream.
  • dump (of type string, which defaults to ""): Dump received data to the given file for debugging. Unused is empty.
  • enforced_encryption (of type bool?, which defaults to null): Enforces that both connection parties have the same passphrase set, or both do not set the passphrase, otherwise the connection is rejected.
  • host (of type string, which defaults to "localhost"): Address to connect to. Used only in caller mode.
  • ipv6only (of type bool?, which defaults to null): If true and mode is set to listen, only ipv6 connections are accepted. When null, defaults to true when the bind_address is a ipv6 address and system defaults otherwise.
  • listen_callback (of type ((hs_version : int, peeraddr : string, streamid : string?, srt_socket) -> bool)?, which defaults to null): Callback used to decide whether to accept new incoming connections. Used in listener mode only.
  • max (of type float, which defaults to 10.0): Maximum duration of the buffered data.
  • messageapi (of type bool, which defaults to true): Use message api
  • mode (of type string, 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)
  • passphrase (of type string?, which defaults to null): When set to a non-empty string, this option enables encryption and sets the passphrase for it. See libsrt documentation for more details.
  • payload_size (of type int, which defaults to 1316): Payload size.
  • pbkeylen (of type int?, which defaults to null): Set encryption key length. See libsrt documentation for more details.
  • polling_delay (of type float, which defaults to 2.0): Delay between connection attempts. Used only in caller mode.
  • port (of type int, which defaults to 8000): Port to bind on the local machine (listener mode) or to connect to (caller mode). The term port as used in SRT is occasionally identical to the term UDP 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 type string?, which defaults to null): Preferred address type when resolving hostnames. One of: "system", "ipv4" or "ipv6". Defaults to global srt.prefer_connection settings when null.
  • read_timeout (of type float?, which defaults to 1.0): Timeout, in seconds, after which read operations are aborted if no data was received, indefinite if null.
  • self_sync (of type bool, which defaults to true): true if the source controls its own latency (i.e. the SRT stream is in live mode), false otherwise (i.e. the stream is in file mode.
  • start (of type bool, which defaults to true): Start input as soon as it is available.
  • streamid (of type string?, which defaults to null): Set streamid. This value can be retrieved by the listener side when connecting to it. Used in caller mode only.
  • write_timeout (of type float?, which defaults to 1.0): Timeout, in seconds, after which write operations are aborted if no data was received, indefinite if null.

Methods:

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

Callbacks:

  • on_connect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when connected.
  • on_disconnect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when disconnected.
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_socket (of type (synchronous : bool, ((mode : string, srt_socket) -> unit)) -> unit): Call a given handler when a new SRT socket is created to set additional options, add monitoring, etc. mode should 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 (synchronous : bool, (() -> unit)) -> unit): Call a given handler when source starts
  • on_stop (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when source stops
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Source / Input / Passive

blank

Produce silence and blank images.

Type:

(?id : string?, ?duration : {float}) -> source('a)
where 'a is a set of internal tracks

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • duration (of type {float}, which defaults to -1.0): Duration of blank tracks in seconds, Negative value means forever.

Methods:

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

Callbacks:

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

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 type string?, which defaults to null): Force the value of the source ID.
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

This function is experimental.

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=yuv420p('b))

Arguments:

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

Callbacks:

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

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_delay_on_error : float, ?restart_on_error : bool,
 ?samplerate : int, {string}) -> source(audio=pcm('a))

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • buffer (of type float, which defaults to 2.0): Duration of the pre-buffered data.
  • channels (of type int, which defaults to 2): Number of channels.
  • max (of type float, which defaults to 10.0): Maximum duration of the buffered data.
  • restart (of type bool, which defaults to true): Restart process when exited.
  • restart_delay_on_error (of type float, which defaults to 0.1): Delay (in seconds) before restarting the process if its exit status is other than 0. Prevents busy-looping when the command exits immediately.
  • restart_on_error (of type bool, which defaults to false): Restart process when exited with error.
  • samplerate (of type int, which defaults to 44100): Samplerate.
  • (unlabeled) (of type {string}): Command to execute.

Methods:

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

Callbacks:

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

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=yuv420p('a))

Arguments:

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

Callbacks:

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

This function is experimental.

input.external.wav

Stream WAV data from an external application.

Type:

(?id : string?, ?buffer : float, ?max : float, ?restart : bool,
 ?restart_delay_on_error : float, ?restart_on_error : bool, {string}) ->
source(audio=pcm('a))

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • buffer (of type float, which defaults to 2.0): Duration of the pre-buffered data.
  • max (of type float, which defaults to 10.0): Maximum duration of the buffered data.
  • restart (of type bool, which defaults to true): Restart process when exited.
  • restart_delay_on_error (of type float, which defaults to 0.1): Delay (in seconds) before restarting the process if its exit status is other than 0. Prevents busy-looping when the command exits immediately.
  • restart_on_error (of type bool, which defaults to false): 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 type clock): The source’s clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source’s log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source’s id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source’s last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomesnull`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source’s time, based on its assigned clock.

Callbacks:

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

noise

Generate audio/video noise source.

Type:

(?id : string?, ?duration : float?) -> source('a)
where 'a is a set of internal tracks

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • duration (of type float?, which defaults to null): Duration in seconds (null means infinite).

Methods:

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

Callbacks:

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

request.dynamic

Play request dynamically created by a given function.

Type:

(?id : string?, ?available : {bool}, ?prefetch : int?,
 ?retry_delay : {float}, ?synchronous : bool, ?timeout : float?,
 (() -> request?)) -> source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • available (of type {bool}, which defaults to true): Whether some new requests are available (when set to false, it stops after current playing request).
  • prefetch (of type int?, which defaults to null): How many requests should be queued in advance.
  • retry_delay (of type {float}, which defaults to 0.1): Retry after a given time (in seconds) when callback returns null or an error occurs while resolving a returned request.
  • synchronous (of type bool, which defaults to false): If true, new requests are prepared as needed instead of using an asynchronous queue.
  • timeout (of type float?, which defaults to null): Timeout (in sec.) to resolve the request. Defaults to settings.request.timeout when null.
  • (unlabeled) (of type () -> request?)

Methods:

  • add (of type (request) -> bool): Add a request to the queue. Requests are resolved before being added. Returns true if the request was successfully added.
  • buffered (of type () -> [string * float]): Length of buffered data.
  • clock (of type clock): The source’s clock
  • current (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 type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • fetch (of type () -> unit): Notify the source to queue a new request. If synchronous is false (the default), this method returns immediately and a new request is fetched in the background. If synchronous is true, can take long to return and should usually be run in a separate thread.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source’s log level, from 1 to 5.
  • 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}): If true, the source’s last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomesnull`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • set_queue (of type ([request]) -> unit): Set the queue of requests. Requests are resolved before being added to the queue. You are responsible for destroying the requests currently in the queue.
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source’s time, based on its assigned clock.

Callbacks:

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

saw

Generate a saw wave.

Type:

(?id : string?, ?amplitude : {float}, ?duration : float?, ?{float}) ->
source(audio=pcm*)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • amplitude (of type {float}, which defaults to 1.0): Maximal value of the waveform.
  • duration (of type float?, which defaults to null): Duration in seconds (null means infinite).
  • (unlabeled) (of type {float}, which defaults to 440.0): Frequency of the saw.

Methods:

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

Callbacks:

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

sine

Generate a sine wave.

Type:

(?id : string?, ?amplitude : {float}, ?duration : float?, ?{float}) ->
source(audio=pcm*)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • amplitude (of type {float}, which defaults to 1.0): Maximal value of the waveform.
  • duration (of type float?, which defaults to null): Duration in seconds (null means infinite).
  • (unlabeled) (of type {float}, which defaults to 440.0): Frequency of the sine.

Methods:

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

Callbacks:

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

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

Callbacks:

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

source.fail

A source that does not produce anything. No silence, no track at all.

Type:

(?id : string?) -> source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.

Methods:

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

Callbacks:

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

source.fail.init

A source that errors during its initialization phase, used for testing and debugging.

Type:

(?id : string?) -> source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.

Methods:

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

Callbacks:

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

This function is experimental.

square

Generate a square wave.

Type:

(?id : string?, ?amplitude : {float}, ?duration : float?, ?{float}) ->
source(audio=pcm*)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • amplitude (of type {float}, which defaults to 1.0): Maximal value of the waveform.
  • duration (of type float?, which defaults to null): Duration in seconds (null means infinite).
  • (unlabeled) (of type {float}, which defaults to 440.0): Frequency of the square.

Methods:

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

Callbacks:

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

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 type string?, which defaults to null): Force the value of the source ID.
  • height (of type int, which defaults to -1)
  • width (of type int, which defaults to -1)

Methods:

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

Callbacks:

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

Source / Liquidsoap

buffer

Create a buffer between two different clocks.

Type:

(?id : string?, ?add_track_mark : bool, ?buffer : float, ?fallible : bool,
 ?max : float, ?register_telnet : bool, ?replay_metadata : bool,
 ?start : bool, source('a)) -> source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • add_track_mark (of type bool, which defaults to true): Insert a track mark when the buffer becomes available again.
  • buffer (of type float, which defaults to 1.0): Amount of data to pre-buffer, in seconds.
  • fallible (of type bool, which defaults to true): Allow the child source to fail.
  • max (of type float, which defaults to 10.0): Maximum amount of buffered data, in seconds.
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • replay_metadata (of type bool, which defaults to true): Replay the last metadata when the buffer becomes available again.
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

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, ?register_telnet : bool, ?resample : bool,
 ?reset : bool, ?start : bool, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • averaging (of type float, which defaults to 30.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 type float, which defaults to 1.0): Amount of data to prebuffer, in seconds.
  • fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.
  • limit (of type float, which defaults to 1.25): Maximum acceleration or deceleration factor, ie how fast or slow we can be compared to realtime.
  • max (of type float, which defaults to 10.0): Maximum amount of buffered data, in seconds.
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • resample (of type bool, which defaults to true): Use proper resampling instead of simply duplicating samples.
  • reset (of type bool, which defaults to false): Reset speed estimation to 1 when the source becomes available again (resuming from a buffer underflow).
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

This function is experimental.

format.description

Return a description of the given format as a record with optional methods. For PCM audio: { channels, channel_layout }. For YUV420P video: { width, height }. For MIDI: { channels }. Returns an empty record for formats without a description (e.g. metadata, track marks).

Type:

(content_format) -> unit

Arguments:

  • (unlabeled) (of type content_format)

Methods:

  • ffmpeg_copy? (of type string)
  • ffmpeg_raw_audio? (of type string)
  • ffmpeg_raw_video? (of type string)
  • metadata? (of type string)
  • midi? (of type {channels : int})
  • pcm? (of type {channel_layout : string, channels : int})
  • pcm_f32? (of type {channel_layout : string, channels : int})
  • pcm_s16? (of type {channel_layout : string, channels : int})
  • subtitle? (of type string)
  • track_marks? (of type string)
  • yuv420p? (of type {height : int, width : int})

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 type format('a)): Encoding format.
  • (unlabeled) (of type string): Name of the file.
  • (unlabeled) (of type request): Request to encode.
  • ratio (of type float, which defaults to 50.0): Time ratio. A value of 50 means process data at 50x real rate, when possible.
  • timeout (of type float, which defaults to 1.0): Stop processing the source if it has not started after the given timeout.
  • sleep_latency (of type float, which defaults to 0.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 type request): Request to process
  • process (of type (source('a)) -> source('b), which defaults to <fun>): Callback to create the source to animate.
  • ratio (of type float, which defaults to 50.0): Time ratio. A value of 50 means process data at 50x real rate, when possible.
  • timeout (of type float, which defaults to 1.0): Stop processing the source if it has not started after the given timeout.
  • sleep_latency (of type float, which defaults to 0.1): How much time ahead, in seconds, should we should be before pausing the processing.

source.content

Return the content type of the source as an associative list mapping frame field names (e.g. "audio", "video") to their content format. Use format.description to introspect a format value.

Type:

(source('a)) -> [string * content_format]

Arguments:

  • (unlabeled) (of type source('a))

source.duration

Estimation of the duration in the current track.

Type:

(source('a)) -> float

Arguments:

  • (unlabeled) (of type source('a))

source.effective

Returns the effective source for the given source that is the source effectively being animated during the current streaming cycle. For instance, this return the currently active source in a switch and etc. The operator is recursive so it is applied through the whole streaming graph until it finds a leaf source.

Type:

(source('a)) -> source('a)

Arguments:

  • (unlabeled) (of type source('a))

source.elapsed

Elapsed time in the current track.

Type:

(source('a)) -> float

Arguments:

  • (unlabeled) (of type source('a))

source.fallible

Indicate if a source may fail, i.e. may not be ready to stream.

Type:

(source('a)) -> bool

Arguments:

  • (unlabeled) (of type source('a))

source.id

Get the identifier of a source.

Type:

(source('a)) -> string

Arguments:

  • (unlabeled) (of type source('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 type source('a))

source.methods

Returns the given source decorated with all its methods.

Type:

(source('a)) -> source('a)

Arguments:

  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

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 type source('a))
  • (unlabeled) (of type () -> unit)

source.remaining

Estimation of remaining time in the current track.

Type:

(source('a)) -> float

Arguments:

  • (unlabeled) (of type source('a))

source.seek

Seek forward, in seconds. Returns the amount of time effectively seeked.

Type:

(source('a), float) -> float

Arguments:

  • (unlabeled) (of type source('a))
  • (unlabeled) (of type float)

source.set_id

Set the id of an operator.

Type:

(source('a), string) -> unit

Arguments:

  • (unlabeled) (of type source('a))
  • (unlabeled) (of type string)

source.skip

Skip to the next track.

Type:

(source('a)) -> unit

Arguments:

  • (unlabeled) (of type source('a))

source.time

Get a source’s time, based on its assigned clock

Type:

(source('a)) -> float

Arguments:

  • (unlabeled) (of type source('a))

Source / MIDI processing

midi.chord

Generate a chord.

Type:

(?id : string?, ?metadata : string, source('a)) ->
source(midi=midi(channels=1), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • metadata (of type string, which defaults to "chord"): Name of the metadata containing the chords.
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

midi.merge_all

Merge all MIDI tracks in one.

Type:

(?id : string?, ?track_out : int, source(midi=midi('a), 'b)) ->
source(midi=midi('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • track_out (of type int, which defaults to 0): Destination track.
  • (unlabeled) (of type source(midi=midi('a), 'b))

Methods:

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

Callbacks:

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

midi.remove

Remove MIDI tracks.

Type:

(?id : string?, [int], source(midi=midi('a), 'b)) -> source(midi=midi('a),
'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • (unlabeled) (of type [int]): Tracks to remove.
  • (unlabeled) (of type source(midi=midi('a), 'b))

Methods:

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

Callbacks:

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

Source / Output

output.alsa

Output the source’s stream to an ALSA output device.

Type:

(?id : string?, ?buffer_size : float?, ?device : string, ?fallible : bool,
 ?register_telnet : bool, ?self_sync : bool, ?start : bool,
 source(audio=pcm('a), 'b)) -> unit

Synchronization:

This output uses the ALSA hardware clock as synchronization source when self_sync=true and the device is open.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • buffer_size (of type float?, which defaults to null): ALSA buffer size in seconds. Defaults to frame duration when null.
  • device (of type string, which defaults to "default"): Alsa device to use
  • fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • self_sync (of type bool, which defaults to true): Mark the source as being synchronized by the ALSA driver.
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

output.ao

Output stream to local sound card using libao.

Type:

(?id : string?, ?channels_matrix : string, ?driver : string,
 ?fallible : bool, ?options : [string * string], ?register_telnet : bool,
 ?self_sync : bool, ?start : bool, source(audio=pcm('a), 'b)) -> unit

Synchronization:

This output uses the AO device clock as synchronization source when self_sync=true and the device is open.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • channels_matrix (of type string, which defaults to ""): Output channels matrix, “” for AO’s default.
  • driver (of type string, which defaults to ""): Driver to be used, “” for AO’s default.
  • fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.
  • options (of type [string * string], which defaults to []): List of parameters, depends on the driver.
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • self_sync (of type bool, which defaults to true): Use the dedicated AO clock.
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

output.dummy

Dummy output: computes the stream, without actually using it.

Type:

(?id : string?, ?fallible : bool, ?register_telnet : bool, ?start : bool,
 source('a)) -> unit

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

output.external

Send the stream to a process’ standard input.

Type:

(?id : string?, ?export_cover_metadata : bool, ?fallible : bool,
 ?flush : bool, ?register_telnet : bool, ?reopen_delay : {float},
 ?reopen_on_error : ((error?) -> float?),
 ?reopen_on_metadata : (([string * string]) -> bool),
 ?reopen_when : (() -> bool), ?self_sync : bool, ?start : bool, format('a),
 {string}, source('a)) -> unit

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • export_cover_metadata (of type bool, which defaults to true): Export cover metadata.
  • fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.
  • flush (of type bool, which defaults to false): Perform a flush after each write.
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • reopen_delay (of type {float}, which defaults to 120.0): Prevent re-opening within that delay, in seconds. Only applies to reopen_when.
  • reopen_on_error (of type (error?) -> float?, which defaults to fun (_) -> null): Callback called when there is an error. Error is raised when returning null. Otherwise, the file is reopened after the returned value, in seconds.
  • reopen_on_metadata (of type ([string * string]) -> bool, which defaults to fun (_) -> false): Callback called on metadata. If returned value is true, the file is reopened.
  • reopen_when (of type () -> bool, which defaults to {false}): Callback called on each frame. If returned value is true, the file is reopened.
  • self_sync (of type bool, which defaults to false): Set to true if the process is expected to control the output’s latency. Typical example: ffmpeg with the -re command-line option.
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • (unlabeled) (of type format('a)): Encoding format.
  • (unlabeled) (of type {string}): Process to pipe data to.
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

output.file

Output the source stream to a file.

Type:

(?id : string?, ?append : bool, ?dir_perm : int,
 ?export_cover_metadata : bool, ?fallible : bool, ?flush : bool,
 ?on_close : ((string) -> unit), ?perm : int, ?register_telnet : bool,
 ?reopen_delay : {float}, ?reopen_on_error : ((error?) -> float?),
 ?reopen_on_metadata : (([string * string]) -> bool),
 ?reopen_when : (() -> bool), ?start : bool, format('a), {string},
 source('a)) -> unit

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • append (of type bool, which defaults to false): Do not truncate but append in the file if it exists.
  • dir_perm (of type int, which defaults to 511): Permission of the directories if some have to be created, up to umask. Although you can enter values in octal notation (0oXXX) they will be displayed in decimal (for instance, 0o777 = 7×8^2 + 7×8 + 7 = 511).
  • export_cover_metadata (of type bool, which defaults to true): Export cover metadata.
  • fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.
  • flush (of type bool, which defaults to false): Perform a flush after each write.
  • on_close (of type (string) -> unit, which defaults to fun (_) -> ()): This function will be called for each file, after that it is finished and closed. The filename will be passed as argument.
  • perm (of type int, which defaults to 438): Permission of the file if it has to be created, up to umask. You can and should write this number in octal notation: 0oXXX. The default value is however displayed in decimal (0o666 = 6×8^2 + 6×8 + 6 = 438).
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • reopen_delay (of type {float}, which defaults to 120.0): Prevent re-opening within that delay, in seconds. Only applies to reopen_when.
  • reopen_on_error (of type (error?) -> float?, which defaults to fun (_) -> null): Callback called when there is an error. Error is raised when returning null. Otherwise, the file is reopened after the returned value, in seconds.
  • reopen_on_metadata (of type ([string * string]) -> bool, which defaults to fun (_) -> false): Callback called on metadata. If returned value is true, the file is reopened.
  • reopen_when (of type () -> bool, which defaults to {false}): Callback called on each frame. If returned value is true, the file is reopened.
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • (unlabeled) (of type format('a)): Encoding format.
  • (unlabeled) (of type {string}): Filename where to output the stream.
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

output.file.hls

Output the source stream to an HTTP live stream served from a local directory.

Type:

(?id : string?, ?dir_perm : int, ?extra_tags : [string], ?fallible : bool,
 ?main_playlist_writer : ((extra_tags : [string], prefix : string,
                           version : int,
                           [string
                            .{
                              bandwidth : int,
                              codecs : string,
                              video_size? : int * int
                            }]) -> string?)?,
 ?perm : int, ?persist_at : string?, ?playlist : string, ?prefix : string,
 ?register_telnet : bool, ?segment_duration : float,
 ?segment_name : ((
                   {
                     duration : float,
                     extname : string,
                     position : int,
                     stream_name : string,
                     ticks : int
                   }) -> string),
 ?segments : int, ?segments_overhead : int?, ?start : bool,
 ?strict_persist : bool, ?temp_dir : string?, string,
 [string * format('a)
  .{
    bandwidth? : int,
    codecs? : string,
    extname? : string,
    extra_tags? : [string],
    id3? : bool,
    id3_version? : int,
    replay_id3? : bool,
    video_size? : int * int
  }],
 source('a)) -> unit

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • dir_perm (of type int, which defaults to 0o777): Permission of the directories if some have to be created, up to umask.
  • extra_tags (of type [string], which defaults to []): Extra tags to insert into the main playlist.
  • fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.
  • main_playlist_writer (of type ((extra_tags : [string], prefix : string, version : int, [string.{bandwidth : int, codecs : string, video_size? : int * int}]) -> string?)?, which defaults to null): Main playlist writer. Main playlist writing is disabled when null or when returning null.
  • perm (of type int, which defaults to 0o666): Permission of the created files, up to umask.
  • persist_at (of type string?, which defaults to null): Location of the configuration file used to restart the output. Relative paths are assumed to be with regard to the directory for generated file.
  • playlist (of type string, which defaults to "stream.m3u8"): Playlist name (m3u8 extension is recommended).
  • prefix (of type string, which defaults to ""): Prefix for each files in playlists.
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • segment_duration (of type float, which defaults to 10.0): Segment duration (in seconds).
  • segment_name (of type ( { duration : float, extname : string, position : int, stream_name : string, ticks : int }) -> string, which defaults to <fun>): Segment name. Default: fun (metadata) -> "#{metadata.stream_name}_#{metadata.position}.#{metadata.extname}"
  • segments (of type int, which defaults to 10): Number of segments per playlist.
  • segments_overhead (of type int?, which defaults to 5): Number of segments to keep after they have been featured in the live playlist. Set to null to disable.
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • strict_persist (of type bool, which defaults to false): Fail if an invalid saved state exists.
  • temp_dir (of type string?, which defaults to null): Temporary directory used for writing files. This should be in the same partition or device as the final directory to guarantee atomic file operations. Use the same directory as the HLS files if null.
  • (unlabeled) (of type string): Directory for generated files.
  • (unlabeled) (of type [string * format('a) .{ bandwidth? : int, codecs? : string, extname? : string, extra_tags? : [string], id3? : bool, id3_version? : int, replay_id3? : bool, video_size? : int * int }]): List of specifications for each stream: (name, format).
  • (unlabeled) (of type source('a))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clock (of type clock): The source’s clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true.
  • insert_tag (of type (string) -> unit): Insert the same tag into all the streams
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_started (of type () -> bool): true if 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 is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source’s log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source’s id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source’s last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomesnull`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • shutdown (of type () -> unit): Shutdown the output.
  • skip (of type () -> unit): Skip to the next track.
  • start (of type () -> unit): Ask the source or output to start.
  • stop (of type () -> unit): Ask the source or output to stop.
  • streams (of type () -> [ { bandwidth : int, codecs : string, discontinuity_count : int, encoder : format('A), extname : string, extra_tags : [string], id3_enabled : bool, insert_tag : (string) -> unit, name : string, replay_id3 : bool, video_size : {height : int, width : int }? }]): Output streams
  • time (of type () -> float): Get a source’s time, based on its assigned clock.

Callbacks:

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

output.harbor

Encode and output the stream using the harbor server.

Type:

(?id : string?,
 ?auth : (({address : string, login : string, password : string}) -> bool)?,
 ?buffer : int, ?burst : int?, ?dedicated_encoder : bool,
 ?dumpfile : string?, ?encoding : string, ?fallible : bool, ?format : string,
 ?headers : [string * string], ?metaint : int, mount : string, ?port : int,
 ?register_telnet : bool, ?start : bool, ?timeout : float,
 ?transport : http_transport, ?url : string?, format('a), source('a)) -> unit

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • auth (of type (({address : string, login : string, password : string}) -> bool)?, which defaults to null): Authentication function. Receives a record with address, login, and password fields. Returns true to grant access. When null, no authentication is required.
  • buffer (of type int, which defaults to 327675): Maximum buffer per-client.
  • burst (of type int?, which defaults to 65534): Initial burst of data sent to the client. Set to null to disable burst. This feature is only available when dedicated_encoder is false.
  • dedicated_encoder (of type bool, which defaults to false): When true, create a separate encoder instance for each listener, ensuring each gets a clean encoder state. For copy-only formats (e.g. %ffmpeg in copy mode) this has minimal overhead. For encoded formats (e.g. mp3, aac) this adds a full encoder per client, which can be significant under load.
  • dumpfile (of type string?, which defaults to null): Dump stream to file, for debugging purpose. Disabled if null.
  • encoding (of type string, which defaults to ""): Encoding used to send metadata. If empty, defaults to “UTF-8”
  • fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.
  • format (of type string, which defaults to ""): Format, e.g. “audio/ogg”. When empty, the encoder is used to guess.
  • headers (of type [string * string], which defaults to []): Additional headers.
  • metaint (of type int, which defaults to 8192): Interval used to send ICY metadata
  • mount (of type string)
  • port (of type int, which defaults to 8000)
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • timeout (of type float, which defaults to 30.0): Timeout for network operations (in seconds).
  • transport (of type http_transport, which defaults to <unix_transport>): Http transport. Use http.transport.ssl or http.transport.secure_transport, when available, to enable HTTPS output
  • url (of type string?, which defaults to null)
  • (unlabeled) (of type format('a)): Encoding format.
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

output.icecast

Encode and output the stream to an icecast2 or shoutcast server.

Type:

(?id : string?, ?chunked : bool, ?connection_timeout : float,
 ?description : string?, ?dumpfile : string?, ?encoding : string?,
 ?fallible : bool, ?format : string, ?genre : string?,
 ?headers : [string * string], ?host : string, ?icy_id : int,
 ?icy_metadata : [string], ?icy_song : (([string * string]) -> string?),
 ?method : string, mount : string, ?name : string?, ?password : string,
 ?port : int, ?prefer_address : string?, ?protocol : string, ?public : bool,
 ?register_telnet : bool, ?send_icy_metadata : bool?,
 ?send_last_metadata_on_connect : bool, ?start : bool, ?timeout : float,
 ?transport : http_transport, ?url : string?, ?user : string?, format('a),
 source('a)) -> unit

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • chunked (of type bool, which defaults to false): Used chunked transfer with the ‘http(s)’ protocol.
  • connection_timeout (of type float, which defaults to 5.0): Timeout for establishing network connections (disabled is negative).
  • description (of type string?, which defaults to null)
  • dumpfile (of type string?, which defaults to null): Dump stream to file, for debugging purpose. Disabled if null.
  • encoding (of type string?, which defaults to null): Encoding used to send metadata and stream info (name, genre and description). If null, defaults to “UTF-8”.
  • fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.
  • format (of type string, which defaults to ""): Format, e.g. “audio/ogg”. When empty, the encoder is used to guess.
  • genre (of type string?, which defaults to null)
  • headers (of type [string * string], which defaults to [("User-Agent", "Liquidsoap/2.5.0+git@e72712d (Unix; OCaml 5.4.0)")]): Additional headers.
  • host (of type string, which defaults to "localhost")
  • icy_id (of type int, which defaults to 1): Shoutcast source ID.
  • icy_metadata (of type [string], which defaults to ["song", "title", "artist", "genre", "date", "album", "tracknum", "comment", "dj", "next"]): List of metadata to send with ICY metadata update
  • icy_song (of type ([string * string]) -> string?, which defaults to <fun>): Function used to generate the default icy “song” metadata. Metadata is not added when returning null. Default: $(artist) - $(title) if both are defined, otherwise artist or title if either is defined or null.
  • method (of type string, which defaults to "source"): Method to use with the ‘http(s)’ protocol. One of: ‘source’, ‘put’ or ‘post’.
  • mount (of type string): Source mount point.
  • name (of type string?, which defaults to null)
  • password (of type string, which defaults to "hackme")
  • port (of type int, which defaults to 8000)
  • prefer_address (of type string?, which defaults to null): Preferred address type when resolving hostnames. One of: "system", "ipv4" or "ipv6". Defaults to settings.icecast.prefer_address when null.
  • protocol (of type string, which defaults to "http")
  • public (of type bool, which defaults to true)
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • send_icy_metadata (of type bool?, which defaults to null): Send new metadata using the ICY protocol. Guessed when null
  • send_last_metadata_on_connect (of type bool, which defaults to true): Send the source’s last metadata when connecting to the remote icecast server.
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • timeout (of type float, which defaults to 30.0): Timeout for network read and write.
  • transport (of type http_transport, which defaults to <unix_transport>): Http transport. Use http.transport.ssl or http.transport.secure_transport, when available, to enable HTTPS output
  • url (of type string?, which defaults to null)
  • user (of type string?, which defaults to null): User for shout source connection. Defaults to “source” for icecast connections. Useful only in special cases, like with per-mountpoint users.
  • (unlabeled) (of type format('a)): Encoding format.
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

  • on_connect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when connection is established.
  • on_disconnect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when connection stops.
  • on_error (of type (synchronous : bool, ((restart_in : ((float?) -> unit), error) -> unit)) -> unit): Call a given handler when an error happens. The callback receives the error that occurred and a restart callback. If restart callback is executed with a positive float value, connection will be tried again after this amount of time (in seconds). If executed with a negative value, an error is raised. If executed with null, connection is not attempted again and no errors are raised. There can only be one single callback registered for this at a time. Every secondary registration replaces the previous one.
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_start (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output starts
  • on_stop (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stops
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

output.jack

Output stream to JACK.

Type:

(?id : string?, ?fallible : bool, ?register_telnet : bool, ?server : string?,
 ?start : bool, source(audio=pcm('a), 'b)) -> unit

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • server (of type string?, which defaults to null): JACK server to connect to.
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

output.ndi

Output stream to NDI

Type:

(?id : string?, ?fallible : bool, ?groups : string?, library_file : string,
 ?name : string?, ?register_telnet : bool, ?self_sync : bool, ?start : bool,
 format('a), source('a)) -> unit

Synchronization:

This output uses the NDI sender clock as synchronization source when self_sync=true and the sender is active.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.
  • groups (of type string?, which defaults to null): NDI sender groups
  • library_file (of type string): Path to the shared library file.
  • name (of type string?, which defaults to null): NDI sender name
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • self_sync (of type bool, which defaults to false): Use the dedicated NDI clock.
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • (unlabeled) (of type format('a)): Encoding format. Only the %ndi encoder is allowed here!
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

This function is experimental.

output.oss

Output the source’s stream to an OSS output device.

Type:

(?id : string?, ?device : string, ?fallible : bool, ?register_telnet : bool,
 ?self_sync : bool, ?start : bool, source(audio=pcm('a), 'b)) -> unit

Synchronization:

This output uses the OSS hardware clock as synchronization source when self_sync=true and the device is open.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • device (of type string, which defaults to "/dev/dsp"): OSS device to use.
  • fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • self_sync (of type bool, which defaults to true): Mark the source as being synchronized by the OSS driver.
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

output.portaudio

Output the source’s stream to a portaudio output device.

Type:

(?id : string?, ?buflen : int, ?device_id : int?, ?device_name : string?,
 ?fallible : bool, ?latency : float?, ?register_telnet : bool,
 ?self_sync : bool, ?start : bool, source(audio=pcm('a), 'b)) -> unit

Synchronization:

This output uses the PortAudio clock as synchronization source when self_sync=true and the stream is open.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • buflen (of type int, which defaults to 256): Length of a buffer in samples.
  • device_id (of type int?, which defaults to null): Device ID. Uses default device if null.
  • device_name (of type string?, which defaults to null): Device name.
  • fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.
  • latency (of type float?, which defaults to null): Device latency. Only used when specifying device ID.
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • self_sync (of type bool, which defaults to true): Mark the source as being synchronized by the portaudio driver.
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

output.pulseaudio

Output the source’s stream to a pulseaudio output device.

Type:

(?id : string?, ?client : string, ?device : string?, ?fallible : bool,
 ?on_error : ((string) -> unit), ?register_telnet : bool,
 ?retry_delay : float, ?self_sync : bool, ?start : bool,
 source(audio=pcm('a), 'b)) -> unit

Synchronization:

This output uses the PulseAudio clock as synchronization source when self_sync=true and the stream is open.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • client (of type string, which defaults to "liquidsoap")
  • device (of type string?, which defaults to null): Device to use. Uses default if set to null.
  • fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.
  • on_error (of type (string) -> unit, which defaults to fun (_) -> ()): Function executed when an operation with the pulseaudio server returns an error.
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • retry_delay (of type float, which defaults to 1.0): When fallible, time to wait before trying to connect again.
  • self_sync (of type bool, which defaults to true): Mark the source as being synchronized by the pulseaudio driver.
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

output.sdl

Display a video using SDL.

Type:

(?id : string?, ?fallible : bool, ?register_telnet : bool, ?start : bool,
 source(video=yuv420p('a), 'b)) -> unit

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • (unlabeled) (of type source(video=yuv420p('a), 'b))

Methods:

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

Callbacks:

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

output.sdl.has_video

Check whether video output is available with SDL.

Type:

() -> bool

output.srt

Send a SRT stream to a distant agent.

Type:

(?id : string?, ?bind_address : string, ?connection_timeout : float?,
 ?enforced_encryption : bool?, ?fallible : bool, ?host : string,
 ?ipv6only : bool?,
 ?listen_callback : ((hs_version : int, peeraddr : string,
                      streamid : string?, srt_socket) -> bool)?,
 ?max_clients : int?, ?messageapi : bool, ?mode : string,
 ?passphrase : string?, ?payload_size : int, ?pbkeylen : int?,
 ?polling_delay : float, ?port : int, ?prefer_address : string?,
 ?read_timeout : float?, ?register_telnet : bool, ?start : bool,
 ?streamid : string?, ?write_timeout : float?, format('a), source('a)) ->
unit

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • bind_address (of type string, which defaults to "0.0.0.0"): Address to bind on the local machine. Used only in listener mode
  • connection_timeout (of type float?, which defaults to null): Timeout, in seconds, after which initial connection operations are aborted if no data was received. Uses library’s default if null. Used only in client mode.
  • enforced_encryption (of type bool?, which defaults to null): Enforces that both connection parties have the same passphrase set, or both do not set the passphrase, otherwise the connection is rejected.
  • fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.
  • host (of type string, which defaults to "localhost"): Address to connect to. Used only in caller mode.
  • ipv6only (of type bool?, which defaults to null): If true and mode is set to listen, only ipv6 connections are accepted. When null, defaults to true when the bind_address is a ipv6 address and system defaults otherwise.
  • listen_callback (of type ((hs_version : int, peeraddr : string, streamid : string?, srt_socket) -> bool)?, which defaults to null): Callback used to decide whether to accept new incoming connections. Used in listener mode only.
  • max_clients (of type int?, which defaults to null): Max number of connected clients (listener mode only)
  • messageapi (of type bool, which defaults to true): Use message api
  • mode (of type string, which defaults to "caller"): Mode to operate on. One of: "listener" (waits for connection to come in) or "caller" (initiate connection to a remote server)
  • passphrase (of type string?, which defaults to null): When set to a non-empty string, this option enables encryption and sets the passphrase for it. See libsrt documentation for more details.
  • payload_size (of type int, which defaults to 1316): Payload size.
  • pbkeylen (of type int?, which defaults to null): Set encryption key length. See libsrt documentation for more details.
  • polling_delay (of type float, which defaults to 2.0): Delay between connection attempts. Used only in caller mode.
  • port (of type int, which defaults to 8000): Port to bind on the local machine (listener mode) or to connect to (caller mode). The term port as used in SRT is occasionally identical to the term UDP 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 type string?, which defaults to null): Preferred address type when resolving hostnames. One of: "system", "ipv4" or "ipv6". Defaults to global srt.prefer_connection settings when null.
  • read_timeout (of type float?, which defaults to 1.0): Timeout, in seconds, after which read operations are aborted if no data was received, indefinite if null.
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • streamid (of type string?, which defaults to null): Set streamid. This value can be retrieved by the listener side when connecting to it. Used in caller mode only.
  • write_timeout (of type float?, which defaults to 1.0): Timeout, in seconds, after which write operations are aborted if no data was received, indefinite if null.
  • (unlabeled) (of type format('a)): Encoding format.
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

  • on_connect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when connected.
  • on_disconnect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when disconnected.
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_socket (of type (synchronous : bool, ((mode : string, srt_socket) -> unit)) -> unit): Call a given handler when a new SRT socket is created to set additional options, add monitoring, etc. mode should 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 (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output starts
  • on_stop (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler when output stops
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

output.url

Encode and let encoder handle data output. Useful with encoder with no expected output or to encode to files that need full control from the encoder, e.g. %ffmpeg with rtmp output.

Type:

(?id : string?, ?export_cover_metadata : bool, ?fallible : bool,
 ?register_telnet : bool, ?restart_delay : float?, ?self_sync : bool,
 ?start : bool, url : string, format('a), source('a)) -> unit

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • export_cover_metadata (of type bool, which defaults to true): Export cover metadata.
  • fallible (of type bool, which defaults to false): Allow the child source to fail, in which case the output will be stopped until the source is available again.
  • register_telnet (of type bool, which defaults to true): Register telnet commands for this output.
  • restart_delay (of type float?, which defaults to 2.0): If not null, restart output on errors after the given delay.
  • self_sync (of type bool, which defaults to false): Should the source control its own synchronization? Set to true for output to e.g. rtmp output using %ffmpeg and etc.
  • start (of type bool, which defaults to true): Start output as soon as it is available.
  • url (of type string): Url to output to.
  • (unlabeled) (of type format('a)): Encoding format.
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

Source / Sound synthesis

dssi.register

Register a DSSI plugin.

Type:

(string) -> unit

Arguments:

  • (unlabeled) (of type string): Path of the DSSI plugin file.

synth.all.saw

Saw synthesizer. It creates one synthesizer for each channel.

Type:

(?id : string?, ?attack : float, ?decay : float, ?envelope : bool,
 ?release : float, ?sustain : float, source(midi=midi(channels=16), 'a)) ->
source(midi=midi(channels=16), 'a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • attack (of type float, which defaults to 0.02): Envelope attack (in seconds).
  • decay (of type float, which defaults to 0.01): Envelope decay (in seconds).
  • envelope (of type bool, which defaults to true): Use envelope.
  • release (of type float, which defaults to 0.01): Envelope release (in seconds).
  • sustain (of type float, which defaults to 0.9): Envelope sustain level.
  • (unlabeled) (of type source(midi=midi(channels=16), 'a))

Methods:

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

Callbacks:

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

synth.all.sine

Sine synthesizer. It creates one synthesizer for each channel.

Type:

(?id : string?, ?attack : float, ?decay : float, ?envelope : bool,
 ?release : float, ?sustain : float, source(midi=midi(channels=16), 'a)) ->
source(midi=midi(channels=16), 'a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • attack (of type float, which defaults to 0.02): Envelope attack (in seconds).
  • decay (of type float, which defaults to 0.01): Envelope decay (in seconds).
  • envelope (of type bool, which defaults to true): Use envelope.
  • release (of type float, which defaults to 0.01): Envelope release (in seconds).
  • sustain (of type float, which defaults to 0.9): Envelope sustain level.
  • (unlabeled) (of type source(midi=midi(channels=16), 'a))

Methods:

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

Callbacks:

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

synth.all.square

Square synthesizer. It creates one synthesizer for each channel.

Type:

(?id : string?, ?attack : float, ?decay : float, ?envelope : bool,
 ?release : float, ?sustain : float, source(midi=midi(channels=16), 'a)) ->
source(midi=midi(channels=16), 'a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • attack (of type float, which defaults to 0.02): Envelope attack (in seconds).
  • decay (of type float, which defaults to 0.01): Envelope decay (in seconds).
  • envelope (of type bool, which defaults to true): Use envelope.
  • release (of type float, which defaults to 0.01): Envelope release (in seconds).
  • sustain (of type float, which defaults to 0.9): Envelope sustain level.
  • (unlabeled) (of type source(midi=midi(channels=16), 'a))

Methods:

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

Callbacks:

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

synth.saw

Saw synthesizer.

Type:

(?id : string?, ?attack : float, ?channel : int, ?decay : float,
 ?envelope : bool, ?release : float, ?sustain : float, ?volume : float,
 source(midi=midi(channels=1), 'a)) -> source(midi=midi(channels=1), 'a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • attack (of type float, which defaults to 0.02): Envelope attack (in seconds).
  • channel (of type int, which defaults to 0): MIDI channel to handle.
  • decay (of type float, which defaults to 0.01): Envelope decay (in seconds).
  • envelope (of type bool, which defaults to true): Use envelope.
  • release (of type float, which defaults to 0.05): Envelope release (in seconds).
  • sustain (of type float, which defaults to 0.9): Envelope sustain level.
  • volume (of type float, which defaults to 0.3): Initial volume.
  • (unlabeled) (of type source(midi=midi(channels=1), 'a))

Methods:

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

Callbacks:

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

synth.sine

Sine synthesizer.

Type:

(?id : string?, ?attack : float, ?channel : int, ?decay : float,
 ?envelope : bool, ?release : float, ?sustain : float, ?volume : float,
 source(midi=midi(channels=1), 'a)) -> source(midi=midi(channels=1), 'a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • attack (of type float, which defaults to 0.02): Envelope attack (in seconds).
  • channel (of type int, which defaults to 0): MIDI channel to handle.
  • decay (of type float, which defaults to 0.01): Envelope decay (in seconds).
  • envelope (of type bool, which defaults to true): Use envelope.
  • release (of type float, which defaults to 0.05): Envelope release (in seconds).
  • sustain (of type float, which defaults to 0.9): Envelope sustain level.
  • volume (of type float, which defaults to 0.3): Initial volume.
  • (unlabeled) (of type source(midi=midi(channels=1), 'a))

Methods:

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

Callbacks:

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

synth.square

Square synthesizer.

Type:

(?id : string?, ?attack : float, ?channel : int, ?decay : float,
 ?envelope : bool, ?release : float, ?sustain : float, ?volume : float,
 source(midi=midi(channels=1), 'a)) -> source(midi=midi(channels=1), 'a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • attack (of type float, which defaults to 0.02): Envelope attack (in seconds).
  • channel (of type int, which defaults to 0): MIDI channel to handle.
  • decay (of type float, which defaults to 0.01): Envelope decay (in seconds).
  • envelope (of type bool, which defaults to true): Use envelope.
  • release (of type float, which defaults to 0.05): Envelope release (in seconds).
  • sustain (of type float, which defaults to 0.9): Envelope sustain level.
  • volume (of type float, which defaults to 0.3): Initial volume.
  • (unlabeled) (of type source(midi=midi(channels=1), 'a))

Methods:

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

Callbacks:

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

Source / Track processing

blank.detect

Calls a given handler when detecting a blank.

Type:

(?id : string?, ?max_blank : {float}, ?min_noise : {float},
 ?start_blank : bool, ?threshold : {float}, ?track_sensitive : {bool},
 source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • max_blank (of type {float}, which defaults to 20.0): Maximum duration of silence allowed, in seconds.
  • min_noise (of type {float}, which defaults to 0.0): Minimum duration of noise required to end silence, in seconds.
  • start_blank (of type bool, which defaults to false): Start assuming we have blank.
  • threshold (of type {float}, which defaults to -40.0): Power in decibels under which the stream is considered silent.
  • track_sensitive (of type {bool}, which defaults to true): Reset blank counter at each track.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

blank.eat

Eat blanks, i.e., drop the contents of the stream until it is not blank anymore.

Type:

(?id : string?, ?at_beginning : bool, ?max_blank : {float},
 ?min_noise : {float}, ?start_blank : bool, ?threshold : {float},
 ?track_sensitive : {bool}, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • at_beginning (of type bool, which defaults to false): Only eat at the beginning of a track.
  • max_blank (of type {float}, which defaults to 20.0): Maximum duration of silence allowed, in seconds.
  • min_noise (of type {float}, which defaults to 0.0): Minimum duration of noise required to end silence, in seconds.
  • start_blank (of type bool, which defaults to false): Start assuming we have blank.
  • threshold (of type {float}, which defaults to -40.0): Power in decibels under which the stream is considered silent.
  • track_sensitive (of type {bool}, which defaults to true): Reset blank counter at each track.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

blank.strip

Make the source unavailable when it is streaming blank. This is an active operator, meaning that the source used in this operator will be consumed continuously, even when it is not actively used.

Type:

(?id : string?, ?max_blank : {float}, ?min_noise : {float},
 ?start_blank : bool, ?threshold : {float}, ?track_sensitive : {bool},
 source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • max_blank (of type {float}, which defaults to 20.0): Maximum duration of silence allowed, in seconds.
  • min_noise (of type {float}, which defaults to 0.0): Minimum duration of noise required to end silence, in seconds.
  • start_blank (of type bool, which defaults to false): Start assuming we have blank.
  • threshold (of type {float}, which defaults to -40.0): Power in decibels under which the stream is considered silent.
  • track_sensitive (of type {bool}, which defaults to true): Reset blank counter at each track.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

delay

Make the source unavailable for a given time between tracks.

Type:

(?id : string?, ?initial : bool, {float}, source('a)) -> source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • initial (of type bool, which defaults to false): Start in unavailable state, as if a track had just finished.
  • (unlabeled) (of type {float}): The source won’t be ready less than this amount of seconds after any end of track
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

delay_line

Delay the source by a given amount of time.

Type:

(?id : string?, {float}, source('a)) -> source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • (unlabeled) (of type {float}): Duration of the delay in seconds.
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

max_duration

Limit source duration

Type:

(?id : string?, ?override : string, float, source('a)) -> source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • override (of type string, which defaults to "liq_remaining"): Metadata field which, if present and containing a float, overrides the remaining play time.
  • (unlabeled) (of type float): Maximum duration
  • (unlabeled) (of type source('a))

Methods:

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

Callbacks:

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

sequence

Play a sequence of sources. By default, play one track per source, except for the last one which is played as much as available.

Type:

(?id : string?, ?merge : bool, ?single_track : bool, [source('a)]) ->
source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • merge (of type bool, which defaults to false): Merge tracks when advancing from one source to the next one. This will NOT merge consecutive tracks from the last source; see merge_tracks() if you need that too.
  • single_track (of type bool, which defaults to true): Advance to the new track in the sequence on new track. Set to false to play each source until it becomes unavailable.
  • (unlabeled) (of type [source('a)])

Methods:

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

Callbacks:

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

source.available

Change the availability of a source depending on a predicate.

Type:

(?id : string?, ?override : bool, ?track_sensitive : {bool}, source('a),
 {bool}) -> source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • override (of type bool, which defaults to false): Don’t take availability of original source in account (this can be dangerous and should be avoided).
  • track_sensitive (of type {bool}, which defaults to false): Change availability only on end of tracks.
  • (unlabeled) (of type source('a)): Source of which the availability should be changed.
  • (unlabeled) (of type {bool}): Predicate indicating whether the source should be available or not.

Methods:

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

Callbacks:

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

source.dynamic

Dynamically change the underlying source: it can either be changed by the function given as argument, which returns the source to be played, or by calling the set method.

Type:

(?id : string?, ?infallible : bool, ?init : source('a)?, ?merge : {bool},
 ?self_sync : bool?, ?track_sensitive : {bool},
 (() -> source('a).{activation? : activation}?)) -> source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • infallible (of type bool, which defaults to false): Whether the source is infallible or not (be careful when setting this, it will not be checked by the typing system).
  • init (of type source('a)?, which defaults to null): Initial value for the source
  • merge (of type {bool}, which defaults to false): Set or return true to merge subsequent tracks.
  • self_sync (of type bool?, which defaults to null): For the source’s self_sync property.
  • track_sensitive (of type {bool}, which defaults to false): Whether the source should only be updated on track change.
  • (unlabeled) (of type () -> source('a).{activation? : activation}?): Function returning the source to be used, null means keep current source.

Methods:

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

Callbacks:

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

source.frame.duration

Compute the duration of the last frame.

Type:

(?id : string?, source('a)) -> source(frame_duration=float, 'a)

Arguments:

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

Methods:

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

Callbacks:

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

source.frame.rms

Compute the rms of the last frame.

Type:

(?id : string?, source('a)) -> source(frame_rms=float, 'a)

Arguments:

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

Methods:

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

Callbacks:

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

source.tracks

Return the tracks of a given source.

Type:

(source('a)) -> 'a

Arguments:

  • (unlabeled) (of type source('a))

Methods:

  • metadata (of type metadata)
  • track_marks (of type track_marks)

switch

At the beginning of a track, select the first source whose predicate is true.

Type:

(?id : string?, ?all_predicates : bool, ?override : string,
 ?replay_metadata : bool, ?single : [bool], ?track_sensitive : {bool},
 ?transition_length : float,
 ?transitions : [(source('a), source('a)) -> source('a)],
 [(() -> bool) * source('a)]) -> source('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • all_predicates (of type bool, which defaults to false): Always evaluate all predicates when re-selecting.
  • override (of type string, which defaults to "liq_transition_length"): Metadata field which, if present and containing a float, overrides the transition_length parameter.
  • replay_metadata (of type bool, which defaults to true): Replay the last metadata of a child when switching to it in the middle of a track.
  • single (of type [bool], which defaults to []): Forbid the selection of a branch for two tracks in a row. The empty list stands for [false,...,false].
  • track_sensitive (of type {bool}, which defaults to true): Re-select only on end of tracks.
  • transition_length (of type float, which defaults to 5.0): Maximum transition duration.
  • transitions (of type [(source('a), source('a)) -> source('a)], which defaults to []): Transition functions, padded with fun (x,y) -> y functions.
  • (unlabeled) (of type [(() -> bool) * source('a)]): Sources with the predicate telling when they can be played.

Methods:

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

Callbacks:

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

Source / Video processing

video.add_line

Draw a line on the video.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.add_rectangle

Draw a rectangle.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.align

Translate the video so that it is aligned on boundaries.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.alpha.movement

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

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.alpha.of_color

Set a color to be transparent.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.alpha.remove

Remove α channel.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.alpha.to_y

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

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.board

A plane where one can draw.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.bounding_box

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

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.crop

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

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.fade.in

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

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.fade.out

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

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.fill

Fill frame with a color.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.greyscale

Convert video to greyscale.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.hmirror

Flip image horizontally.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.info

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

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.invert

Invert video.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.lomo

Emulate the “Lomo effect”.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.opacity

Scale opacity of video.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.opacity.box

Set alpha value on a given box inside the image.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.persistence

Make images of the video persistent.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.render

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

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.resize

Resize and translate video.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.rotate

Rotate video.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.scale

Scale and translate video.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.sepia

Convert video to sepia.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.still_frame

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

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.text.native

Display a text.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.text.sdl

Display a text.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.translate

Translate video.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

video.viewport

Set the viewport for the current video.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

Source / Visualization

bpm

Detect the BPM (number of beats per minute). The returned source has a method bpm, which can be called to compute it.

Type:

(?id : string?, source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Arguments:

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

Methods:

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

Callbacks:

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

lufs

Compute current LUFS of the source according to the EBU R128 standard. It returns the source with a method to compute the current value.

Type:

(?id : string?, ?true_peak : bool, ?window : {float}, source(audio=pcm('a),
 'b)) -> source(audio=pcm('a), 'b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • true_peak (of type bool, which defaults to true): Measure true peak. Set to false to disable true peak measurement and save CPU.
  • window (of type {float}, which defaults to 3.0): Duration of the window (in seconds) used to compute the LUFS.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

midi.inspect

Display midi events on standard output.

Type:

(?id : string?, source('a)) -> source('a)

Arguments:

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

Methods:

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

Callbacks:

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

rms.smooth

Compute the current RMS for the source, this varies more smoothly that rms and is updated more frequently. Returns the source with a method rms.

Type:

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

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • duration (of type {float}, which defaults to 0.5): Duration of the window in seconds (more precisely, this is the time constant of the low-pass filter).
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

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

Callbacks:

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

video.volume

Graphical visualization of the sound.

Type:

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

Arguments:

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

Methods:

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

Callbacks:

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

String

%

pattern % [...,(k,v),...] changes in the pattern occurrences of:

  • $(k) into v
  • `$(if $(k2),“a”,“b”) into “a” if k2 is found in the list, “b” otherwise.

Type:

(string, [string * string]) -> string

Arguments:

  • (unlabeled) (of type string)
  • (unlabeled) (of type [string * string])

^

Concatenate strings.

Type:

(string, string) -> string

Arguments:

  • (unlabeled) (of type string)
  • (unlabeled) (of type string)

bool_of_string

Convert a string to a bool. Raises error.failure("a string to a bool") if conversion fails and default is null

Type:

(string, ?default : bool?) -> bool

Arguments:

  • (unlabeled) (of type string)
  • default (of type bool?, which defaults to null)

float_of_string

Convert a string to a float. Raises error.failure("a string to a float") if conversion fails and default is null

Type:

(string, ?default : float?) -> float

Arguments:

  • (unlabeled) (of type string)
  • default (of type float?, which defaults to null)

int_of_string

Convert a string to a int. Raises error.failure("a string to a int") if conversion fails and default is null

Type:

(string, ?default : int?) -> int

Arguments:

  • (unlabeled) (of type string)
  • default (of type int?, which defaults to null)

irc.channel

Contents of an IRC channel.

Type:

(?server : string, ?port : int, ?channel : string, ?nick : string,
 ?limit : int) -> () -> string

Example:

# Display messages in the #liquidsoap-test room over a video
s = single("test.mp4")
s = video.add_text.native(irc.channel(channel="#liquidsoap-test"), s)

Arguments:

  • server (of type string, which defaults to "irc.libera.chat"): IRC server.
  • port (of type int, which defaults to 6667): Port for IRC server.
  • channel (of type string, which defaults to "#liquidsoap"): IRC chan to join.
  • nick (of type string, which defaults to "liquidbot"): Nickname.
  • limit (of type int, which defaults to 10): Limit to n last messages

json.object

Create a generic json object

Type:

() -> json

Methods:

  • add (of type (string, 'a) -> unit): Add or replace a new key/value pair to the object.
  • remove (of type (string) -> unit): Remove a key from the object. Does not nothing if the key does not exist.
  • stringify (of type (?compact : bool, ?json5 : bool) -> string): Render object as json string.

json.stringify

Convert a value to JSON. If the value cannot be represented as JSON (for instance a function), a error.json exception is raised.

Type:

(?compact : bool, ?json5 : bool, 'a) -> string

Arguments:

  • compact (of type bool, which defaults to false): Output compact text.
  • json5 (of type bool, which defaults to false): Use json5 extended spec.
  • (unlabeled) (of type 'a)

json.value

Create a generic json value

Type:

('a) -> json

Arguments:

  • (unlabeled) (of type 'a)

metadata.id3v2.render

Return a string representation of a id3v2 metadata tag

Type:

([string * string], ?version : int) -> string

Arguments:

  • (unlabeled) (of type [string * string])
  • version (of type int, which defaults to 3): Tag version. One of: 3 or 4

metadata.parse.amplify

Parse an amplify metadata. Parsing is the same as in the amplify operator. Metadata can be of the form: “ dB” for a decibel-based value or “” for a linear-based value. Returns a decibel value.

Type:

(string) -> float

Arguments:

  • (unlabeled) (of type string)

regexp

Create a regular expression

Type:

(?flags : [string], string) -> regexp

Arguments:

  • flags (of type [string], which defaults to []): List of flags. Valid flags: "i", "g", "m".
  • (unlabeled) (of type string)

Methods:

  • exec (of type (string) -> [int * string].{groups : [string * string]}): Extract substrings from a string. Returns a list of (index,value). If the list does not have a pair associated to some index, it means that the corresponding pattern was not found.
  • replace (of type (((string) -> string), string) -> string): Replace substrings matched by the regexp by another string returned by a function.
  • split (of type (string) -> [string]): Split a string on the given regular expression.
  • test (of type (string) -> bool): Match a string with the expressionn.

runtime.memory.prettify_bytes

Returns a human-redable description of an amount of bytes.

Type:

(?float_printer : ((float) -> string)?, ?signed : bool?, ?bits : bool?,
 ?binary : bool?, int) -> string

Arguments:

  • float_printer (of type ((float) -> string)?, which defaults to null)
  • signed (of type bool?, which defaults to null)
  • bits (of type bool?, which defaults to null)
  • binary (of type bool?, which defaults to null)
  • (unlabeled) (of type int)

string

Return the representation of a value.

Type:

(?fields : bool, ?print_binary : bool, 'a) -> string

Arguments:

  • fields (of type bool, which defaults to false): Show toplevel fields around the value.
  • print_binary (of type bool, which defaults to true): When false, strings marked as binary are masked and returned as <string>
  • (unlabeled) (of type 'a)

string.annotate.parse

Parse a string of the form <key>=<value>,...:<uri> as given by the annotate: protocol

Type:

(string) -> [string * string] * string

Arguments:

  • (unlabeled) (of type string)

string.base64.decode

Decode a Base64 encoded string.

Type:

(string) -> string

Arguments:

  • (unlabeled) (of type string)

string.base64.encode

Encode a string in Base64.

Type:

(string) -> string

Arguments:

  • (unlabeled) (of type string)

string.capitalize

Return a string with the first character set to upper case (capitalize), or to lower case (uncapitalize).

Type:

(?capitalize : bool, ?space_sensitive : bool, string) -> string

Arguments:

  • capitalize (of type bool, which defaults to true): Capitalize if true, uncapitalize otherwise
  • space_sensitive (of type bool, which defaults to true): Capitalize each space separated sub-string.
  • (unlabeled) (of type string)

string.case

Convert a string to lower or upper case.

Type:

(?lower : bool, string) -> string

Arguments:

  • lower (of type bool, which defaults to true): Convert to lower case if true and uppercase otherwise.
  • (unlabeled) (of type string)

string.char

Create a string with one character.

Type:

(int) -> string

Arguments:

  • (unlabeled) (of type int): Code of the character.

string.chars

Split string into characters. Raises error.invalid on errors.

Type:

(?encoding : string?, string) -> [string]

Arguments:

  • encoding (of type string?, which defaults to null): Encoding used to split characters. Should be one of: "utf8" or "ascii"
  • (unlabeled) (of type string)

string.compare

Compare strings in lexicographical order.

Type:

(string, string) -> int

Arguments:

  • (unlabeled) (of type string)
  • (unlabeled) (of type string)

string.concat

Concatenate strings.

Type:

(?separator : string, [string]) -> string

Arguments:

  • separator (of type string, which defaults to "")
  • (unlabeled) (of type [string])

string.digest

Return an MD5 digest for the given string.

Type:

(string) -> string

Arguments:

  • (unlabeled) (of type string)

string.escape

Escape special characters in an string. By default, the string is assumed to be "utf8" encoded and is escaped following JSON and javascript specification.

Type:

(?special_char : ((encoding : string, string) -> bool)?,
 ?escape_char : ((encoding : string, string) -> string)?,
 ?encoding : string?, string) -> string

Arguments:

  • special_char (of type ((encoding : string, string) -> bool)?, which defaults to null): Return true if the given character (passed as a string) should be escaped. Defaults to control characters for "utf8" and control characters and any character above \x7E (non-printable characters) for "ascii".
  • escape_char (of type ((encoding : string, string) -> string)?, which defaults to null): Function used to escape a character. Defaults to \xxx octal notation for "ascii" and \uxxxx hexadecimal notation for "utf8".
  • encoding (of type string?, which defaults to null): One of: "ascii" or "utf8". If null, utf8 is tried first and ascii is used as a fallback if this fails.
  • (unlabeled) (of type string)

string.escape.all

Escape each character in the given string using a specific escape sequence.

Type:

(?format : string, string) -> string

Arguments:

  • format (of type string, which defaults to "utf8"): Escape format. One of: "octal", "hex" or "utf8".
  • (unlabeled) (of type string)

string.escape.special_char

Default function to detect characters to escape. See string.escape for more details.

Type:

(?encoding : string, string) -> bool

Arguments:

  • encoding (of type string, which defaults to "utf8"): One of: "ascii" or "utf8".
  • (unlabeled) (of type string)

string.float

String representation of a float.

Type:

(?decimal_places : int?, float) -> string

Arguments:

  • decimal_places (of type int?, which defaults to null): Number of decimal places.
  • (unlabeled) (of type float)

string.hex_of_int

Hexadecimal representation of an integer.

Type:

(?pad : int, int) -> string

Arguments:

  • pad (of type int, which defaults to 0): Minimum length in digits (pad on the left with zeros in order to reach it).
  • (unlabeled) (of type int)

string.id

Generate an identifier with given operator name.

Type:

(?category : string, string) -> string

Arguments:

  • category (of type string, which defaults to ""): Category
  • (unlabeled) (of type string): Operator name.

string.index

Index where a substring occurs in a string. The function returns -1 if the substring is not present

Type:

(substring : string, string) -> int

Arguments:

  • substring (of type string): Substring to look for.
  • (unlabeled) (of type string): String in which to look.

string.length

Return the string’s length using the given encoding. Raises error.invalid on errors.

Type:

(?encoding : string?, string) -> int

Arguments:

  • encoding (of type string?, which defaults to null): Encoding used to split characters. Should be one of: "utf8" or "ascii"
  • (unlabeled) (of type string)

string.make

Create a string of a given length using the given character.

Type:

(?char_code : int, int) -> string

Arguments:

  • char_code (of type int, which defaults to 32): Character code.
  • (unlabeled) (of type int): String length.

string.nth

Retrieve a character in a string. Raises error.not_found if character does not exist.

Type:

(string, int) -> int

Example:

c = string.nth("abcde", 2)
print(c) # should print 99 which is the ascii code for "c"

Arguments:

  • (unlabeled) (of type string): String to look into.
  • (unlabeled) (of type int): Index of the character.

string.recode

Convert a string. Effective only if Camomile is enabled.

Type:

(?in_enc : string?, ?out_enc : string, string) -> string

Arguments:

  • in_enc (of type string?, which defaults to null): Input encoding. Autodetected if null.
  • out_enc (of type string, which defaults to "UTF-8"): Output encoding.
  • (unlabeled) (of type string)

string.sub

Get a substring of a string. Returns “” if no such substring exists.

Type:

(string, start : int, ?encoding : string?, length : int) -> string

Arguments:

  • (unlabeled) (of type string)
  • start (of type int): Return a sub string starting at this position. First position is 0.
  • encoding (of type string?, which defaults to null): Encoding used to split characters. Should be one of: "utf8" or "ascii"
  • length (of type int): Return a sub string of length characters.

string.trim

Return a string without leading and trailing whitespace.

Type:

(string) -> string

Arguments:

  • (unlabeled) (of type string)

string.unescape

This function is the inverse of string.escape.

Type:

(string) -> string

Arguments:

  • (unlabeled) (of type string)

url.decode

Decode an encoded url (e.g. “%20” becomes ” “).

Type:

(?plus : bool, string) -> string

Arguments:

  • plus (of type bool, which defaults to true)
  • (unlabeled) (of type string)

url.encode

Encode an url (e.g. ” ” becomes “%20”).

Type:

(?plus : bool, string) -> string

Arguments:

  • plus (of type bool, which defaults to true)
  • (unlabeled) (of type string)

xml.stringify

Convert a value to XML. If the value cannot be represented as XML (for instance a function), a error.xml exception is raised.

Type:

(?compact : bool, 'a) -> string

Arguments:

  • compact (of type bool, which defaults to false): Output compact text.
  • (unlabeled) (of type 'a)

yaml.stringify

Convert a value to YAML. If the value cannot be represented as YAML (for instance a function), a error.yaml exception is raised.

Type:

(?scalar_style : string, ?layout_style : string, 'a) -> string

Arguments:

  • scalar_style (of type string, which defaults to "any"): Scalar style. One of: “any”, “plain”, “single_quoted”, “double_quoted”, “literal” or “folded”.
  • layout_style (of type string, which defaults to "any"): Layout style. One of: “any”, “block” or “flow”.
  • (unlabeled) (of type 'a)

System

argv

Get command-line parameters. The parameters are numbered starting from 1, the zeroth parameter being the script name.

Type:

(?default : string, int) -> string

Arguments:

  • default (of type string, which defaults to "")
  • (unlabeled) (of type int)

environment

Return the process environment.

Type:

() -> [string * string]

environment.set

Set the value associated to a variable in the process environment.

Type:

(string, string) -> unit

Arguments:

  • (unlabeled) (of type string): Variable to be set.
  • (unlabeled) (of type string): Value to set.

exe_ext

Executable file extension.

Type:

string

exit

Immediately stop the application. This should only be used in extreme cases or to specify an exit value. The recommended way of stopping Liquidsoap is to use shutdown.

Type:

(int) -> unit

Arguments:

  • (unlabeled) (of type int): Exit value.

getopt

Parse command line options: getopt("-o") returns “1” if “-o” was passed without any parameter, “0” otherwise. getopt(default="X","-o") returns “Y” if “-o Y” was passed, “X” otherwise. The result is removed from the list of arguments, affecting subsequent calls to argv() and getopt().

Type:

(?default : string, string) -> string

Arguments:

  • default (of type string, which defaults to "")
  • (unlabeled) (of type string)

on_cleanup

Register a function to be called for the final cleanup.

Type:

((() -> unit)) -> unit

Arguments:

  • (unlabeled) (of type () -> unit)

on_shutdown

Register a function to be called when Liquidsoap shuts down.

Type:

((() -> unit)) -> unit

Arguments:

  • (unlabeled) (of type () -> unit)

on_start

Register a function to be called when Liquidsoap starts.

Type:

((() -> unit)) -> unit

Arguments:

  • (unlabeled) (of type () -> unit)

os.type

Type of OS running liquidsoap.

Type:

string

process.pid

Get the process’ pid.

Type:

() -> int

process.quote

Return a quoted copy of the given string, suitable for use as one argument in a command line, escaping all meta-characters. Warning: under Windows, the output is only suitable for use with programs that follow the standard Windows quoting conventions.

Type:

(string) -> string

Arguments:

  • (unlabeled) (of type string): String to escape

process.quote.command

Return a quoted command line, suitable for use as an argument to process.run.

The optional arguments stdin, stdout and stderr are file names used to redirect the standard input, the standard output, or the standard error of the command.

If stdin=f is given, a redirection < f is performed and the standard input of the command reads from file f.

If stdout=f is given, a redirection > f is performed and the standard output of the command is written to file f.

If stderr=f is given, a redirection 2> f is performed and the standard error of the command is written to file f.

If both stdout=f and stderr=f are given, with the exact same file name f, a 2>&1 redirection is performed so that the standard output and the standard error of the command are interleaved and redirected to the same file f.

Type:

(?stdin : string?, ?stdout : string?, ?stderr : string?, ?args : [string],
 string) -> string

Arguments:

  • stdin (of type string?, which defaults to null): command standard input
  • stdout (of type string?, which defaults to null): command standard output
  • stderr (of type string?, which defaults to null): command standard error
  • args (of type [string], which defaults to []): command arguments
  • (unlabeled) (of type string): Command to execute

process.run

Run a process in a shell environment. Returns the standard output, as well as standard error and status as methods. The status can be “exit” (the status code is set), “killed” or “stopped” (the status code is the signal), or “exception” (the description is set) or “timeout” (the description is the run time).

Type:

(?env : [string * string], ?inherit_env : bool, ?stdin : string,
 ?rwdirs : [string], ?rodirs : [string], ?network : bool?, ?timeout : float?,
 string) -> unit

Arguments:

  • env (of type [string * string], which defaults to []): Process environment
  • inherit_env (of type bool, which defaults to true): Inherit calling process’s environment when env parameter is empty.
  • stdin (of type string, which defaults to ""): Data to write to the process’ standard input.
  • rwdirs (of type [string], which defaults to ["default"]): Read/write directories for sandboxing. "default" expands to sandbox default.
  • rodirs (of type [string], which defaults to ["default"]): Read-only directories for sandboxing "default" expands to sandbox default.
  • network (of type bool?, which defaults to null): Enable or disable network inside sandboxed environment (sandbox default if not specified).
  • timeout (of type float?, which defaults to null): Cancel process after timeout has elapsed. Ignored if negative.
  • (unlabeled) (of type string): Command to run

Methods:

  • status (of type string.{code : int, description : string}): Status when process ended, can be one of "exit" (the program exited, the status code is then relevant), "killed" (the program was killed by signal given in status code), "stopped" (the program was stopped by signal given in status code) or "exception" (the program raised and exception detailed in the description).
  • stderr (of type string): Messages written by process on standard error stream.
  • stdout (of type string): Messages written by process on standard output stream.

process.stderr

The process’ stderr

Type:

socket
.{
  close : () -> unit,
  closed : () -> bool,
  non_blocking : (bool) -> unit,
  read : ((?timeout : float?) -> string)
  .{wait : (?timeout : float?, (() -> unit)) -> unit
  },
  type : string,
  write : ((?timeout : float?, string) -> unit)
  .{wait : (?timeout : float?, (() -> unit)) -> unit
  }
}

process.stdin

The process’ stdin

Type:

socket
.{
  close : () -> unit,
  closed : () -> bool,
  non_blocking : (bool) -> unit,
  read : ((?timeout : float?) -> string)
  .{wait : (?timeout : float?, (() -> unit)) -> unit
  },
  type : string,
  write : ((?timeout : float?, string) -> unit)
  .{wait : (?timeout : float?, (() -> unit)) -> unit
  }
}

process.stdout

The process’ stdout

Type:

socket
.{
  close : () -> unit,
  closed : () -> bool,
  non_blocking : (bool) -> unit,
  read : ((?timeout : float?) -> string)
  .{wait : (?timeout : float?, (() -> unit)) -> unit
  },
  type : string,
  write : ((?timeout : float?, string) -> unit)
  .{wait : (?timeout : float?, (() -> unit)) -> unit
  }
}

process.time

Get the execution time of the current liquidsoap process.

Type:

() -> unit

Methods:

  • system (of type float)
  • user (of type float)

reopen.stderr

Reopen standard error on the given file

Type:

(string) -> unit

Arguments:

  • (unlabeled) (of type string)

reopen.stdin

Reopen standard input on the given file

Type:

(string) -> unit

Arguments:

  • (unlabeled) (of type string)

reopen.stdout

Reopen standard output on the given file

Type:

(string) -> unit

Arguments:

  • (unlabeled) (of type string)

restart

Restart the application.

Type:

() -> unit

runtime.gc.get

Return the current values of the GC parameters

Type:

() -> unit

Methods:

  • allocation_policy (of type int)
  • custom_major_ratio (of type int)
  • custom_minor_max_size (of type int)
  • custom_minor_ratio (of type int)
  • major_heap_increment (of type int)
  • max_overhead (of type int)
  • minor_heap_size (of type int)
  • space_overhead (of type int)
  • stack_limit (of type int)
  • verbose (of type int)
  • window_size (of type int)

runtime.gc.print_stat

Print the current values of the memory management counters in human-readable form.

Type:

() -> unit

runtime.gc.quick_stat

Same as stat except that live_words, live_blocks, free_words, free_blocks, largest_free, and fragments are set to 0. This function is much faster than gc.stat because it does not need to go through the heap.

Type:

() -> unit

Methods:

  • compactions (of type int)
  • forced_major_collections (of type int)
  • fragments (of type int)
  • free_blocks (of type int)
  • free_words (of type int)
  • heap_chunks (of type int)
  • heap_words (of type int)
  • largest_free (of type int)
  • live_blocks (of type int)
  • live_words (of type int)
  • major_collections (of type int)
  • major_words (of type float)
  • minor_collections (of type int)
  • minor_words (of type float)
  • promoted_words (of type float)
  • stack_size (of type int)
  • top_heap_words (of type int)

runtime.gc.set

Set the GC parameters.

Type:

(
 {
   allocation_policy : int,
   custom_major_ratio : int,
   custom_minor_max_size : int,
   custom_minor_ratio : int,
   major_heap_increment : int,
   max_overhead : int,
   minor_heap_size : int,
   space_overhead : int,
   stack_limit : int,
   verbose : int,
   window_size : int
 }) -> unit

Arguments:

  • (unlabeled) (of type { allocation_policy : int, custom_major_ratio : int, custom_minor_max_size : int, custom_minor_ratio : int, major_heap_increment : int, max_overhead : int, minor_heap_size : int, space_overhead : int, stack_limit : int, verbose : int, window_size : int })

runtime.gc.stat

Return the current values of the memory management counters. This function examines every heap block to get the statistics.

Type:

() -> unit

Methods:

  • compactions (of type int)
  • forced_major_collections (of type int)
  • fragments (of type int)
  • free_blocks (of type int)
  • free_words (of type int)
  • heap_chunks (of type int)
  • heap_words (of type int)
  • largest_free (of type int)
  • live_blocks (of type int)
  • live_words (of type int)
  • major_collections (of type int)
  • major_words (of type float)
  • minor_collections (of type int)
  • minor_words (of type float)
  • promoted_words (of type float)
  • stack_size (of type int)
  • top_heap_words (of type int)

runtime.locale.set

Set the system’s locale. This sets LANG and LC_ALL environment variables to the given value and then calls setlocale. This is set to "C" on startup, which defaults to the system’s default locale. Keep in mind that changing this can potentially impact some functions such a float_of_string.

Type:

(string) -> unit

Arguments:

  • (unlabeled) (of type string)

runtime.memory

Returns information about the system and process’ memory.

Type:

() -> unit

Methods:

  • process_physical_memory (of type int)
  • process_private_memory (of type int)
  • process_swapped_memory (of type int)
  • process_virtual_memory (of type int)
  • total_physical_memory (of type int)
  • total_used_physical_memory (of type int)
  • total_used_virtual_memory (of type int)
  • total_virtual_memory (of type int)

runtime.sys.word_size

Size of one word on the machine currently executing the program, in bits. Either 32 or 64.

Type:

int

shutdown

Shutdown the application.

Type:

(?code : int) -> unit

Arguments:

  • code (of type int, which defaults to 0): Exit code. Default: 0

source.is_up

Check whether a source is up.

Type:

(source('a)) -> bool

Arguments:

  • (unlabeled) (of type source('a))

Time

cron.parse

Parse a cron entry. Format is the posix crontab format with linux extensions (named months and week days and @yearly,annyally,monthly,weeklydaily,hourly.

Type:

(string) -> unit

Arguments:

  • (unlabeled) (of type string)

Methods:

  • hour (of type string)
  • minute (of type string)
  • month (of type string)
  • month_day (of type string)
  • test (of type (?time : float?) -> bool)
  • week_day (of type string)

time

Return the current time since 00:00:00 GMT, Jan. 1, 1970, in seconds. Sub-second precision is available as the fractional part (64-bit float).

Type:

() -> float

time.local

Convert a time in seconds into a date in the local time zone (current time is used if no argument is provided).

Type:

(?float?) -> unit

Arguments:

  • (unlabeled) (of type float?, which defaults to null)

Methods:

  • day (of type int): Day of month.
  • dst (of type bool): Daylight time savings in effect.
  • hour (of type int): Hours.
  • min (of type int): Minutes.
  • month (of type int): Month of year.
  • sec (of type int): Seconds.
  • week_day (of type int): Day of week (Sunday is 0 or 7, Saturday is 6).
  • year (of type int): Year.
  • year_day (of type int): Day of year, between 1 and 366.

time.make

Convert a date and time in the local timezone into a time, in seconds, since 00:00:00 GMT, Jan. 1, 1970.

Type:

(
 {
   day : int,
   dst : bool?,
   hour : int,
   min : int,
   month : int,
   sec : int,
   year : int
 }) -> float

Arguments:

  • (unlabeled) (of type { day : int, dst : bool?, hour : int, min : int, month : int, sec : int, year : int })

time.predicate

Parse a string as a time predicate

Type:

(string) -> () -> bool

Arguments:

  • (unlabeled) (of type string)

time.string

Obtain a string representation of the current time. It takes a string as argument where special strings are replaced roughly following strftime: %H is replaced by the current hour, %M minute, %S second, %A week day (%a week day abbreviated), %d month day, %B month name (%b month name abbreviated), %z timezone.

Type:

(?time : float?, ?string?) -> string

Example:

s = time.string("Current time is %H:%M.")
print(s)

Example:

# Backup a source naming the file based on time
output.file({time.string("/path/to/file%H%M%S.wav")}, ...)

Arguments:

  • time (of type float?, which defaults to null): If specified convert the given time (in seconds since 00:00:00 GMT, Jan. 1, 1970) instead of the current time.
  • (unlabeled) (of type string?, which defaults to null): Description of the string to produce, e.g. "Current time is %H:%M“`.

time.up

Current time, in seconds, since the script has started.

Type:

() -> float

time.utc

Convert a time in seconds into a date in the UTC time zone (current time is used if no argument is provided).

Type:

(?float?) -> unit

Arguments:

  • (unlabeled) (of type float?, which defaults to null)

Methods:

  • day (of type int): Day of month.
  • dst (of type bool): Daylight time savings in effect.
  • hour (of type int): Hours.
  • min (of type int): Minutes.
  • month (of type int): Month of year.
  • sec (of type int): Seconds.
  • week_day (of type int): Day of week (Sunday is 0 or 7, Saturday is 6).
  • year (of type int): Year.
  • year_day (of type int): Day of year, between 1 and 366.

time.zone

Returns a description of the time zone set for the running process.

Type:

() -> string

Methods:

  • daylight (of type string): Daylight Savings Time
  • utc_diff (of type int): Difference in seconds between the current timezone and UTC.

Track / Audio processing

track.audio.add

Mix audio tracks with optional normalization.

Type:

(?id : string?, [pcm('a).{weight? : {float}}], ?normalize : {bool},
 ?power : {bool}) -> pcm('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type [pcm('a).{weight? : {float}}])
  • normalize (of type {bool}, which defaults to true): Divide by the sum of weights of ready sources (or by the number of ready sources if weights are not specified).
  • power (of type {bool}, which defaults to false): Perform constant-power normalization.

track.audio.amplify

Multiply the amplitude of the signal.

Type:

(?id : string?, ?override : {string?}, {float}, pcm*) -> pcm*

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • override (of type {string?}, which defaults to "liq_amplify"): Specify the name of a metadata field that, when present and well-formed, overrides the amplification factor for the current track. Well-formed values are floats in decimal notation (e.g. 0.7) which are taken as normal/linear multiplicative factors; values can be passed in decibels with the suffix dB (e.g. -8.2 dB, but the spaces do not matter). Defaults to settings.amplify.metadata. Set to null to disable.
  • (unlabeled) (of type {float}): Multiplicative factor.
  • (unlabeled) (of type anything that is a track of type: pcm, pcm_s16 or pcm_f32)

track.audio.clip

Clip samples, i.e. ensure that all values are between -1 and 1: values lower than -1 become -1 and values higher than 1 become 1. nan values become 0.

Type:

(?id : string?, pcm('a)) -> pcm('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type pcm('a))

track.audio.comb

Comb filter.

Type:

(?id : string?, ?delay : float, ?feedback : {float}, pcm('a)) -> pcm('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • delay (of type float, which defaults to 0.001): Delay in seconds.
  • feedback (of type {float}, which defaults to -6.0): Feedback coefficient in dB.
  • (unlabeled) (of type pcm('a))

track.audio.compand

Compand the signal.

Type:

(?id : string?, ?mu : float, source(pcm('a))) -> pcm('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • mu (of type float, which defaults to 1.0)
  • (unlabeled) (of type source(pcm('a)))

track.audio.compress

Compress the signal.

Type:

(?id : string?, ?attack : {float}, ?release : {float}, ?lookahead : {float},
 ?threshold : {float}, ?track_sensitive : bool, ?knee : {float},
 ?pre_gain : {float}, ?gain : {float}, ?ratio : {float}, ?window : {float},
 ?wet : {float}, pcm('a)) -> pcm('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • attack (of type {float}, which defaults to 50.0): Attack time (ms).
  • release (of type {float}, which defaults to 400.0): Release time (ms).
  • lookahead (of type {float}, which defaults to 0.0): Lookahead (ms).
  • threshold (of type {float}, which defaults to -10.0): Threshold level (dB).
  • track_sensitive (of type bool, which defaults to false): Reset on every track.
  • knee (of type {float}, which defaults to 1.0): Knee width (dB).
  • pre_gain (of type {float}, which defaults to 0.0): Pre-amplification (dB).
  • gain (of type {float}, which defaults to 0.0): Post-amplification (dB).
  • ratio (of type {float}, which defaults to 2.0): Gain reduction ratio (reduction is ratio:1). Must be at least 1.
  • window (of type {float}, which defaults to 0.0): RMS window length (second). 0. means peak mode.
  • wet (of type {float}, which defaults to 1.0): How much of input sound to output (between 0 and 1, 0 means only original sound, 1 means only compressed sound).
  • (unlabeled) (of type pcm('a))

Methods:

  • gain (of type () -> float): Gain (dB).
  • rms (of type () -> float): RMS or peak power (linear).

track.audio.compress.exponential

Exponential compressor.

Type:

(?id : string?, ?mu : float, pcm('a)) -> pcm('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • mu (of type float, which defaults to 2.0): Exponential compression factor, typically greater than 1.
  • (unlabeled) (of type pcm('a))

track.audio.map

Map a function to all audio samples. This is SLOW!

Type:

(?id : string?, ((float) -> float), pcm('a)) -> pcm('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type (float) -> float)
  • (unlabeled) (of type pcm('a))

This function is experimental.

track.audio.stereo.ms.decode

Decode mid+side stereo (M/S) to left+right stereo.

Type:

(?id : string?, ?width : float, pcm(stereo)) -> pcm(stereo)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • width (of type float, which defaults to 1.0): Width of the stereo field.
  • (unlabeled) (of type pcm(stereo))

track.audio.stereo.ms.encode

Encode left+right stereo to mid+side stereo (M/S).

Type:

(?id : string?, pcm(stereo)) -> pcm(stereo)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type pcm(stereo))

track.audio.stereo.pan

Pan a stereo sound.

Type:

(?id : string?, ?field : {float}, {float}, pcm(stereo)) -> pcm(stereo)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • field (of type {float}, which defaults to 90.0): Field width in degrees (between 0 and 90).
  • (unlabeled) (of type {float}): Pan value. Should be between -1 (left side) and 1 (right side).
  • (unlabeled) (of type pcm(stereo))

track.audio.stereo.width

Spacializer which allows controlling the width of the signal.

Type:

(?id : string?, ?{float}, pcm(stereo)) -> pcm(stereo)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type {float}, which defaults to 0.0): Width of the signal (-1: mono, 0.: original, 1.: wide stereo).
  • (unlabeled) (of type pcm(stereo))

track.audio.stereotool

Process the given audio track with StereoTool.

Type:

(?id : string?, library_file : string, ?license_key : string?,
 ?preset : string?, ?load_type : string, ?active : bool, pcm('a)) -> pcm('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • library_file (of type string): Path to the shared library file.
  • license_key (of type string?, which defaults to null)
  • preset (of type string?, which defaults to null): Path to a preset file to load when initializing the operator.
  • load_type (of type string, which defaults to "totalinit"): Load type for preset. One of: “totalinit”, “all_settings”, “audiofm”, “audio”, “processing”, “repair”, “repair_no_pnr” or “sublevel_pnr”.
  • active (of type bool, which defaults to false): Set to true to keep the source streaming even when not actively used by an output.
  • (unlabeled) (of type pcm('a))

Methods:

  • api_version (of type () -> int): API version.
  • latency (of type () -> float): Get the operator’s latency.
  • software_version (of type () -> int): Software version.
  • unlincensed_used_features (of type () -> string?): Check if the license is valid for the current settings.
  • valid_license (of type () -> bool): Check if the license is valid for the current settings.

track.audio.stretch

Slow down or accelerate an audio stream by stretching (sounds lower) or squeezing it (sounds higher).

Type:

(?id : string?, ratio : {float}, pcm('a)) -> pcm('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • ratio (of type {float}): A value higher than 1 means slowing down.
  • (unlabeled) (of type pcm('a))

track.decode.audio.pcm_f32

Decode an audio track using PCM signed 16 bit integers.

Type:

(?id : string?, pcm_f32('a)) -> pcm('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type pcm_f32('a))

track.decode.audio.pcm_s16

Decode an audio track using PCM signed 16 bit integers.

Type:

(?id : string?, pcm_s16('a)) -> pcm('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type pcm_s16('a))

track.encode.audio.pcm_f32

Encode an audio track using PCM signed 16 bit integers.

Type:

(?id : string?, pcm('a)) -> pcm_f32('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type pcm('a))

track.encode.audio.pcm_s16

Encode an audio track using PCM signed 16 bit integers.

Type:

(?id : string?, pcm('a)) -> pcm_s16('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type pcm('a))

Track / Conversion

track.audio.mean

Produce mono audio by taking the mean of all audio channels.

Type:

(?id : string?, ?normalize : bool, pcm('a)) -> pcm(mono)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • normalize (of type bool, which defaults to true): Divide the output volume by the number of channels.
  • (unlabeled) (of type pcm('a)): Track whose mean should be computed.

track.audio.stereo

Convert any pcm audio track into a stereo track.

Type:

(?id : string?, pcm('a)) -> pcm(stereo)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type pcm('a))

track.audio.swap

Swap two channels of a stereo track.

Type:

(?id : string?, pcm(stereo)) -> pcm(stereo)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type pcm(stereo))

track.ffmpeg.decode.audio

Decode a track content

Type:

(?id : string?, ffmpeg.copy('a)) -> pcm('b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type ffmpeg.copy('a))

track.ffmpeg.decode.video

Decode a track content

Type:

(?id : string?, ffmpeg.copy('a)) -> yuv420p('b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type ffmpeg.copy('a))

track.ffmpeg.encode.audio

Convert a track’s content

Type:

(?id : string?, format(audio=pcm('a), 'b), pcm('a)) -> ffmpeg.copy('c)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type format(audio=pcm('a), 'b)): Encoding format.
  • (unlabeled) (of type pcm('a))

track.ffmpeg.encode.video

Convert a track’s content

Type:

(?id : string?, format(video=yuv420p('a), 'b), yuv420p('a)) ->
ffmpeg.copy('c)

Arguments:

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

track.ffmpeg.raw.decode.audio

Decode a track content

Type:

(?id : string?, ffmpeg.audio.raw('a)) -> pcm('b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type ffmpeg.audio.raw('a))

track.ffmpeg.raw.decode.video

Decode a track content

Type:

(?id : string?, ffmpeg.video.raw('a)) -> yuv420p('b)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type ffmpeg.video.raw('a))

track.ffmpeg.raw.encode.audio

Convert a track’s content

Type:

(?id : string?, format(audio=ffmpeg.audio.raw('a), 'b), pcm('c)) ->
ffmpeg.audio.raw('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type format(audio=ffmpeg.audio.raw('a), 'b)): Encoding format.
  • (unlabeled) (of type pcm('c))

track.ffmpeg.raw.encode.video

Convert a track’s content

Type:

(?id : string?, format(video=ffmpeg.video.raw('a), 'b), yuv420p('c)) ->
ffmpeg.video.raw('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type format(video=ffmpeg.video.raw('a), 'b)): Encoding format.
  • (unlabeled) (of type yuv420p('c))

Track / FFmpeg filter

ffmpeg.filter.audio.output

Return an audio track from a filter’s output

Type:

(?id : string?, ?pass_metadata : bool, ffmpeg.filter.graph,
 ffmpeg.filter.audio) -> ffmpeg.audio.raw('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • pass_metadata (of type bool, which defaults to true): Pass ffmpeg stream metadata to liquidsoap
  • (unlabeled) (of type ffmpeg.filter.graph)
  • (unlabeled) (of type ffmpeg.filter.audio)

Track / Track processing

track.audio.defer

Defer an audio track by a given amount of time. Track will be available when the given delay has been fully buffered. Use this operator instead of buffer when buffering large amount of data as initial delay.

Type:

(?id : string?, delay : float, ?overhead : float?, pcm_s16('a)) ->
pcm_s16('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • delay (of type float): Duration of the delay, in seconds.
  • overhead (of type float?, which defaults to null): Duration of the delay overhead, in seconds. Defaults to frame size.
  • (unlabeled) (of type pcm_s16('a)): Track to delay.

track.metadata

Return the metadata associated with the given track

Type:

(?id : string?, 'a) -> metadata where 'a is a track

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type anything that is a track)

track.metadata.map

Rewrite metadata on the fly using a function.

Type:

(?id : string?, (([string * string]) -> [string * string]), ?update : bool,
 ?strip : bool?, ?insert_missing : bool?, metadata) -> metadata

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type ([string * string]) -> [string * string]): A function that returns new metadata.
  • update (of type bool, which defaults to true): Update metadata. If false, existing metadata are cleared and only returned values are set as new metadata.
  • strip (of type bool?, which defaults to null): Completely remove empty metadata. Operates on both empty values and empty metadata chunk. Defaults to settings.metadata.map.strip when null.
  • insert_missing (of type bool?, which defaults to null): Treat track beginnings without metadata as having empty ones. The operational order is: create empty if needed, map and strip if enabled. Defaults to settings.metadata.map.insert_missing when null.
  • (unlabeled) (of type metadata)

track.metadata.merge

Merge metadata from all given tracks. If two sources have metadata with the same label at the same time, the one from the last source in the list takes precedence.

Type:

(?id : string?, [metadata]) -> metadata

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type [metadata])

track.on_subtitle

Call a callback on each subtitle in the track.

Type:

(?id : string?,
 ((
   {
     absolute_end_time : float,
     absolute_start_time : float,
     end_time : int,
     forced : bool,
     format : string,
     position : int,
     start_time : int,
     text : string
   }) -> unit),
 subtitles) -> subtitles

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type ( { absolute_end_time : float, absolute_start_time : float, end_time : int, forced : bool, format : string, position : int, start_time : int, text : string }) -> unit): Callback function called on each subtitle.
  • (unlabeled) (of type subtitles)

track.subtitles.insert

Allow inserting subtitles into the track. Returns the track with an insert_subtitle method.

Type:

(?id : string?, ?subtitles?) -> subtitles

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type subtitles?, which defaults to null)

Methods:

  • insert_subtitle (of type ({duration : float, forced : bool, format : string, text : string}) -> unit): Insert a subtitle at the current position.

track.subtitles.map

Map a function over each subtitle in the track.

Type:

(?id : string?,
 ((
   {
     absolute_end_time : float,
     absolute_start_time : float,
     end_time : int,
     forced : bool,
     format : string,
     position : int,
     start_time : int,
     text : string
   }) -> {forced? : bool, format? : string, text? : string}?),
 subtitles) -> subtitles

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type ( { absolute_end_time : float, absolute_start_time : float, end_time : int, forced : bool, format : string, position : int, start_time : int, text : string }) -> {forced? : bool, format? : string, text? : string}?): Callback function called on each subtitle. Returns a record with optional fields to update (text, format, forced), or null to remove the subtitle.
  • (unlabeled) (of type subtitles)

track.track_marks

Return the track marks associated with the given track

Type:

(?id : string?, 'a) -> track_marks where 'a is a track

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type anything that is a track)

Track / Video processing

ffmpeg.filter.video.output

Return a video track from a filter’s output

Type:

(?id : string?, ?pass_metadata : bool, ffmpeg.filter.graph,
 ffmpeg.filter.video) -> ffmpeg.video.raw('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • pass_metadata (of type bool, which defaults to true): Pass ffmpeg stream metadata to liquidsoap
  • (unlabeled) (of type ffmpeg.filter.graph)
  • (unlabeled) (of type ffmpeg.filter.video)

track.video.add

Merge video tracks.

Type:

(?id : string?, [yuv420p('a)]) -> yuv420p('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • (unlabeled) (of type [yuv420p('a)])

track.video.tile

Tile video tracks.

Type:

(?id : string?, ?proportional : bool, [yuv420p('a)]) -> yuv420p('a)

Arguments:

  • id (of type string?, which defaults to null): Force the value of the track ID.
  • proportional (of type bool, which defaults to true): Scale preserving the proportions.
  • (unlabeled) (of type [yuv420p('a)])