mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-15 02:57:38 +01:00
Add buffer comments
This commit is contained in:
parent
e06e2f2bb2
commit
b2e3058072
@ -45,8 +45,6 @@
|
||||
#define fseeko fseek
|
||||
#endif
|
||||
|
||||
#define STREAMFILE_DEFAULT_BUFFER_SIZE 0x8000
|
||||
|
||||
#ifndef DIR_SEPARATOR
|
||||
#if defined (_WIN32) || defined (WIN32)
|
||||
#define DIR_SEPARATOR '\\'
|
||||
@ -55,6 +53,14 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Streamfiles normally use an internal buffer to increase performance, configurable
|
||||
* but usually of this size. Lower increases the number of freads/system calls (slower).
|
||||
* However some formats need to jump around causing more buffer trashing than usual,
|
||||
* higher may needlessly read data that may be going to be trashed.
|
||||
*
|
||||
* Value can be adjusted freely but 8k is a good enough compromise. */
|
||||
#define STREAMFILE_DEFAULT_BUFFER_SIZE 0x8000
|
||||
|
||||
/* struct representing a file with callbacks. Code should use STREAMFILEs and not std C functions
|
||||
* to do file operations, as plugins may need to provide their own callbacks.
|
||||
* Reads from arbitrary offsets, meaning internally may need fseek equivalents during reads. */
|
||||
|
@ -2819,7 +2819,8 @@ int vgmstream_open_stream(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t s
|
||||
}
|
||||
|
||||
/* if blocked layout (implicit) use multiple streamfiles; using only one leads to
|
||||
* lots of buffer-trashing, with all the jumping around in the block layout */
|
||||
* lots of buffer-trashing, with all the jumping around in the block layout
|
||||
* (this increases total of data read but still seems faster) */
|
||||
if (vgmstream->layout_type != layout_none && vgmstream->layout_type != layout_interleave) {
|
||||
use_streamfile_per_channel = 1;
|
||||
}
|
||||
@ -2860,7 +2861,8 @@ int vgmstream_open_stream(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t s
|
||||
offset = start_offset + vgmstream->interleave_block_size*ch;
|
||||
}
|
||||
|
||||
/* open new one if needed */
|
||||
/* open new one if needed, useful to avoid jumping around when each channel data is too apart
|
||||
* (don't use when data is close as it'd make buffers read the full file multiple times) */
|
||||
if (use_streamfile_per_channel) {
|
||||
file = open_streamfile(streamFile,filename);
|
||||
if (!file) goto fail;
|
||||
|
Loading…
Reference in New Issue
Block a user