TB2026-YDS Firmware
Toggle main menu visibility
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
44
typedef
struct
{
45
uint32_t
rate_hz
;
46
uint8_t
channels
;
47
uint8_t
bits
;
49
uint32_t
duration_ms
;
50
}
decoder_format_t
;
51
63
esp_err_t
decoder_open
(
const
char
*path);
64
71
esp_err_t
decoder_format
(
decoder_format_t
*fmt);
72
83
esp_err_t
decoder_read
(
void
*pcm,
size_t
cap_bytes,
size_t
*got_bytes);
84
90
esp_err_t
decoder_close
(
void
);
91
decoder_format
esp_err_t decoder_format(decoder_format_t *fmt)
Get the PCM format of the open stream.
Definition
decoder.c:80
decoder_read
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
decoder_open
esp_err_t decoder_open(const char *path)
Open an audio file, pick the backend, and read its format.
Definition
decoder.c:53
decoder_close
esp_err_t decoder_close(void)
Close the stream and free the decoder. Safe to call when nothing is open.
Definition
decoder.c:93
decoder_format_t
PCM format of the open stream, read once after decoder_open().
Definition
decoder.h:44
decoder_format_t::channels
uint8_t channels
Definition
decoder.h:46
decoder_format_t::duration_ms
uint32_t duration_ms
Definition
decoder.h:49
decoder_format_t::rate_hz
uint32_t rate_hz
Definition
decoder.h:45
decoder_format_t::bits
uint8_t bits
Definition
decoder.h:47
components
services
audio
decoder.h
Generated by
1.17.0