On 4/2/20 12:11 AM, Sergio Gómez Del Real wrote:
+static HRESULT WINAPI test_media_source_CreatePresentationDescriptor(IMFMediaSource *iface, IMFPresentationDescriptor **descriptor) +{
- HRESULT hr;
- IMFPresentationDescriptor *pd;
- IMFMediaType *mediatypes[3];
- IMFStreamDescriptor *sd[2];
- if (FAILED(hr = MFCreateMediaType(&mediatypes[0])))
return hr;
- if (FAILED(hr = IMFMediaType_SetGUID(mediatypes[0], &MF_MT_MAJOR_TYPE, &MFMediaType_Video)))
return hr;
- if (FAILED(hr = IMFMediaType_SetGUID(mediatypes[0], &MF_MT_SUBTYPE, &MFVideoFormat_YUY2)))
return hr;
- if (FAILED(hr = MFCreateMediaType(&mediatypes[1])))
return hr;
- if (FAILED(hr = IMFMediaType_SetGUID(mediatypes[1], &MF_MT_MAJOR_TYPE, &MFMediaType_Audio)))
return hr;
- if (FAILED(hr = IMFMediaType_SetGUID(mediatypes[1], &MF_MT_SUBTYPE, &MFAudioFormat_MP3)))
return hr;
- if (FAILED(hr = IMFMediaType_SetUINT32(mediatypes[1], &MF_MT_AUDIO_SAMPLES_PER_SECOND, 32000)))
return hr;
- if (FAILED(hr = IMFMediaType_SetUINT32(mediatypes[1], &MF_MT_AUDIO_NUM_CHANNELS, 2)))
return hr;
- if (FAILED(hr = IMFMediaType_SetUINT32(mediatypes[1], &MF_MT_AUDIO_PREFER_WAVEFORMATEX, 1)))
return hr;
- if (FAILED(hr = MFCreateMediaType(&mediatypes[2])))
return hr;
- if (FAILED(hr = IMFMediaType_SetGUID(mediatypes[2], &MF_MT_MAJOR_TYPE, &MFMediaType_Audio)))
return hr;
- if (FAILED(hr = IMFMediaType_SetGUID(mediatypes[2], &MF_MT_SUBTYPE, &MFAudioFormat_PCM)))
return hr;
- if (FAILED(hr = MFCreateStreamDescriptor(0, 3, mediatypes, &sd[0])))
return hr;
- if (FAILED(hr = MFCreateStreamDescriptor(1, 3, mediatypes, &sd[1])))
return hr;
- if (FAILED(hr = MFCreatePresentationDescriptor(2, sd, &pd)))
return hr;
- *descriptor = pd;
- IMFMediaType_Release(mediatypes[0]);
- IMFMediaType_Release(mediatypes[1]);
- IMFMediaType_Release(mediatypes[2]);
- IMFStreamDescriptor_Release(sd[0]);
- IMFStreamDescriptor_Release(sd[1]);
- return S_OK;
+}
You probably don't need this method, you can create descriptor directly in test function.
- hr = IMFTopology_GetUINT32(topology, &MF_TOPOLOGY_ENUMERATE_SOURCE_TYPES, &enum_src);
- ok(hr == MF_E_ATTRIBUTENOTFOUND, "Attribute should not be set\n.");
It doesn't look that this could ever be set at this point.
- IMFTopologyNode_GetUINT32(src_node, &MF_TOPONODE_CONNECT_METHOD, &method);
- ok(hr == S_OK, "Attribute should be set\n.");
- IMFTopologyNode_SetUINT32(src_node, &MF_TOPONODE_CONNECT_METHOD, method & ~MF_CONNECT_RESOLVE_INDEPENDENT_OUTPUTTYPES);
- ok(hr == S_OK, "Failed setting attribute %#x\n.", hr);
This does not test return value.