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

winegstreamer: Pass desired output plane alignment to wg_transform_create.

parent 4f4ee0e1
......@@ -67,6 +67,7 @@ static struct aac_decoder *impl_from_IMFTransform(IMFTransform *iface)
static HRESULT try_create_wg_transform(struct aac_decoder *decoder)
{
struct wg_format input_format, output_format;
struct wg_transform_attrs attrs = {0};
if (decoder->wg_transform)
wg_transform_destroy(decoder->wg_transform);
......@@ -80,7 +81,7 @@ static HRESULT try_create_wg_transform(struct aac_decoder *decoder)
if (output_format.major_type == WG_MAJOR_TYPE_UNKNOWN)
return MF_E_INVALIDMEDIATYPE;
if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format)))
if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format, &attrs)))
return E_FAIL;
return S_OK;
......@@ -625,13 +626,14 @@ 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;
struct aac_decoder *decoder;
HRESULT hr;
TRACE("riid %s, ret %p.\n", debugstr_guid(riid), ret);
if (!(transform = wg_transform_create(&input_format, &output_format)))
if (!(transform = wg_transform_create(&input_format, &output_format, &attrs)))
{
ERR_(winediag)("GStreamer doesn't support WMA decoding, please install appropriate plugins\n");
return E_FAIL;
......
......@@ -98,6 +98,7 @@ static inline struct color_convert *impl_from_IUnknown(IUnknown *iface)
static HRESULT try_create_wg_transform(struct color_convert *impl)
{
struct wg_format input_format, output_format;
struct wg_transform_attrs attrs = {0};
if (impl->wg_transform)
wg_transform_destroy(impl->wg_transform);
......@@ -111,7 +112,7 @@ static HRESULT try_create_wg_transform(struct color_convert *impl)
if (output_format.major_type == WG_MAJOR_TYPE_UNKNOWN)
return MF_E_INVALIDMEDIATYPE;
if (!(impl->wg_transform = wg_transform_create(&input_format, &output_format)))
if (!(impl->wg_transform = wg_transform_create(&input_format, &output_format, &attrs)))
return E_FAIL;
return S_OK;
......@@ -936,13 +937,14 @@ HRESULT color_convert_create(IUnknown *outer, IUnknown **out)
.height = 1080,
},
};
struct wg_transform_attrs attrs = {0};
struct wg_transform *transform;
struct color_convert *impl;
HRESULT hr;
TRACE("outer %p, out %p.\n", outer, out);
if (!(transform = wg_transform_create(&input_format, &output_format)))
if (!(transform = wg_transform_create(&input_format, &output_format, &attrs)))
{
ERR_(winediag)("GStreamer doesn't support video conversion, please install appropriate plugins.\n");
return E_FAIL;
......
......@@ -102,7 +102,7 @@ void wg_parser_stream_seek(struct wg_parser_stream *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,
const struct wg_format *output_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);
......
......@@ -76,6 +76,10 @@ static struct h264_decoder *impl_from_IMFTransform(IMFTransform *iface)
static HRESULT try_create_wg_transform(struct h264_decoder *decoder)
{
struct wg_transform_attrs attrs =
{
.output_plane_align = 15,
};
struct wg_format input_format;
struct wg_format output_format;
......@@ -99,7 +103,7 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder)
output_format.u.video.fps_d = 0;
output_format.u.video.fps_n = 0;
if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format)))
if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format, &attrs)))
return E_FAIL;
return S_OK;
......@@ -832,13 +836,14 @@ 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;
struct h264_decoder *decoder;
HRESULT hr;
TRACE("riid %s, ret %p.\n", debugstr_guid(riid), ret);
if (!(transform = wg_transform_create(&input_format, &output_format)))
if (!(transform = wg_transform_create(&input_format, &output_format, &attrs)))
{
ERR_(winediag)("GStreamer doesn't support H.264 decoding, please install appropriate plugins\n");
return E_FAIL;
......
......@@ -337,12 +337,13 @@ void wg_parser_stream_seek(struct wg_parser_stream *stream, double rate,
}
struct wg_transform *wg_transform_create(const struct wg_format *input_format,
const struct wg_format *output_format)
const struct wg_format *output_format, const struct wg_transform_attrs *attrs)
{
struct wg_transform_create_params params =
{
.input_format = input_format,
.output_format = output_format,
.attrs = attrs,
};
TRACE("input_format %p, output_format %p.\n", input_format, output_format);
......
......@@ -98,6 +98,7 @@ static HRESULT transform_init_stream(struct strmbase_filter *iface)
{
struct transform *filter = impl_from_strmbase_filter(iface);
struct wg_format input_format, output_format;
struct wg_transform_attrs attrs = {0};
HRESULT hr;
if (filter->source.pin.peer)
......@@ -111,7 +112,7 @@ static HRESULT transform_init_stream(struct strmbase_filter *iface)
if (FAILED(hr = wg_sample_queue_create(&filter->sample_queue)))
return hr;
filter->transform = wg_transform_create(&input_format, &output_format);
filter->transform = wg_transform_create(&input_format, &output_format, &attrs);
if (!filter->transform)
{
wg_sample_queue_destroy(filter->sample_queue);
......@@ -710,11 +711,12 @@ HRESULT mpeg_audio_codec_create(IUnknown *outer, IUnknown **out)
.rate = 44100,
},
};
struct wg_transform_attrs attrs = {0};
struct wg_transform *transform;
struct transform *object;
HRESULT hr;
transform = wg_transform_create(&input_format, &output_format);
transform = wg_transform_create(&input_format, &output_format, &attrs);
if (!transform)
{
ERR_(winediag)("GStreamer doesn't support MPEG-1 audio decoding, please install appropriate plugins.\n");
......@@ -844,11 +846,12 @@ HRESULT mpeg_layer3_decoder_create(IUnknown *outer, IUnknown **out)
.rate = 44100,
},
};
struct wg_transform_attrs attrs = {0};
struct wg_transform *transform;
struct transform *object;
HRESULT hr;
transform = wg_transform_create(&input_format, &output_format);
transform = wg_transform_create(&input_format, &output_format, &attrs);
if (!transform)
{
ERR_(winediag)("GStreamer doesn't support MPEG-1 audio decoding, please install appropriate plugins.\n");
......
......@@ -56,6 +56,7 @@ struct resampler
static HRESULT try_create_wg_transform(struct resampler *impl)
{
struct wg_format input_format, output_format;
struct wg_transform_attrs attrs = {0};
if (impl->wg_transform)
wg_transform_destroy(impl->wg_transform);
......@@ -69,7 +70,7 @@ static HRESULT try_create_wg_transform(struct resampler *impl)
if (output_format.major_type == WG_MAJOR_TYPE_UNKNOWN)
return MF_E_INVALIDMEDIATYPE;
if (!(impl->wg_transform = wg_transform_create(&input_format, &output_format)))
if (!(impl->wg_transform = wg_transform_create(&input_format, &output_format, &attrs)))
return E_FAIL;
return S_OK;
......@@ -895,13 +896,14 @@ HRESULT resampler_create(IUnknown *outer, IUnknown **out)
.rate = 44100,
},
};
struct wg_transform_attrs attrs = {0};
struct wg_transform *transform;
struct resampler *impl;
HRESULT hr;
TRACE("outer %p, out %p.\n", outer, out);
if (!(transform = wg_transform_create(&input_format, &output_format)))
if (!(transform = wg_transform_create(&input_format, &output_format, &attrs)))
{
ERR_(winediag)("GStreamer doesn't support audio resampling, please install appropriate plugins.\n");
return E_FAIL;
......
......@@ -305,11 +305,17 @@ struct wg_parser_stream_seek_params
DWORD start_flags, stop_flags;
};
struct wg_transform_attrs
{
UINT32 output_plane_align;
};
struct wg_transform_create_params
{
struct wg_transform *transform;
const struct wg_format *input_format;
const struct wg_format *output_format;
const struct wg_transform_attrs *attrs;
};
struct wg_transform_push_data_params
......
......@@ -68,6 +68,7 @@ static struct video_decoder *impl_from_IMFTransform(IMFTransform *iface)
static HRESULT try_create_wg_transform(struct video_decoder *decoder)
{
struct wg_transform_attrs attrs = {0};
struct wg_format input_format;
struct wg_format output_format;
......@@ -86,7 +87,7 @@ static HRESULT try_create_wg_transform(struct video_decoder *decoder)
output_format.u.video.fps_d = 0;
output_format.u.video.fps_n = 0;
if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format)))
if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format, &attrs)))
{
ERR("Failed to create transform with input major_type %u.\n", input_format.major_type);
return E_FAIL;
......
......@@ -88,6 +88,7 @@ struct video_processor
static HRESULT try_create_wg_transform(struct video_processor *impl)
{
struct wg_format input_format, output_format;
struct wg_transform_attrs attrs = {0};
if (impl->wg_transform)
wg_transform_destroy(impl->wg_transform);
......@@ -101,7 +102,7 @@ static HRESULT try_create_wg_transform(struct video_processor *impl)
if (output_format.major_type == WG_MAJOR_TYPE_UNKNOWN)
return MF_E_INVALIDMEDIATYPE;
if (!(impl->wg_transform = wg_transform_create(&input_format, &output_format)))
if (!(impl->wg_transform = wg_transform_create(&input_format, &output_format, &attrs)))
return E_FAIL;
return S_OK;
......@@ -602,13 +603,14 @@ HRESULT video_processor_create(REFIID riid, void **ret)
.height = 1080,
},
};
struct wg_transform_attrs attrs = {0};
struct wg_transform *transform;
struct video_processor *impl;
HRESULT hr;
TRACE("riid %s, ret %p.\n", debugstr_guid(riid), ret);
if (!(transform = wg_transform_create(&input_format, &output_format)))
if (!(transform = wg_transform_create(&input_format, &output_format, &attrs)))
{
ERR_(winediag)("GStreamer doesn't support video conversion, please install appropriate plugins.\n");
return E_FAIL;
......
......@@ -43,6 +43,8 @@
struct wg_transform
{
struct wg_transform_attrs attrs;
GstElement *container;
GstAllocator *allocator;
GstPad *my_src, *my_sink;
......@@ -55,7 +57,6 @@ struct wg_transform
bool input_is_flipped;
GstElement *video_flip;
guint output_plane_align;
struct wg_format output_format;
struct wg_sample *output_wg_sample;
GstAtomicQueue *output_queue;
......@@ -111,7 +112,7 @@ static gboolean transform_sink_query_cb(GstPad *pad, GstObject *parent, GstQuery
{
case GST_QUERY_ALLOCATION:
{
gsize plane_align = transform->output_plane_align;
gsize plane_align = transform->attrs.output_plane_align;
GstStructure *config, *params;
GstVideoAlignment align;
gboolean needs_pool;
......@@ -300,8 +301,8 @@ NTSTATUS wg_transform_create(void *args)
goto out;
if (!(transform->allocator = wg_allocator_create(transform_request_sample, transform)))
goto out;
transform->attrs = *params->attrs;
transform->input_max_length = 1;
transform->output_plane_align = 0;
transform->output_format = output_format;
if (!(src_caps = wg_format_to_caps(&input_format)))
......@@ -344,7 +345,6 @@ NTSTATUS wg_transform_create(void *args)
* to match its expectations.
*/
transform->input_max_length = 16;
transform->output_plane_align = 15;
/* fallthrough */
case WG_MAJOR_TYPE_AUDIO_MPEG1:
case WG_MAJOR_TYPE_AUDIO_MPEG4:
......@@ -795,7 +795,7 @@ NTSTATUS wg_transform_read_data(void *args)
if (format)
{
gsize plane_align = transform->output_plane_align;
gsize plane_align = transform->attrs.output_plane_align;
GstVideoAlignment align;
GstVideoInfo info;
......@@ -827,7 +827,7 @@ NTSTATUS wg_transform_read_data(void *args)
}
if ((status = read_transform_output_data(output_buffer, output_caps,
transform->output_plane_align, sample)))
transform->attrs.output_plane_align, sample)))
{
wg_allocator_release_sample(transform->allocator, sample, false);
return status;
......
......@@ -70,6 +70,7 @@ static inline struct wma_decoder *impl_from_IUnknown(IUnknown *iface)
static HRESULT try_create_wg_transform(struct wma_decoder *decoder)
{
struct wg_format input_format, output_format;
struct wg_transform_attrs attrs = {0};
if (decoder->wg_transform)
wg_transform_destroy(decoder->wg_transform);
......@@ -83,7 +84,7 @@ static HRESULT try_create_wg_transform(struct wma_decoder *decoder)
if (output_format.major_type == WG_MAJOR_TYPE_UNKNOWN)
return MF_E_INVALIDMEDIATYPE;
if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format)))
if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format, &attrs)))
return E_FAIL;
return S_OK;
......@@ -851,13 +852,14 @@ 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;
struct wma_decoder *decoder;
HRESULT hr;
TRACE("outer %p, out %p.\n", outer, out);
if (!(transform = wg_transform_create(&input_format, &output_format)))
if (!(transform = wg_transform_create(&input_format, &output_format, &attrs)))
{
ERR_(winediag)("GStreamer doesn't support WMA decoding, please install appropriate plugins\n");
return E_FAIL;
......
......@@ -540,6 +540,7 @@ static HRESULT WINAPI media_object_SetOutputType(IMediaObject *iface, DWORD inde
const DMO_MEDIA_TYPE *type, DWORD flags)
{
struct wmv_decoder *decoder = impl_from_IMediaObject(iface);
struct wg_transform_attrs attrs = {0};
struct wg_format wg_format;
unsigned int i;
......@@ -593,7 +594,7 @@ static HRESULT WINAPI media_object_SetOutputType(IMediaObject *iface, DWORD inde
wg_transform_destroy(decoder->wg_transform);
decoder->wg_transform = NULL;
}
if (!(decoder->wg_transform = wg_transform_create(&decoder->input_format, &decoder->output_format)))
if (!(decoder->wg_transform = wg_transform_create(&decoder->input_format, &decoder->output_format, &attrs)))
return E_FAIL;
return S_OK;
......@@ -885,13 +886,14 @@ HRESULT wmv_decoder_create(IUnknown *outer, IUnknown **out)
.height = 1080,
},
};
struct wg_transform_attrs attrs = {0};
struct wg_transform *transform;
struct wmv_decoder *decoder;
HRESULT hr;
TRACE("outer %p, out %p.\n", outer, out);
if (!(transform = wg_transform_create(&input_format, &output_format)))
if (!(transform = wg_transform_create(&input_format, &output_format, &attrs)))
{
ERR_(winediag)("GStreamer doesn't support WMV decoding, please install appropriate plugins.\n");
return E_FAIL;
......
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