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
9b17bd17
Commit
9b17bd17
authored
Jan 28, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfmediaengine: Improve AddRange() behavior for intersecting ranges.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4c610279
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
115 additions
and
14 deletions
+115
-14
main.c
dlls/mfmediaengine/main.c
+25
-3
mfmediaengine.c
dlls/mfmediaengine/tests/mfmediaengine.c
+90
-11
No files found.
dlls/mfmediaengine/main.c
View file @
9b17bd17
...
@@ -653,13 +653,35 @@ static BOOL WINAPI time_range_ContainsTime(IMFMediaTimeRange *iface, double time
...
@@ -653,13 +653,35 @@ static BOOL WINAPI time_range_ContainsTime(IMFMediaTimeRange *iface, double time
static
HRESULT
WINAPI
time_range_AddRange
(
IMFMediaTimeRange
*
iface
,
double
start
,
double
end
)
static
HRESULT
WINAPI
time_range_AddRange
(
IMFMediaTimeRange
*
iface
,
double
start
,
double
end
)
{
{
struct
time_range
*
range
=
impl_from_IMFMediaTimeRange
(
iface
);
struct
time_range
*
range
=
impl_from_IMFMediaTimeRange
(
iface
);
struct
range
*
c
;
size_t
i
;
TRACE
(
"%p, %.8e, %.8e.
\n
"
,
iface
,
start
,
end
);
TRACE
(
"%p, %.8e, %.8e.
\n
"
,
iface
,
start
,
end
);
if
(
range
->
count
)
for
(
i
=
0
;
i
<
range
->
count
;
++
i
)
{
{
FIXME
(
"Range merging is not implemented.
\n
"
);
c
=
&
range
->
ranges
[
i
];
return
E_NOTIMPL
;
/* New range is fully contained within existing one. */
if
(
c
->
start
<=
start
&&
c
->
end
>=
end
)
return
S_OK
;
/* New range fully contains existing one. */
if
(
c
->
start
>=
start
&&
c
->
end
<=
end
)
{
c
->
start
=
start
;
c
->
end
=
end
;
return
S_OK
;
}
/* Merge if ranges intersect. */
if
((
start
>=
c
->
start
&&
start
<=
c
->
end
)
||
(
end
>=
c
->
start
&&
end
<=
c
->
end
))
{
c
->
start
=
min
(
c
->
start
,
start
);
c
->
end
=
max
(
c
->
end
,
end
);
return
S_OK
;
}
}
}
if
(
!
mf_array_reserve
((
void
**
)
&
range
->
ranges
,
&
range
->
capacity
,
range
->
count
+
1
,
sizeof
(
*
range
->
ranges
)))
if
(
!
mf_array_reserve
((
void
**
)
&
range
->
ranges
,
&
range
->
capacity
,
range
->
count
+
1
,
sizeof
(
*
range
->
ranges
)))
...
...
dlls/mfmediaengine/tests/mfmediaengine.c
View file @
9b17bd17
...
@@ -729,7 +729,6 @@ static void test_time_range(void)
...
@@ -729,7 +729,6 @@ static void test_time_range(void)
ok
(
end
==
1
.
0
,
"Unexpected end %.e.
\n
"
,
end
);
ok
(
end
==
1
.
0
,
"Unexpected end %.e.
\n
"
,
end
);
hr
=
IMFMediaTimeRange_AddRange
(
range
,
2
.
0
,
3
.
0
);
hr
=
IMFMediaTimeRange_AddRange
(
range
,
2
.
0
,
3
.
0
);
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
count
=
IMFMediaTimeRange_GetLength
(
range
);
count
=
IMFMediaTimeRange_GetLength
(
range
);
...
@@ -737,49 +736,129 @@ todo_wine
...
@@ -737,49 +736,129 @@ todo_wine
hr
=
IMFMediaTimeRange_GetStart
(
range
,
0
,
&
start
);
hr
=
IMFMediaTimeRange_GetStart
(
range
,
0
,
&
start
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
start
==
2
.
0
,
"Unexpected start %.8e.
\n
"
,
start
);
ok
(
start
==
2
.
0
,
"Unexpected start %.8e.
\n
"
,
start
);
hr
=
IMFMediaTimeRange_GetEnd
(
range
,
0
,
&
end
);
hr
=
IMFMediaTimeRange_GetEnd
(
range
,
0
,
&
end
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
end
==
3
.
0
,
"Unexpected end %.8e.
\n
"
,
end
);
ok
(
end
==
3
.
0
,
"Unexpected end %.8e.
\n
"
,
end
);
hr
=
IMFMediaTimeRange_AddRange
(
range
,
10
.
0
,
9
.
0
);
hr
=
IMFMediaTimeRange_AddRange
(
range
,
10
.
0
,
9
.
0
);
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
count
=
IMFMediaTimeRange_GetLength
(
range
);
count
=
IMFMediaTimeRange_GetLength
(
range
);
todo_wine
ok
(
count
==
2
,
"Unexpected range count.
\n
"
);
ok
(
count
==
2
,
"Unexpected range count.
\n
"
);
hr
=
IMFMediaTimeRange_GetStart
(
range
,
0
,
&
start
);
hr
=
IMFMediaTimeRange_GetStart
(
range
,
0
,
&
start
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
start
==
2
.
0
,
"Unexpected start %.8e.
\n
"
,
start
);
ok
(
start
==
2
.
0
,
"Unexpected start %.8e.
\n
"
,
start
);
hr
=
IMFMediaTimeRange_GetEnd
(
range
,
0
,
&
end
);
hr
=
IMFMediaTimeRange_GetEnd
(
range
,
0
,
&
end
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
end
==
3
.
0
,
"Unexpected end %.8e.
\n
"
,
end
);
ok
(
end
==
3
.
0
,
"Unexpected end %.8e.
\n
"
,
end
);
start
=
0
.
0
;
start
=
0
.
0
;
hr
=
IMFMediaTimeRange_GetStart
(
range
,
1
,
&
start
);
hr
=
IMFMediaTimeRange_GetStart
(
range
,
1
,
&
start
);
todo_wine
{
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
start
==
10
.
0
,
"Unexpected start %.8e.
\n
"
,
start
);
ok
(
start
==
10
.
0
,
"Unexpected start %.8e.
\n
"
,
start
);
}
hr
=
IMFMediaTimeRange_GetEnd
(
range
,
1
,
&
end
);
hr
=
IMFMediaTimeRange_GetEnd
(
range
,
1
,
&
end
);
todo_wine
{
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
end
==
9
.
0
,
"Unexpected end %.8e.
\n
"
,
end
);
ok
(
end
==
9
.
0
,
"Unexpected end %.8e.
\n
"
,
end
);
}
hr
=
IMFMediaTimeRange_AddRange
(
range
,
2
.
0
,
9
.
1
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
count
=
IMFMediaTimeRange_GetLength
(
range
);
ok
(
count
==
2
,
"Unexpected range count.
\n
"
);
hr
=
IMFMediaTimeRange_GetStart
(
range
,
0
,
&
start
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
start
==
2
.
0
,
"Unexpected start %.8e.
\n
"
,
start
);
hr
=
IMFMediaTimeRange_GetEnd
(
range
,
0
,
&
end
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
end
==
9
.
1
,
"Unexpected end %.8e.
\n
"
,
end
);
hr
=
IMFMediaTimeRange_GetStart
(
range
,
1
,
&
start
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
start
==
10
.
0
,
"Unexpected start %.8e.
\n
"
,
start
);
hr
=
IMFMediaTimeRange_GetEnd
(
range
,
1
,
&
end
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
end
==
9
.
0
,
"Unexpected end %.8e.
\n
"
,
end
);
hr
=
IMFMediaTimeRange_AddRange
(
range
,
8
.
5
,
2
.
5
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
count
=
IMFMediaTimeRange_GetLength
(
range
);
ok
(
count
==
2
,
"Unexpected range count.
\n
"
);
hr
=
IMFMediaTimeRange_GetStart
(
range
,
0
,
&
start
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
start
==
2
.
0
,
"Unexpected start %.8e.
\n
"
,
start
);
hr
=
IMFMediaTimeRange_GetEnd
(
range
,
0
,
&
end
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
end
==
9
.
1
,
"Unexpected end %.8e.
\n
"
,
end
);
hr
=
IMFMediaTimeRange_AddRange
(
range
,
20
.
0
,
20
.
0
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
count
=
IMFMediaTimeRange_GetLength
(
range
);
ok
(
count
==
3
,
"Unexpected range count.
\n
"
);
hr
=
IMFMediaTimeRange_Clear
(
range
);
hr
=
IMFMediaTimeRange_Clear
(
range
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
count
=
IMFMediaTimeRange_GetLength
(
range
);
count
=
IMFMediaTimeRange_GetLength
(
range
);
ok
(
!
count
,
"Unexpected range count.
\n
"
);
ok
(
!
count
,
"Unexpected range count.
\n
"
);
/* Intersect */
hr
=
IMFMediaTimeRange_AddRange
(
range
,
5
.
0
,
10
.
0
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaTimeRange_AddRange
(
range
,
6
.
0
,
12
.
0
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaTimeRange_GetStart
(
range
,
0
,
&
start
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
start
==
5
.
0
,
"Unexpected start %.8e.
\n
"
,
start
);
hr
=
IMFMediaTimeRange_GetEnd
(
range
,
0
,
&
end
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
end
==
12
.
0
,
"Unexpected end %.8e.
\n
"
,
end
);
count
=
IMFMediaTimeRange_GetLength
(
range
);
ok
(
count
==
1
,
"Unexpected range count.
\n
"
);
hr
=
IMFMediaTimeRange_AddRange
(
range
,
4
.
0
,
6
.
0
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
count
=
IMFMediaTimeRange_GetLength
(
range
);
ok
(
count
==
1
,
"Unexpected range count.
\n
"
);
hr
=
IMFMediaTimeRange_GetStart
(
range
,
0
,
&
start
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
start
==
4
.
0
,
"Unexpected start %.8e.
\n
"
,
start
);
hr
=
IMFMediaTimeRange_GetEnd
(
range
,
0
,
&
end
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
end
==
12
.
0
,
"Unexpected end %.8e.
\n
"
,
end
);
hr
=
IMFMediaTimeRange_AddRange
(
range
,
5
.
0
,
3
.
0
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
count
=
IMFMediaTimeRange_GetLength
(
range
);
ok
(
count
==
1
,
"Unexpected range count.
\n
"
);
hr
=
IMFMediaTimeRange_GetStart
(
range
,
0
,
&
start
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
start
==
4
.
0
,
"Unexpected start %.8e.
\n
"
,
start
);
hr
=
IMFMediaTimeRange_GetEnd
(
range
,
0
,
&
end
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
end
==
12
.
0
,
"Unexpected end %.8e.
\n
"
,
end
);
IMFMediaTimeRange_Release
(
range
);
IMFMediaTimeRange_Release
(
range
);
}
}
...
...
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