TB2026-YDS Firmware
Loading...
Searching...
No Matches
track_meta.h File Reference

Read a track's tags and format without playing it. More...

#include "esp_err.h"
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  track_meta_t
 A track's tags and audio format, filled by track_meta_read(). More...

Macros

#define TRACK_META_STR_MAX   64
 Longest tag string kept, including the terminating NUL (longer tags are truncated).

Functions

esp_err_t track_meta_read (const char *path, track_meta_t *out)
 Read the tags and format of path.

Detailed Description

Read a track's tags and format without playing it.

A standalone reader in the Services layer: it opens a file, parses the tags (ID3v2 with an ID3v1 fallback for MP3), the duration and the audio format, then closes — no decoder, no sink, no playback. This is what the Now Playing screen calls for the current track and what a track browser can call per file (lazily, on demand) to show or sort by artist and album. Reading one track at a time keeps SD and RAM cost flat; a library-wide pre-scan, if a browser ever needs to sort the whole list, is just this call in a loop with the result cached.

The duration field matches the playing decoder exactly (same Xing/Info/VBRI logic): 0 means unknown (e.g. a headerless VBR MP3), never a guess.

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.