TB2026-YDS Firmware
Loading...
Searching...
No Matches
mp3_frame.c File Reference

MPEG Layer III header + Xing/Info/VBRI parsing (see mp3_frame.h). More...

#include "mp3_frame.h"
#include <string.h>

Functions

bool mp3_frame_parse (const uint8_t *p, size_t len, mp3_frame_hdr_t *out)
 Parse a 4-byte MPEG Layer III frame header at p.
uint32_t mp3_xing_duration_ms (const uint8_t *frame, size_t len, const mp3_frame_hdr_t *hdr)
 Track duration from a Xing/Info/VBRI tag in the first frame, if present.

Detailed Description

MPEG Layer III header + Xing/Info/VBRI parsing (see mp3_frame.h).

Note
Développé avec l'assistance de Claude Opus 4.8 (Anthropic), sous la direction de Y. Dos Santos : spécification, revue et validation sur cible par l'auteur.

Function Documentation

◆ mp3_frame_parse()

bool mp3_frame_parse ( const uint8_t * p,
size_t len,
mp3_frame_hdr_t * out )

Parse a 4-byte MPEG Layer III frame header at p.

Parameters
pCandidate frame start (the 0xFF sync byte).
lenBytes readable from p (must be >= 4).
outFilled on success.
Returns
true if p holds a valid Layer III header; false otherwise.

◆ mp3_xing_duration_ms()

uint32_t mp3_xing_duration_ms ( const uint8_t * frame,
size_t len,
const mp3_frame_hdr_t * hdr )

Track duration from a Xing/Info/VBRI tag in the first frame, if present.

Parameters
frameFirst frame start (its 0xFF sync byte).
lenBytes readable from frame.
hdrHeader already parsed by mp3_frame_parse() for frame.
Returns
Duration in ms, or 0 when no usable VBR tag is present (duration unknown).