10#ifndef LIBOPENMPT_STREAM_CALLBACKS_BUFFER_H
11#define LIBOPENMPT_STREAM_CALLBACKS_BUFFER_H
40 size_t valid_bytes = 0;
48 endpos = (uint64_t)endpos + (uint64_t)offset;
49 if ( ( offset > 0 ) && !( (uint64_t)endpos > (uint64_t)begpos ) ) {
61 bytes = bytes - (size_t)( endpos - s->
file_size );
62 endpos = endpos - ( endpos - s->
file_size );
64 memset( dst, 0, bytes );
70 valid_bytes = bytes - (size_t)( endpos - s->
prefix_size );
100 pos = (uint64_t)pos + (uint64_t)offset;
101 if ( ( offset > 0 ) && !( (uint64_t)pos > (uint64_t)oldpos ) ) {
105 if ( ( offset < 0 ) && !( (uint64_t)pos < (uint64_t)oldpos ) ) {
121 pos = (uint64_t)pos + (uint64_t)offset;
122 if ( ( offset < 0 ) && !( (uint64_t)pos < (uint64_t)oldpos ) ) {
151#define openmpt_stream_buffer_init_prefix_only( buffer_, prefix_data_, prefix_size_, file_size_ ) do { \
152 openmpt_stream_buffer_init( (buffer_), (prefix_data_), (file_size_) ); \
153 (buffer_)->prefix_size = (prefix_size_); \
156#define openmpt_stream_buffer_overflowed( buffer_ ) ( (buffer_)->overflow )
198 endpos = (uint64_t)endpos + (uint64_t)offset;
199 if ( ( offset > 0 ) && !( (uint64_t)endpos > (uint64_t)begpos ) ) {
211 bytes = bytes - (size_t)( endpos - s->
file_size );
212 endpos = endpos - ( endpos - s->
file_size );
240 pos = (uint64_t)pos + (uint64_t)offset;
241 if ( ( offset > 0 ) && !( (uint64_t)pos > (uint64_t)oldpos ) ) {
245 if ( ( offset < 0 ) && !( (uint64_t)pos < (uint64_t)oldpos ) ) {
261 pos = (uint64_t)pos + (uint64_t)offset;
262 if ( ( offset < 0 ) && !( (uint64_t)pos < (uint64_t)oldpos ) ) {
static openmpt_stream_callbacks openmpt_stream_get_buffer_callbacks2(void)
Provide openmpt_stream_callbacks for in-memoy buffers.
Definition: libopenmpt_stream_callbacks_buffer.h:303
#define OPENMPT_STREAM_SEEK_SET
Definition: libopenmpt.h:253
#define OPENMPT_STREAM_SEEK_CUR
Definition: libopenmpt.h:255
static int openmpt_stream_buffer_seek_func2(void *stream, int64_t offset, int whence)
Definition: libopenmpt_stream_callbacks_buffer.h:219
static void openmpt_stream_buffer_init(openmpt_stream_buffer *buffer, const void *file_data, int64_t file_size)
Definition: libopenmpt_stream_callbacks_buffer.h:142
struct openmpt_stream_buffer openmpt_stream_buffer
struct openmpt_stream_buffer2 openmpt_stream_buffer2
static int64_t openmpt_stream_buffer_tell_func(void *stream)
Definition: libopenmpt_stream_callbacks_buffer.h:134
static openmpt_stream_callbacks openmpt_stream_get_buffer_callbacks(void)
Provide openmpt_stream_callbacks for in-memoy buffers.
Definition: libopenmpt_stream_callbacks_buffer.h:172
#define OPENMPT_STREAM_SEEK_END
Definition: libopenmpt.h:257
static void openmpt_stream_buffer_init2(openmpt_stream_buffer2 *buffer, const void *file_data, int64_t file_size)
Definition: libopenmpt_stream_callbacks_buffer.h:282
static int openmpt_stream_buffer_seek_func(void *stream, int64_t offset, int whence)
Definition: libopenmpt_stream_callbacks_buffer.h:79
static size_t openmpt_stream_buffer_read_func2(void *stream, void *dst, size_t bytes)
Definition: libopenmpt_stream_callbacks_buffer.h:187
static size_t openmpt_stream_buffer_read_func(void *stream, void *dst, size_t bytes)
Definition: libopenmpt_stream_callbacks_buffer.h:35
static int64_t openmpt_stream_buffer_tell_func2(void *stream)
Definition: libopenmpt_stream_callbacks_buffer.h:274
#define LIBOPENMPT_DEPRECATED
Definition: libopenmpt_config.h:315
#define LIBOPENMPT_C_INLINE
Definition: libopenmpt_config.h:339
Definition: libopenmpt_stream_callbacks_buffer.h:181
int64_t file_size
Definition: libopenmpt_stream_callbacks_buffer.h:183
const void * file_data
Definition: libopenmpt_stream_callbacks_buffer.h:182
int64_t file_pos
Definition: libopenmpt_stream_callbacks_buffer.h:184
Definition: libopenmpt_stream_callbacks_buffer.h:27
int64_t prefix_size
Definition: libopenmpt_stream_callbacks_buffer.h:31
int64_t file_size
Definition: libopenmpt_stream_callbacks_buffer.h:29
int overflow
Definition: libopenmpt_stream_callbacks_buffer.h:32
int64_t file_pos
Definition: libopenmpt_stream_callbacks_buffer.h:30
const void * file_data
Definition: libopenmpt_stream_callbacks_buffer.h:28
Stream callbacks.
Definition: libopenmpt.h:300
openmpt_stream_read_func read
Read callback.
Definition: libopenmpt.h:306
openmpt_stream_seek_func seek
Seek callback.
Definition: libopenmpt.h:313
openmpt_stream_tell_func tell
Tell callback.
Definition: libopenmpt.h:320