1 /* 2 * Copyright 2017 Alistair Leslie-Hughes 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 */ 18 #define COBJMACROS 19 #define WIN32_LEAN_AND_MEAN 20 #include "initguid.h" 21 #include "wmsdkidl.h" 22 23 #include "wine/test.h" 24 25 HRESULT WINAPI WMCreateWriterPriv(IWMWriter **writer); 26 27 static void test_wmwriter_interfaces(void) 28 { 29 HRESULT hr; 30 IWMWriter *writer; 31 IWMHeaderInfo *header; 32 IWMHeaderInfo2 *header2; 33 IWMHeaderInfo3 *header3; 34 35 hr = WMCreateWriter( NULL, &writer ); 36 ok(hr == S_OK, "WMCreateWriter failed 0x%08x\n", hr); 37 if(FAILED(hr)) 38 { 39 win_skip("Failed to create IWMWriter\n"); 40 return; 41 } 42 43 hr = IWMWriter_QueryInterface(writer, &IID_IWMHeaderInfo, (void **)&header); 44 todo_wine ok(hr == S_OK, "Failed 0x%08x\n", hr); 45 46 hr = IWMWriter_QueryInterface(writer, &IID_IWMHeaderInfo2, (void **)&header2); 47 todo_wine ok(hr == S_OK, "Failed 0x%08x\n", hr); 48 49 hr = IWMWriter_QueryInterface(writer, &IID_IWMHeaderInfo3, (void **)&header3); 50 todo_wine ok(hr == S_OK, "Failed 0x%08x\n", hr); 51 52 if(header) 53 IWMHeaderInfo_Release(header); 54 if(header2) 55 IWMHeaderInfo2_Release(header2); 56 if(header3) 57 IWMHeaderInfo3_Release(header3); 58 IWMWriter_Release(writer); 59 } 60 61 static void test_wmreader_interfaces(void) 62 { 63 HRESULT hr; 64 IWMReader *reader; 65 IWMReaderAdvanced *advanced; 66 IWMReaderAdvanced2 *advanced2; 67 IWMHeaderInfo *header; 68 IWMHeaderInfo2 *header2; 69 IWMHeaderInfo3 *header3; 70 IWMProfile *profile; 71 IWMProfile2 *profile2; 72 IWMProfile3 *profile3; 73 IWMPacketSize *packet; 74 IWMPacketSize2 *packet2; 75 IWMReaderAccelerator *accel; 76 IWMReaderTimecode *timecode; 77 IWMReaderNetworkConfig *netconfig; 78 IWMReaderNetworkConfig2 *netconfig2; 79 IWMReaderStreamClock *clock; 80 IWMReaderTypeNegotiation *negotiation; 81 IWMDRMReader *drmreader; 82 IWMDRMReader2 *drmreader2; 83 IWMDRMReader3 *drmreader3; 84 IWMReaderPlaylistBurn *playlist; 85 IWMLanguageList *langlist; 86 IReferenceClock *refclock; 87 88 hr = WMCreateReader( NULL, 0, &reader ); 89 ok(hr == S_OK, "WMCreateReader failed 0x%08x\n", hr); 90 if(FAILED(hr)) 91 { 92 win_skip("Failed to create IWMReader\n"); 93 return; 94 } 95 96 hr = IWMReader_QueryInterface(reader, &IID_IWMReaderAdvanced, (void **)&advanced); 97 ok(hr == S_OK, "Failed 0x%08x\n", hr); 98 99 hr = IWMReader_QueryInterface(reader, &IID_IWMReaderAdvanced2, (void **)&advanced2); 100 ok(hr == S_OK, "Failed 0x%08x\n", hr); 101 102 hr = IWMReader_QueryInterface(reader, &IID_IWMHeaderInfo, (void **)&header); 103 ok(hr == S_OK, "Failed 0x%08x\n", hr); 104 105 hr = IWMReader_QueryInterface(reader, &IID_IWMHeaderInfo2, (void **)&header2); 106 ok(hr == S_OK, "Failed 0x%08x\n", hr); 107 108 hr = IWMReader_QueryInterface(reader, &IID_IWMHeaderInfo3, (void **)&header3); 109 ok(hr == S_OK, "Failed 0x%08x\n", hr); 110 111 hr = IWMReader_QueryInterface(reader, &IID_IWMProfile, (void **)&profile); 112 ok(hr == S_OK, "Failed 0x%08x\n", hr); 113 114 hr = IWMReader_QueryInterface(reader, &IID_IWMProfile2, (void **)&profile2); 115 ok(hr == S_OK, "Failed 0x%08x\n", hr); 116 117 hr = IWMReader_QueryInterface(reader, &IID_IWMProfile3, (void **)&profile3); 118 ok(hr == S_OK, "Failed 0x%08x\n", hr); 119 120 hr = IWMReader_QueryInterface(reader, &IID_IWMPacketSize, (void **)&packet); 121 ok(hr == S_OK, "Failed 0x%08x\n", hr); 122 123 hr = IWMReader_QueryInterface(reader, &IID_IWMPacketSize2, (void **)&packet2); 124 ok(hr == S_OK, "Failed 0x%08x\n", hr); 125 126 hr = IWMReader_QueryInterface(reader, &IID_IWMReaderAccelerator, (void **)&accel); 127 ok(hr == S_OK, "Failed 0x%08x\n", hr); 128 129 hr = IWMReader_QueryInterface(reader, &IID_IWMReaderTimecode, (void **)&timecode); 130 ok(hr == S_OK, "Failed 0x%08x\n", hr); 131 132 hr = IWMReader_QueryInterface(reader, &IID_IWMReaderNetworkConfig, (void **)&netconfig); 133 ok(hr == S_OK, "Failed 0x%08x\n", hr); 134 135 hr = IWMReader_QueryInterface(reader, &IID_IWMReaderNetworkConfig2, (void **)&netconfig2); 136 ok(hr == S_OK, "Failed 0x%08x\n", hr); 137 138 hr = IWMReader_QueryInterface(reader, &IID_IWMReaderStreamClock, (void **)&clock); 139 ok(hr == S_OK, "Failed 0x%08x\n", hr); 140 141 hr = IWMReader_QueryInterface(reader, &IID_IWMReaderTypeNegotiation, (void **)&negotiation); 142 ok(hr == S_OK, "Failed 0x%08x\n", hr); 143 144 hr = IWMReader_QueryInterface(reader, &IID_IWMDRMReader, (void **)&drmreader); 145 ok(hr == E_NOINTERFACE, "Failed 0x%08x\n", hr); 146 147 hr = IWMReader_QueryInterface(reader, &IID_IWMDRMReader2, (void **)&drmreader2); 148 ok(hr == E_NOINTERFACE, "Failed 0x%08x\n", hr); 149 150 hr = IWMReader_QueryInterface(reader, &IID_IWMDRMReader3, (void **)&drmreader3); 151 ok(hr == E_NOINTERFACE, "Failed 0x%08x\n", hr); 152 153 hr = IWMReader_QueryInterface(reader, &IID_IWMReaderPlaylistBurn, (void **)&playlist); 154 ok(hr == S_OK, "Failed 0x%08x\n", hr); 155 156 hr = IWMReader_QueryInterface(reader, &IID_IWMLanguageList, (void **)&langlist); 157 ok(hr == S_OK, "Failed 0x%08x\n", hr); 158 159 hr = IWMReader_QueryInterface(reader, &IID_IReferenceClock, (void **)&refclock); 160 ok(hr == S_OK, "Failed 0x%08x\n", hr); 161 162 if(packet) 163 IWMPacketSize_Release(packet); 164 if(packet2) 165 IWMPacketSize2_Release(packet2); 166 if(advanced) 167 IWMReaderAdvanced_Release(advanced); 168 if(advanced2) 169 IWMReaderAdvanced2_Release(advanced2); 170 if(profile) 171 IWMProfile_Release(profile); 172 if(profile2) 173 IWMProfile2_Release(profile2); 174 if(profile3) 175 IWMProfile3_Release(profile3); 176 if(header) 177 IWMHeaderInfo_Release(header); 178 if(header2) 179 IWMHeaderInfo2_Release(header2); 180 if(header3) 181 IWMHeaderInfo3_Release(header3); 182 if(accel) 183 IWMReaderAccelerator_Release(accel); 184 if(timecode) 185 IWMReaderTimecode_Release(timecode); 186 if(netconfig) 187 IWMReaderNetworkConfig_Release(netconfig); 188 if(netconfig2) 189 IWMReaderNetworkConfig2_Release(netconfig2); 190 if(clock) 191 IWMReaderStreamClock_Release(clock); 192 if(negotiation) 193 IWMReaderTypeNegotiation_Release(negotiation); 194 if(playlist) 195 IWMReaderPlaylistBurn_Release(playlist); 196 if(langlist) 197 IWMLanguageList_Release(langlist); 198 if(refclock) 199 IReferenceClock_Release(refclock); 200 201 IWMReader_Release(reader); 202 } 203 204 static void test_profile_manager_interfaces(void) 205 { 206 HRESULT hr; 207 IWMProfileManager *profile; 208 209 hr = WMCreateProfileManager(&profile); 210 ok(hr == S_OK, "WMCreateProfileManager failed 0x%08x\n", hr); 211 if(FAILED(hr)) 212 { 213 win_skip("Failed to create IWMProfileManager\n"); 214 return; 215 } 216 217 IWMProfileManager_Release(profile); 218 } 219 220 static void test_WMCreateWriterPriv(void) 221 { 222 IWMWriter *writer, *writer2; 223 HRESULT hr; 224 225 hr = WMCreateWriterPriv(&writer); 226 ok(hr == S_OK, "got 0x%08x\n", hr); 227 228 hr = IWMWriter_QueryInterface(writer, &IID_IWMWriter, (void**)&writer2); 229 ok(hr == S_OK, "got 0x%08x\n", hr); 230 231 IWMWriter_Release(writer); 232 IWMWriter_Release(writer2); 233 } 234 235 START_TEST(wmvcore) 236 { 237 HRESULT hr; 238 239 hr = CoInitialize(0); 240 ok(hr == S_OK, "failed to init com\n"); 241 if(hr != S_OK) 242 return; 243 244 test_wmreader_interfaces(); 245 test_wmwriter_interfaces(); 246 test_profile_manager_interfaces(); 247 test_WMCreateWriterPriv(); 248 249 CoUninitialize(); 250 } 251