|
arduino-audio-tools
|
Writes every entry to a caller-provided scratch file as it's appended, instead of keeping it in RAM - get() seeks that file and reads the entry back. Unlike SourceSeekSampleTableStore this needs no knowledge of (or seekability in) the original MP4 source - it works even when that source is a live, non-seekable stream, since it's writing its own local, sequential copy as data streams past. The tradeoff is disk I/O (both a write during parsing and a seek+read during playback) instead of a pure RAM cost. More...
#include <SampleTableStore.h>


Public Member Functions | |
| SpoolFileSampleTableStore (SpoolStorage &spool) | |
| void | append (T value) override |
| Appends one entry - call in file order, once per table entry. | |
| void | clear () override |
| Resets to empty - call once per begin()/track. | |
| T | get (size_t index) override |
| Reads back entry 'index' - index must be < size(). | |
| virtual void | setNextEntryOffset (uint64_t fileOffset) |
| virtual void | setOnDiskEntrySize (size_t bytes) |
| size_t | size () override |
| Number of entries appended so far. | |
Protected Attributes | |
| size_t | entry_count = 0 |
| SpoolStorage * | p_spool |
Writes every entry to a caller-provided scratch file as it's appended, instead of keeping it in RAM - get() seeks that file and reads the entry back. Unlike SourceSeekSampleTableStore this needs no knowledge of (or seekability in) the original MP4 source - it works even when that source is a live, non-seekable stream, since it's writing its own local, sequential copy as data streams past. The tradeoff is disk I/O (both a write during parsing and a seek+read during playback) instead of a pure RAM cost.
Unlike SourceSeekSampleTableStore there's no endianness/on-disk-width concern here - this store's on-disk layout is its own private format (whatever bytes T's native in-memory representation happens to be), not MP4's, so a plain byte-for-byte round-trip is correct as long as the same host reads back what it wrote (true here - never persisted across runs).
Each instance needs its own dedicated SpoolStorage - see DemuxerMP4::setSpoolStorageFactory() for how one gets created per table per track.
|
inline |
'spool' must be open for reading, writing and seeking, and empty/truncated at construction time.
|
inlineoverridevirtual |
Appends one entry - call in file order, once per table entry.
Implements SampleTableStore< T >.
|
inlineoverridevirtual |
Resets to empty - call once per begin()/track.
Implements SampleTableStore< T >.
|
inlineoverridevirtual |
Reads back entry 'index' - index must be < size().
Implements SampleTableStore< T >.
|
inlinevirtualinherited |
Only meaningful for SourceSeekSampleTableStore: the absolute byte offset (from the start of the original MP4 file) of the entry about to be appended next. Default no-op - other implementations ignore it, so callers can always call this unconditionally before append() without needing to know which implementation is active.
Reimplemented in SourceSeekSampleTableStore< T >.
|
inlinevirtualinherited |
Only meaningful for SourceSeekSampleTableStore, and only for tables whose on-disk width isn't a fixed sizeof(T) - see its comment. Default no-op.
Reimplemented in SourceSeekSampleTableStore< T >.
|
inlineoverridevirtual |
Number of entries appended so far.
Implements SampleTableStore< T >.
|
protected |
|
protected |