Login
1 branch 0 tags
Ben (Desktop/Arch) More reliable metadata 91cec1c 1 month ago 26 Commits
moon / firmware / src / audio_metadata.h
#pragma once
#include <stdbool.h>
#include <stdint.h>

typedef struct {
    uint32_t duration_ms;    // Total duration in milliseconds
    uint32_t bitrate;        // Average bitrate in bps
    uint32_t sample_rate;    // Sample rate in Hz
    uint8_t channels;        // Number of channels
    char title[64];          // ID3 title or filename fallback
    char artist[64];         // Artist name
    char album[64];          // Album name
    bool valid;              // Whether parsing succeeded
} audio_metadata_t;

// Get metadata for an audio file
// Dispatches to format-specific parser based on file extension
// Returns true on success, false on failure
// On failure, metadata->valid will be false but title may contain filename
bool audio_metadata_get(const char *path, audio_metadata_t *metadata);