TB2026-YDS Firmware
Loading...
Searching...
No Matches
decoder.h
Go to the documentation of this file.
1
21#pragma once
22
23#include "esp_err.h"
24#include <stdint.h>
25#include <stddef.h>
26
33
41#define DECODER_READ_BUF_BYTES (2304 * 4)
42
44typedef struct {
45 uint32_t rate_hz;
46 uint8_t channels;
47 uint8_t bits;
49 uint32_t duration_ms;
51
63esp_err_t decoder_open(const char *path);
64
71esp_err_t decoder_format(decoder_format_t *fmt);
72
83esp_err_t decoder_read(void *pcm, size_t cap_bytes, size_t *got_bytes);
84
90esp_err_t decoder_close(void);
91
esp_err_t decoder_format(decoder_format_t *fmt)
Get the PCM format of the open stream.
Definition decoder.c:80
esp_err_t decoder_read(void *pcm, size_t cap_bytes, size_t *got_bytes)
Decode the next chunk of audio into pcm.
Definition decoder.c:87
esp_err_t decoder_open(const char *path)
Open an audio file, pick the backend, and read its format.
Definition decoder.c:53
esp_err_t decoder_close(void)
Close the stream and free the decoder. Safe to call when nothing is open.
Definition decoder.c:93
PCM format of the open stream, read once after decoder_open().
Definition decoder.h:44
uint8_t channels
Definition decoder.h:46
uint32_t duration_ms
Definition decoder.h:49
uint32_t rate_hz
Definition decoder.h:45
uint8_t bits
Definition decoder.h:47