text/plain
•
770 B
•
20 lines
#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);