Bell catchup

This commit is contained in:
philippe44
2023-07-26 13:19:20 -07:00
parent 859efdb954
commit 232afb948b
467 changed files with 77538 additions and 37137 deletions

View File

@@ -51,7 +51,7 @@ class reader {
reader(std::istream& inp)
: _inp(inp), _cached_header_data_valid(false), _number_of_files(-1) {}
// Returns true iff another file can be read from |inp|.
// Returns true if another file can be read from |inp|.
bool contains_another_file();
// Returns file name of next file in |inp|.
@@ -72,4 +72,4 @@ class reader {
// Returns number of files in tar at |inp|.
int number_of_files();
};
} // namespace bell::BellTar
} // namespace bell::BellTar

View File

@@ -1,8 +1,9 @@
#pragma once
#ifndef ESP_PLATFORM
#if __has_include(<bit>)
#include <bit> // for endian
#endif
#include <stdint.h> // for int16_t, int32_t, int64_t, uint16_t, uint32_t
#include <cstddef> // for byte
#include <iostream> // for istream, ostream

View File

@@ -6,7 +6,6 @@
#include <string> // for basic_string, string
#include <vector> // for vector
#include "aacdec.h" // for AACFrameInfo
#include "mp3dec.h" // for MP3FrameInfo
namespace bell {
@@ -48,7 +47,7 @@ class EncodedAudioStream {
std::vector<uint8_t> mp3MagicBytesUntagged = {0xFF, 0xFB};
std::vector<uint8_t> mp3MagicBytesIdc = {0x49, 0x44, 0x33};
AACFrameInfo aacFrameInfo;
// AACFrameInfo aacFrameInfo;
MP3FrameInfo mp3FrameInfo;
size_t decodeFrameMp3(uint8_t* dst);

View File

@@ -0,0 +1,60 @@
#pragma once
#include <iostream>
#include <ostream>
#include <cstring>
#include "civetweb.h"
const size_t BUF_SIZE = 1024;
// Custom streambuf
class mg_buf : public std::streambuf {
private:
struct mg_connection* conn;
char buffer[BUF_SIZE];
public:
mg_buf(struct mg_connection* _conn);
protected:
virtual int_type overflow(int_type c);
int flush_buffer();
virtual int sync();
};
/**
* @brief Adapts ostream to mg_write
*
*/
class MGStreamAdapter : public std::ostream {
private:
mg_buf buf;
public:
MGStreamAdapter(struct mg_connection* _conn);
};
// Custom streambuf
class mg_read_buf : public std::streambuf {
private:
struct mg_connection* conn;
char buffer[BUF_SIZE];
public:
mg_read_buf(struct mg_connection* _conn);
protected:
virtual int_type underflow();
};
/**
* @brief Adapts istream to mg_read
*/
class MGInputStreamAdapter : public std::istream {
private:
mg_read_buf buf;
public:
MGInputStreamAdapter(struct mg_connection* _conn);
};