It's not the easiest thing to follow so here is what's going on with
STREAMFILEs:
- external player opens base-streamfile, with a base FILE
- meta scd parses stuff, then per DSP channel/layer:
- open temp-streamfile, which does custom IO with base-streamfile
(doesn't open any FILE)
- pass temp-streamfile to init_vgmstream_ngc_dsp_std
- init parses ok, and re-opens temp-streamfile (with custom IO) as its
own dsp-vgmstream-streamfile; internally it does fopen/fdopen the
original FILE from base-streamfile
- scd_int_layout stores the newly created VGMSTREAM (internally has
the dsp-vgmstream-streamfile too)
- close temp-streamfile, that doesn't close base-streamfile as it's
wrapped to avoid doing so, nor affects dsp-vgmstream-streamfile in any
way.
- meta parsing is done, so external player closes base-streamfile (but
the re-fopen'ed dsp-vgmstream-streamfile FILE remains)
- vgmstream renders pcm buffers, etc
- finally player calls close_vgmstream
- scd_int_layout calls close_vgmstream for each stored VGMSTREAM
- the VGMSTREAM internally closes the dsp-vgmstream-streamfile, which
in turn closes its own FILE
So ultimately all FILEs, STREAMFILEs and their clones should be properly
handled and closed.
Remove layout_interleave_shortblock for clarity as the value is enough
to signal its use. Also fix .snd last block calculation, and clean some
metas since I was testing changes anyway.
Layout was not actually needed, remove to simplify. Rename
vgm_vorbis_info_t to ogg_vorbis_meta_info_t to clarify it's only for
meta, also don't pass filename to init ogg (not useful even as an
optimization since getting the name is a minuscule part in parsing a
meta)
Now writes header sample and skips last nibble, as seen in MS's XDK
code, and simplifies multichannel layouts and fixes some theoretical
configurations
Currently same as ms_ima_bytes_to_samples, but this will change; renamed
for consistency with all other IMA variations. Also clean a bit some
metas since I was testing anyway.
This is needed for blocked layout, as it can't do normal interleave.
Probably could be fixed in the future to remove several superfluous
_int/block decoders
Previously, the streams' offsets needed to be pre-adjusted with the
interleave; now assumes all streams start in the same offset (first
stream).
This simplifies short last interleaves (SCD/P3D) and makes
layout_mpeg_custom unnecessary (also allows theoretical variable-sized
interleaves).
The layout was designed to do subframe deinterleave (when
less-than-a-frame bytes of each channel are interleaved) in an array and
pass it to "mem" decoders.
In practice this only happens in a handful of formats, was only used
with DSP, and since making "mem" decoders is required it's simpler to
make normal decoders handling the byte layout directly.
In an effort to simplify vgmstream's layouts, code, and other esoteric
features I changed the old decode_ngc_dsp_mem for decode_ngc_dsp_subint;
results are byte-exact.
To test dual stereo it was trying all metas, but only the meta that
opened the first file can be accepted (as validated), so pass its
function pointer and try only that instead.
EACS was just DVI (high nibble first) with stereo and mono modes, while
old DVI was mono only.
This unifies both decoders, so DVI_IMA (not interleaved) works with mono
and stereo while DVI_IMA_int (interleaved) forces mono.
Some metas needed to explicitly set DVI_IMA_int but others work with no
change.