View Source Membrane.File.SeekSinkEvent (Membrane File plugin v0.17.0)

Event that triggers seeking or insertion to a file in Membrane.File.Sink.

inspect(__MODULE__) allows to control behaviour of Membrane.File.Sink when writing to a file by seeking to given position (relative to beginning of file, current position or end of file). All buffers that arrive after that event are being written starting from the position.

If overwriting isn't the desired behaviour, one can set insert? flag to true. This will trigger splitting the file into two parts containing bytes before and after position. All buffers following such an event will be appended to the first part. Inserting has considerable performance impact, especially if done repeatedly, so it should be used only as a fallback for variable-length data. For all other cases, one can fill unknown bytes with eg. 0s and simply overwrite them later.

Summary

Types

Specifies the position to which the seek is performed.

t()

Types

@type offset_t() :: integer()
@type position_t() ::
  offset_t() | {:bof | :cur | :eof, offset_t()} | :bof | :cur | :eof

Specifies the position to which the seek is performed.

The meaning is the same as for the Location argument in https://www.erlang.org/doc/man/file.html#position-2.

@type t() :: %Membrane.File.SeekSinkEvent{insert?: boolean(), position: position_t()}