added code for mp3 and jpeg parsing

added interface for data sources
This commit is contained in:
2021-02-28 20:46:38 +01:00
parent 422610c21c
commit 331f9f3e6c
11 changed files with 5912 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
#pragma once
#include "../../ext/sd/File.h"
/** data source using our filesystem */
class DataSourceFile {
File* f;
public:
/** empty ctor */
DataSourceFile() : f(nullptr) {
}
/** ctor with the filesystem file to wrap */
DataSourceFile(File& f) : f(&f) {
}
/** get the current position */
uint32_t curPos() const {
return f->curPos();
}
/** seek to the given position */
void seekTo(uint32_t newPos) {
f->seekTo(newPos);
}
/** read x bytes from the input into dst */
uint32_t read(uint32_t size, uint8_t* dst) {
return f->read(size, dst);
}
/** read an entity */
template <typename T> void readType(T& dst) {
read(sizeof(T), (uint8_t*)&dst);
}
};