Commit 86c3d729 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

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: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent a49aa45c
......@@ -13,3 +13,6 @@ C_SRCS = \
videorenderer.c
IDL_SRCS = fil_data.idl
RC_SRCS = \
rsrc.rc
......@@ -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)
......
......@@ -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)
......
/*
* 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"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment