View Source Membrane.File.Sink.Multi (Membrane File plugin v0.17.0)

Element that writes buffers to a set of files. File is switched on event.

Files are named according to naming_fun passed in options. This function receives sequential number of file and should return string. It defaults to path/to/file0.ext, path/to/file1.ext, ...

The event type, which starts writing to a next file is passed by split_event option. It defaults to Membrane.File.SplitEvent.

Element options

Passed via struct Membrane.File.Sink.Multi.t/0

  • location

    Path.t()

    Required
    Base path to the file, will be passed to the naming function

  • extension

    String.t()

    Default value: ""
    Extension of the file, should be preceeded with dot (.). It is passed to the naming function.

  • naming_fun

    (Path.t(), non_neg_integer, String.t() -> Path.t())

    Default value: &Membrane.File.Sink.Multi.default_naming_fun/3
    Function accepting base path, sequential number and file extension, and returning file path as a string. Default one generates path/to/file0.ext, path/to/file1.ext, ...

  • split_event

    Membrane.Event.t()

    Default value: Membrane.File.SplitEvent
    Event causing switching to a new file

Pads

:input

Accepted formats:

_any
Direction::input
Availability::always
Flow control::manual
Demand unit::buffers

Summary

Types

t()

Struct containing options for Membrane.File.Sink.Multi

Functions

Returns description of options available for this module

Types

@type t() :: %Membrane.File.Sink.Multi{
  extension: String.t(),
  location: Path.t(),
  naming_fun: (Path.t(), non_neg_integer(), String.t() -> Path.t()),
  split_event: Membrane.Event.t()
}

Struct containing options for Membrane.File.Sink.Multi

Functions

Link to this function

default_naming_fun(path, i, ext)

View Source
@spec default_naming_fun(Path.t(), non_neg_integer(), String.t()) :: Path.t()
@spec options() :: keyword()

Returns description of options available for this module