From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winedmo/main.c | 2 ++ dlls/winedmo/unixlib.c | 8 ++++++++ dlls/winedmo/unixlib.h | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/dlls/winedmo/main.c b/dlls/winedmo/main.c index 0c3187697bb..5bd66733d86 100644 --- a/dlls/winedmo/main.c +++ b/dlls/winedmo/main.c @@ -28,6 +28,8 @@ static struct stream_context *stream_context_create(void) struct stream_context *context;
if (!(context = malloc( sizeof(*context) ))) return NULL; + context->length = 0; + context->position = 0;
return context; } diff --git a/dlls/winedmo/unixlib.c b/dlls/winedmo/unixlib.c index d79b6e45591..33c8bea54aa 100644 --- a/dlls/winedmo/unixlib.c +++ b/dlls/winedmo/unixlib.c @@ -35,23 +35,30 @@ static UINT64 read_callback; int64_t unix_seek_callback( void *opaque, int64_t offset, int whence ) { struct seek_callback_params params = {.dispatch = {.callback = seek_callback}, .context = (UINT_PTR)opaque}; + struct stream_context *context = opaque; void *ret_ptr; ULONG ret_len; int status;
TRACE( "opaque %p, offset %#jx, whence %#x\n", opaque, offset, whence );
+ if (whence == AVSEEK_SIZE) return context->length; + if (whence == SEEK_END) offset += context->length; + if (whence == SEEK_CUR) offset += context->position; + params.offset = offset; status = KeUserDispatchCallback( ¶ms.dispatch, sizeof(params), &ret_ptr, &ret_len ); if (status || ret_len != sizeof(UINT64)) return AVERROR( EINVAL ); offset = *(UINT64 *)ret_ptr;
+ context->position = offset; return offset; }
int unix_read_callback( void *opaque, uint8_t *buffer, int size ) { struct read_callback_params params = {.dispatch = {.callback = read_callback}, .context = (UINT_PTR)opaque}; + struct stream_context *context = opaque; int status, total; void *ret_ptr; ULONG ret_len; @@ -64,6 +71,7 @@ int unix_read_callback( void *opaque, uint8_t *buffer, int size ) total = *(ULONG *)ret_ptr;
if (!total) return AVERROR_EOF; + context->position += total; return total; }
diff --git a/dlls/winedmo/unixlib.h b/dlls/winedmo/unixlib.h index 891d401aeb5..e97e47ea259 100644 --- a/dlls/winedmo/unixlib.h +++ b/dlls/winedmo/unixlib.h @@ -39,7 +39,8 @@ struct process_attach_params
struct stream_context { - UINT64 placeholder; + UINT64 length; + UINT64 position; };
struct seek_callback_params