1851{
1852
1853 DWORD cookie1 = 0, cookie2 = 0, cookie3 = 0;
1859 static const CLSID CLSID_TestFilter2 = {
1860 0x37a4edb0,
1861 0x4d13,
1862 0x11dd,
1863 {0xe8, 0x9b, 0x00, 0x19, 0x66, 0x2f, 0xf0, 0xce}
1864 };
1865 static const CLSID CLSID_TestFilter3 = {
1866 0x37a4f2d8,
1867 0x4d13,
1868 0x11dd,
1869 {0xe8, 0x9b, 0x00, 0x19, 0x66, 0x2f, 0xf0, 0xce}
1870 };
1871 static const CLSID CLSID_TestFilter4 = {
1872 0x37a4f3b4,
1873 0x4d13,
1874 0x11dd,
1875 {0xe8, 0x9b, 0x00, 0x19, 0x66, 0x2f, 0xf0, 0xce}
1876 };
1877 static const GUID mediasubtype1 = {
1878 0x37a4f51c,
1879 0x4d13,
1880 0x11dd,
1881 {0xe8, 0x9b, 0x00, 0x19, 0x66, 0x2f, 0xf0, 0xce}
1882 };
1883 static const GUID mediasubtype2 = {
1884 0x37a4f5c6,
1885 0x4d13,
1886 0x11dd,
1887 {0xe8, 0x9b, 0x00, 0x19, 0x66, 0x2f, 0xf0, 0xce}
1888 };
1891 { 0, 0 }
1892 };
1895 { 0, 0 }
1896 };
1899 { 0, 0 }
1900 };
1904 { 0, 0 }
1905 };
1908 { 0, 0 }
1909 };
1912 PinData2, &CLSID_TestFilter2
1913 };
1916 PinData4, &CLSID_TestFilter3
1917 };
1920 PinData5, &CLSID_TestFilter4
1921 };
1927 static const WCHAR wszFilterInstanceName1[] = {
'T',
'e',
's',
't',
'f',
'i',
'l',
't',
'e',
'r',
'I',
1928 'n', 's', 't', 'a', 'n', 'c', 'e', '1', 0 };
1929 static const WCHAR wszFilterInstanceName2[] = {
'T',
'e',
's',
't',
'f',
'i',
'l',
't',
'e',
'r',
'I',
1930 'n', 's', 't', 'a', 'n', 'c', 'e', '2', 0 };
1931 static const WCHAR wszFilterInstanceName3[] = {
'T',
'e',
's',
't',
'f',
'i',
'l',
't',
'e',
'r',
'I',
1932 'n', 's', 't', 'a', 'n', 'c', 'e', '3', 0 };
1933 static const WCHAR wszFilterInstanceName4[] = {
'T',
'e',
's',
't',
'f',
'i',
'l',
't',
'e',
'r',
'I',
1934 'n', 's', 't', 'a', 'n', 'c', 'e', '4', 0 };
1935
1936
1937
1938
1939
1941
1943 ok(
hr ==
S_OK,
"createtestfilter failed with %08x\n",
hr);
1944
1945 hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter->
IBaseFilter_iface, wszFilterInstanceName1);
1946 ok(
hr ==
S_OK,
"IFilterGraph2_AddFilter failed with %08x\n",
hr);
1947
1949 ok(
hr ==
S_OK,
"createtestfilter failed with %08x\n",
hr);
1950
1951 hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->
IBaseFilter_iface, wszFilterInstanceName2);
1952 ok(
hr ==
S_OK,
"IFilterGraph2_AddFilter failed with %08x\n",
hr);
1953
1955
1957 ok(
hr ==
S_OK,
"createtestfilter failed with %08x\n",
hr);
1958
1959 hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->
IBaseFilter_iface, wszFilterInstanceName3);
1960 ok(
hr ==
S_OK,
"IFilterGraph2_AddFilter failed with %08x\n",
hr);
1961
1962 hr = IFilterGraph2_Render(pgraph2, ptestfilter->
ppPins[0]);
1963 ok(
hr ==
S_OK,
"IFilterGraph2_Render failed with %08x\n",
hr);
1964
1966
1967 IFilterGraph2_Release(pgraph2);
1970
1972
1974 ok(
hr ==
S_OK,
"createtestfilter failed with %08x\n",
hr);
1975
1976 hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter->
IBaseFilter_iface, wszFilterInstanceName1);
1977 ok(
hr ==
S_OK,
"IFilterGraph2_AddFilter failed with %08x\n",
hr);
1978
1980 ok(
hr ==
S_OK,
"createtestfilter failed with %08x\n",
hr);
1981
1982 hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->
IBaseFilter_iface, wszFilterInstanceName3);
1983 ok(
hr ==
S_OK,
"IFilterGraph2_AddFilter failed with %08x\n",
hr);
1984
1986
1988 ok(
hr ==
S_OK,
"createtestfilter failed with %08x\n",
hr);
1989
1990 hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->
IBaseFilter_iface, wszFilterInstanceName2);
1991 ok(
hr ==
S_OK,
"IFilterGraph2_AddFilter failed with %08x\n",
hr);
1992
1993 hr = IFilterGraph2_Render(pgraph2, ptestfilter->
ppPins[0]);
1994 ok(
hr ==
S_OK,
"IFilterGraph2_Render failed with %08x\n",
hr);
1995
1996 hr = IFilterGraph2_Disconnect(pgraph2,
NULL);
1997 ok(
hr ==
E_POINTER,
"IFilterGraph2_Disconnect failed. Expected E_POINTER, received %08x\n",
hr);
1998
2000 ok(
strcmp(ConnectedFilterName1, ConnectedFilterName2),
2001 "expected connected filters to be different but got %s both times\n", ConnectedFilterName1);
2002
2003 IFilterGraph2_Release(pgraph2);
2006
2007
2008
2009
2010
2012
2014 ok(
hr ==
S_OK,
"createtestfilter failed with %08x\n",
hr);
2015
2016 hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter->
IBaseFilter_iface, wszFilterInstanceName1);
2017 ok(
hr ==
S_OK,
"IFilterGraph2_AddFilter failed with %08x\n",
hr);
2018
2020 ok(
hr ==
S_OK,
"createtestfilter failed with %08x\n",
hr);
2021
2022 hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->
IBaseFilter_iface, wszFilterInstanceName2);
2023 ok(
hr ==
S_OK,
"IFilterGraph2_AddFilter failed with %08x\n",
hr);
2024
2026
2028 ok(
hr ==
S_OK,
"createtestfilter failed with %08x\n",
hr);
2029
2030 hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->
IBaseFilter_iface, wszFilterInstanceName3);
2031 ok(
hr ==
S_OK,
"IFilterGraph2_AddFilter failed with %08x\n",
hr);
2032
2034
2036 ok(
hr ==
S_OK,
"createtestfilter failed with %08x\n",
hr);
2037
2038 hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->
IBaseFilter_iface, wszFilterInstanceName4);
2039 ok(
hr ==
S_OK,
"IFilterGraph2_AddFilter failed with %08x\n",
hr);
2040
2041 hr = IFilterGraph2_Render(pgraph2, ptestfilter->
ppPins[0]);
2042 ok(
hr ==
S_OK,
"IFilterGraph2_Render failed with %08x\n",
hr);
2043
2045 ok(!
strcmp(ConnectedFilterName1,
"TestfilterInstance3") || !
strcmp(ConnectedFilterName1,
"TestfilterInstance2"),
2046 "unexpected connected filter: %s\n", ConnectedFilterName1);
2047
2048 IFilterGraph2_Release(pgraph2);
2051
2053
2055 ok(
hr ==
S_OK,
"createtestfilter failed with %08x\n",
hr);
2056
2057 hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter->
IBaseFilter_iface, wszFilterInstanceName1);
2058 ok(
hr ==
S_OK,
"IFilterGraph2_AddFilter failed with %08x\n",
hr);
2059
2061 ok(
hr ==
S_OK,
"createtestfilter failed with %08x\n",
hr);
2062
2063 hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->
IBaseFilter_iface, wszFilterInstanceName3);
2064 ok(
hr ==
S_OK,
"IFilterGraph2_AddFilter failed with %08x\n",
hr);
2065
2067
2069 ok(
hr ==
S_OK,
"createtestfilter failed with %08x\n",
hr);
2070
2071 hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->
IBaseFilter_iface, wszFilterInstanceName4);
2072 ok(
hr ==
S_OK,
"IFilterGraph2_AddFilter failed with %08x\n",
hr);
2073
2075
2077 ok(
hr ==
S_OK,
"createtestfilter failed with %08x\n",
hr);
2078
2079 hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->
IBaseFilter_iface, wszFilterInstanceName2);
2080 ok(
hr ==
S_OK,
"IFilterGraph2_AddFilter failed with %08x\n",
hr);
2081
2082 hr = IFilterGraph2_Render(pgraph2, ptestfilter->
ppPins[0]);
2083 ok(
hr ==
S_OK,
"IFilterGraph2_Render failed with %08x\n",
hr);
2084
2086 ok(!
strcmp(ConnectedFilterName2,
"TestfilterInstance3") || !
strcmp(ConnectedFilterName2,
"TestfilterInstance2"),
2087 "unexpected connected filter: %s\n", ConnectedFilterName2);
2088 ok(
strcmp(ConnectedFilterName1, ConnectedFilterName2),
2089 "expected connected filters to be different but got %s both times\n", ConnectedFilterName1);
2090
2091 IFilterGraph2_Release(pgraph2);
2094
2095
2097
2099 ok(
hr ==
S_OK,
"CoCreateInstance failed with %08x\n",
hr);
2100
2102 ok(
hr ==
S_OK,
"createtestfilter failed with %08x\n",
hr);
2103
2104 hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter->
IBaseFilter_iface, wszFilterInstanceName1);
2105 ok(
hr ==
S_OK,
"IFilterGraph2_AddFilter failed with %08x\n",
hr);
2106
2107
2111 ok(
hr ==
S_OK,
"CoRegisterClassObject failed with %08x\n",
hr);
2115 ok(
hr ==
S_OK,
"CoRegisterClassObject failed with %08x\n",
hr);
2119 ok(
hr ==
S_OK,
"CoRegisterClassObject failed with %08x\n",
hr);
2120
2122 rgf2.
dwMerit = MERIT_UNLIKELY;
2123 S2(
U(rgf2)).cPins2 = 1;
2124 S2(
U(rgf2)).rgPins2 = rgPins2;
2132 rgPinType[0].clsMajorType = &MEDIATYPE_Video;
2133 rgPinType[0].clsMinorType = &mediasubtype1;
2134
2135 hr = IFilterMapper2_RegisterFilter(pMapper2, &CLSID_TestFilter2, wszFilterInstanceName2,
NULL,
2136 &CLSID_LegacyAmFilterCategory,
NULL, &rgf2);
2138 skip(
"Not authorized to register filters\n");
2139 else
2140 {
2141 ok(
hr ==
S_OK,
"IFilterMapper2_RegisterFilter failed with %x\n",
hr);
2142
2143 rgf2.
dwMerit = MERIT_PREFERRED;
2144 rgPinType[0].clsMinorType = &mediasubtype2;
2145
2146 hr = IFilterMapper2_RegisterFilter(pMapper2, &CLSID_TestFilter4, wszFilterInstanceName4,
NULL,
2147 &CLSID_LegacyAmFilterCategory,
NULL, &rgf2);
2148 ok(
hr ==
S_OK,
"IFilterMapper2_RegisterFilter failed with %x\n",
hr);
2149
2150 S2(
U(rgf2)).cPins2 = 2;
2152 rgPinType[0].clsMinorType = &mediasubtype1;
2153
2161 rgPinType[1].clsMajorType = &MEDIATYPE_Video;
2162 rgPinType[1].clsMinorType = &mediasubtype2;
2163
2164 hr = IFilterMapper2_RegisterFilter(pMapper2, &CLSID_TestFilter3, wszFilterInstanceName3,
NULL,
2165 &CLSID_LegacyAmFilterCategory,
NULL, &rgf2);
2166 ok(
hr ==
S_OK,
"IFilterMapper2_RegisterFilter failed with %x\n",
hr);
2167
2168 hr = IFilterGraph2_Render(pgraph2, ptestfilter->
ppPins[0]);
2169 ok(
hr ==
S_OK,
"IFilterGraph2_Render failed with %08x\n",
hr);
2170
2172 ok(!
strcmp(ConnectedFilterName1,
"TestfilterInstance3"),
2173 "unexpected connected filter: %s\n", ConnectedFilterName1);
2174
2175 hr = IFilterMapper2_UnregisterFilter(pMapper2, &CLSID_LegacyAmFilterCategory,
NULL,
2176 &CLSID_TestFilter2);
2177 ok(
hr ==
S_OK,
"IFilterMapper2_UnregisterFilter failed with %x\n",
hr);
2178 hr = IFilterMapper2_UnregisterFilter(pMapper2, &CLSID_LegacyAmFilterCategory,
NULL,
2179 &CLSID_TestFilter3);
2180 ok(
hr ==
S_OK,
"IFilterMapper2_UnregisterFilter failed with %x\n",
hr);
2181 hr = IFilterMapper2_UnregisterFilter(pMapper2, &CLSID_LegacyAmFilterCategory,
NULL,
2182 &CLSID_TestFilter4);
2183 ok(
hr ==
S_OK,
"IFilterMapper2_UnregisterFilter failed with %x\n",
hr);
2184 }
2185
2187 IFilterGraph2_Release(pgraph2);
2188 IFilterMapper2_Release(pMapper2);
2189
2191 ok(
hr ==
S_OK,
"CoRevokeClassObject failed with %08x\n",
hr);
2193 ok(
hr ==
S_OK,
"CoRevokeClassObject failed with %08x\n",
hr);
2195 ok(
hr ==
S_OK,
"CoRevokeClassObject failed with %08x\n",
hr);
2196}
int strcmp(const char *String1, const char *String2)
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
static HRESULT get_connected_filter_name(TestFilterImpl *pFilter, char *FilterName)
static IClassFactoryVtbl TestClassFactory_Vtbl
const CLSID * clsPinCategory
const REGPINMEDIUM * lpMedium
const REGPINTYPES * lpMediaType
IClassFactory IClassFactory_iface