Signed-off-by: Matthew Harm Bekkema id@mbekkema.name --- dlls/wmvcore/tests/Makefile.in | 3 + dlls/wmvcore/tests/rsrc.rc | 23 +++++++ dlls/wmvcore/tests/test.mp3 | Bin 0 -> 24494 bytes dlls/wmvcore/tests/wmvcore.c | 113 +++++++++++++++++++++++++++++++++ 4 files changed, 139 insertions(+) create mode 100644 dlls/wmvcore/tests/rsrc.rc create mode 100644 dlls/wmvcore/tests/test.mp3
diff --git a/dlls/wmvcore/tests/Makefile.in b/dlls/wmvcore/tests/Makefile.in index 8054ddd..856e02d 100644 --- a/dlls/wmvcore/tests/Makefile.in +++ b/dlls/wmvcore/tests/Makefile.in @@ -3,3 +3,6 @@ IMPORTS = ole32 wmvcore
C_SRCS = \ wmvcore.c + +RC_SRCS = \ + rsrc.rc diff --git a/dlls/wmvcore/tests/rsrc.rc b/dlls/wmvcore/tests/rsrc.rc new file mode 100644 index 0000000..517cb22 --- /dev/null +++ b/dlls/wmvcore/tests/rsrc.rc @@ -0,0 +1,23 @@ +/* + * Resource file for wmvcore tests. + * + * 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 + */ + +#include "windef.h" + +/* ffmpeg -f lavfi -i anullsrc -t 3 -acodec libmp3lame -b:a 64k dlls/wmvcore/tests/test.mp3 */ +/* @makedep: test.mp3 */ +test.mp3 RCDATA "test.mp3" diff --git a/dlls/wmvcore/tests/test.mp3 b/dlls/wmvcore/tests/test.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..5328ce2425e41393626cf01a5423d828471f469f GIT binary patch literal 24494 zcmeI&Z)BBG9Ki8kYcgZ5UPLk(l~gu&w$+$PYU$>dtMx32Rd!t_wHM3GB+Vp|>O~?m zdo$A#y+{)2#f)U8H%T&jkwlWrGIM2}Xa5>^ryQqW?sI(~*L}|Od;EURdCuoN&zqAt zP*W`7vE_JkbCWs8MAjzHc4g}JRMpp1RmbD=cNhNVvZ)nUt2YxDG9BiQDI*s}PWQ^X zlG3u+`VAX5m2a-twtdI0%6RSW`i926`wt#EoIIKePMkc|dM2G|KX<;Pv#Y!3(&fIZ z*RJ2VdHc@Yd;J50L&NtUJbd){$<t@gUyP2ud^JAt`pw&S?<YTe{Pg+D*KbolW@fWL z!=9Kvx0yayuk5dEEt(GRh5cwr?5td9|Nb}QNlWazNV|!Zh?G@`tTDeKb7`8jS44`F z`;IgPK@gtiABSn@?J<`<mTvjWc$PXJnE{P3prtv>!*fWE8Op<nS?&@u6n@2)A4eWG zm?389KeL1!<RItw1Xx3?AwNOR*^q;rGaA1H$U)9ekaITVAm@z6F9C9p^AqHp4LQg; zqw!0C9OV22IcGx-a?WV{5+DaTKS9pfkb|5v8ova{6%e^dY{m*4$VFv9sr1OLKkxrr zT&0m1ki!H;XG0^q%ltkRy4jE`pwAF51>MDBsm>Z=4OwVtg&_wyEnAklkb|6shE^DI zkkhhdsS7#CS!ig5AqP1vTb8<zgPetiRv2=S)3Rl$3pvPHXlR8Y2RSWUmb#FGoP~x~ z7;=!)vSq0YImlUPXoVffMPhdu`~O%%T5H8p*I@~<cggY$b;HaMF9ls;In^Ntxf~R_ d0mwm4S6EJU$U!a#g>JxwoNiD4QT2iw&@UK&&2s<%
literal 0 HcmV?d00001
diff --git a/dlls/wmvcore/tests/wmvcore.c b/dlls/wmvcore/tests/wmvcore.c index 2b5a455..273af70 100644 --- a/dlls/wmvcore/tests/wmvcore.c +++ b/dlls/wmvcore/tests/wmvcore.c @@ -1,6 +1,7 @@ /* * Copyright 2017 Alistair Leslie-Hughes * Copyright 2019 Vijay Kiran Kamuju + * Copyright 2020 Matthew Harm Bekkema * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,8 +24,38 @@
#include "wine/test.h"
+DEFINE_GUID(WMMEDIATYPE_Audio, 0x73647561,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71); +DEFINE_GUID(WMMEDIASUBTYPE_PCM, 0x00000001,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71); +DEFINE_GUID(WMFORMAT_WaveFormatEx, 0x05589f81,0xc356,0x11ce,0xbf,0x01,0x00,0xaa,0x00,0x55,0x59,0x5a); + HRESULT WINAPI WMCreateWriterPriv(IWMWriter **writer);
+static const WCHAR mp3file[] = {'t','e','s','t','.','m','p','3',0}; +static inline WCHAR *load_resource(const WCHAR *name) +{ + static WCHAR pathW[MAX_PATH]; + DWORD written; + HANDLE file; + HRSRC res; + void *ptr; + + GetTempPathW(ARRAY_SIZE(pathW), pathW); + lstrcatW(pathW, name); + + file = CreateFileW(pathW, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); + ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n", wine_dbgstr_w(pathW), + GetLastError()); + + res = FindResourceW(NULL, name, (LPCWSTR)RT_RCDATA); + ok( res != 0, "couldn't find resource\n" ); + ptr = LockResource( LoadResource( GetModuleHandleA(NULL), res )); + WriteFile( file, ptr, SizeofResource( GetModuleHandleA(NULL), res ), &written, NULL ); + ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't write resource\n" ); + CloseHandle( file ); + + return pathW; +} + static void test_wmwriter_interfaces(void) { HRESULT hr; @@ -355,6 +386,87 @@ static void test_iscontentprotected(void) ok(drm == FALSE, "got %0dx\n", drm); }
+static void test_wmsyncreader_mp3_props(void) +{ + const WCHAR *filename; + HRESULT hr; + IWMSyncReader *reader; + IWMOutputMediaProps *output_props = NULL; + DWORD type_size = 0; + WM_MEDIA_TYPE *type; + WAVEFORMATEX *format; + ULONG ref; + + hr = WMCreateSyncReader( NULL, 0, &reader ); + ok(hr == S_OK, "WMCreateSyncReader failed 0x%08x\n", hr); + if(FAILED(hr)) + { + win_skip("Failed to create IWMSyncReader\n"); + return; + } + + filename = load_resource(mp3file); + hr = IWMSyncReader_Open(reader, filename); + todo_wine ok(hr == S_OK, "Failed 0x%08x\n", hr); + + hr = IWMSyncReader_GetOutputProps(reader, 0, &output_props); + todo_wine ok(hr == S_OK, "Failed 0x%08x\n", hr); + if(FAILED(hr)) + { + todo_wine win_skip("Failed to get IWMOutputMediaProps\n"); + goto cleanup_reader; + } + + hr = IWMOutputMediaProps_GetMediaType(output_props, NULL, &type_size); + todo_wine ok(hr == S_OK, "Failed 0x%08x\n", hr); + + type = malloc(type_size); + + hr = IWMOutputMediaProps_GetMediaType(output_props, type, &type_size); + todo_wine ok(hr == S_OK, "Failed 0x%08x\n", hr); + if(FAILED(hr)) + { + todo_wine win_skip("Failed to get WM_MEDIA_TYPE\n"); + goto cleanup_type; + } + + todo_wine ok(IsEqualGUID(&type->majortype, &WMMEDIATYPE_Audio), + "Incorrect media majortype %s\n", debugstr_guid(&type->majortype)); + todo_wine ok(IsEqualGUID(&type->subtype, &WMMEDIASUBTYPE_PCM), + "Incorrect media subtype %s\n", debugstr_guid(&type->subtype)); + todo_wine ok(IsEqualGUID(&type->formattype, &WMFORMAT_WaveFormatEx), + "Incorrect media formattype %s\n", debugstr_guid(&type->formattype)); + + format = (WAVEFORMATEX*)type->pbFormat; + + todo_wine ok(format->wFormatTag == WAVE_FORMAT_PCM, "Incorrect wFormatTag %u\n", + format->wFormatTag); + todo_wine ok(format->nChannels == 2, "Incorrect nChannels %u\n", format->nChannels); + todo_wine ok(format->nSamplesPerSec == 44100, "Incorrect nSamplesPerSec %u\n", + format->nSamplesPerSec); + todo_wine ok(format->nAvgBytesPerSec == format->nSamplesPerSec * format->nBlockAlign, + "Incorrect nAvgBytesPerSec %u != %u * %u\n", + format->nAvgBytesPerSec, format->nSamplesPerSec, format->nBlockAlign); + todo_wine ok(format->nBlockAlign == format->nChannels * format->wBitsPerSample / 8, + "Incorrect nBlockAlign %u != %u * %u / 8\n", + format->nBlockAlign, format->nChannels, format->wBitsPerSample); + todo_wine ok(format->wBitsPerSample == 16, + "Incorrect wBitesPerSample %u\n", format->wBitsPerSample); + +cleanup_type: + free(type); + + ref = IWMOutputMediaProps_Release(output_props); + ok(ref == 0, "Got unexpected refcount %d.\n", ref); + +cleanup_reader: + hr = IWMSyncReader_Close(reader); + todo_wine ok(hr == S_OK, "Failed 0x%08x\n", hr); + + DeleteFileW(filename); + IWMSyncReader_Release(reader); +} + START_TEST(wmvcore) { HRESULT hr; @@ -371,6 +483,7 @@ START_TEST(wmvcore) test_WMCreateWriterPriv(); test_urlextension(); test_iscontentprotected(); + test_wmsyncreader_mp3_props();
CoUninitialize(); }