Commit d063fff6 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf: Add default attributes for sample copier.

parent 267b365f
......@@ -1523,7 +1523,8 @@ static ULONG WINAPI sample_copier_transform_Release(IMFTransform *iface)
if (!refcount)
{
IMFAttributes_Release(transform->attributes);
if (transform->attributes)
IMFAttributes_Release(transform->attributes);
if (transform->buffer_type)
IMFMediaType_Release(transform->buffer_type);
DeleteCriticalSection(&transform->cs);
......@@ -1999,6 +2000,7 @@ static const IMFTransformVtbl sample_copier_transform_vtbl =
HRESULT WINAPI MFCreateSampleCopierMFT(IMFTransform **transform)
{
struct sample_copier *object;
HRESULT hr;
TRACE("%p.\n", transform);
......@@ -2008,10 +2010,20 @@ HRESULT WINAPI MFCreateSampleCopierMFT(IMFTransform **transform)
object->IMFTransform_iface.lpVtbl = &sample_copier_transform_vtbl;
object->refcount = 1;
MFCreateAttributes(&object->attributes, 0);
InitializeCriticalSection(&object->cs);
if (FAILED(hr = MFCreateAttributes(&object->attributes, 0)))
goto failed;
IMFAttributes_SetUINT32(object->attributes, &MFT_SUPPORT_DYNAMIC_FORMAT_CHANGE, 1);
*transform = &object->IMFTransform_iface;
return S_OK;
failed:
IMFTransform_Release(&object->IMFTransform_iface);
return hr;
}
......@@ -3660,6 +3660,7 @@ static BOOL is_sample_copier_available_type(IMFMediaType *type)
static void test_sample_copier(void)
{
IMFAttributes *attributes, *attributes2;
DWORD in_min, in_max, out_min, out_max;
IMFMediaType *mediatype, *mediatype2;
MFT_OUTPUT_STREAM_INFO output_info;
......@@ -3668,9 +3669,9 @@ static void test_sample_copier(void)
DWORD input_count, output_count;
MFT_OUTPUT_DATA_BUFFER buffer;
IMFMediaBuffer *media_buffer;
IMFAttributes *attributes;
DWORD count, flags, status;
IMFTransform *copier;
DWORD flags, status;
UINT32 value;
HRESULT hr;
hr = MFCreateSampleCopierMFT(&copier);
......@@ -3678,6 +3679,16 @@ static void test_sample_copier(void)
hr = IMFTransform_GetAttributes(copier, &attributes);
ok(hr == S_OK, "Failed to get transform attributes, hr %#x.\n", hr);
hr = IMFTransform_GetAttributes(copier, &attributes2);
ok(hr == S_OK, "Failed to get transform attributes, hr %#x.\n", hr);
ok(attributes == attributes2, "Unexpected instance.\n");
IMFAttributes_Release(attributes2);
hr = IMFAttributes_GetCount(attributes, &count);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(count == 1, "Unexpected attribute count %u.\n", count);
hr = IMFAttributes_GetUINT32(attributes, &MFT_SUPPORT_DYNAMIC_FORMAT_CHANGE, &value);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!!value, "Unexpected value %u.\n", value);
IMFAttributes_Release(attributes);
hr = IMFTransform_GetInputStreamAttributes(copier, 0, &attributes);
......
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