Login
1 branch 0 tags
Ben (Desktop/Arch) Switched to RGB565_SWAPPED for more efficient rendering bc79297 1 month ago 73 Commits
moon / 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
	uint32_t
	    audio_data_offset;  // Byte offset where audio frames begin (after tags)
	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);