Commit cf02b0bd authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

winegstreamer: Use a static buffer to enumerate stream types in media_stream_init_desc().

parent 609dfea1
......@@ -757,8 +757,7 @@ fail:
static HRESULT media_stream_init_desc(struct media_stream *stream)
{
IMFMediaTypeHandler *type_handler = NULL;
IMFMediaType **stream_types = NULL;
IMFMediaType *stream_type = NULL;
IMFMediaType *stream_types[6];
struct wg_format format;
DWORD type_count = 0;
unsigned int i;
......@@ -784,8 +783,6 @@ static HRESULT media_stream_init_desc(struct media_stream *stream)
IMFMediaType_GetGUID(base_type, &MF_MT_SUBTYPE, &base_subtype);
stream_types = malloc(sizeof(IMFMediaType *) * (ARRAY_SIZE(video_types) + 1));
stream_types[0] = base_type;
type_count = 1;
......@@ -816,8 +813,6 @@ static HRESULT media_stream_init_desc(struct media_stream *stream)
WG_AUDIO_FORMAT_F32LE,
};
stream_types = malloc( sizeof(IMFMediaType *) * (ARRAY_SIZE(audio_types) + 1) );
stream_types[0] = mf_media_type_from_wg_format(&format);
type_count = 1;
......@@ -833,14 +828,12 @@ static HRESULT media_stream_init_desc(struct media_stream *stream)
}
else
{
stream_type = mf_media_type_from_wg_format(&format);
if (stream_type)
{
stream_types = &stream_type;
if ((stream_types[0] = mf_media_type_from_wg_format(&format)))
type_count = 1;
}
}
assert(type_count < ARRAY_SIZE(stream_types));
if (!type_count)
{
ERR("Failed to establish an IMFMediaType from any of the possible stream caps!\n");
......@@ -861,8 +854,6 @@ done:
IMFMediaTypeHandler_Release(type_handler);
for (i = 0; i < type_count; i++)
IMFMediaType_Release(stream_types[i]);
if (stream_types != &stream_type)
free(stream_types);
return 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