winegstreamer: Replace pointers with handles in PE->Unix transition.

Converts struct pointers in syscalls to 64bit opaque handles. This makes future wow64 thunking
simpler and should avoid dereferencing Unix pointers in the PE code.
This commit is contained in:
Kurt Kartaltepe 2023-07-07 20:32:21 -07:00 committed by Alexandre Julliard
parent abdde73a1c
commit 18e79f813b
18 changed files with 236 additions and 217 deletions

View file

@ -55,7 +55,7 @@ struct aac_decoder
IMFMediaType *input_type;
IMFMediaType *output_type;
struct wg_transform *wg_transform;
wg_transform_t wg_transform;
struct wg_sample_queue *wg_sample_queue;
};
@ -71,7 +71,7 @@ static HRESULT try_create_wg_transform(struct aac_decoder *decoder)
if (decoder->wg_transform)
wg_transform_destroy(decoder->wg_transform);
decoder->wg_transform = NULL;
decoder->wg_transform = 0;
mf_media_type_to_wg_format(decoder->input_type, &input_format);
if (input_format.major_type == WG_MAJOR_TYPE_UNKNOWN)
@ -627,7 +627,7 @@ HRESULT aac_decoder_create(REFIID riid, void **ret)
};
static const struct wg_format input_format = {.major_type = WG_MAJOR_TYPE_AUDIO_MPEG4};
struct wg_transform_attrs attrs = {0};
struct wg_transform *transform;
wg_transform_t transform;
struct aac_decoder *decoder;
HRESULT hr;

View file

@ -86,7 +86,7 @@ struct color_convert
IMFMediaType *output_type;
MFT_OUTPUT_STREAM_INFO output_info;
struct wg_transform *wg_transform;
wg_transform_t wg_transform;
struct wg_sample_queue *wg_sample_queue;
};
@ -102,7 +102,7 @@ static HRESULT try_create_wg_transform(struct color_convert *impl)
if (impl->wg_transform)
wg_transform_destroy(impl->wg_transform);
impl->wg_transform = NULL;
impl->wg_transform = 0;
mf_media_type_to_wg_format(impl->input_type, &input_format);
if (input_format.major_type == WG_MAJOR_TYPE_UNKNOWN)
@ -938,7 +938,7 @@ HRESULT color_convert_create(IUnknown *outer, IUnknown **out)
},
};
struct wg_transform_attrs attrs = {0};
struct wg_transform *transform;
wg_transform_t transform;
struct color_convert *impl;
HRESULT hr;

View file

