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>
template<typename T>
class audio_tools::SpoolFileSampleTableStore< T >
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.
◆ SpoolFileSampleTableStore()
'spool' must be open for reading, writing and seeking, and empty/truncated at construction time.
◆ append()
◆ clear()
◆ get()
◆ setNextEntryOffset()
template<typename T >
| virtual void setNextEntryOffset |
( |
uint64_t |
fileOffset | ) |
|
|
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 >.
◆ setOnDiskEntrySize()
template<typename T >
| virtual void setOnDiskEntrySize |
( |
size_t |
bytes | ) |
|
|
inlinevirtualinherited |
◆ size()
◆ entry_count
◆ p_spool
The documentation for this class was generated from the following file: