Commit 18e79f81 authored by Kurt Kartaltepe's avatar Kurt Kartaltepe Committed by Alexandre Julliard

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.
parent abdde73a
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
};
......
......@@ -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)
......
......@@ -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;
......
......@@ -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)
{
......
......@@ -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;
......
......@@ -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)))
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
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