wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
mp4frag.h File Reference

Fragmented-MP4 top-level layout (ISO/IEC 14496-12 box structure): the init segment (ftyp through moov) and each moof+mdat media fragment as views into the caller's file bytes. More...

Go to the source code of this file.

Data Structures

struct  mp4frag_layout
 Result of mp4frag_scan: init is ftyp up to and including moov; frags[i] spans the i-th moof and the mdat that immediately follows it. More...

Macros

#define MP4FRAG_MAX_FRAGS   64
 Fixed capacity: media fragments one file may hold.

Functions

int mp4frag_scan (wired_span file, mp4frag_layout *out)
 Scan file's top-level boxes into *out.

Detailed Description

Fragmented-MP4 top-level layout (ISO/IEC 14496-12 box structure): the init segment (ftyp through moov) and each moof+mdat media fragment as views into the caller's file bytes.

No sample-table parsing – a publisher only needs the fragment boundaries.

Macro Definition Documentation

◆ MP4FRAG_MAX_FRAGS

#define MP4FRAG_MAX_FRAGS   64

Fixed capacity: media fragments one file may hold.

64 covers a 2-minute loop at the sample's 2-second fragments (16 today).

Function Documentation

◆ mp4frag_scan()

int mp4frag_scan ( wired_span file,
mp4frag_layout * out )

Scan file's top-level boxes into *out.

Parameters
filethe whole fMP4
outreceives the layout (valid only when 1 is returned)
Returns
1 on success; 0 when a box header is truncated, a box size is below 8, 1 (64-bit largesize) or 0 (to end of file), a size runs past the file, a moof is not immediately followed by mdat, no moov precedes the first fragment, no fragment exists, or more than MP4FRAG_MAX_FRAGS fragments exist