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 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
{
BaseFilter filter;
@ -618,19 +631,11 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
This->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
if (!pmt)
{
This->pmt->bFixedSizeSamples = TRUE;
This->pmt->bTemporalCompression = FALSE;
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))
CopyMediaType(This->pmt, &default_mt);
if (FAILED(GetClassMediaFile(pReader, pszFileName, &This->pmt->majortype, &This->pmt->subtype, NULL)))
{
This->pmt->majortype = MEDIATYPE_Stream;
This->pmt->subtype = MEDIASUBTYPE_NULL;
hr = S_OK;
}
}
else
@ -763,14 +768,20 @@ static HRESULT WINAPI FileAsyncReaderPin_CheckMediaType(BasePin *pin, const AM_M
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);
if (iPosition < 0)
AsyncReader *filter = impl_from_IBaseFilter(This->pin.pin.pinInfo.pFilter);
if (index < 0)
return E_INVALIDARG;
if (iPosition > 0)
else if (index > 1)
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;
}

View File

@ -257,15 +257,11 @@ static void test_file_source_filter(void)
CoTaskMemFree(pmt);
hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
todo_wine
ok(hr == S_OK, "Got hr %#x.\n", hr);
if (hr == S_OK)
{
mt = file_mt;
mt.subtype = GUID_NULL;
ok(!memcmp(pmt, &mt, sizeof(*pmt)), "Media types did not match.\n");
CoTaskMemFree(pmt);
}
mt = file_mt;
mt.subtype = GUID_NULL;
ok(!memcmp(pmt, &mt, sizeof(*pmt)), "Media types did not match.\n");
CoTaskMemFree(pmt);
hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
@ -339,26 +335,22 @@ todo_wine
CoTaskMemFree(pmt);
hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
todo_wine
ok(hr == S_OK, "Got hr %#x.\n", hr);
if (hr == S_OK)
{
ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Stream), "Got major type %s.\n",
wine_dbgstr_guid(&pmt->majortype));
ok(IsEqualGUID(&pmt->subtype, &GUID_NULL), "Got subtype %s.\n",
wine_dbgstr_guid(&pmt->subtype));
ok(pmt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", pmt->bFixedSizeSamples);
ok(!pmt->bTemporalCompression, "Got temporal compression %d.\n", pmt->bTemporalCompression);
ok(pmt->lSampleSize == 1, "Got sample size %u.\n", pmt->lSampleSize);
ok(IsEqualGUID(&pmt->formattype, &GUID_NULL), "Got format type %s.\n",
wine_dbgstr_guid(&pmt->formattype));
ok(!pmt->pUnk, "Got pUnk %p.\n", pmt->pUnk);
ok(!pmt->cbFormat, "Got format size %#x.\n", pmt->cbFormat);
ok(!pmt->pbFormat, "Got format %p.\n", pmt->pbFormat);
ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Stream), "Got major type %s.\n",
wine_dbgstr_guid(&pmt->majortype));
ok(IsEqualGUID(&pmt->subtype, &GUID_NULL), "Got subtype %s.\n",
wine_dbgstr_guid(&pmt->subtype));
ok(pmt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", pmt->bFixedSizeSamples);
ok(!pmt->bTemporalCompression, "Got temporal compression %d.\n", pmt->bTemporalCompression);
ok(pmt->lSampleSize == 1, "Got sample size %u.\n", pmt->lSampleSize);
ok(IsEqualGUID(&pmt->formattype, &GUID_NULL), "Got format type %s.\n",
wine_dbgstr_guid(&pmt->formattype));
ok(!pmt->pUnk, "Got pUnk %p.\n", pmt->pUnk);
ok(!pmt->cbFormat, "Got format size %#x.\n", pmt->cbFormat);
ok(!pmt->pbFormat, "Got format %p.\n", pmt->pbFormat);
hr = IPin_QueryAccept(pin, pmt);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
}
hr = IPin_QueryAccept(pin, pmt);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);