esp32-audio-player 0.1.0
Audio player engine for ESP32
Loading...
Searching...
No Matches
stream.h File Reference

Byte streams used by decoders and tag parsers. More...

Include dependency graph for stream.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  core_stream_ops_t
 

Typedefs

typedef struct core_stream core_stream_t
 

Functions

core_stream_t * core_stream_create (const core_stream_ops_t *ops, void *ctx)
 Wrap custom ops. The stream owns ctx and calls ops->close on core_stream_close.
 
core_stream_t * core_stream_open_file (const char *path, size_t buf_size)
 Open a file with an internal read buffer of buf_size bytes (0 = default 16 KiB).
 
core_stream_t * core_stream_open_memory (const void *data, size_t len, bool take_ownership)
 Read-only view of memory. If take_ownership, core_free(data) on close.
 
int32_t core_stream_read (core_stream_t *s, void *buf, size_t len)
 
int core_stream_read_exact (core_stream_t *s, void *buf, size_t len)
 Reads exactly len bytes or fails with CORE_EOF / CORE_EIO.
 
int core_stream_seek (core_stream_t *s, int64_t offset, int whence)
 
int core_stream_skip (core_stream_t *s, int64_t bytes)
 
int64_t core_stream_tell (core_stream_t *s)
 
int64_t core_stream_size (core_stream_t *s)
 
void core_stream_close (core_stream_t *s)
 
int core_stream_read_u8 (core_stream_t *s, uint8_t *out)
 Little/big-endian readers. Return CORE_OK or error; value written to *out.
 
int core_stream_read_le16 (core_stream_t *s, uint16_t *out)
 
int core_stream_read_le32 (core_stream_t *s, uint32_t *out)
 
int core_stream_read_le64 (core_stream_t *s, uint64_t *out)
 
int core_stream_read_be16 (core_stream_t *s, uint16_t *out)
 
int core_stream_read_be24 (core_stream_t *s, uint32_t *out)
 
int core_stream_read_be32 (core_stream_t *s, uint32_t *out)
 
int core_stream_read_be64 (core_stream_t *s, uint64_t *out)
 

Detailed Description

Byte streams used by decoders and tag parsers.

A stream is either a plain file (stdio FILE*, works on ESP-IDF VFS and on the host), a memory block, or a platform-provided implementation (for example the readahead buffer in PSRAM).

Typedef Documentation

◆ core_stream_t

typedef struct core_stream core_stream_t

Function Documentation

◆ core_stream_close()

void core_stream_close ( core_stream_t *  s)

◆ core_stream_create()

core_stream_t * core_stream_create ( const core_stream_ops_t *  ops,
void *  ctx 
)

Wrap custom ops. The stream owns ctx and calls ops->close on core_stream_close.

◆ core_stream_open_file()

core_stream_t * core_stream_open_file ( const char *  path,
size_t  buf_size 
)

Open a file with an internal read buffer of buf_size bytes (0 = default 16 KiB).

◆ core_stream_open_memory()

core_stream_t * core_stream_open_memory ( const void *  data,
size_t  len,
bool  take_ownership 
)

Read-only view of memory. If take_ownership, core_free(data) on close.

◆ core_stream_read()

int32_t core_stream_read ( core_stream_t *  s,
void *  buf,
size_t  len 
)

◆ core_stream_read_be16()

int core_stream_read_be16 ( core_stream_t *  s,
uint16_t *  out 
)

◆ core_stream_read_be24()

int core_stream_read_be24 ( core_stream_t *  s,
uint32_t *  out 
)

◆ core_stream_read_be32()

int core_stream_read_be32 ( core_stream_t *  s,
uint32_t *  out 
)

◆ core_stream_read_be64()

int core_stream_read_be64 ( core_stream_t *  s,
uint64_t *  out 
)

◆ core_stream_read_exact()

int core_stream_read_exact ( core_stream_t *  s,
void *  buf,
size_t  len 
)

Reads exactly len bytes or fails with CORE_EOF / CORE_EIO.

◆ core_stream_read_le16()

int core_stream_read_le16 ( core_stream_t *  s,
uint16_t *  out 
)

◆ core_stream_read_le32()

int core_stream_read_le32 ( core_stream_t *  s,
uint32_t *  out 
)

◆ core_stream_read_le64()

int core_stream_read_le64 ( core_stream_t *  s,
uint64_t *  out 
)

◆ core_stream_read_u8()

int core_stream_read_u8 ( core_stream_t *  s,
uint8_t *  out 
)

Little/big-endian readers. Return CORE_OK or error; value written to *out.

◆ core_stream_seek()

int core_stream_seek ( core_stream_t *  s,
int64_t  offset,
int  whence 
)

◆ core_stream_size()

int64_t core_stream_size ( core_stream_t *  s)

◆ core_stream_skip()

int core_stream_skip ( core_stream_t *  s,
int64_t  bytes 
)

◆ core_stream_tell()

int64_t core_stream_tell ( core_stream_t *  s)