// Copyright 2014-2025 Jesper Larsson
//
// This file is part of Klipspringer, <https://klipspringer.avadeaux.net/>
//
// Klipspringer is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// Klipspringer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
// even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with Klipspringer. If
// not, see <https://www.gnu.org/licenses/>.

#ifndef OPUS_ERR_H
#define OPUS_ERR_H

#include "opusfile.h"

const char *opusfile_strerror(int err) {
    switch (err) {
    case OP_HOLE: return "missing page sequence number in Opus data";
    case OP_EREAD: return "error reading opus input";
    case OP_EFAULT: return "Opus memory allocation failed or internal library error";
    case OP_EIMPL: return "Opus feature not implemented";
    case OP_EINVAL: return "invalid Opus parameter";
    case OP_ENOTFORMAT: return "input not valid Opus data";
    case OP_EBADHEADER: return "invalid header in Opus data";
    case OP_EVERSION: return "unrecognized version in Opus header";
    case OP_ENOTAUDIO: return "failed to decode Opus sudio packet";
    case OP_EBADLINK: return "inconsistent or malformed Opus data";
    case OP_ENOSEEK: return "seek attempt in unseekable Opus input";
    case OP_EBADTIMESTAMP: return "Opus granule position failed validity check";
    default: return "Opus error";
    }
}

#endif
