Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
613d7b09
Commit
613d7b09
authored
Aug 04, 2023
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Aug 08, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfmediaengine/tests: Test IMFMediaEngine::GetDuration().
parent
6b8ecfd2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
mfmediaengine.c
dlls/mfmediaengine/tests/mfmediaengine.c
+41
-0
No files found.
dlls/mfmediaengine/tests/mfmediaengine.c
View file @
613d7b09
...
...
@@ -17,6 +17,7 @@
*/
#include <stdarg.h>
#include <math.h>
#define COBJMACROS
...
...
@@ -66,6 +67,11 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
IUnknown_Release
(
unk
);
}
static
BOOL
compare_double
(
double
a
,
double
b
,
double
allowed_error
)
{
return
fabs
(
a
-
b
)
<=
allowed_error
;
}
static
DWORD
compare_rgb32
(
const
BYTE
*
data
,
DWORD
*
length
,
const
RECT
*
rect
,
const
BYTE
*
expect
)
{
DWORD
x
,
y
,
size
,
diff
=
0
,
width
=
(
rect
->
right
+
0xf
)
&
~
0xf
,
height
=
(
rect
->
bottom
+
0xf
)
&
~
0xf
;
...
...
@@ -1931,6 +1937,40 @@ done:
IMFMediaEngineNotify_Release
(
&
notify
->
IMFMediaEngineNotify_iface
);
}
static
void
test_GetDuration
(
void
)
{
static
const
double
allowed_error
=
0
.
000001
;
struct
test_transfer_notify
*
notify
;
IMFMediaEngineEx
*
media_engine
;
IMFByteStream
*
stream
;
double
duration
;
HRESULT
hr
;
DWORD
res
;
BSTR
url
;
notify
=
create_transfer_notify
();
media_engine
=
create_media_engine_ex
(
&
notify
->
IMFMediaEngineNotify_iface
,
NULL
,
DXGI_FORMAT_B8G8R8X8_UNORM
);
notify
->
media_engine
=
media_engine
;
ok
(
!!
media_engine
,
"create_media_engine_ex failed.
\n
"
);
stream
=
load_resource
(
L"i420-64x64.avi"
,
L"video/avi"
);
url
=
SysAllocString
(
L"i420-64x64.avi"
);
hr
=
IMFMediaEngineEx_SetSourceFromByteStream
(
media_engine
,
stream
,
url
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
res
=
WaitForSingleObject
(
notify
->
ready_event
,
5000
);
ok
(
!
res
,
"Unexpected res %#lx.
\n
"
,
res
);
duration
=
IMFMediaEngineEx_GetDuration
(
media_engine
);
todo_wine
ok
(
compare_double
(
duration
,
0
.
133467
,
allowed_error
),
"Got unexpected duration %lf.
\n
"
,
duration
);
SysFreeString
(
url
);
IMFByteStream_Release
(
stream
);
IMFMediaEngineEx_Shutdown
(
media_engine
);
IMFMediaEngineEx_Release
(
media_engine
);
IMFMediaEngineNotify_Release
(
&
notify
->
IMFMediaEngineNotify_iface
);
}
START_TEST
(
mfmediaengine
)
{
HRESULT
hr
;
...
...
@@ -1963,6 +2003,7 @@ START_TEST(mfmediaengine)
test_audio_configuration
();
test_TransferVideoFrame
();
test_effect
();
test_GetDuration
();
IMFMediaEngineClassFactory_Release
(
factory
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment