/* RAU-26, MIT, Copyright (c) 2026 Joerg Burbach. */
#ifndef RAU_H
#define RAU_H
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
    int16_t *pcm; /* interleaved, samples is per channel */
    uint32_t sample_rate, samples;
    unsigned channels, bits;
} rau_audio;
typedef struct {
    uint32_t sample_rate, samples;
    unsigned channels, bits, fuzzy_index;
} rau_info;
typedef enum { RAU_LOSSLESS, RAU_LOW, RAU_MID, RAU_HIGH, RAU_CRAPPY } rau_profile;
enum { RAU_OK = 0, RAU_INVALID = 1, RAU_TRUNCATED = 2, RAU_NOMEM = 3 };
/* Memory-only. Output is zeroed on failure. Caller frees successful outputs
 * with free(). Decoder accepts RA26 and RC26; encoder produces RC26.
 * Input PCM is signed 16-bit even when audio.bits is 8 (values scaled by 256).
 */
int rau_inspect(const uint8_t *data, size_t size, rau_info *info);
int rau_decode(const uint8_t *data, size_t size, rau_audio *audio);
int rau_encode(const rau_audio *audio, rau_profile profile, uint8_t **data, size_t *size);
#ifdef __cplusplus
}
#endif
#endif
