refactoring

This commit is contained in:
AlexandreRouma
2023-02-07 08:33:47 +01:00
parent 7758c40bd7
commit 3451edb131
5 changed files with 1 additions and 2 deletions

43
core/src/utils/riff.h Normal file
View File

@@ -0,0 +1,43 @@
#pragma once
#include <mutex>
#include <fstream>
#include <string>
#include <stack>
#include <stdint.h>
namespace riff {
#pragma pack(push, 1)
struct ChunkHeader {
char id[4];
uint32_t size;
};
#pragma pack(pop)
struct ChunkDesc {
ChunkHeader hdr;
std::streampos pos;
};
class Writer {
public:
bool open(std::string path, const char form[4]);
bool isOpen();
void close();
void beginList(const char id[4]);
void endList();
void beginChunk(const char id[4]);
void endChunk();
void write(const uint8_t* data, size_t len);
private:
void beginRIFF(const char form[4]);
void endRIFF();
std::recursive_mutex mtx;
std::ofstream file;
std::stack<ChunkDesc> chunks;
};
}