quartz/tests: Add test AVI and MPG files.

Generated with ffmpeg using the following commands:

ffmpeg -f lavfi -i smptebars -t 1 -r 1 -f avi -vcodec rawvideo -pix_fmt yuv420p -vf scale=32x24 test.avi
ffmpeg -f lavfi -i smptebars -f lavfi -i "sine=frequency=1000" -t 0.04 -r 25 -f mpeg -vcodec mpeg1video -vf scale=32x24 -acodec mp2 test.mpg

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2017-11-09 19:09:53 -06:00 committed by Alexandre Julliard
parent a49aa45c2b
commit 86c3d7293b
6 changed files with 110 additions and 12 deletions

View File

@ -13,3 +13,6 @@ C_SRCS = \
videorenderer.c
IDL_SRCS = fil_data.idl
RC_SRCS = \
rsrc.rc

View File

@ -270,8 +270,32 @@ static void test_filesourcefilter(void)
}
}
static const WCHAR wfile[] = {'t','e','s','t','.','a','v','i',0};
static const char afile[] = "test.avi";
static const WCHAR avifile[] = {'t','e','s','t','.','a','v','i',0};
static WCHAR *load_resource(const WCHAR *name)
{
static WCHAR pathW[MAX_PATH];
DWORD written;
HANDLE file;
HRSRC res;
void *ptr;
GetTempPathW(sizeof(pathW)/sizeof(WCHAR), 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_filter_graph(void)
{
@ -286,11 +310,14 @@ static void test_filter_graph(void)
DWORD readbytes;
FILTER_STATE state;
file = CreateFileW(wfile, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE,
WCHAR *filename = load_resource(avifile);
file = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
if (file == INVALID_HANDLE_VALUE)
{
skip("Could not read test file \"%s\", skipping test\n", afile);
skip("Could not read test file \"%s\", skipping test\n", wine_dbgstr_w(filename));
DeleteFileW(filename);
return;
}
@ -301,7 +328,8 @@ static void test_filter_graph(void)
if (strncmp(buffer, "RIFF", 4) || strcmp(buffer + 8, "AVI "))
{
skip("%s is not an avi riff file, not doing the avi splitter test\n",
afile);
wine_dbgstr_w(filename));
DeleteFileW(filename);
return;
}
@ -331,10 +359,10 @@ static void test_filter_graph(void)
if (hr != S_OK)
goto fail;
hr = IFileSourceFilter_Load(pfile, wfile, NULL);
hr = IFileSourceFilter_Load(pfile, filename, NULL);
if (hr != S_OK)
{
trace("Could not load file\n");
trace("Could not load file: %08x\n", hr);
goto fail;
}
@ -509,6 +537,8 @@ fail:
IBaseFilter_Release(pavi);
if (pfile)
IFileSourceFilter_Release(pfile);
DeleteFileW(filename);
}
START_TEST(avisplitter)

View File

@ -42,6 +42,31 @@ typedef struct TestFilterImpl
static const WCHAR avifile[] = {'t','e','s','t','.','a','v','i',0};
static const WCHAR mpegfile[] = {'t','e','s','t','.','m','p','g',0};
static WCHAR *load_resource(const WCHAR *name)
{
static WCHAR pathW[MAX_PATH];
DWORD written;
HANDLE file;
HRSRC res;
void *ptr;
GetTempPathW(sizeof(pathW)/sizeof(WCHAR), 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 IGraphBuilder *pgraph;
static int createfiltergraph(void)
@ -355,26 +380,39 @@ static void test_render_run(const WCHAR *file)
HANDLE h;
HRESULT hr;
h = CreateFileW(file, 0, 0, NULL, OPEN_EXISTING, 0, NULL);
WCHAR *filename = load_resource(file);
h = CreateFileW(filename, 0, 0, NULL, OPEN_EXISTING, 0, NULL);
if (h == INVALID_HANDLE_VALUE) {
skip("Could not read test file %s, skipping test\n", wine_dbgstr_w(file));
DeleteFileW(filename);
return;
}
CloseHandle(h);
if (!createfiltergraph())
{
DeleteFileW(filename);
return;
}
hr = IGraphBuilder_RenderFile(pgraph, file, NULL);
ok(hr == S_OK, "RenderFile returned: %x\n", hr);
rungraph();
hr = IGraphBuilder_RenderFile(pgraph, filename, NULL);
if (hr == VFW_E_CANNOT_RENDER)
skip("%s: codec not supported; skipping test\n", wine_dbgstr_w(file));
else
{
ok(hr == S_OK || hr == VFW_S_AUDIO_NOT_RENDERED, "RenderFile failed: %x\n", hr);
rungraph();
}
releasefiltergraph();
/* check reference leaks */
h = CreateFileW(file, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
h = CreateFileW(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
ok(h != INVALID_HANDLE_VALUE, "CreateFile failed: err=%d\n", GetLastError());
CloseHandle(h);
DeleteFileW(filename);
}
static DWORD WINAPI call_RenderFile_multithread(LPVOID lParam)

27
dlls/quartz/tests/rsrc.rc Normal file
View File

@ -0,0 +1,27 @@
/*
* Resource file for quartz tests.
*
* Copyright 2017 Zebediah Figura
*
* 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"
/* @makedep: test.avi */
test.avi RCDATA "test.avi"
/* @makedep: test.mpg */
test.mpg RCDATA "test.mpg"

BIN
dlls/quartz/tests/test.avi Normal file

Binary file not shown.

BIN
dlls/quartz/tests/test.mpg Normal file

Binary file not shown.