@ -69,45 +69,45 @@ HRESULT wg_sample_queue_create(struct wg_sample_queue **out);
void wg_sample_queue_destroy(struct wg_sample_queue *queue);
void wg_sample_queue_flush(struct wg_sample_queue *queue, bool all);
struct wg_parser *wg_parser_create(enum wg_parser_type type, bool unlimited_buffering);
void wg_parser_destroy(struct wg_parser *parser);
wg_parser_t wg_parser_create(enum wg_parser_type type, bool unlimited_buffering);
void wg_parser_destroy(wg_parser_t parser);
HRESULT wg_parser_connect(struct wg_parser *parser, uint64_t file_size);
void wg_parser_disconnect(struct wg_parser *parser);
HRESULT wg_parser_connect(wg_parser_t parser, uint64_t file_size);
void wg_parser_disconnect(wg_parser_t parser);
bool wg_parser_get_next_read_offset(struct wg_parser *parser, uint64_t *offset, uint32_t *size);
void wg_parser_push_data(struct wg_parser *parser, const void *data, uint32_t size);
bool wg_parser_get_next_read_offset(wg_parser_t parser, uint64_t *offset, uint32_t *size);
void wg_parser_push_data(wg_parser_t parser, const void *data, uint32_t size);
uint32_t wg_parser_get_stream_count(struct wg_parser *parser);
struct wg_parser_stream *wg_parser_get_stream(struct wg_parser *parser, uint32_t index);
uint32_t wg_parser_get_stream_count(wg_parser_t parser);
wg_parser_stream_t wg_parser_get_stream(wg_parser_t parser, uint32_t index);
void wg_parser_stream_get_preferred_format(struct wg_parser_stream *stream, struct wg_format *format);
void wg_parser_stream_get_codec_format(struct wg_parser_stream *stream, struct wg_format *format);
void wg_parser_stream_enable(struct wg_parser_stream *stream, const struct wg_format *format);
void wg_parser_stream_disable(struct wg_parser_stream *stream);
void wg_parser_stream_get_preferred_format(wg_parser_stream_t stream, struct wg_format *format);
void wg_parser_stream_get_codec_format(wg_parser_stream_t stream, struct wg_format *format);
void wg_parser_stream_enable(wg_parser_stream_t stream, const struct wg_format *format);
void wg_parser_stream_disable(wg_parser_stream_t stream);
bool wg_parser_stream_get_buffer(struct wg_parser *parser, struct wg_parser_stream *stream,
bool wg_parser_stream_get_buffer(wg_parser_t parser, wg_parser_stream_t stream,
struct wg_parser_buffer *buffer);
bool wg_parser_stream_copy_buffer(struct wg_parser_stream *stream,
bool wg_parser_stream_copy_buffer(wg_parser_stream_t stream,
void *data, uint32_t offset, uint32_t size);
void wg_parser_stream_release_buffer(struct wg_parser_stream *stream);
void wg_parser_stream_notify_qos(struct wg_parser_stream *stream,
void wg_parser_stream_release_buffer(wg_parser_stream_t stream);
void wg_parser_stream_notify_qos(wg_parser_stream_t stream,
bool underflow, double proportion, int64_t diff, uint64_t timestamp);
/* Returns the duration in 100-nanosecond units. */
uint64_t wg_parser_stream_get_duration(struct wg_parser_stream *stream);
char *wg_parser_stream_get_tag(struct wg_parser_stream *stream, enum wg_parser_tag tag);
uint64_t wg_parser_stream_get_duration(wg_parser_stream_t stream);
char *wg_parser_stream_get_tag(wg_parser_stream_t stream, enum wg_parser_tag tag);
/* start_pos and stop_pos are in 100-nanosecond units. */
void wg_parser_stream_seek(struct wg_parser_stream *stream, double rate,
void wg_parser_stream_seek(wg_parser_stream_t stream, double rate,
uint64_t start_pos, uint64_t stop_pos, DWORD start_flags, DWORD stop_flags);
struct wg_transform *wg_transform_create(const struct wg_format *input_format,
wg_transform_t wg_transform_create(const struct wg_format *input_format,
const struct wg_format *output_format, const struct wg_transform_attrs *attrs);
void wg_transform_destroy(struct wg_transform *transform);
bool wg_transform_set_output_format(struct wg_transform *transform, struct wg_format *format);
bool wg_transform_get_status(struct wg_transform *transform, bool *accepts_input);
HRESULT wg_transform_drain(struct wg_transform *transform);
HRESULT wg_transform_flush(struct wg_transform *transform);
void wg_transform_destroy(wg_transform_t transform);
bool wg_transform_set_output_format(wg_transform_t transform, struct wg_format *format);
bool wg_transform_get_status(wg_transform_t transform, bool *accepts_input);
HRESULT wg_transform_drain(wg_transform_t transform);
HRESULT wg_transform_flush(wg_transform_t transform);
unsigned int wg_format_get_max_size(const struct wg_format *format);
@ -138,16 +138,16 @@ HRESULT wg_sample_create_quartz(IMediaSample *sample, struct wg_sample **out);
HRESULT wg_sample_create_dmo(IMediaBuffer *media_buffer, struct wg_sample **out);
void wg_sample_release(struct wg_sample *wg_sample);
HRESULT wg_transform_push_mf(struct wg_transform *transform, IMFSample *sample,
HRESULT wg_transform_push_mf(wg_transform_t transform, IMFSample *sample,
struct wg_sample_queue *queue);
HRESULT wg_transform_push_quartz(struct wg_transform *transform, struct wg_sample *sample,
HRESULT wg_transform_push_quartz(wg_transform_t transform, struct wg_sample *sample,
struct wg_sample_queue *queue);
HRESULT wg_transform_push_dmo(struct wg_transform *transform, IMediaBuffer *media_buffer,
HRESULT wg_transform_push_dmo(wg_transform_t transform, IMediaBuffer *media_buffer,
DWORD flags, REFERENCE_TIME time_stamp, REFERENCE_TIME time_length, struct wg_sample_queue *queue);
HRESULT wg_transform_read_mf(struct wg_transform *transform, IMFSample *sample,
HRESULT wg_transform_read_mf(wg_transform_t transform, IMFSample *sample,
DWORD sample_size, struct wg_format *format, DWORD *flags);
HRESULT wg_transform_read_quartz(struct wg_transform *transform, struct wg_sample *sample);
HRESULT wg_transform_read_dmo(struct wg_transform *transform, DMO_OUTPUT_DATA_BUFFER *buffer);
HRESULT wg_transform_read_quartz(wg_transform_t transform, struct wg_sample *sample);
HRESULT wg_transform_read_dmo(wg_transform_t transform, DMO_OUTPUT_DATA_BUFFER *buffer);
HRESULT gstreamer_byte_stream_handler_create(REFIID riid, void **obj);

View file

@ -60,7 +60,7 @@ struct h264_decoder
MFT_OUTPUT_STREAM_INFO output_info;
IMFMediaType *stream_type;
struct wg_transform *wg_transform;
wg_transform_t wg_transform;
struct wg_sample_queue *wg_sample_queue;
IMFVideoSampleAllocatorEx *allocator;
@ -92,7 +92,7 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder)
if (decoder->wg_transform)
wg_transform_destroy(decoder->wg_transform);
decoder->wg_transform = NULL;
decoder->wg_transform = 0;
mf_media_type_to_wg_format(decoder->input_type, &input_format);
if (input_format.major_type == WG_MAJOR_TYPE_UNKNOWN)
@ -847,7 +847,7 @@ HRESULT h264_decoder_create(REFIID riid, void **ret)
};
static const struct wg_format input_format = {.major_type = WG_MAJOR_TYPE_VIDEO_H264};
struct wg_transform_attrs attrs = {0};
struct wg_transform *transform;
wg_transform_t transform;
struct h264_decoder *decoder;
HRESULT hr;

View file

@ -66,7 +66,7 @@ bool array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
return TRUE;
}
struct wg_parser *wg_parser_create(enum wg_parser_type type, bool unlimited_buffering)
wg_parser_t wg_parser_create(enum wg_parser_type type, bool unlimited_buffering)
{
struct wg_parser_create_params params =
{
@ -79,21 +79,21 @@ struct wg_parser *wg_parser_create(enum wg_parser_type type, bool unlimited_buff
TRACE("type %#x, unlimited_buffering %d.\n", type, unlimited_buffering);
if (WINE_UNIX_CALL(unix_wg_parser_create, &params))
return NULL;
return 0;
TRACE("Returning parser %p.\n", params.parser);
TRACE("Returning parser %#I64x.\n", params.parser);
return params.parser;
}
void wg_parser_destroy(struct wg_parser *parser)
void wg_parser_destroy(wg_parser_t parser)
{
TRACE("parser %p.\n", parser);
TRACE("parser %#I64x.\n", parser);
WINE_UNIX_CALL(unix_wg_parser_destroy, parser);
WINE_UNIX_CALL(unix_wg_parser_destroy, &parser);
}
HRESULT wg_parser_connect(struct wg_parser *parser, uint64_t file_size)
HRESULT wg_parser_connect(wg_parser_t parser, uint64_t file_size)
{
struct wg_parser_connect_params params =
{
@ -101,26 +101,26 @@ HRESULT wg_parser_connect(struct wg_parser *parser, uint64_t file_size)
.file_size = file_size,
};
TRACE("parser %p, file_size %I64u.\n", parser, file_size);
TRACE("parser %#I64x, file_size %I64u.\n", parser, file_size);
return WINE_UNIX_CALL(unix_wg_parser_connect, &params);
}
void wg_parser_disconnect(struct wg_parser *parser)
void wg_parser_disconnect(wg_parser_t parser)
{
TRACE("parser %p.\n", parser);
TRACE("parser %#I64x.\n", parser);
WINE_UNIX_CALL(unix_wg_parser_disconnect, parser);
WINE_UNIX_CALL(unix_wg_parser_disconnect, &parser);
}
bool wg_parser_get_next_read_offset(struct wg_parser *parser, uint64_t *offset, uint32_t *size)
bool wg_parser_get_next_read_offset(wg_parser_t parser, uint64_t *offset, uint32_t *size)
{
struct wg_parser_get_next_read_offset_params params =
{
.parser = parser,
};
TRACE("parser %p, offset %p, size %p.\n", parser, offset, size);
TRACE("parser %#I64x, offset %p, size %p.\n", parser, offset, size);
if (WINE_UNIX_CALL(unix_wg_parser_get_next_read_offset, &params))
return false;
@ -129,7 +129,7 @@ bool wg_parser_get_next_read_offset(struct wg_parser *parser, uint64_t *offset,
return true;
}
void wg_parser_push_data(struct wg_parser *parser, const void *data, uint32_t size)
void wg_parser_push_data(wg_parser_t parser, const void *data, uint32_t size)
{
struct wg_parser_push_data_params params =
{
@ -138,25 +138,25 @@ void wg_parser_push_data(struct wg_parser *parser, const void *data, uint32_t si
.size = size,
};
TRACE("parser %p, data %p, size %u.\n", parser, data, size);
TRACE("parser %#I64x, data %p, size %u.\n", parser, data, size);
WINE_UNIX_CALL(unix_wg_parser_push_data, &params);
}
uint32_t wg_parser_get_stream_count(struct wg_parser *parser)
uint32_t wg_parser_get_stream_count(wg_parser_t parser)
{
struct wg_parser_get_stream_count_params params =
{
.parser = parser,
};
TRACE("parser %p.\n", parser);
TRACE("parser %#I64x.\n", parser);
WINE_UNIX_CALL(unix_wg_parser_get_stream_count, &params);
return params.count;
}
struct wg_parser_stream *wg_parser_get_stream(struct wg_parser *parser, uint32_t index)
wg_parser_stream_t wg_parser_get_stream(wg_parser_t parser, uint32_t index)
{
struct wg_parser_get_stream_params params =
{
@ -164,15 +164,15 @@ struct wg_parser_stream *wg_parser_get_stream(struct wg_parser *parser, uint32_t
.index = index,
};
TRACE("parser %p, index %u.\n", parser, index);
TRACE("parser %#I64x, index %u.\n", parser, index);
WINE_UNIX_CALL(unix_wg_parser_get_stream, &params);
TRACE("Returning stream %p.\n", params.stream);
TRACE("Returning stream %#I64x.\n", params.stream);
return params.stream;
}
void wg_parser_stream_get_preferred_format(struct wg_parser_stream *stream, struct wg_format *format)
void wg_parser_stream_get_preferred_format(wg_parser_stream_t stream, struct wg_format *format)
{
struct wg_parser_stream_get_preferred_format_params params =
{
@ -180,12 +180,12 @@ void wg_parser_stream_get_preferred_format(struct wg_parser_stream *stream, stru
.format = format,
};
TRACE("stream %p, format %p.\n", stream, format);
TRACE("stream %#I64x, format %p.\n", stream, format);
WINE_UNIX_CALL(unix_wg_parser_stream_get_preferred_format, &params);
}
void wg_parser_stream_get_codec_format(struct wg_parser_stream *stream, struct wg_format *format)
void wg_parser_stream_get_codec_format(wg_parser_stream_t stream, struct wg_format *format)
{
struct wg_parser_stream_get_codec_format_params params =
{
@ -193,12 +193,12 @@ void wg_parser_stream_get_codec_format(struct wg_parser_stream *stream, struct w
.format = format,
};
TRACE("stream %p, format %p.\n", stream, format);
TRACE("stream %#I64x, format %p.\n", stream, format);
WINE_UNIX_CALL(unix_wg_parser_stream_get_codec_format, &params);
}
void wg_parser_stream_enable(struct wg_parser_stream *stream, const struct wg_format *format)
void wg_parser_stream_enable(wg_parser_stream_t stream, const struct wg_format *format)
{
struct wg_parser_stream_enable_params params =
{
@ -206,19 +206,19 @@ void wg_parser_stream_enable(struct wg_parser_stream *stream, const struct wg_fo
.format = format,
};
TRACE("stream %p, format %p.\n", stream, format);
TRACE("stream %#I64x, format %p.\n", stream, format);
WINE_UNIX_CALL(unix_wg_parser_stream_enable, &params);
}
void wg_parser_stream_disable(struct wg_parser_stream *stream)
void wg_parser_stream_disable(wg_parser_stream_t stream)
{
TRACE("stream %p.\n", stream);
TRACE("stream %#I64x.\n", stream);
WINE_UNIX_CALL(unix_wg_parser_stream_disable, stream);
WINE_UNIX_CALL(unix_wg_parser_stream_disable, &stream);
}
bool wg_parser_stream_get_buffer(struct wg_parser *parser, struct wg_parser_stream *stream,
bool wg_parser_stream_get_buffer(wg_parser_t parser, wg_parser_stream_t stream,
struct wg_parser_buffer *buffer)
{
struct wg_parser_stream_get_buffer_params params =
@ -228,12 +228,12 @@ bool wg_parser_stream_get_buffer(struct wg_parser *parser, struct wg_parser_stre
.buffer = buffer,
};
TRACE("parser %p, stream %p, buffer %p.\n", parser, stream, buffer);
TRACE("parser %#I64x, stream %#I64x, buffer %p.\n", parser, stream, buffer);
return !WINE_UNIX_CALL(unix_wg_parser_stream_get_buffer, &params);
}
bool wg_parser_stream_copy_buffer(struct wg_parser_stream *stream,
bool wg_parser_stream_copy_buffer(wg_parser_stream_t stream,
void *data, uint32_t offset, uint32_t size)
{
struct wg_parser_stream_copy_buffer_params params =
@ -244,19 +244,19 @@ bool wg_parser_stream_copy_buffer(struct wg_parser_stream *stream,
.size = size,
};
TRACE("stream %p, data %p, offset %u, size %u.\n", stream, data, offset, size);
TRACE("stream %#I64x, data %p, offset %u, size %u.\n", stream, data, offset, size);
return !WINE_UNIX_CALL(unix_wg_parser_stream_copy_buffer, &params);
}
void wg_parser_stream_release_buffer(struct wg_parser_stream *stream)
void wg_parser_stream_release_buffer(wg_parser_stream_t stream)
{
TRACE("stream %p.\n", stream);
TRACE("stream %#I64x.\n", stream);
WINE_UNIX_CALL(unix_wg_parser_stream_release_buffer, stream);
WINE_UNIX_CALL(unix_wg_parser_stream_release_buffer, &stream);
}
void wg_parser_stream_notify_qos(struct wg_parser_stream *stream,
void wg_parser_stream_notify_qos(wg_parser_stream_t stream,
bool underflow, double proportion, int64_t diff, uint64_t timestamp)
{
struct wg_parser_stream_notify_qos_params params =
@ -268,20 +268,20 @@ void wg_parser_stream_notify_qos(struct wg_parser_stream *stream,
.timestamp = timestamp,
};
TRACE("stream %p, underflow %d, proportion %.16e, diff %I64d, timestamp %I64u.\n",
TRACE("stream %#I64x, underflow %d, proportion %.16e, diff %I64d, timestamp %I64u.\n",
stream, underflow, proportion, diff, timestamp);
WINE_UNIX_CALL(unix_wg_parser_stream_notify_qos, &params);
}
uint64_t wg_parser_stream_get_duration(struct wg_parser_stream *stream)
uint64_t wg_parser_stream_get_duration(wg_parser_stream_t stream)
{
struct wg_parser_stream_get_duration_params params =
{
.stream = stream,
};
TRACE("stream %p.\n", stream);
TRACE("stream %#I64x.\n", stream);
WINE_UNIX_CALL(unix_wg_parser_stream_get_duration, &params);
@ -289,7 +289,7 @@ uint64_t wg_parser_stream_get_duration(struct wg_parser_stream *stream)
return params.duration;
}
char *wg_parser_stream_get_tag(struct wg_parser_stream *stream, enum wg_parser_tag tag)
char *wg_parser_stream_get_tag(wg_parser_stream_t stream, enum wg_parser_tag tag)
{
uint32_t size = 0;
struct wg_parser_stream_get_tag_params params =
@ -317,7 +317,7 @@ char *wg_parser_stream_get_tag(struct wg_parser_stream *stream, enum wg_parser_t
return buffer;
}
void wg_parser_stream_seek(struct wg_parser_stream *stream, double rate,
void wg_parser_stream_seek(wg_parser_stream_t stream, double rate,
uint64_t start_pos, uint64_t stop_pos, DWORD start_flags, DWORD stop_flags)
{
struct wg_parser_stream_seek_params params =
@ -330,13 +330,13 @@ void wg_parser_stream_seek(struct wg_parser_stream *stream, double rate,
.stop_flags = stop_flags,
};
TRACE("stream %p, rate %.16e, start_pos %I64u, stop_pos %I64u, start_flags %#lx, stop_flags %#lx.\n",
TRACE("stream %#I64x, rate %.16e, start_pos %I64u, stop_pos %I64u, start_flags %#lx, stop_flags %#lx.\n",
stream, rate, start_pos, stop_pos, start_flags, stop_flags);
WINE_UNIX_CALL(unix_wg_parser_stream_seek, &params);
}
struct wg_transform *wg_transform_create(const struct wg_format *input_format,
wg_transform_t wg_transform_create(const struct wg_format *input_format,
const struct wg_format *output_format, const struct wg_transform_attrs *attrs)
{
struct wg_transform_create_params params =
@ -349,20 +349,20 @@ struct wg_transform *wg_transform_create(const struct wg_format *input_format,
TRACE("input_format %p, output_format %p.\n", input_format, output_format);
if (WINE_UNIX_CALL(unix_wg_transform_create, &params))
return NULL;
return 0;
TRACE("Returning transform %p.\n", params.transform);
TRACE("Returning transform %#I64x.\n", params.transform);
return params.transform;
}
void wg_transform_destroy(struct wg_transform *transform)
void wg_transform_destroy(wg_transform_t transform)
{
TRACE("transform %p.\n", transform);
TRACE("transform %#I64x.\n", transform);
WINE_UNIX_CALL(unix_wg_transform_destroy, transform);
WINE_UNIX_CALL(unix_wg_transform_destroy, &transform);
}
HRESULT wg_transform_push_data(struct wg_transform *transform, struct wg_sample *sample)
HRESULT wg_transform_push_data(wg_transform_t transform, struct wg_sample *sample)
{
struct wg_transform_push_data_params params =
{
@ -371,7 +371,7 @@ HRESULT wg_transform_push_data(struct wg_transform *transform, struct wg_sample
};
NTSTATUS status;
TRACE("transform %p, sample %p.\n", transform, sample);
TRACE("transform %#I64x, sample %p.\n", transform, sample);
if ((status = WINE_UNIX_CALL(unix_wg_transform_push_data, &params)))
return HRESULT_FROM_NT(status);
@ -379,7 +379,7 @@ HRESULT wg_transform_push_data(struct wg_transform *transform, struct wg_sample
return params.result;
}
HRESULT wg_transform_read_data(struct wg_transform *transform, struct wg_sample *sample,
HRESULT wg_transform_read_data(wg_transform_t transform, struct wg_sample *sample,
struct wg_format *format)
{
struct wg_transform_read_data_params params =
@ -390,7 +390,7 @@ HRESULT wg_transform_read_data(struct wg_transform *transform, struct wg_sample
};
NTSTATUS status;
TRACE("transform %p, sample %p, format %p.\n", transform, sample, format);
TRACE("transform %#I64x, sample %p, format %p.\n", transform, sample, format);
if ((status = WINE_UNIX_CALL(unix_wg_transform_read_data, &params)))
return HRESULT_FROM_NT(status);
@ -398,14 +398,14 @@ HRESULT wg_transform_read_data(struct wg_transform *transform, struct wg_sample
return params.result;
}
bool wg_transform_get_status(struct wg_transform *transform, bool *accepts_input)
bool wg_transform_get_status(wg_transform_t transform, bool *accepts_input)
{
struct wg_transform_get_status_params params =
{
.transform = transform,
};
TRACE("transform %p, accepts_input %p.\n", transform, accepts_input);
TRACE("transform %#I64x, accepts_input %p.\n", transform, accepts_input);
if (WINE_UNIX_CALL(unix_wg_transform_get_status, &params))
return false;
@ -414,7 +414,7 @@ bool wg_transform_get_status(struct wg_transform *transform, bool *accepts_input
return true;
}
bool wg_transform_set_output_format(struct wg_transform *transform, struct wg_format *format)
bool wg_transform_set_output_format(wg_transform_t transform, struct wg_format *format)
{
struct wg_transform_set_output_format_params params =
{
@ -422,18 +422,18 @@ bool wg_transform_set_output_format(struct wg_transform *transform, struct wg_fo
.format = format,
};
TRACE("transform %p, format %p.\n", transform, format);
TRACE("transform %#I64x, format %p.\n", transform, format);
return !WINE_UNIX_CALL(unix_wg_transform_set_output_format, &params);
}
HRESULT wg_transform_drain(struct wg_transform *transform)
HRESULT wg_transform_drain(wg_transform_t transform)
{
NTSTATUS status;
TRACE("transform %p.\n", transform);
TRACE("transform %#I64x.\n", transform);
if ((status = WINE_UNIX_CALL(unix_wg_transform_drain, transform)))
if ((status = WINE_UNIX_CALL(unix_wg_transform_drain, &transform)))
{
WARN("wg_transform_drain returned status %#lx\n", status);
return HRESULT_FROM_NT(status);
@ -442,13 +442,13 @@ HRESULT wg_transform_drain(struct wg_transform *transform)
return S_OK;
}
HRESULT wg_transform_flush(struct wg_transform *transform)
HRESULT wg_transform_flush(wg_transform_t transform)
{
NTSTATUS status;
TRACE("transform %p.\n", transform);
TRACE("transform %#I64x.\n", transform);
if ((status = WINE_UNIX_CALL(unix_wg_transform_flush, transform)))
if ((status = WINE_UNIX_CALL(unix_wg_transform_flush, &transform)))
{
WARN("wg_transform_flush returned status %#lx\n", status);
return HRESULT_FROM_NT(status);

View file

@ -128,7 +128,7 @@ struct media_stream
IMFMediaEventQueue *event_queue;
IMFStreamDescriptor *descriptor;
struct wg_parser_stream *wg_stream;
wg_parser_stream_t wg_stream;
IUnknown **token_queue;
LONG token_queue_count;
@ -182,8 +182,8 @@ struct media_source
CRITICAL_SECTION cs;
struct wg_parser *wg_parser;
UINT64 file_size;
wg_parser_t wg_parser;
UINT64 duration;
IMFStreamDescriptor **descriptors;
@ -365,7 +365,7 @@ static HRESULT wg_format_from_stream_descriptor(IMFStreamDescriptor *descriptor,
return hr;
}
static HRESULT stream_descriptor_set_tag(IMFStreamDescriptor *descriptor, struct wg_parser_stream *stream,
static HRESULT stream_descriptor_set_tag(IMFStreamDescriptor *descriptor, wg_parser_stream_t stream,
const GUID *attr, enum wg_parser_tag tag)
{
WCHAR *strW;
@ -1099,12 +1099,12 @@ static const IMFMediaStreamVtbl media_stream_vtbl =
};
static HRESULT media_stream_create(IMFMediaSource *source, IMFStreamDescriptor *descriptor,
struct wg_parser_stream *wg_stream, struct media_stream **out)
wg_parser_stream_t wg_stream, struct media_stream **out)
{
struct media_stream *object;
HRESULT hr;
TRACE("source %p, descriptor %p, wg_stream %p.\n", source, descriptor, wg_stream);
TRACE("source %p, descriptor %p, wg_stream %#I64x.\n", source, descriptor, wg_stream);
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
@ -1617,7 +1617,7 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc
{
unsigned int stream_count = UINT_MAX;
struct media_source *object;
struct wg_parser *parser;
wg_parser_t parser;
unsigned int i;
HRESULT hr;
@ -1674,7 +1674,7 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc
for (i = 0; i < stream_count; ++i)
{
struct wg_parser_stream *wg_stream = wg_parser_get_stream(object->wg_parser, i);
wg_parser_stream_t wg_stream = wg_parser_get_stream(object->wg_parser, i);
IMFStreamDescriptor *descriptor;
struct media_stream *stream;
struct wg_format format;

View file

@ -52,7 +52,7 @@ struct parser
unsigned int source_count;
BOOL enum_sink_first;
struct wg_parser *wg_parser;
wg_parser_t wg_parser;
/* This protects the "streaming" and "flushing" fields, accessed by both
* the application and streaming threads.
@ -83,7 +83,7 @@ struct parser_source
struct strmbase_source pin;
IQualityControl IQualityControl_iface;
struct wg_parser_stream *wg_stream;
wg_parser_stream_t wg_stream;
SourceSeeking seek;
@ -109,7 +109,7 @@ static const IMediaSeekingVtbl GST_Seeking_Vtbl;
static const IQualityControlVtbl GSTOutPin_QualityControl_Vtbl;
static struct parser_source *create_pin(struct parser *filter,
struct wg_parser_stream *stream, const WCHAR *name);
wg_parser_stream_t stream, const WCHAR *name);
static HRESULT GST_RemoveOutputPins(struct parser *This);
static HRESULT WINAPI GST_ChangeCurrent(IMediaSeeking *iface);
static HRESULT WINAPI GST_ChangeStop(IMediaSeeking *iface);
@ -1365,7 +1365,7 @@ static const struct strmbase_sink_ops sink_ops =
static BOOL decodebin_parser_filter_init_gst(struct parser *filter)
{
struct wg_parser *parser = filter->wg_parser;
wg_parser_t parser = filter->wg_parser;
unsigned int i, stream_count;
WCHAR source_name[20];
@ -1876,7 +1876,7 @@ static const struct strmbase_source_ops source_ops =
};
static struct parser_source *create_pin(struct parser *filter,
struct wg_parser_stream *stream, const WCHAR *name)
wg_parser_stream_t stream, const WCHAR *name)
{
struct parser_source *pin, **new_array;
@ -1962,9 +1962,7 @@ static const struct strmbase_sink_ops wave_parser_sink_ops =
static BOOL wave_parser_filter_init_gst(struct parser *filter)
{
struct wg_parser *parser = filter->wg_parser;
if (!create_pin(filter, wg_parser_get_stream(parser, 0), L"output"))
if (!create_pin(filter, wg_parser_get_stream(filter->wg_parser, 0), L"output"))
return FALSE;
return TRUE;
@ -2033,7 +2031,7 @@ static const struct strmbase_sink_ops avi_splitter_sink_ops =
static BOOL avi_splitter_filter_init_gst(struct parser *filter)
{
struct wg_parser *parser = filter->wg_parser;
wg_parser_t parser = filter->wg_parser;
uint32_t i, stream_count;
WCHAR source_name[20];
@ -2116,9 +2114,7 @@ static const struct strmbase_sink_ops mpeg_splitter_sink_ops =
static BOOL mpeg_splitter_filter_init_gst(struct parser *filter)
{
struct wg_parser *parser = filter->wg_parser;
if (!create_pin(filter, wg_parser_get_stream(parser, 0), L"Audio"))
if (!create_pin(filter, wg_parser_get_stream(filter->wg_parser, 0), L"Audio"))
return FALSE;
return TRUE;

View file

@ -40,7 +40,7 @@ struct transform
IQualityControl source_IQualityControl_iface;
IQualityControl *qc_sink;
struct wg_transform *transform;
wg_transform_t transform;
struct wg_sample_queue *sample_queue;
const struct transform_ops *ops;
@ -712,7 +712,7 @@ HRESULT mpeg_audio_codec_create(IUnknown *outer, IUnknown **out)
},
};
struct wg_transform_attrs attrs = {0};
struct wg_transform *transform;
wg_transform_t transform;
struct transform *object;
HRESULT hr;
@ -847,7 +847,7 @@ HRESULT mpeg_layer3_decoder_create(IUnknown *outer, IUnknown **out)
},
};
struct wg_transform_attrs attrs = {0};
struct wg_transform *transform;
wg_transform_t transform;
struct transform *object;
HRESULT hr;

View file

@ -49,7 +49,7 @@ struct resampler
IMFMediaType *output_type;
MFT_OUTPUT_STREAM_INFO output_info;
struct wg_transform *wg_transform;
wg_transform_t wg_transform;
struct wg_sample_queue *wg_sample_queue;
};
@ -60,7 +60,7 @@ static HRESULT try_create_wg_transform(struct resampler *impl)
if (impl->wg_transform)
wg_transform_destroy(impl->wg_transform);
impl->wg_transform = NULL;
impl->wg_transform = 0;
mf_media_type_to_wg_format(impl->input_type, &input_format);
if (input_format.major_type == WG_MAJOR_TYPE_UNKNOWN)
@ -897,7 +897,7 @@ HRESULT resampler_create(IUnknown *outer, IUnknown **out)
},
};
struct wg_transform_attrs attrs = {0};
struct wg_transform *transform;
wg_transform_t transform;
struct resampler *impl;
HRESULT hr;

View file

@ -192,9 +192,13 @@ enum wg_parser_type
WG_PARSER_WAVPARSE,
};
typedef UINT64 wg_parser_t;
typedef UINT64 wg_parser_stream_t;
typedef UINT64 wg_transform_t;
struct wg_parser_create_params
{
struct wg_parser *parser;
wg_parser_t parser;
enum wg_parser_type type;
bool unlimited_buffering;
bool err_on;
@ -203,65 +207,65 @@ struct wg_parser_create_params
struct wg_parser_connect_params
{
struct wg_parser *parser;
wg_parser_t parser;
UINT64 file_size;
};
struct wg_parser_get_next_read_offset_params
{
struct wg_parser *parser;
wg_parser_t parser;
UINT32 size;
UINT64 offset;
};
struct wg_parser_push_data_params
{
struct wg_parser *parser;
wg_parser_t parser;
const void *data;
UINT32 size;
};
struct wg_parser_get_stream_count_params
{
struct wg_parser *parser;
wg_parser_t parser;
UINT32 count;
};
struct wg_parser_get_stream_params
{
struct wg_parser *parser;
wg_parser_t parser;
UINT32 index;
struct wg_parser_stream *stream;
wg_parser_stream_t stream;
};
struct wg_parser_stream_get_preferred_format_params
{
struct wg_parser_stream *stream;
wg_parser_stream_t stream;
struct wg_format *format;
};
struct wg_parser_stream_get_codec_format_params
{
struct wg_parser_stream *stream;
wg_parser_stream_t stream;
struct wg_format *format;
};
struct wg_parser_stream_enable_params
{
struct wg_parser_stream *stream;
wg_parser_stream_t stream;
const struct wg_format *format;
};
struct wg_parser_stream_get_buffer_params
{
struct wg_parser *parser;
struct wg_parser_stream *stream;
wg_parser_t parser;
wg_parser_stream_t stream;
struct wg_parser_buffer *buffer;
};
struct wg_parser_stream_copy_buffer_params
{
struct wg_parser_stream *stream;
wg_parser_stream_t stream;
void *data;
UINT32 offset;
UINT32 size;
@ -269,7 +273,7 @@ struct wg_parser_stream_copy_buffer_params
struct wg_parser_stream_notify_qos_params
{
struct wg_parser_stream *stream;
wg_parser_stream_t stream;
bool underflow;
DOUBLE proportion;
INT64 diff;
@ -278,7 +282,7 @@ struct wg_parser_stream_notify_qos_params
struct wg_parser_stream_get_duration_params
{
struct wg_parser_stream *stream;
wg_parser_stream_t stream;
UINT64 duration;
};
@ -291,7 +295,7 @@ enum wg_parser_tag
struct wg_parser_stream_get_tag_params
{
struct wg_parser_stream *stream;
wg_parser_stream_t stream;
enum wg_parser_tag tag;
char *buffer;
UINT32 *size;
@ -299,7 +303,7 @@ struct wg_parser_stream_get_tag_params
struct wg_parser_stream_seek_params
{
struct wg_parser_stream *stream;
wg_parser_stream_t stream;
DOUBLE rate;
UINT64 start_pos, stop_pos;
DWORD start_flags, stop_flags;
@ -314,7 +318,7 @@ struct wg_transform_attrs
struct wg_transform_create_params
{
struct wg_transform *transform;
wg_transform_t transform;
const struct wg_format *input_format;
const struct wg_format *output_format;
const struct wg_transform_attrs *attrs;
@ -322,14 +326,14 @@ struct wg_transform_create_params
struct wg_transform_push_data_params
{
struct wg_transform *transform;
wg_transform_t transform;
struct wg_sample *sample;
HRESULT result;
};
struct wg_transform_read_data_params
{
struct wg_transform *transform;
wg_transform_t transform;
struct wg_sample *sample;
struct wg_format *format;
HRESULT result;
@ -337,13 +341,13 @@ struct wg_transform_read_data_params
struct wg_transform_set_output_format_params
{
struct wg_transform *transform;
wg_transform_t transform;
const struct wg_format *format;
};
struct wg_transform_get_status_params
{
struct wg_transform *transform;
wg_transform_t transform;
UINT32 accepts_input;
};

View file

@ -57,7 +57,7 @@ struct video_decoder
IMFMediaType *output_type;
struct wg_format wg_format;
struct wg_transform *wg_transform;
wg_transform_t wg_transform;
struct wg_sample_queue *wg_sample_queue;
};
@ -74,7 +74,7 @@ static HRESULT try_create_wg_transform(struct video_decoder *decoder)
if (decoder->wg_transform)
wg_transform_destroy(decoder->wg_transform);
decoder->wg_transform = NULL;
decoder->wg_transform = 0;
mf_media_type_to_wg_format(decoder->input_type, &input_format);
if (input_format.major_type == WG_MAJOR_TYPE_UNKNOWN)

View file

@ -81,7 +81,7 @@ struct video_processor
IMFMediaType *output_type;
MFT_OUTPUT_STREAM_INFO output_info;
struct wg_transform *wg_transform;
wg_transform_t wg_transform;
struct wg_sample_queue *wg_sample_queue;
};
@ -92,7 +92,7 @@ static HRESULT try_create_wg_transform(struct video_processor *impl)
if (impl->wg_transform)
wg_transform_destroy(impl->wg_transform);
impl->wg_transform = NULL;
impl->wg_transform = 0;
mf_media_type_to_wg_format(impl->input_type, &input_format);
if (input_format.major_type == WG_MAJOR_TYPE_UNKNOWN)
@ -604,7 +604,7 @@ HRESULT video_processor_create(REFIID riid, void **ret)
},
};
struct wg_transform_attrs attrs = {0};
struct wg_transform *transform;
wg_transform_t transform;
struct video_processor *impl;
HRESULT hr;

View file

@ -49,6 +49,8 @@ typedef enum
GST_AUTOPLUG_SELECT_SKIP,
} GstAutoplugSelectResult;
struct wg_parser;
typedef BOOL (*init_gst_cb)(struct wg_parser *parser);
struct input_cache_chunk
@ -119,6 +121,16 @@ struct wg_parser_stream
gchar *tags[WG_PARSER_TAG_COUNT];
};
static struct wg_parser *get_parser(wg_parser_t parser)
{
return (struct wg_parser *)(ULONG_PTR)parser;
}
static struct wg_parser_stream *get_stream(wg_parser_stream_t stream)
{
return (struct wg_parser_stream *)(ULONG_PTR)stream;
}
static bool format_is_compressed(struct wg_format *format)
{
return format->major_type != WG_MAJOR_TYPE_UNKNOWN
@ -130,7 +142,7 @@ static NTSTATUS wg_parser_get_stream_count(void *args)
{
struct wg_parser_get_stream_count_params *params = args;
params->count = params->parser->stream_count;
params->count = get_parser(params->parser)->stream_count;
return S_OK;
}
@ -138,14 +150,14 @@ static NTSTATUS wg_parser_get_stream(void *args)
{
struct wg_parser_get_stream_params *params = args;
params->stream = params->parser->streams[params->index];
params->stream = (wg_parser_stream_t)(ULONG_PTR)get_parser(params->parser)->streams[params->index];
return S_OK;
}
static NTSTATUS wg_parser_get_next_read_offset(void *args)
{
struct wg_parser_get_next_read_offset_params *params = args;
struct wg_parser *parser = params->parser;
struct wg_parser *parser = get_parser(params->parser);
pthread_mutex_lock(&parser->mutex);
@ -168,7 +180,7 @@ static NTSTATUS wg_parser_get_next_read_offset(void *args)
static NTSTATUS wg_parser_push_data(void *args)
{
const struct wg_parser_push_data_params *params = args;
struct wg_parser *parser = params->parser;
struct wg_parser *parser = get_parser(params->parser);
const void *data = params->data;
uint32_t size = params->size;
@ -212,24 +224,25 @@ static NTSTATUS wg_parser_stream_get_preferred_format(void *args)
{
const struct wg_parser_stream_get_preferred_format_params *params = args;
*params->format = params->stream->preferred_format;
*params->format = get_stream(params->stream)->preferred_format;
return S_OK;
}
static NTSTATUS wg_parser_stream_get_codec_format(void *args)
{
struct wg_parser_stream_get_codec_format_params *params = args;
struct wg_parser_stream *stream = get_stream(params->stream);
*params->format = format_is_compressed(&params->stream->codec_format) ?
params->stream->codec_format :
params->stream->preferred_format;
*params->format = format_is_compressed(&stream->codec_format) ?
stream->codec_format :
stream->preferred_format;
return S_OK;
}
static NTSTATUS wg_parser_stream_enable(void *args)
{
const struct wg_parser_stream_enable_params *params = args;
struct wg_parser_stream *stream = params->stream;
struct wg_parser_stream *stream = get_stream(params->stream);
const struct wg_format *format = params->format;
struct wg_parser *parser = stream->parser;
@ -253,7 +266,7 @@ static NTSTATUS wg_parser_stream_enable(void *args)
static NTSTATUS wg_parser_stream_disable(void *args)
{
struct wg_parser_stream *stream = args;
struct wg_parser_stream *stream = get_stream(*(wg_parser_stream_t *)args);
struct wg_parser *parser = stream->parser;
pthread_mutex_lock(&parser->mutex);
@ -281,8 +294,8 @@ static NTSTATUS wg_parser_stream_get_buffer(void *args)
{
const struct wg_parser_stream_get_buffer_params *params = args;
struct wg_parser_buffer *wg_buffer = params->buffer;
struct wg_parser_stream *stream = params->stream;
struct wg_parser *parser = params->parser;
struct wg_parser_stream *stream = get_stream(params->stream);
struct wg_parser *parser = get_parser(params->parser);
GstBuffer *buffer;
unsigned int i;
@ -352,7 +365,7 @@ static NTSTATUS wg_parser_stream_get_buffer(void *args)
static NTSTATUS wg_parser_stream_copy_buffer(void *args)
{
const struct wg_parser_stream_copy_buffer_params *params = args;
struct wg_parser_stream *stream = params->stream;
struct wg_parser_stream *stream = get_stream(params->stream);
struct wg_parser *parser = stream->parser;
uint32_t offset = params->offset;
uint32_t size = params->size;
@ -375,7 +388,7 @@ static NTSTATUS wg_parser_stream_copy_buffer(void *args)
static NTSTATUS wg_parser_stream_release_buffer(void *args)
{
struct wg_parser_stream *stream = args;
struct wg_parser_stream *stream = get_stream(*(wg_parser_stream_t *)args);
struct wg_parser *parser = stream->parser;
pthread_mutex_lock(&parser->mutex);
@ -396,25 +409,26 @@ static NTSTATUS wg_parser_stream_get_duration(void *args)
{
struct wg_parser_stream_get_duration_params *params = args;
params->duration = params->stream->duration;
params->duration = get_stream(params->stream)->duration;
return S_OK;
}
static NTSTATUS wg_parser_stream_get_tag(void *args)
{
struct wg_parser_stream_get_tag_params *params = args;
struct wg_parser_stream *stream = get_stream(params->stream);
uint32_t len;
if (params->tag >= WG_PARSER_TAG_COUNT)
return STATUS_INVALID_PARAMETER;
if (!params->stream->tags[params->tag])
if (!stream->tags[params->tag])
return STATUS_NOT_FOUND;
if ((len = strlen(params->stream->tags[params->tag]) + 1) > *params->size)
if ((len = strlen(stream->tags[params->tag]) + 1) > *params->size)
{
*params->size = len;
return STATUS_BUFFER_TOO_SMALL;
}
memcpy(params->buffer, params->stream->tags[params->tag], len);
memcpy(params->buffer, stream->tags[params->tag], len);
return STATUS_SUCCESS;
}
@ -438,7 +452,7 @@ static NTSTATUS wg_parser_stream_seek(void *args)
if ((stop_flags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning)
stop_type = GST_SEEK_TYPE_NONE;
if (!gst_pad_push_event(params->stream->my_sink, gst_event_new_seek(params->rate, GST_FORMAT_TIME,
if (!gst_pad_push_event(get_stream(params->stream)->my_sink, gst_event_new_seek(params->rate, GST_FORMAT_TIME,
flags, start_type, params->start_pos * 100, stop_type, params->stop_pos * 100)))
GST_ERROR("Failed to seek.\n");
@ -448,7 +462,7 @@ static NTSTATUS wg_parser_stream_seek(void *args)
static NTSTATUS wg_parser_stream_notify_qos(void *args)
{
const struct wg_parser_stream_notify_qos_params *params = args;
struct wg_parser_stream *stream = params->stream;
struct wg_parser_stream *stream = get_stream(params->stream);
GstClockTime stream_time;
GstEvent *event;
@ -1535,7 +1549,7 @@ static NTSTATUS wg_parser_connect(void *args)
GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE("quartz_src",
GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY);
const struct wg_parser_connect_params *params = args;
struct wg_parser *parser = params->parser;
struct wg_parser *parser = get_parser(params->parser);
unsigned int i;
int ret;
@ -1700,7 +1714,7 @@ out:
static NTSTATUS wg_parser_disconnect(void *args)
{
struct wg_parser *parser = args;
struct wg_parser *parser = get_parser(*(wg_parser_t *)args);
unsigned int i;
/* Unblock all of our streams. */
@ -1878,13 +1892,13 @@ static NTSTATUS wg_parser_create(void *args)
parser->err_on = params->err_on;
parser->warn_on = params->warn_on;
GST_DEBUG("Created winegstreamer parser %p.", parser);
params->parser = parser;
params->parser = (wg_parser_t)(ULONG_PTR)parser;
return S_OK;
}
static NTSTATUS wg_parser_destroy(void *args)
{
struct wg_parser *parser = args;
struct wg_parser *parser = get_parser(*(wg_parser_t *)args);
if (parser->bus)
{

View file

@ -306,11 +306,11 @@ void wg_sample_queue_destroy(struct wg_sample_queue *queue)
/* These unixlib entry points should not be used directly, they assume samples
* to be queued and zero-copy support, use the helpers below instead.
*/
HRESULT wg_transform_push_data(struct wg_transform *transform, struct wg_sample *sample);
HRESULT wg_transform_read_data(struct wg_transform *transform, struct wg_sample *sample,
HRESULT wg_transform_push_data(wg_transform_t transform, struct wg_sample *sample);
HRESULT wg_transform_read_data(wg_transform_t transform, struct wg_sample *sample,
struct wg_format *format);
HRESULT wg_transform_push_mf(struct wg_transform *transform, IMFSample *sample,
HRESULT wg_transform_push_mf(wg_transform_t transform, IMFSample *sample,
struct wg_sample_queue *queue)
{
struct wg_sample *wg_sample;
@ -318,7 +318,7 @@ HRESULT wg_transform_push_mf(struct wg_transform *transform, IMFSample *sample,
UINT32 value;
HRESULT hr;
TRACE_(mfplat)("transform %p, sample %p, queue %p.\n", transform, sample, queue);
TRACE_(mfplat)("transform %#I64x, sample %p, queue %p.\n", transform, sample, queue);
if (FAILED(hr = wg_sample_create_mf(sample, &wg_sample)))
return hr;
@ -345,14 +345,14 @@ HRESULT wg_transform_push_mf(struct wg_transform *transform, IMFSample *sample,
return hr;
}
HRESULT wg_transform_read_mf(struct wg_transform *transform, IMFSample *sample,
HRESULT wg_transform_read_mf(wg_transform_t transform, IMFSample *sample,
DWORD sample_size, struct wg_format *format, DWORD *flags)
{
struct wg_sample *wg_sample;
IMFMediaBuffer *buffer;
HRESULT hr;
TRACE_(mfplat)("transform %p, sample %p, format %p, flags %p.\n", transform, sample, format, flags);
TRACE_(mfplat)("transform %#I64x, sample %p, format %p, flags %p.\n", transform, sample, format, flags);
if (FAILED(hr = wg_sample_create_mf(sample, &wg_sample)))
return hr;
@ -388,14 +388,14 @@ HRESULT wg_transform_read_mf(struct wg_transform *transform, IMFSample *sample,
return hr;
}
HRESULT wg_transform_push_quartz(struct wg_transform *transform, struct wg_sample *wg_sample,
HRESULT wg_transform_push_quartz(wg_transform_t transform, struct wg_sample *wg_sample,
struct wg_sample_queue *queue)
{
struct sample *sample = unsafe_quartz_from_wg_sample(wg_sample);
REFERENCE_TIME start_time, end_time;
HRESULT hr;
TRACE_(quartz)("transform %p, wg_sample %p, queue %p.\n", transform, wg_sample, queue);
TRACE_(quartz)("transform %#I64x, wg_sample %p, queue %p.\n", transform, wg_sample, queue);
hr = IMediaSample_GetTime(sample->u.quartz.sample, &start_time, &end_time);
if (SUCCEEDED(hr))
@ -421,14 +421,14 @@ HRESULT wg_transform_push_quartz(struct wg_transform *transform, struct wg_sampl
return hr;
}
HRESULT wg_transform_read_quartz(struct wg_transform *transform, struct wg_sample *wg_sample)
HRESULT wg_transform_read_quartz(wg_transform_t transform, struct wg_sample *wg_sample)
{
struct sample *sample = unsafe_quartz_from_wg_sample(wg_sample);
REFERENCE_TIME start_time, end_time;
HRESULT hr;
BOOL value;
TRACE_(mfplat)("transform %p, wg_sample %p.\n", transform, wg_sample);
TRACE_(mfplat)("transform %#I64x, wg_sample %p.\n", transform, wg_sample);
if (FAILED(hr = wg_transform_read_data(transform, wg_sample, NULL)))
{
@ -462,13 +462,13 @@ HRESULT wg_transform_read_quartz(struct wg_transform *transform, struct wg_sampl
return S_OK;
}
HRESULT wg_transform_push_dmo(struct wg_transform *transform, IMediaBuffer *media_buffer,
HRESULT wg_transform_push_dmo(wg_transform_t transform, IMediaBuffer *media_buffer,
DWORD flags, REFERENCE_TIME time_stamp, REFERENCE_TIME time_length, struct wg_sample_queue *queue)
{
struct wg_sample *wg_sample;
HRESULT hr;
TRACE_(mfplat)("transform %p, media_buffer %p, flags %#lx, time_stamp %s, time_length %s, queue %p.\n",
TRACE_(mfplat)("transform %#I64x, media_buffer %p, flags %#lx, time_stamp %s, time_length %s, queue %p.\n",
transform, media_buffer, flags, wine_dbgstr_longlong(time_stamp), wine_dbgstr_longlong(time_length), queue);
if (FAILED(hr = wg_sample_create_dmo(media_buffer, &wg_sample)))
@ -494,12 +494,12 @@ HRESULT wg_transform_push_dmo(struct wg_transform *transform, IMediaBuffer *medi
return hr;
}
HRESULT wg_transform_read_dmo(struct wg_transform *transform, DMO_OUTPUT_DATA_BUFFER *buffer)
HRESULT wg_transform_read_dmo(wg_transform_t transform, DMO_OUTPUT_DATA_BUFFER *buffer)
{
struct wg_sample *wg_sample;
HRESULT hr;
TRACE_(mfplat)("transform %p, buffer %p.\n", transform, buffer);
TRACE_(mfplat)("transform %#I64x, buffer %p.\n", transform, buffer);
if (FAILED(hr = wg_sample_create_dmo(buffer->pBuffer, &wg_sample)))
return hr;

View file

@ -63,6 +63,11 @@ struct wg_transform
GstCaps *output_caps;
};
static struct wg_transform *get_transform(wg_transform_t trans)
{
return (struct wg_transform *)(ULONG_PTR)trans;
}
static void align_video_info_planes(gsize plane_align, GstVideoInfo *info, GstVideoAlignment *align)
{
gst_video_alignment_reset(align);
@ -253,7 +258,7 @@ static gboolean transform_sink_event_cb(GstPad *pad, GstObject *parent, GstEvent
NTSTATUS wg_transform_destroy(void *args)
{
struct wg_transform *transform = args;
struct wg_transform *transform = get_transform(*(wg_transform_t *)args);
GstSample *sample;
GstBuffer *buffer;
@ -456,7 +461,7 @@ NTSTATUS wg_transform_create(void *args)
gst_caps_unref(src_caps);
GST_INFO("Created winegstreamer transform %p.", transform);
params->transform = transform;
params->transform = (wg_transform_t)(ULONG_PTR)transform;
return STATUS_SUCCESS;
out:
@ -489,7 +494,7 @@ out:
NTSTATUS wg_transform_set_output_format(void *args)
{
struct wg_transform_set_output_format_params *params = args;
struct wg_transform *transform = params->transform;
struct wg_transform *transform = get_transform(params->transform);
const struct wg_format *format = params->format;
GstSample *sample;
GstCaps *caps;
@ -559,7 +564,7 @@ static void wg_sample_free_notify(void *arg)
NTSTATUS wg_transform_push_data(void *args)
{
struct wg_transform_push_data_params *params = args;
struct wg_transform *transform = params->transform;
struct wg_transform *transform = get_transform(params->transform);
struct wg_sample *sample = params->sample;
GstBuffer *buffer;
guint length;
@ -770,7 +775,7 @@ static bool get_transform_output(struct wg_transform *transform, struct wg_sampl
NTSTATUS wg_transform_read_data(void *args)
{
struct wg_transform_read_data_params *params = args;
struct wg_transform *transform = params->transform;
struct wg_transform *transform = get_transform(params->transform);
struct wg_sample *sample = params->sample;
struct wg_format *format = params->format;
GstBuffer *output_buffer;
@ -865,7 +870,7 @@ NTSTATUS wg_transform_read_data(void *args)
NTSTATUS wg_transform_get_status(void *args)
{
struct wg_transform_get_status_params *params = args;
struct wg_transform *transform = params->transform;
struct wg_transform *transform = get_transform(params->transform);
params->accepts_input = gst_atomic_queue_length(transform->input_queue) < transform->attrs.input_queue_length + 1;
return STATUS_SUCCESS;
@ -873,7 +878,7 @@ NTSTATUS wg_transform_get_status(void *args)
NTSTATUS wg_transform_drain(void *args)
{
struct wg_transform *transform = args;
struct wg_transform *transform = get_transform(*(wg_transform_t *)args);
GstBuffer *input_buffer;
GstFlowReturn ret;
GstEvent *event;
@ -908,7 +913,7 @@ error:
NTSTATUS wg_transform_flush(void *args)
{
struct wg_transform *transform = args;
struct wg_transform *transform = get_transform(*(wg_transform_t *)args);
GstBuffer *input_buffer;
GstSample *sample;
NTSTATUS status;
@ -918,7 +923,7 @@ NTSTATUS wg_transform_flush(void *args)
while ((input_buffer = gst_atomic_queue_pop(transform->input_queue)))
gst_buffer_unref(input_buffer);
if ((status = wg_transform_drain(transform)))
if ((status = wg_transform_drain(args)))
return status;
while ((sample = gst_atomic_queue_pop(transform->output_queue)))

View file

@ -25,7 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wmvcore);
struct wm_stream
{
struct wm_reader *reader;
struct wg_parser_stream *wg_stream;
wg_parser_stream_t wg_stream;
struct wg_format format;
WMT_STREAM_SELECTION selection;
WORD index;
@ -60,7 +60,7 @@ struct wm_reader
HANDLE file;
HANDLE read_thread;
bool read_thread_shutdown;
struct wg_parser *wg_parser;
wg_parser_t wg_parser;
struct wm_stream *streams;
WORD stream_count;
@ -1455,7 +1455,7 @@ static const IWMReaderTimecodeVtbl timecode_vtbl =
static HRESULT init_stream(struct wm_reader *reader, QWORD file_size)
{
struct wg_parser *wg_parser;
wg_parser_t wg_parser;
HRESULT hr;
WORD i;
@ -1538,7 +1538,7 @@ out_shutdown_thread:
out_destroy_parser:
wg_parser_destroy(reader->wg_parser);
reader->wg_parser = NULL;
reader->wg_parser = 0;
return hr;
}
@ -1799,7 +1799,7 @@ static HRESULT WINAPI reader_Close(IWMSyncReader2 *iface)
reader->read_thread = NULL;
wg_parser_destroy(reader->wg_parser);
reader->wg_parser = NULL;
reader->wg_parser = 0;
if (reader->source_stream)
IStream_Release(reader->source_stream);
@ -1869,7 +1869,7 @@ static HRESULT WINAPI reader_GetNextSample(IWMSyncReader2 *iface,
while (hr == S_FALSE)
{
struct wg_parser_buffer wg_buffer;
if (!wg_parser_stream_get_buffer(reader->wg_parser, stream ? stream->wg_stream : NULL, &wg_buffer))
if (!wg_parser_stream_get_buffer(reader->wg_parser, stream ? stream->wg_stream : 0, &wg_buffer))
hr = NS_E_NO_MORE_SAMPLES;
else if (SUCCEEDED(hr = wm_reader_read_stream_sample(reader, &wg_buffer, sample, pts, duration, flags)))
stream_number = wg_buffer.stream + 1;

View file

@ -58,7 +58,7 @@ struct wma_decoder
IMFMediaType *output_type;
MFT_OUTPUT_STREAM_INFO output_info;
struct wg_transform *wg_transform;
wg_transform_t wg_transform;
struct wg_sample_queue *wg_sample_queue;
};
@ -74,7 +74,7 @@ static HRESULT try_create_wg_transform(struct wma_decoder *decoder)
if (decoder->wg_transform)
wg_transform_destroy(decoder->wg_transform);
decoder->wg_transform = NULL;
decoder->wg_transform = 0;
mf_media_type_to_wg_format(decoder->input_type, &input_format);
if (input_format.major_type == WG_MAJOR_TYPE_UNKNOWN)
@ -853,7 +853,7 @@ HRESULT wma_decoder_create(IUnknown *outer, IUnknown **out)
};
static const struct wg_format input_format = {.major_type = WG_MAJOR_TYPE_AUDIO_WMA};
struct wg_transform_attrs attrs = {0};
struct wg_transform *transform;
wg_transform_t transform;
struct wma_decoder *decoder;
HRESULT hr;

View file

@ -85,7 +85,7 @@ struct wmv_decoder
struct wg_format output_format;
GUID output_subtype;
struct wg_transform *wg_transform;
wg_transform_t wg_transform;
struct wg_sample_queue *wg_sample_queue;
};
@ -501,7 +501,7 @@ static HRESULT WINAPI media_object_SetInputType(IMediaObject *iface, DWORD index
if (decoder->wg_transform)
{
wg_transform_destroy(decoder->wg_transform);
decoder->wg_transform = NULL;
decoder->wg_transform = 0;
}
return S_OK;
}
@ -530,7 +530,7 @@ static HRESULT WINAPI media_object_SetInputType(IMediaObject *iface, DWORD index
if (decoder->wg_transform)
{
wg_transform_destroy(decoder->wg_transform);
decoder->wg_transform = NULL;
decoder->wg_transform = 0;
}
return S_OK;
@ -557,7 +557,7 @@ static HRESULT WINAPI media_object_SetOutputType(IMediaObject *iface, DWORD inde
if (decoder->wg_transform)
{
wg_transform_destroy(decoder->wg_transform);
decoder->wg_transform = NULL;
decoder->wg_transform = 0;
}
return S_OK;
}
@ -592,7 +592,7 @@ static HRESULT WINAPI media_object_SetOutputType(IMediaObject *iface, DWORD inde
if (decoder->wg_transform)
{
wg_transform_destroy(decoder->wg_transform);
decoder->wg_transform = NULL;
decoder->wg_transform = 0;
}
if (!(decoder->wg_transform = wg_transform_create(&decoder->input_format, &decoder->output_format, &attrs)))
return E_FAIL;
@ -896,7 +896,7 @@ HRESULT wmv_decoder_create(IUnknown *outer, IUnknown **out)
},
};
struct wg_transform_attrs attrs = {0};
struct wg_transform *transform;
wg_transform_t transform;
struct wmv_decoder *decoder;
HRESULT hr;