mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 16:47:17 +00:00
mfplat: Implement IMFMediaType_(Get|Free)Representation.
This commit is contained in:
parent
77a71bc43b
commit
2e1fe519e7
|
@ -634,16 +634,30 @@ static HRESULT WINAPI mediatype_IsEqual(IMFMediaType *iface, IMFMediaType *type,
|
||||||
|
|
||||||
static HRESULT WINAPI mediatype_GetRepresentation(IMFMediaType *iface, GUID guid, void **representation)
|
static HRESULT WINAPI mediatype_GetRepresentation(IMFMediaType *iface, GUID guid, void **representation)
|
||||||
{
|
{
|
||||||
FIXME("%p, %s, %p.\n", iface, debugstr_guid(&guid), representation);
|
TRACE("%p, %s, %p.\n", iface, debugstr_guid(&guid), representation);
|
||||||
|
|
||||||
return E_NOTIMPL;
|
if (IsEqualGUID(&guid, &AM_MEDIA_TYPE_REPRESENTATION))
|
||||||
|
return MFCreateAMMediaTypeFromMFMediaType(iface, GUID_NULL, (AM_MEDIA_TYPE **)representation);
|
||||||
|
|
||||||
|
if (IsEqualGUID(&guid, &FORMAT_WaveFormatEx)
|
||||||
|
|| IsEqualGUID(&guid, &FORMAT_VideoInfo)
|
||||||
|
|| IsEqualGUID(&guid, &FORMAT_VideoInfo2)
|
||||||
|
|| IsEqualGUID(&guid, &FORMAT_MFVideoFormat))
|
||||||
|
return MFCreateAMMediaTypeFromMFMediaType(iface, guid, (AM_MEDIA_TYPE **)representation);
|
||||||
|
|
||||||
|
FIXME("Format %s not implemented!\n", debugstr_guid(&guid));
|
||||||
|
return MF_E_UNSUPPORTED_REPRESENTATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI mediatype_FreeRepresentation(IMFMediaType *iface, GUID guid, void *representation)
|
static HRESULT WINAPI mediatype_FreeRepresentation(IMFMediaType *iface, GUID guid, void *representation)
|
||||||
{
|
{
|
||||||
FIXME("%p, %s, %p.\n", iface, debugstr_guid(&guid), representation);
|
AM_MEDIA_TYPE *am_type = representation;
|
||||||
|
|
||||||
return E_NOTIMPL;
|
TRACE("%p, %s, %p.\n", iface, debugstr_guid(&guid), representation);
|
||||||
|
|
||||||
|
CoTaskMemFree(am_type->pbFormat);
|
||||||
|
CoTaskMemFree(am_type);
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const IMFMediaTypeVtbl mediatypevtbl =
|
static const IMFMediaTypeVtbl mediatypevtbl =
|
||||||
|
@ -1009,16 +1023,18 @@ static HRESULT WINAPI video_mediatype_IsEqual(IMFVideoMediaType *iface, IMFMedia
|
||||||
|
|
||||||
static HRESULT WINAPI video_mediatype_GetRepresentation(IMFVideoMediaType *iface, GUID guid, void **representation)
|
static HRESULT WINAPI video_mediatype_GetRepresentation(IMFVideoMediaType *iface, GUID guid, void **representation)
|
||||||
{
|
{
|
||||||
FIXME("%p, %s, %p.\n", iface, debugstr_guid(&guid), representation);
|
TRACE("%p, %s, %p.\n", iface, debugstr_guid(&guid), representation);
|
||||||
|
|
||||||
return E_NOTIMPL;
|
if (IsEqualGUID(&guid, &FORMAT_WaveFormatEx))
|
||||||
|
return MF_E_UNSUPPORTED_REPRESENTATION;
|
||||||
|
|
||||||
|
return mediatype_GetRepresentation((IMFMediaType *)iface, guid, representation);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI video_mediatype_FreeRepresentation(IMFVideoMediaType *iface, GUID guid, void *representation)
|
static HRESULT WINAPI video_mediatype_FreeRepresentation(IMFVideoMediaType *iface, GUID guid, void *representation)
|
||||||
{
|
{
|
||||||
FIXME("%p, %s, %p.\n", iface, debugstr_guid(&guid), representation);
|
TRACE("%p, %s, %p.\n", iface, debugstr_guid(&guid), representation);
|
||||||
|
return mediatype_FreeRepresentation((IMFMediaType *)iface, guid, representation);
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const MFVIDEOFORMAT * WINAPI video_mediatype_GetVideoFormat(IMFVideoMediaType *iface)
|
static const MFVIDEOFORMAT * WINAPI video_mediatype_GetVideoFormat(IMFVideoMediaType *iface)
|
||||||
|
@ -1410,16 +1426,20 @@ static HRESULT WINAPI audio_mediatype_IsEqual(IMFAudioMediaType *iface, IMFMedia
|
||||||
|
|
||||||
static HRESULT WINAPI audio_mediatype_GetRepresentation(IMFAudioMediaType *iface, GUID guid, void **representation)
|
static HRESULT WINAPI audio_mediatype_GetRepresentation(IMFAudioMediaType *iface, GUID guid, void **representation)
|
||||||
{
|
{
|
||||||
FIXME("%p, %s, %p.\n", iface, debugstr_guid(&guid), representation);
|
TRACE("%p, %s, %p.\n", iface, debugstr_guid(&guid), representation);
|
||||||
|
|
||||||
return E_NOTIMPL;
|
if (IsEqualGUID(&guid, &FORMAT_VideoInfo)
|
||||||
|
|| IsEqualGUID(&guid, &FORMAT_VideoInfo2)
|
||||||
|
|| IsEqualGUID(&guid, &FORMAT_MFVideoFormat))
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
return mediatype_GetRepresentation((IMFMediaType *)iface, guid, representation);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI audio_mediatype_FreeRepresentation(IMFAudioMediaType *iface, GUID guid, void *representation)
|
static HRESULT WINAPI audio_mediatype_FreeRepresentation(IMFAudioMediaType *iface, GUID guid, void *representation)
|
||||||
{
|
{
|
||||||
FIXME("%p, %s, %p.\n", iface, debugstr_guid(&guid), representation);
|
TRACE("%p, %s, %p.\n", iface, debugstr_guid(&guid), representation);
|
||||||
|
return mediatype_FreeRepresentation((IMFMediaType *)iface, guid, representation);
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const WAVEFORMATEX * WINAPI audio_mediatype_GetAudioFormat(IMFAudioMediaType *iface)
|
static const WAVEFORMATEX * WINAPI audio_mediatype_GetAudioFormat(IMFAudioMediaType *iface)
|
||||||
|
|
|
@ -7603,27 +7603,26 @@ static void test_IMFMediaType_GetRepresentation(void)
|
||||||
ok(hr == S_OK, "Failed to create media type, hr %#lx.\n", hr);
|
ok(hr == S_OK, "Failed to create media type, hr %#lx.\n", hr);
|
||||||
|
|
||||||
hr = IMFMediaType_GetRepresentation(media_type, GUID_NULL, (void **)&am_type);
|
hr = IMFMediaType_GetRepresentation(media_type, GUID_NULL, (void **)&am_type);
|
||||||
todo_wine ok(hr == MF_E_UNSUPPORTED_REPRESENTATION, "Unexpected hr %#lx.\n", hr);
|
ok(hr == MF_E_UNSUPPORTED_REPRESENTATION, "Unexpected hr %#lx.\n", hr);
|
||||||
hr = IMFMediaType_GetRepresentation(media_type, AM_MEDIA_TYPE_REPRESENTATION, (void **)&am_type);
|
hr = IMFMediaType_GetRepresentation(media_type, AM_MEDIA_TYPE_REPRESENTATION, (void **)&am_type);
|
||||||
todo_wine ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr);
|
ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr);
|
||||||
hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio);
|
hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio);
|
||||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||||
hr = IMFMediaType_GetRepresentation(media_type, AM_MEDIA_TYPE_REPRESENTATION, (void **)&am_type);
|
hr = IMFMediaType_GetRepresentation(media_type, AM_MEDIA_TYPE_REPRESENTATION, (void **)&am_type);
|
||||||
todo_wine ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr);
|
ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr);
|
||||||
hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video);
|
hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video);
|
||||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||||
hr = IMFMediaType_GetRepresentation(media_type, AM_MEDIA_TYPE_REPRESENTATION, (void **)&am_type);
|
hr = IMFMediaType_GetRepresentation(media_type, AM_MEDIA_TYPE_REPRESENTATION, (void **)&am_type);
|
||||||
todo_wine ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr);
|
ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr);
|
||||||
|
|
||||||
hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio);
|
hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio);
|
||||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||||
hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFAudioFormat_PCM);
|
hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFAudioFormat_PCM);
|
||||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||||
hr = IMFMediaType_GetRepresentation(media_type, FORMAT_VideoInfo, (void **)&am_type);
|
hr = IMFMediaType_GetRepresentation(media_type, FORMAT_VideoInfo, (void **)&am_type);
|
||||||
todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
|
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
|
||||||
hr = IMFMediaType_GetRepresentation(media_type, AM_MEDIA_TYPE_REPRESENTATION, (void **)&am_type);
|
hr = IMFMediaType_GetRepresentation(media_type, AM_MEDIA_TYPE_REPRESENTATION, (void **)&am_type);
|
||||||
todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||||
if (hr != S_OK) goto skip_tests;
|
|
||||||
ok(IsEqualGUID(&am_type->majortype, &MFMediaType_Audio), "got %s.\n", debugstr_guid(&am_type->majortype));
|
ok(IsEqualGUID(&am_type->majortype, &MFMediaType_Audio), "got %s.\n", debugstr_guid(&am_type->majortype));
|
||||||
ok(IsEqualGUID(&am_type->subtype, &MFAudioFormat_PCM), "got %s.\n", debugstr_guid(&am_type->subtype));
|
ok(IsEqualGUID(&am_type->subtype, &MFAudioFormat_PCM), "got %s.\n", debugstr_guid(&am_type->subtype));
|
||||||
ok(IsEqualGUID(&am_type->formattype, &FORMAT_WaveFormatEx), "got %s.\n", debugstr_guid(&am_type->formattype));
|
ok(IsEqualGUID(&am_type->formattype, &FORMAT_WaveFormatEx), "got %s.\n", debugstr_guid(&am_type->formattype));
|
||||||
|
@ -7663,7 +7662,6 @@ static void test_IMFMediaType_GetRepresentation(void)
|
||||||
hr = IMFMediaType_FreeRepresentation(media_type, AM_MEDIA_TYPE_REPRESENTATION, am_type);
|
hr = IMFMediaType_FreeRepresentation(media_type, AM_MEDIA_TYPE_REPRESENTATION, am_type);
|
||||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||||
|
|
||||||
skip_tests:
|
|
||||||
IMFMediaType_Release(media_type);
|
IMFMediaType_Release(media_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue