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
194e90da
Commit
194e90da
authored
Feb 15, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplay: Enable rate control methods.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9c12ca85
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
5 deletions
+94
-5
player.c
dlls/mfplay/player.c
+58
-4
mfplay.c
dlls/mfplay/tests/mfplay.c
+36
-1
No files found.
dlls/mfplay/player.c
View file @
194e90da
...
...
@@ -1094,16 +1094,44 @@ static HRESULT WINAPI media_player_GetDuration(IMFPMediaPlayer *iface, REFGUID p
static
HRESULT
WINAPI
media_player_SetRate
(
IMFPMediaPlayer
*
iface
,
float
rate
)
{
FIXME
(
"%p, %f.
\n
"
,
iface
,
rate
);
struct
media_player
*
player
=
impl_from_IMFPMediaPlayer
(
iface
);
IMFRateControl
*
rate_control
;
HRESULT
hr
;
return
E_NOTIMPL
;
TRACE
(
"%p, %f.
\n
"
,
iface
,
rate
);
if
(
rate
==
0
.
0
f
)
return
MF_E_OUT_OF_RANGE
;
if
(
SUCCEEDED
(
hr
=
MFGetService
((
IUnknown
*
)
player
->
session
,
&
MF_RATE_CONTROL_SERVICE
,
&
IID_IMFRateControl
,
(
void
**
)
&
rate_control
)))
{
hr
=
IMFRateControl_SetRate
(
rate_control
,
FALSE
,
rate
);
IMFRateControl_Release
(
rate_control
);
}
return
hr
;
}
static
HRESULT
WINAPI
media_player_GetRate
(
IMFPMediaPlayer
*
iface
,
float
*
rate
)
{
FIXME
(
"%p, %p.
\n
"
,
iface
,
rate
);
struct
media_player
*
player
=
impl_from_IMFPMediaPlayer
(
iface
);
IMFRateControl
*
rate_control
;
HRESULT
hr
;
return
E_NOTIMPL
;
TRACE
(
"%p, %p.
\n
"
,
iface
,
rate
);
if
(
!
rate
)
return
E_POINTER
;
if
(
SUCCEEDED
(
hr
=
MFGetService
((
IUnknown
*
)
player
->
session
,
&
MF_RATE_CONTROL_SERVICE
,
&
IID_IMFRateControl
,
(
void
**
)
&
rate_control
)))
{
hr
=
IMFRateControl_GetRate
(
rate_control
,
NULL
,
rate
);
IMFRateControl_Release
(
rate_control
);
}
return
hr
;
}
static
HRESULT
WINAPI
media_player_GetSupportedRates
(
IMFPMediaPlayer
*
iface
,
BOOL
forward
,
...
...
@@ -2080,6 +2108,17 @@ static void media_player_playback_ended(struct media_player *player, HRESULT eve
LeaveCriticalSection
(
&
player
->
cs
);
}
static
void
media_player_rate_changed
(
struct
media_player
*
player
,
HRESULT
event_status
,
float
rate
,
struct
media_event
**
event
)
{
EnterCriticalSection
(
&
player
->
cs
);
if
(
SUCCEEDED
(
media_event_create
(
player
,
MFP_EVENT_TYPE_RATE_SET
,
event_status
,
player
->
item
,
event
)))
(
*
event
)
->
u
.
rate_set
.
flRate
=
rate
;
LeaveCriticalSection
(
&
player
->
cs
);
}
static
HRESULT
WINAPI
media_player_session_events_callback_Invoke
(
IMFAsyncCallback
*
iface
,
IMFAsyncResult
*
result
)
{
...
...
@@ -2092,6 +2131,7 @@ static HRESULT WINAPI media_player_session_events_callback_Invoke(IMFAsyncCallba
IMFTopology
*
topology
;
unsigned
int
status
;
PROPVARIANT
value
;
float
rate
;
if
(
FAILED
(
hr
=
IMFMediaSession_EndGetEvent
(
player
->
session
,
result
,
&
session_event
)))
return
S_OK
;
...
...
@@ -2146,6 +2186,20 @@ static HRESULT WINAPI media_player_session_events_callback_Invoke(IMFAsyncCallba
break
;
case
MESessionRateChanged
:
rate
=
0
.
0
f
;
if
(
SUCCEEDED
(
IMFMediaEvent_GetValue
(
session_event
,
&
value
)))
{
if
(
value
.
vt
==
VT_R4
)
rate
=
value
.
fltVal
;
PropVariantClear
(
&
value
);
}
media_player_rate_changed
(
player
,
event_status
,
rate
,
&
event
);
break
;
case
MEBufferingStarted
:
case
MEBufferingStopped
:
case
MEExtendedType
:
...
...
dlls/mfplay/tests/mfplay.c
View file @
194e90da
...
...
@@ -171,10 +171,10 @@ static void test_create_player(void)
static
void
test_shutdown
(
void
)
{
SIZE
size
,
min_size
,
max_size
;
float
slowest
,
fastest
,
rate
;
MFP_MEDIAPLAYER_STATE
state
;
MFVideoNormalizedRect
rect
;
IMFPMediaPlayer
*
player
;
float
slowest
,
fastest
;
IMFPMediaItem
*
item
;
PROPVARIANT
propvar
;
COLORREF
color
;
...
...
@@ -263,6 +263,15 @@ static void test_shutdown(void)
hr
=
IMFPMediaPlayer_GetPosition
(
player
,
&
MFP_POSITIONTYPE_100NS
,
&
propvar
);
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFPMediaPlayer_SetRate
(
player
,
2
.
0
f
);
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFPMediaPlayer_GetRate
(
player
,
NULL
);
ok
(
hr
==
E_POINTER
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFPMediaPlayer_GetRate
(
player
,
&
rate
);
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFPMediaPlayer_Shutdown
(
player
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
...
...
@@ -548,6 +557,31 @@ static void test_duration(void)
IMFPMediaPlayer_Release
(
player
);
}
static
void
test_playback_rate
(
void
)
{
IMFPMediaPlayer
*
player
;
float
rate
;
HRESULT
hr
;
hr
=
MFPCreateMediaPlayer
(
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
player
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFPMediaPlayer_SetRate
(
player
,
0
.
0
f
);
ok
(
hr
==
MF_E_OUT_OF_RANGE
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFPMediaPlayer_SetRate
(
player
,
2
.
0
f
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFPMediaPlayer_GetRate
(
player
,
NULL
);
ok
(
hr
==
E_POINTER
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFPMediaPlayer_GetRate
(
player
,
&
rate
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
rate
==
1
.
0
f
,
"Unexpected rate %f.
\n
"
,
rate
);
IMFPMediaPlayer_Release
(
player
);
}
START_TEST
(
mfplay
)
{
test_create_player
();
...
...
@@ -555,4 +589,5 @@ START_TEST(mfplay)
test_media_item
();
test_video_control
();
test_duration
();
test_playback_rate
();
}
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