ExMP4.FragDataWriter behaviour (MP4 Reader and Writer v0.11.0)
View SourceA 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 media header initialization.
Invoked to handle writing the whole segment.
Types
@type location() :: :file.location() | nil
@type state() :: any()
Callbacks
@callback close(state()) :: :ok
Close the output.
Initialize the output.
The returned state
will be the first argument on the other callbacks.
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.
@callback write_init_header(state(), header :: [ExMP4.Box.t()]) :: state()
Invoked to handle writing media header initialization.
The header is two element list with the first element being ftyp
box and
the second the moov
box.
@callback write_segment(state(), segment :: [ExMP4.Box.t()]) :: state()
Invoked to handle writing the whole segment.
The segment is a list of boxes that are part of the segment. The first boxes are sidx
if present,
then a moof
box, followed by the mdat
box containing the media data.