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