- merge with original master from jorgen

- minimize RAM usage of all components
- use both IRAM and DRAM in player component so we can buffer up to 1s on modules without SPI RAM
- support fragemented pcm chunks so we can use all available RAM if there isn't a big enough block available but still enough HEAP
- reinclude all components from jorgen's master branch
- add custom i2s driver to get a precise timing of initial sync
- change wrong usage of esp_timer for latency measurement of snapcast protocol
- add player component
This commit is contained in:
Carlos
2021-08-19 21:57:16 +02:00
Unverified
parent 2bd066ca09
commit 15b4baba28
340 changed files with 35616 additions and 3624 deletions

View File

@@ -1,17 +1,17 @@
#ifndef __BUFFER_H__
#define __BUFFER_H__
#include <stdint.h>
#include <stddef.h>
#include <stdint.h>
typedef struct read_buffer_t {
const char *buffer;
size_t size, index;
const char *buffer;
size_t size, index;
} read_buffer_t;
typedef struct write_buffer_t {
char *buffer;
size_t size, index;
char *buffer;
size_t size, index;
} write_buffer_t;
/**
@@ -43,7 +43,7 @@ void buffer_write_init(write_buffer_t *buffer, char *data, size_t size);
* @param[out] data The read data.
* @param[in] size The size of the array of bytes.
* @return 1 if there are not enough bytes to read from the buffer, 0 otherwise.
*/
*/
int buffer_read_buffer(read_buffer_t *buffer, char *data, size_t size);
/**
@@ -52,8 +52,9 @@ int buffer_read_buffer(read_buffer_t *buffer, char *data, size_t size);
* @param[in] buffer The buffer to write to.
* @param[in] data The data to write.
* @param[in] size The size of the array of bytes.
* @return 1 if there is not enough room in the buffer to write the data, 0 otherwise.
*/
* @return 1 if there is not enough room in the buffer to write the data, 0
* otherwise.
*/
int buffer_write_buffer(write_buffer_t *buffer, const char *data, size_t size);
/**
@@ -62,7 +63,7 @@ int buffer_write_buffer(write_buffer_t *buffer, const char *data, size_t size);
* @param[in] buffer The buffer to read from.
* @param[out] data The read data.
* @return 1 if there are not enough bytes to read from the buffer, 0 otherwise.
*/
*/
int buffer_read_uint32(read_buffer_t *buffer, uint32_t *data);
/**
@@ -70,8 +71,9 @@ int buffer_read_uint32(read_buffer_t *buffer, uint32_t *data);
*
* @param[in] buffer The buffer to write to.
* @param[in] data The data to write.
* @return 1 if there is not enough room in the buffer to write the data, 0 otherwise.
*/
* @return 1 if there is not enough room in the buffer to write the data, 0
* otherwise.
*/
int buffer_write_uint32(write_buffer_t *buffer, uint32_t data);
/**
@@ -80,7 +82,7 @@ int buffer_write_uint32(write_buffer_t *buffer, uint32_t data);
* @param[in] buffer The buffer to read from.
* @param[out] data The read data.
* @return 1 if there are not enough bytes to read from the buffer, 0 otherwise.
*/
*/
int buffer_read_uint16(read_buffer_t *buffer, uint16_t *data);
/**
@@ -88,8 +90,9 @@ int buffer_read_uint16(read_buffer_t *buffer, uint16_t *data);
*
* @param[in] buffer The buffer to write to.
* @param[in] data The data to write.
* @return 1 if there is not enough room in the buffer to write the data, 0 otherwise.
*/
* @return 1 if there is not enough room in the buffer to write the data, 0
* otherwise.
*/
int buffer_write_uint16(write_buffer_t *buffer, uint16_t data);
/**
@@ -98,7 +101,7 @@ int buffer_write_uint16(write_buffer_t *buffer, uint16_t data);
* @param[in] buffer The buffer to read from.
* @param[out] data The read data.
* @return 1 if there are not enough bytes to read from the buffer, 0 otherwise.
*/
*/
int buffer_read_uint8(read_buffer_t *buffer, uint8_t *data);
/**
@@ -106,8 +109,9 @@ int buffer_read_uint8(read_buffer_t *buffer, uint8_t *data);
*
* @param[in] buffer The buffer to write to.
* @param[in] data The data to write.
* @return 1 if there is not enough room in the buffer to write the data, 0 otherwise.
*/
* @return 1 if there is not enough room in the buffer to write the data, 0
* otherwise.
*/
int buffer_write_uint8(write_buffer_t *buffer, uint8_t data);
/**
@@ -116,7 +120,7 @@ int buffer_write_uint8(write_buffer_t *buffer, uint8_t data);
* @param[in] buffer The buffer to read from.
* @param[out] data The read data.
* @return 1 if there are not enough bytes to read from the buffer, 0 otherwise.
*/
*/
int buffer_read_int32(read_buffer_t *buffer, int32_t *data);
/**
@@ -124,8 +128,9 @@ int buffer_read_int32(read_buffer_t *buffer, int32_t *data);
*
* @param[in] buffer The buffer to write to.
* @param[in] data The data to write.
* @return 1 if there is not enough room in the buffer to write the data, 0 otherwise.
*/
* @return 1 if there is not enough room in the buffer to write the data, 0
* otherwise.
*/
int buffer_write_int32(write_buffer_t *buffer, int32_t data);
/**
@@ -134,7 +139,7 @@ int buffer_write_int32(write_buffer_t *buffer, int32_t data);
* @param[in] buffer The buffer to read from.
* @param[out] data The read data.
* @return 1 if there are not enough bytes to read from the buffer, 0 otherwise.
*/
*/
int buffer_read_int16(read_buffer_t *buffer, int16_t *data);
/**
@@ -142,8 +147,9 @@ int buffer_read_int16(read_buffer_t *buffer, int16_t *data);
*
* @param[in] buffer The buffer to write to.
* @param[in] data The data to write.
* @return 1 if there is not enough room in the buffer to write the data, 0 otherwise.
*/
* @return 1 if there is not enough room in the buffer to write the data, 0
* otherwise.
*/
int buffer_write_int16(write_buffer_t *buffer, int16_t data);
/**
@@ -152,7 +158,7 @@ int buffer_write_int16(write_buffer_t *buffer, int16_t data);
* @param[in] buffer The buffer to read from.
* @param[out] data The read data.
* @return 1 if there are not enough bytes to read from the buffer, 0 otherwise.
*/
*/
int buffer_read_int8(read_buffer_t *buffer, int8_t *data);
/**
@@ -160,9 +166,9 @@ int buffer_read_int8(read_buffer_t *buffer, int8_t *data);
*
* @param[in] buffer The buffer to write to.
* @param[in] data The data to write.
* @return 1 if there is not enough room in the buffer to write the data, 0 otherwise.
*/
* @return 1 if there is not enough room in the buffer to write the data, 0
* otherwise.
*/
int buffer_write_int8(write_buffer_t *buffer, int8_t data);
#endif // __BUFFER_H__
#endif // __BUFFER_H__