TB2026-YDS Firmware
Loading...
Searching...
No Matches
Track metadata

Read tags + format from a file without playing it (for now_playing and the browser). More...

Collaboration diagram for Track metadata:

Files

file  components/services/audio/track_meta.c
 Tags + format reader (see track_meta.h): MP3 ID3v2/ID3v1, WAV header, no playback.

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 tags + format from a file without playing it (for now_playing and the browser).

Macro Definition Documentation

◆ TRACK_META_STR_MAX

#define TRACK_META_STR_MAX   64

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

Function Documentation

◆ track_meta_read()

esp_err_t track_meta_read ( const char * path,
track_meta_t * out )

Read the tags and format of path.

Title always falls back to the file name (without extension) when no tag is present; artist and album are left empty when absent. A malformed or truncated tag is bounds-checked and degraded to the file-name fallback (logged), never trusted as garbage and never a crash.

Parameters
pathPOSIX path under the SD mount, e.g. "/sdcard/track.mp3".
[out]outFilled on success (zeroed first). Must not be NULL.
Returns
ESP_OK; ESP_ERR_INVALID_ARG if an argument is NULL; ESP_ERR_NOT_FOUND if the file cannot be opened; ESP_ERR_NOT_SUPPORTED if the format is unrecognised; ESP_FAIL if the header/first frame cannot be parsed.