View Source ExMP4.Write behaviour (MP4 Reader and Writer v0.1.0)

A behaviour defining how to write data to a destination

Summary

Callbacks

Close the input stream.

Open the provided input in write mode

Seek and write from the input stream.

Seek to the provided position in the stream

Write the data

Types

@type location() :: {:cur, offset :: integer()} | integer()
@type reason() :: any()
@type state() :: any()

Callbacks

@callback close(state()) :: :ok

Close the input stream.

@callback open(input :: any()) :: {:ok, state()} | {:error, reason()}

Open the provided input in write mode

The returned state will be the first argument on the other callbacks

Link to this callback

pwrite(state, location, data, insert?)

View Source (optional)
@callback pwrite(state(), location(), data :: iodata(), insert? :: boolean()) :: :ok

Seek and write from the input stream.

Some stream may have optimised way of seeking and reading at the same time as the case for :file

Link to this callback

seek(state, location, insert?)

View Source
@callback seek(state(), location(), insert? :: boolean()) :: :ok

Seek to the provided position in the stream

@callback write(state(), data :: iodata()) :: :ok

Write the data