2017-03-31 00:07:06 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2017 Alistair Leslie-Hughes
|
2019-02-27 21:48:36 +01:00
|
|
|
* Copyright 2019 Vijay Kiran Kamuju
|
2017-03-31 00:07:06 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
#define COBJMACROS
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#include "initguid.h"
|
2019-02-21 08:55:56 +01:00
|
|
|
#include "wmsdk.h"
|
2017-03-31 00:07:06 +02:00
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
2017-05-31 03:22:25 +02:00
|
|
|
HRESULT WINAPI WMCreateWriterPriv(IWMWriter **writer);
|
|
|
|
|
2021-03-05 14:19:02 +01:00
|
|
|
#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c)
|
|
|
|
static HRESULT check_interface_(unsigned int line, void *iface, REFIID riid, BOOL supported)
|
|
|
|
{
|
|
|
|
HRESULT hr, expected_hr;
|
|
|
|
IUnknown *unknown = iface, *out;
|
|
|
|
|
|
|
|
expected_hr = supported ? S_OK : E_NOINTERFACE;
|
|
|
|
|
|
|
|
hr = IUnknown_QueryInterface(unknown, riid, (void **)&out);
|
|
|
|
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
IUnknown_Release(out);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2017-03-31 00:07:06 +02:00
|
|
|
static void test_wmwriter_interfaces(void)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
2021-03-05 14:19:02 +01:00
|
|
|
IWMWriter *writer;
|
2017-03-31 00:07:06 +02:00
|
|
|
|
|
|
|
hr = WMCreateWriter( NULL, &writer );
|
|
|
|
ok(hr == S_OK, "WMCreateWriter failed 0x%08x\n", hr);
|
|
|
|
if(FAILED(hr))
|
|
|
|
{
|
|
|
|
win_skip("Failed to create IWMWriter\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-03-05 14:19:02 +01:00
|
|
|
check_interface(writer, &IID_IWMWriterSink, FALSE);
|
2017-03-31 00:07:06 +02:00
|
|
|
|
2021-03-05 14:19:02 +01:00
|
|
|
check_interface(writer, &IID_IWMWriter, TRUE);
|
|
|
|
check_interface(writer, &IID_IWMWriterAdvanced, TRUE);
|
|
|
|
check_interface(writer, &IID_IWMWriterAdvanced2, TRUE);
|
|
|
|
check_interface(writer, &IID_IWMWriterAdvanced3, TRUE);
|
|
|
|
todo_wine check_interface(writer, &IID_IWMWriterPreprocess, TRUE);
|
|
|
|
todo_wine check_interface(writer, &IID_IWMHeaderInfo, TRUE);
|
|
|
|
todo_wine check_interface(writer, &IID_IWMHeaderInfo2, TRUE);
|
|
|
|
todo_wine check_interface(writer, &IID_IWMHeaderInfo3, TRUE);
|
2017-03-31 00:07:06 +02:00
|
|
|
|
|
|
|
IWMWriter_Release(writer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_wmreader_interfaces(void)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
2021-03-05 14:19:02 +01:00
|
|
|
IWMReader *reader;
|
2017-03-31 00:07:06 +02:00
|
|
|
|
|
|
|
hr = WMCreateReader( NULL, 0, &reader );
|
|
|
|
ok(hr == S_OK, "WMCreateReader failed 0x%08x\n", hr);
|
|
|
|
if(FAILED(hr))
|
|
|
|
{
|
|
|
|
win_skip("Failed to create IWMReader\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-03-05 14:19:02 +01:00
|
|
|
check_interface(reader, &IID_IWMDRMReader, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMDRMReader2, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMDRMReader3, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMSyncReader, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMSyncReader2, FALSE);
|
|
|
|
|
|
|
|
check_interface(reader, &IID_IWMReader, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMReaderAdvanced, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMReaderAdvanced2, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMReaderAdvanced3, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMReaderAdvanced4, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMReaderAdvanced5, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMReaderAdvanced6, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMHeaderInfo, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMHeaderInfo2, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMHeaderInfo3, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMProfile, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMProfile2, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMProfile3, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMPacketSize, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMPacketSize2, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMReaderAccelerator, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMReaderTimecode, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMReaderNetworkConfig, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMReaderNetworkConfig2, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMReaderStreamClock, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMReaderTypeNegotiation, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMReaderPlaylistBurn, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMLanguageList, TRUE);
|
|
|
|
check_interface(reader, &IID_IReferenceClock, TRUE);
|
2017-03-31 00:07:06 +02:00
|
|
|
|
|
|
|
IWMReader_Release(reader);
|
|
|
|
}
|
|
|
|
|
2019-02-27 21:48:36 +01:00
|
|
|
static void test_wmsyncreader_interfaces(void)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
2021-03-05 14:19:02 +01:00
|
|
|
IWMSyncReader *reader;
|
2019-02-27 21:48:36 +01:00
|
|
|
|
|
|
|
hr = WMCreateSyncReader( NULL, 0, &reader );
|
2019-03-02 12:29:55 +01:00
|
|
|
ok(hr == S_OK, "WMCreateSyncReader failed 0x%08x\n", hr);
|
2019-02-27 21:48:36 +01:00
|
|
|
if(FAILED(hr))
|
|
|
|
{
|
2019-03-02 12:29:55 +01:00
|
|
|
win_skip("Failed to create IWMSyncReader\n");
|
2019-02-27 21:48:36 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-03-05 14:19:02 +01:00
|
|
|
check_interface(reader, &IID_IWMDRMReader, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMDRMReader2, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMDRMReader3, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMReader, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMReaderAccelerator, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMReaderAdvanced, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMReaderAdvanced2, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMReaderAdvanced3, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMReaderAdvanced4, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMReaderAdvanced5, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMReaderAdvanced6, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMReaderNetworkConfig, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMReaderNetworkConfig2, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMReaderStreamClock, FALSE);
|
|
|
|
check_interface(reader, &IID_IWMReaderTypeNegotiation, FALSE);
|
|
|
|
check_interface(reader, &IID_IReferenceClock, FALSE);
|
|
|
|
|
|
|
|
check_interface(reader, &IID_IWMSyncReader, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMSyncReader2, TRUE);
|
|
|
|
todo_wine check_interface(reader, &IID_IWMHeaderInfo, TRUE);
|
|
|
|
todo_wine check_interface(reader, &IID_IWMHeaderInfo2, TRUE);
|
|
|
|
todo_wine check_interface(reader, &IID_IWMHeaderInfo3, TRUE);
|
2021-03-05 14:19:03 +01:00
|
|
|
check_interface(reader, &IID_IWMProfile, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMProfile2, TRUE);
|
|
|
|
check_interface(reader, &IID_IWMProfile3, TRUE);
|
2021-03-05 14:19:02 +01:00
|
|
|
todo_wine check_interface(reader, &IID_IWMPacketSize, TRUE);
|
|
|
|
todo_wine check_interface(reader, &IID_IWMPacketSize2, TRUE);
|
|
|
|
todo_wine check_interface(reader, &IID_IWMReaderTimecode, TRUE);
|
|
|
|
todo_wine check_interface(reader, &IID_IWMReaderPlaylistBurn, TRUE);
|
|
|
|
todo_wine check_interface(reader, &IID_IWMLanguageList, TRUE);
|
2019-02-27 21:48:36 +01:00
|
|
|
|
|
|
|
IWMSyncReader_Release(reader);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-04 11:38:44 +02:00
|
|
|
static void test_profile_manager_interfaces(void)
|
2017-03-31 00:07:06 +02:00
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
IWMProfileManager *profile;
|
|
|
|
|
|
|
|
hr = WMCreateProfileManager(&profile);
|
|
|
|
ok(hr == S_OK, "WMCreateProfileManager failed 0x%08x\n", hr);
|
|
|
|
if(FAILED(hr))
|
|
|
|
{
|
|
|
|
win_skip("Failed to create IWMProfileManager\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
IWMProfileManager_Release(profile);
|
|
|
|
}
|
|
|
|
|
2017-05-31 03:22:25 +02:00
|
|
|
static void test_WMCreateWriterPriv(void)
|
|
|
|
{
|
|
|
|
IWMWriter *writer, *writer2;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = WMCreateWriterPriv(&writer);
|
|
|
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
|
|
|
|
|
|
|
hr = IWMWriter_QueryInterface(writer, &IID_IWMWriter, (void**)&writer2);
|
|
|
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
|
|
|
|
|
|
|
IWMWriter_Release(writer);
|
|
|
|
IWMWriter_Release(writer2);
|
|
|
|
}
|
|
|
|
|
2019-02-21 08:55:56 +01:00
|
|
|
static void test_urlextension(void)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = WMCheckURLExtension(NULL);
|
|
|
|
ok(hr == E_INVALIDARG, "WMCheckURLExtension failed 0x%08x\n", hr);
|
2020-12-09 23:00:07 +01:00
|
|
|
hr = WMCheckURLExtension(L"test.mkv");
|
2019-02-21 08:55:56 +01:00
|
|
|
ok(hr == NS_E_INVALID_NAME, "WMCheckURLExtension failed 0x%08x\n", hr);
|
2020-12-09 23:00:07 +01:00
|
|
|
hr = WMCheckURLExtension(L"test.mp3");
|
2019-02-21 08:55:56 +01:00
|
|
|
todo_wine ok(hr == S_OK, "WMCheckURLExtension failed 0x%08x\n", hr);
|
2020-12-09 23:00:07 +01:00
|
|
|
hr = WMCheckURLExtension(L"abcd://test/test.wmv");
|
2019-02-21 08:55:56 +01:00
|
|
|
todo_wine ok(hr == S_OK, "WMCheckURLExtension failed 0x%08x\n", hr);
|
2020-12-09 23:00:07 +01:00
|
|
|
hr = WMCheckURLExtension(L"http://test/t.asf?alt=t.mkv");
|
2019-02-21 08:55:56 +01:00
|
|
|
todo_wine ok(hr == S_OK, "WMCheckURLExtension failed 0x%08x\n", hr);
|
|
|
|
}
|
|
|
|
|
2020-02-29 21:55:59 +01:00
|
|
|
static void test_iscontentprotected(void)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
BOOL drm;
|
|
|
|
|
|
|
|
hr = WMIsContentProtected(NULL, NULL);
|
|
|
|
ok(hr == E_INVALIDARG, "WMIsContentProtected failed 0x%08x\n", hr);
|
|
|
|
hr = WMIsContentProtected(NULL, &drm);
|
|
|
|
ok(hr == E_INVALIDARG, "WMIsContentProtected failed 0x%08x\n", hr);
|
2020-12-09 23:00:07 +01:00
|
|
|
hr = WMIsContentProtected(L"test.mp3", NULL);
|
2020-02-29 21:55:59 +01:00
|
|
|
ok(hr == E_INVALIDARG, "WMIsContentProtected failed 0x%08x\n", hr);
|
2020-12-09 23:00:07 +01:00
|
|
|
hr = WMIsContentProtected(L"test.mp3", &drm);
|
2020-02-29 21:55:59 +01:00
|
|
|
ok(hr == S_FALSE, "WMIsContentProtected failed 0x%08x\n", hr);
|
|
|
|
ok(drm == FALSE, "got %0dx\n", drm);
|
|
|
|
}
|
|
|
|
|
2017-03-31 00:07:06 +02:00
|
|
|
START_TEST(wmvcore)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CoInitialize(0);
|
|
|
|
ok(hr == S_OK, "failed to init com\n");
|
|
|
|
if(hr != S_OK)
|
|
|
|
return;
|
|
|
|
|
|
|
|
test_wmreader_interfaces();
|
2019-02-27 21:48:36 +01:00
|
|
|
test_wmsyncreader_interfaces();
|
2017-03-31 00:07:06 +02:00
|
|
|
test_wmwriter_interfaces();
|
|
|
|
test_profile_manager_interfaces();
|
2017-05-31 03:22:25 +02:00
|
|
|
test_WMCreateWriterPriv();
|
2019-02-21 08:55:56 +01:00
|
|
|
test_urlextension();
|
2020-02-29 21:55:59 +01:00
|
|
|
test_iscontentprotected();
|
2017-03-31 00:07:06 +02:00
|
|
|
|
|
|
|
CoUninitialize();
|
|
|
|
}
|