10 #ifndef LIBOPENMPT_STREAM_CALLBACKS_BUFFER_H 11 #define LIBOPENMPT_STREAM_CALLBACKS_BUFFER_H 47 size_t valid_bytes = 0;
55 endpos = (uint64_t)endpos + (uint64_t)offset;
56 if ( ( offset > 0 ) && !( (uint64_t)endpos > (uint64_t)begpos ) ) {
68 bytes = bytes - (size_t)( endpos - s->
file_size );
69 endpos = endpos - ( endpos - s->
file_size );
71 memset( dst, 0, bytes );
77 valid_bytes = bytes - (size_t)( endpos - s->
prefix_size );
107 pos = (uint64_t)pos + (uint64_t)offset;
108 if ( ( offset > 0 ) && !( (uint64_t)pos > (uint64_t)oldpos ) ) {
112 if ( ( offset < 0 ) && !( (uint64_t)pos < (uint64_t)oldpos ) ) {
128 pos = (uint64_t)pos + (uint64_t)offset;
129 if ( ( offset < 0 ) && !( (uint64_t)pos < (uint64_t)oldpos ) ) {
158 #define openmpt_stream_buffer_init_prefix_only( buffer_, prefix_data_, prefix_size_, file_size_ ) do { \ 159 openmpt_stream_buffer_init( (buffer_), (prefix_data_), (file_size_) ); \ 160 (buffer_)->prefix_size = (prefix_size_); \ 163 #define openmpt_stream_buffer_overflowed( buffer_ ) ( (buffer_)->overflow ) int64_t prefix_size
Definition: libopenmpt_stream_callbacks_buffer.h:38
int64_t file_pos
Definition: libopenmpt_stream_callbacks_buffer.h:37
#define OPENMPT_STREAM_SEEK_CUR
Definition: libopenmpt.h:254
#define OPENMPT_STREAM_SEEK_SET
Definition: libopenmpt.h:252
static void openmpt_stream_buffer_init(openmpt_stream_buffer *buffer, const void *file_data, int64_t file_size)
Definition: libopenmpt_stream_callbacks_buffer.h:149
openmpt_stream_tell_func tell
Tell callback.
Definition: libopenmpt.h:316
#define OPENMPT_STREAM_SEEK_END
Definition: libopenmpt.h:256
int64_t file_size
Definition: libopenmpt_stream_callbacks_buffer.h:36
Stream callbacks.
Definition: libopenmpt.h:296
int overflow
Definition: libopenmpt_stream_callbacks_buffer.h:39
static size_t openmpt_stream_buffer_read_func(void *stream, void *dst, size_t bytes)
Definition: libopenmpt_stream_callbacks_buffer.h:42
static openmpt_stream_callbacks openmpt_stream_get_buffer_callbacks(void)
Definition: libopenmpt_stream_callbacks_buffer.h:165
static int openmpt_stream_buffer_seek_func(void *stream, int64_t offset, int whence)
Definition: libopenmpt_stream_callbacks_buffer.h:86
openmpt_stream_read_func read
Read callback.
Definition: libopenmpt.h:302
struct openmpt_stream_buffer openmpt_stream_buffer
static int64_t openmpt_stream_buffer_tell_func(void *stream)
Definition: libopenmpt_stream_callbacks_buffer.h:141
const void * file_data
Definition: libopenmpt_stream_callbacks_buffer.h:35
openmpt_stream_seek_func seek
Seek callback.
Definition: libopenmpt.h:309
Definition: libopenmpt_stream_callbacks_buffer.h:34