10 #ifndef LIBOPENMPT_STREAM_CALLBACKS_BUFFER_H
11 #define LIBOPENMPT_STREAM_CALLBACKS_BUFFER_H
51 size_t valid_bytes = 0;
59 endpos = (uint64_t)endpos + (uint64_t)offset;
60 if ( ( offset > 0 ) && !( (uint64_t)endpos > (uint64_t)begpos ) ) {
72 bytes = bytes - (size_t)( endpos - s->
file_size );
73 endpos = endpos - ( endpos - s->
file_size );
75 memset( dst, 0, bytes );
81 valid_bytes = bytes - (size_t)( endpos - s->
prefix_size );
111 pos = (uint64_t)pos + (uint64_t)offset;
112 if ( ( offset > 0 ) && !( (uint64_t)pos > (uint64_t)oldpos ) ) {
116 if ( ( offset < 0 ) && !( (uint64_t)pos < (uint64_t)oldpos ) ) {
132 pos = (uint64_t)pos + (uint64_t)offset;
133 if ( ( offset < 0 ) && !( (uint64_t)pos < (uint64_t)oldpos ) ) {
162 #define openmpt_stream_buffer_init_prefix_only( buffer_, prefix_data_, prefix_size_, file_size_ ) do { \
163 openmpt_stream_buffer_init( (buffer_), (prefix_data_), (file_size_) ); \
164 (buffer_)->prefix_size = (prefix_size_); \
167 #define openmpt_stream_buffer_overflowed( buffer_ ) ( (buffer_)->overflow )
#define OPENMPT_STREAM_SEEK_SET
Definition: libopenmpt.h:253
#define OPENMPT_STREAM_SEEK_CUR
Definition: libopenmpt.h:255
static void openmpt_stream_buffer_init(openmpt_stream_buffer *buffer, const void *file_data, int64_t file_size)
Definition: libopenmpt_stream_callbacks_buffer.h:153
struct openmpt_stream_buffer openmpt_stream_buffer
static int64_t openmpt_stream_buffer_tell_func(void *stream)
Definition: libopenmpt_stream_callbacks_buffer.h:145
static openmpt_stream_callbacks openmpt_stream_get_buffer_callbacks(void)
Provide openmpt_stream_callbacks for in-memoy buffers.
Definition: libopenmpt_stream_callbacks_buffer.h:180
#define OPENMPT_STREAM_SEEK_END
Definition: libopenmpt.h:257
static int openmpt_stream_buffer_seek_func(void *stream, int64_t offset, int whence)
Definition: libopenmpt_stream_callbacks_buffer.h:90
static size_t openmpt_stream_buffer_read_func(void *stream, void *dst, size_t bytes)
Definition: libopenmpt_stream_callbacks_buffer.h:46
Definition: libopenmpt_stream_callbacks_buffer.h:38
int64_t prefix_size
Definition: libopenmpt_stream_callbacks_buffer.h:42
int64_t file_size
Definition: libopenmpt_stream_callbacks_buffer.h:40
int overflow
Definition: libopenmpt_stream_callbacks_buffer.h:43
int64_t file_pos
Definition: libopenmpt_stream_callbacks_buffer.h:41
const void * file_data
Definition: libopenmpt_stream_callbacks_buffer.h:39
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