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

winegstreamer: Introduce a new wg_transform_create_quartz helper.

parent 0567f993
...@@ -83,6 +83,8 @@ void wg_parser_stream_seek(wg_parser_stream_t stream, double rate, ...@@ -83,6 +83,8 @@ void wg_parser_stream_seek(wg_parser_stream_t stream, double rate,
wg_transform_t 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); const struct wg_format *output_format, const struct wg_transform_attrs *attrs);
HRESULT wg_transform_create_quartz(const AM_MEDIA_TYPE *input_format, const AM_MEDIA_TYPE *output_format,
const struct wg_transform_attrs *attrs, wg_transform_t *transform);
void wg_transform_destroy(wg_transform_t 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_set_output_format(wg_transform_t transform, struct wg_format *format);
bool wg_transform_get_status(wg_transform_t transform, bool *accepts_input); bool wg_transform_get_status(wg_transform_t transform, bool *accepts_input);
......
...@@ -357,6 +357,21 @@ wg_transform_t wg_transform_create(const struct wg_format *input_format, ...@@ -357,6 +357,21 @@ wg_transform_t wg_transform_create(const struct wg_format *input_format,
return params.transform; return params.transform;
} }
HRESULT wg_transform_create_quartz(const AM_MEDIA_TYPE *input_type, const AM_MEDIA_TYPE *output_type,
const struct wg_transform_attrs *attrs, wg_transform_t *transform)
{
struct wg_format input_format, output_format;
if (!amt_to_wg_format(input_type, &input_format))
return E_FAIL;
if (!amt_to_wg_format(output_type, &output_format))
return E_FAIL;
if (!(*transform = wg_transform_create(&input_format, &output_format, attrs)))
return E_FAIL;
return S_OK;
}
void wg_transform_destroy(wg_transform_t transform) void wg_transform_destroy(wg_transform_t transform)
{ {
TRACE("transform %#I64x.\n", transform); TRACE("transform %#I64x.\n", transform);
......
...@@ -98,26 +98,19 @@ static HRESULT transform_query_interface(struct strmbase_filter *iface, REFIID i ...@@ -98,26 +98,19 @@ static HRESULT transform_query_interface(struct strmbase_filter *iface, REFIID i
static HRESULT transform_init_stream(struct strmbase_filter *iface) static HRESULT transform_init_stream(struct strmbase_filter *iface)
{ {
struct transform *filter = impl_from_strmbase_filter(iface); struct transform *filter = impl_from_strmbase_filter(iface);
struct wg_format input_format, output_format;
struct wg_transform_attrs attrs = {0}; struct wg_transform_attrs attrs = {0};
HRESULT hr; HRESULT hr;
if (filter->source.pin.peer) if (filter->source.pin.peer)
{ {
if (!amt_to_wg_format(&filter->sink.pin.mt, &input_format))
return E_FAIL;
if (!amt_to_wg_format(&filter->source.pin.mt, &output_format))
return E_FAIL;
if (FAILED(hr = wg_sample_queue_create(&filter->sample_queue))) if (FAILED(hr = wg_sample_queue_create(&filter->sample_queue)))
return hr; return hr;
filter->transform = wg_transform_create(&input_format, &output_format, &attrs); if (FAILED(hr = wg_transform_create_quartz(&filter->sink.pin.mt, &filter->source.pin.mt,
if (!filter->transform) &attrs, &filter->transform)))
{ {
wg_sample_queue_destroy(filter->sample_queue); wg_sample_queue_destroy(filter->sample_queue);
return E_FAIL; return hr;
} }
hr = IMemAllocator_Commit(filter->source.pAllocator); hr = IMemAllocator_Commit(filter->source.pAllocator);
......
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