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
34dbb2c8
Commit
34dbb2c8
authored
Feb 19, 2021
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mf/tests: Add a sample copier test for sample fields handling.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a67d7c15
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
2 deletions
+54
-2
mf.c
dlls/mf/tests/mf.c
+54
-2
No files found.
dlls/mf/tests/mf.c
View file @
34dbb2c8
...
...
@@ -4918,20 +4918,51 @@ static void test_sample_copier(void)
IMFTransform_Release
(
copier
);
}
struct
sample_metadata
{
unsigned
int
flags
;
LONGLONG
duration
;
LONGLONG
time
;
};
static
void
sample_copier_process
(
IMFTransform
*
copier
,
IMFMediaBuffer
*
input_buffer
,
IMFMediaBuffer
*
output_buffer
)
IMFMediaBuffer
*
output_buffer
,
const
struct
sample_metadata
*
md
)
{
static
const
struct
sample_metadata
zero_md
=
{
0
,
~
0u
,
~
0u
};
IMFSample
*
input_sample
,
*
output_sample
;
MFT_OUTPUT_DATA_BUFFER
buffer
;
unsigned
int
flags
;
LONGLONG
time
;
DWORD
status
;
HRESULT
hr
;
hr
=
MFCreateSample
(
&
input_sample
);
ok
(
hr
==
S_OK
,
"Failed to create a sample, hr %#x.
\n
"
,
hr
);
if
(
md
)
{
hr
=
IMFSample_SetSampleFlags
(
input_sample
,
md
->
flags
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFSample_SetSampleTime
(
input_sample
,
md
->
time
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFSample_SetSampleDuration
(
input_sample
,
md
->
duration
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
}
hr
=
MFCreateSample
(
&
output_sample
);
ok
(
hr
==
S_OK
,
"Failed to create a sample, hr %#x.
\n
"
,
hr
);
hr
=
IMFSample_SetSampleFlags
(
output_sample
,
~
0u
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFSample_SetSampleTime
(
output_sample
,
~
0u
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFSample_SetSampleDuration
(
output_sample
,
~
0u
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFSample_AddBuffer
(
input_sample
,
input_buffer
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
...
...
@@ -4947,6 +4978,18 @@ static void sample_copier_process(IMFTransform *copier, IMFMediaBuffer *input_bu
hr
=
IMFTransform_ProcessOutput
(
copier
,
0
,
1
,
&
buffer
,
&
status
);
ok
(
hr
==
S_OK
,
"Failed to get output, hr %#x.
\n
"
,
hr
);
if
(
!
md
)
md
=
&
zero_md
;
hr
=
IMFSample_GetSampleFlags
(
output_sample
,
&
flags
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
md
->
flags
==
flags
,
"Unexpected flags.
\n
"
);
hr
=
IMFSample_GetSampleTime
(
output_sample
,
&
time
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
md
->
time
==
time
,
"Unexpected time.
\n
"
);
hr
=
IMFSample_GetSampleDuration
(
output_sample
,
&
time
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
md
->
duration
==
time
,
"Unexpected duration.
\n
"
);
IMFSample_Release
(
input_sample
);
IMFSample_Release
(
output_sample
);
}
...
...
@@ -4955,6 +4998,7 @@ static void test_sample_copier_output_processing(void)
{
IMFMediaBuffer
*
input_buffer
,
*
output_buffer
;
MFT_OUTPUT_STREAM_INFO
output_info
;
struct
sample_metadata
md
;
IMFMediaType
*
mediatype
;
IMFTransform
*
copier
;
DWORD
max_length
;
...
...
@@ -5007,7 +5051,7 @@ static void test_sample_copier_output_processing(void)
hr
=
IMFMediaBuffer_SetCurrentLength
(
input_buffer
,
4
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
sample_copier_process
(
copier
,
input_buffer
,
output_buffer
);
sample_copier_process
(
copier
,
input_buffer
,
output_buffer
,
NULL
);
hr
=
IMFMediaBuffer_Lock
(
output_buffer
,
&
ptr
,
&
max_length
,
NULL
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
...
...
@@ -5016,6 +5060,14 @@ static void test_sample_copier_output_processing(void)
hr
=
IMFMediaBuffer_Unlock
(
output_buffer
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
md
.
flags
=
123
;
md
.
time
=
10
;
md
.
duration
=
2
;
sample_copier_process
(
copier
,
input_buffer
,
output_buffer
,
&
md
);
IMFMediaBuffer_Release
(
input_buffer
);
IMFMediaBuffer_Release
(
output_buffer
);
IMFMediaType_Release
(
mediatype
);
IMFTransform_Release
(
copier
);
}
...
...
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