Commit 9808fd97 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winegstreamer: Wrap async reader op new_context in a union.

parent 453b0a92
...@@ -22,6 +22,14 @@ ...@@ -22,6 +22,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(wmvcore); WINE_DEFAULT_DEBUG_CHANNEL(wmvcore);
union async_op_data
{
struct
{
void *context;
} start;
};
struct async_op struct async_op
{ {
enum async_op_type enum async_op_type
...@@ -30,7 +38,7 @@ struct async_op ...@@ -30,7 +38,7 @@ struct async_op
ASYNC_OP_STOP, ASYNC_OP_STOP,
ASYNC_OP_CLOSE, ASYNC_OP_CLOSE,
} type; } type;
void *new_context; union async_op_data u;
struct list entry; struct list entry;
}; };
...@@ -191,8 +199,8 @@ static DWORD WINAPI async_reader_callback_thread(void *arg) ...@@ -191,8 +199,8 @@ static DWORD WINAPI async_reader_callback_thread(void *arg)
struct async_op *op = LIST_ENTRY(entry, struct async_op, entry); struct async_op *op = LIST_ENTRY(entry, struct async_op, entry);
list_remove(&op->entry); list_remove(&op->entry);
if (op->new_context) if (op->u.start.context)
reader->context = op->new_context; reader->context = op->u.start.context;
hr = list_empty(&reader->async_ops) ? S_OK : E_ABORT; hr = list_empty(&reader->async_ops) ? S_OK : E_ABORT;
switch (op->type) switch (op->type)
{ {
...@@ -291,14 +299,15 @@ error: ...@@ -291,14 +299,15 @@ error:
return hr; return hr;
} }
static HRESULT async_reader_queue_op(struct async_reader *reader, enum async_op_type type, void *context) static HRESULT async_reader_queue_op(struct async_reader *reader, enum async_op_type type, union async_op_data *data)
{ {
struct async_op *op; struct async_op *op;
if (!(op = calloc(1, sizeof(*op)))) if (!(op = calloc(1, sizeof(*op))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
op->type = type; op->type = type;
op->new_context = context; if (data)
op->u = *data;
EnterCriticalSection(&reader->callback_cs); EnterCriticalSection(&reader->callback_cs);
list_add_tail(&reader->async_ops, &op->entry); list_add_tail(&reader->async_ops, &op->entry);
...@@ -432,6 +441,7 @@ static HRESULT WINAPI WMReader_GetOutputFormat(IWMReader *iface, DWORD output, ...@@ -432,6 +441,7 @@ static HRESULT WINAPI WMReader_GetOutputFormat(IWMReader *iface, DWORD output,
static HRESULT WINAPI WMReader_Start(IWMReader *iface, static HRESULT WINAPI WMReader_Start(IWMReader *iface,
QWORD start, QWORD duration, float rate, void *context) QWORD start, QWORD duration, float rate, void *context)
{ {
union async_op_data data = {.start = {.context = context}};
struct async_reader *reader = impl_from_IWMReader(iface); struct async_reader *reader = impl_from_IWMReader(iface);
HRESULT hr; HRESULT hr;
...@@ -448,7 +458,7 @@ static HRESULT WINAPI WMReader_Start(IWMReader *iface, ...@@ -448,7 +458,7 @@ static HRESULT WINAPI WMReader_Start(IWMReader *iface,
else else
{ {
wm_reader_seek(&reader->reader, start, duration); wm_reader_seek(&reader->reader, start, duration);
hr = async_reader_queue_op(reader, ASYNC_OP_START, context); hr = async_reader_queue_op(reader, ASYNC_OP_START, &data);
} }
LeaveCriticalSection(&reader->reader.cs); LeaveCriticalSection(&reader->reader.cs);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment