ExMP4.DataReader behaviour (MP4 Reader and Writer v0.10.0)

View Source

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

location()

@type location() :: :file.location() | nil

reason()

@type reason() :: any()

state()

@type state() :: any()

Callbacks

close(state)

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

Close the input stream.

open(input)

@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

read(state, chars, location)

@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.

seek(state, location)

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

Seek to the provided location in the input stream