View Source ExMP4.DataReader behaviour (MP4 Reader and Writer v0.6.0)

A behaviour module for implementing mp4 data reader.

Summary

Callbacks

Close the input stream.

Open the provided input in read mode

Read the specified amount of bytes from the input.

Seek to the provided location in the input stream

Types

@type location() :: :file.location() | nil
@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 read mode

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

Link to this callback

read(state, chars, location)

View Source
@callback read(state(), chars :: non_neg_integer(), location()) :: iodata() | :eof

Read the specified amount of bytes from the input.

An optional location may be provided to seek into the input.

@callback seek(state(), location()) :: :ok

Seek to the provided location in the input stream