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

A behaviour module for implementing fragmented mp4 data writer.

Summary

Callbacks

Close the output.

Initialize the output.

Invoked to handle writing while seeking into the file.

Invoked to handle writing the whole fragment (sidx [optional] + moof + mdat).

Invoked to handle writing media header initialization.

Types

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

Callbacks

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

Close the output.

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

Initialize the output.

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

Link to this callback

write(state, data, location)

View Source (optional)
@callback write(state(), data :: iodata(), location()) :: :ok

Invoked to handle writing while seeking into the file.

This is an optional callback, only called by the ExMP4.FWriter to update the fragments duration in case mehd is present.

Link to this callback

write_fragment(state, fragment)

View Source
@callback write_fragment(state(), fragment :: iodata()) :: :ok

Invoked to handle writing the whole fragment (sidx [optional] + moof + mdat).

Link to this callback

write_init_header(state, header)

View Source
@callback write_init_header(state(), header :: iodata()) :: :ok

Invoked to handle writing media header initialization.