quartz/filesource: Return a default media type from FileAsyncReaderPin_GetMediaType().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-02-21 18:42:58 -06:00 committed by Alexandre Julliard
parent a67ad09528
commit 529af77051
2 changed files with 43 additions and 40 deletions

View File

@ -37,6 +37,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz);
static const WCHAR wszOutputPinName[] = { 'O','u','t','p','u','t',0 }; static const WCHAR wszOutputPinName[] = { 'O','u','t','p','u','t',0 };
static const AM_MEDIA_TYPE default_mt =
{
{0xe436eb83,0x524f,0x11ce,{0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70}}, /* MEDIATYPE_Stream */
{0,0,0,{0,0,0,0,0,0,0,0}},
TRUE,
FALSE,
1,
{0,0,0,{0,0,0,0,0,0,0,0}},
NULL,
0,
NULL
};
typedef struct AsyncReader typedef struct AsyncReader
{ {
BaseFilter filter; BaseFilter filter;
@ -618,19 +631,11 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
This->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); This->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
if (!pmt) if (!pmt)
{ {
This->pmt->bFixedSizeSamples = TRUE; CopyMediaType(This->pmt, &default_mt);
This->pmt->bTemporalCompression = FALSE; if (FAILED(GetClassMediaFile(pReader, pszFileName, &This->pmt->majortype, &This->pmt->subtype, NULL)))
This->pmt->cbFormat = 0;
This->pmt->pbFormat = NULL;
This->pmt->pUnk = NULL;
This->pmt->lSampleSize = 1;
This->pmt->formattype = GUID_NULL;
hr = GetClassMediaFile(pReader, pszFileName, &This->pmt->majortype, &This->pmt->subtype, NULL);
if (FAILED(hr))
{ {
This->pmt->majortype = MEDIATYPE_Stream; This->pmt->majortype = MEDIATYPE_Stream;
This->pmt->subtype = MEDIASUBTYPE_NULL; This->pmt->subtype = MEDIASUBTYPE_NULL;
hr = S_OK;
} }
} }
else else
@ -763,14 +768,20 @@ static HRESULT WINAPI FileAsyncReaderPin_CheckMediaType(BasePin *pin, const AM_M
return S_FALSE; return S_FALSE;
} }
static HRESULT WINAPI FileAsyncReaderPin_GetMediaType(BasePin *iface, int iPosition, AM_MEDIA_TYPE *pmt) static HRESULT WINAPI FileAsyncReaderPin_GetMediaType(BasePin *iface, int index, AM_MEDIA_TYPE *mt)
{ {
FileAsyncReader *This = impl_from_BasePin(iface); FileAsyncReader *This = impl_from_BasePin(iface);
if (iPosition < 0) AsyncReader *filter = impl_from_IBaseFilter(This->pin.pin.pinInfo.pFilter);
if (index < 0)
return E_INVALIDARG; return E_INVALIDARG;
if (iPosition > 0) else if (index > 1)
return VFW_S_NO_MORE_ITEMS; return VFW_S_NO_MORE_ITEMS;
CopyMediaType(pmt, impl_from_IBaseFilter(This->pin.pin.pinInfo.pFilter)->pmt);
if (index == 0)
CopyMediaType(mt, filter->pmt);
else if (index == 1)
CopyMediaType(mt, &default_mt);
return S_OK; return S_OK;
} }

View File

@ -257,15 +257,11 @@ static void test_file_source_filter(void)
CoTaskMemFree(pmt); CoTaskMemFree(pmt);
hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL); hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
todo_wine
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
if (hr == S_OK)
{
mt = file_mt; mt = file_mt;
mt.subtype = GUID_NULL; mt.subtype = GUID_NULL;
ok(!memcmp(pmt, &mt, sizeof(*pmt)), "Media types did not match.\n"); ok(!memcmp(pmt, &mt, sizeof(*pmt)), "Media types did not match.\n");
CoTaskMemFree(pmt); CoTaskMemFree(pmt);
}
hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL); hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
ok(hr == S_FALSE, "Got hr %#x.\n", hr); ok(hr == S_FALSE, "Got hr %#x.\n", hr);
@ -339,10 +335,7 @@ todo_wine
CoTaskMemFree(pmt); CoTaskMemFree(pmt);
hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL); hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
todo_wine
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
if (hr == S_OK)
{
ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Stream), "Got major type %s.\n", ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Stream), "Got major type %s.\n",
wine_dbgstr_guid(&pmt->majortype)); wine_dbgstr_guid(&pmt->majortype));
ok(IsEqualGUID(&pmt->subtype, &GUID_NULL), "Got subtype %s.\n", ok(IsEqualGUID(&pmt->subtype, &GUID_NULL), "Got subtype %s.\n",
@ -358,7 +351,6 @@ todo_wine
hr = IPin_QueryAccept(pin, pmt); hr = IPin_QueryAccept(pin, pmt);
ok(hr == S_FALSE, "Got hr %#x.\n", hr); ok(hr == S_FALSE, "Got hr %#x.\n", hr);
}
hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL); hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
ok(hr == S_FALSE, "Got hr %#x.\n", hr); ok(hr == S_FALSE, "Got hr %#x.\n", hr);