The hdlr box says what kind of media a track carries - video, audio, or something else - and carries a human-readable name for it. Today you read both, which lets you tell a video track from an audio track and closes out the movie-structure chapter.
Parse an hdlr box to its handler-type fourcc and its trailing name string.
hdlr, the handler-reference box, declares the kind of a track with a fourcc:
vide for video, soun for audio, subt or text for subtitles, and a few
others. It lives inside mdia alongside mdhd. Being a FullBox, its handler_type
sits at payload offset 8, after the 4-byte prefix and a 4-byte pre_defined field
that is always zero. After the type come 12 reserved bytes, then a human-readable
name (like VideoHandler) that runs to the end of the box.
That name is a null-terminated string, so you read from offset 24 to the payload
end and drop a trailing 0x00 if it is there. The handler_type is what makes a
track summary meaningful: knowing a track is vide tells you to expect a width and
height, while soun tells you to expect a sample rate. With mvhd, tkhd,
mdhd, and now hdlr parsed, you have the movie’s whole skeleton, and the next
chapter opens up the sample tables that describe the actual media samples.
// FullBox prefix(4) + pre_defined(4) + handler_type(4) + reserved(12) + namefunc parseHdlr(payload []byte) (handlerType, name string) {handlerType = readType(payload[8:12]) // handler_type fourcc// name runs from offset 24 to the end of the payload;// drop a trailing NUL if present}