Zebediah Figura : quartz/tests: Add test AVI and MPG files.
Alexandre Julliard
julliard at winehq.org
Fri Nov 10 17:21:27 CST 2017
Module: wine
Branch: master
Commit: 86c3d7293b721f99bd5e67c18fcbc926b23c85f1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=86c3d7293b721f99bd5e67c18fcbc926b23c85f1
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Thu Nov 9 19:09:53 2017 -0600
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 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/quartz/tests/Makefile.in | 3 +++
dlls/quartz/tests/avisplitter.c | 44 ++++++++++++++++++++++++++++++------
dlls/quartz/tests/filtergraph.c | 48 +++++++++++++++++++++++++++++++++++-----
dlls/quartz/tests/rsrc.rc | 27 ++++++++++++++++++++++
dlls/quartz/tests/test.avi | Bin 0 -> 6938 bytes
dlls/quartz/tests/test.mpg | Bin 0 -> 6144 bytes
6 files changed, 110 insertions(+), 12 deletions(-)
diff --git a/dlls/quartz/tests/Makefile.in b/dlls/quartz/tests/Makefile.in
index ebded4b..2ff1b47 100644
--- a/dlls/quartz/tests/Makefile.in
+++ b/dlls/quartz/tests/Makefile.in
@@ -13,3 +13,6 @@ C_SRCS = \
videorenderer.c
IDL_SRCS = fil_data.idl
+
+RC_SRCS = \
+ rsrc.rc
diff --git a/dlls/quartz/tests/avisplitter.c b/dlls/quartz/tests/avisplitter.c
index 874036d..23167b5 100644
--- a/dlls/quartz/tests/avisplitter.c
+++ b/dlls/quartz/tests/avisplitter.c
@@ -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)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index f9c95ae..e66dc40 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -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)
diff --git a/dlls/quartz/tests/rsrc.rc b/dlls/quartz/tests/rsrc.rc
new file mode 100644
index 0000000..9bea5be
--- /dev/null
+++ b/dlls/quartz/tests/rsrc.rc
@@ -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"
diff --git a/dlls/quartz/tests/test.avi b/dlls/quartz/tests/test.avi
new file mode 100644
index 0000000..bec304d
Binary files /dev/null and b/dlls/quartz/tests/test.avi differ
diff --git a/dlls/quartz/tests/test.mpg b/dlls/quartz/tests/test.mpg
new file mode 100644
index 0000000..7fe379a
Binary files /dev/null and b/dlls/quartz/tests/test.mpg differ
More information about the wine-cvs
mailing list