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
59f3337a
Commit
59f3337a
authored
Oct 07, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
evr/presenter: Update cached native size on format negotiation.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
95dcc559
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
49 deletions
+71
-49
presenter.c
dlls/evr/presenter.c
+71
-47
evr.c
dlls/evr/tests/evr.c
+0
-2
No files found.
dlls/evr/presenter.c
View file @
59f3337a
...
...
@@ -103,6 +103,58 @@ static struct video_presenter *impl_from_IMFGetService(IMFGetService *iface)
return
CONTAINING_RECORD
(
iface
,
struct
video_presenter
,
IMFGetService_iface
);
}
static
unsigned
int
get_gcd
(
unsigned
int
a
,
unsigned
int
b
)
{
unsigned
int
m
;
while
(
b
)
{
m
=
a
%
b
;
a
=
b
;
b
=
m
;
}
return
a
;
}
static
void
video_presenter_get_native_video_size
(
struct
video_presenter
*
presenter
)
{
IMFMediaType
*
media_type
;
UINT64
frame_size
=
0
;
memset
(
&
presenter
->
native_size
,
0
,
sizeof
(
presenter
->
native_size
));
memset
(
&
presenter
->
native_ratio
,
0
,
sizeof
(
presenter
->
native_ratio
));
if
(
!
presenter
->
mixer
)
return
;
if
(
FAILED
(
IMFTransform_GetInputCurrentType
(
presenter
->
mixer
,
0
,
&
media_type
)))
return
;
if
(
SUCCEEDED
(
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_FRAME_SIZE
,
&
frame_size
)))
{
unsigned
int
gcd
;
presenter
->
native_size
.
cx
=
frame_size
>>
32
;
presenter
->
native_size
.
cy
=
frame_size
;
if
((
gcd
=
get_gcd
(
presenter
->
native_size
.
cx
,
presenter
->
native_size
.
cy
)))
{
presenter
->
native_ratio
.
cx
=
presenter
->
native_size
.
cx
/
gcd
;
presenter
->
native_ratio
.
cy
=
presenter
->
native_size
.
cy
/
gcd
;
}
}
IMFMediaType_Release
(
media_type
);
}
static
HRESULT
video_presenter_invalidate_media_type
(
struct
video_presenter
*
presenter
)
{
video_presenter_get_native_video_size
(
presenter
);
return
S_OK
;
}
static
HRESULT
WINAPI
video_presenter_inner_QueryInterface
(
IUnknown
*
iface
,
REFIID
riid
,
void
**
obj
)
{
struct
video_presenter
*
presenter
=
impl_from_IUnknown
(
iface
);
...
...
@@ -277,9 +329,26 @@ static HRESULT WINAPI video_presenter_OnClockSetRate(IMFVideoPresenter *iface, M
static
HRESULT
WINAPI
video_presenter_ProcessMessage
(
IMFVideoPresenter
*
iface
,
MFVP_MESSAGE_TYPE
message
,
ULONG_PTR
param
)
{
FIXME
(
"%p, %d, %lu.
\n
"
,
iface
,
message
,
param
);
struct
video_presenter
*
presenter
=
impl_from_IMFVideoPresenter
(
iface
);
HRESULT
hr
;
return
E_NOTIMPL
;
TRACE
(
"%p, %d, %lu.
\n
"
,
iface
,
message
,
param
);
EnterCriticalSection
(
&
presenter
->
cs
);
switch
(
message
)
{
case
MFVP_MESSAGE_INVALIDATEMEDIATYPE
:
hr
=
video_presenter_invalidate_media_type
(
presenter
);
break
;
default:
FIXME
(
"Unsupported message %u.
\n
"
,
message
);
hr
=
E_NOTIMPL
;
}
LeaveCriticalSection
(
&
presenter
->
cs
);
return
hr
;
}
static
HRESULT
WINAPI
video_presenter_GetCurrentMediaType
(
IMFVideoPresenter
*
iface
,
IMFVideoMediaType
**
media_type
)
...
...
@@ -379,51 +448,6 @@ static void video_presenter_set_mixer_rect(struct video_presenter *presenter)
}
}
static
unsigned
int
get_gcd
(
unsigned
int
a
,
unsigned
int
b
)
{
unsigned
int
m
;
while
(
b
)
{
m
=
a
%
b
;
a
=
b
;
b
=
m
;
}
return
a
;
}
static
void
video_presenter_get_native_video_size
(
struct
video_presenter
*
presenter
)
{
IMFMediaType
*
media_type
;
UINT64
frame_size
=
0
;
memset
(
&
presenter
->
native_size
,
0
,
sizeof
(
presenter
->
native_size
));
memset
(
&
presenter
->
native_ratio
,
0
,
sizeof
(
presenter
->
native_ratio
));
if
(
!
presenter
->
mixer
)
return
;
if
(
FAILED
(
IMFTransform_GetInputCurrentType
(
presenter
->
mixer
,
0
,
&
media_type
)))
return
;
if
(
SUCCEEDED
(
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_FRAME_SIZE
,
&
frame_size
)))
{
unsigned
int
gcd
;
presenter
->
native_size
.
cx
=
frame_size
>>
32
;
presenter
->
native_size
.
cy
=
frame_size
;
if
((
gcd
=
get_gcd
(
presenter
->
native_size
.
cx
,
presenter
->
native_size
.
cy
)))
{
presenter
->
native_ratio
.
cx
=
presenter
->
native_size
.
cx
/
gcd
;
presenter
->
native_ratio
.
cy
=
presenter
->
native_size
.
cy
/
gcd
;
}
}
IMFMediaType_Release
(
media_type
);
}
static
HRESULT
video_presenter_attach_mixer
(
struct
video_presenter
*
presenter
,
IMFTopologyServiceLookup
*
service_lookup
)
{
IMFVideoDeviceID
*
device_id
;
...
...
dlls/evr/tests/evr.c
View file @
59f3337a
...
...
@@ -1640,12 +1640,10 @@ static void test_presenter_native_video_size(void)
/* Negotiating types updates native video size. */
hr
=
IMFVideoPresenter_ProcessMessage
(
presenter
,
MFVP_MESSAGE_INVALIDATEMEDIATYPE
,
0
);
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFVideoDisplayControl_GetNativeVideoSize
(
display_control
,
&
size
,
&
ratio
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
size
.
cx
==
320
&&
size
.
cy
==
240
,
"Unexpected size %u x %u.
\n
"
,
size
.
cx
,
size
.
cy
);
ok
((
ratio
.
cx
==
4
&&
ratio
.
cy
==
3
)
||
broken
(
!
memcmp
(
&
ratio
,
&
size
,
sizeof
(
ratio
)))
/* < Win10 */
,
"Unexpected ratio %u x %u.
\n
"
,
ratio
.
cx
,
ratio
.
cy
);
...
...
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