[WinCairo][MediaFoundation] Implement methods to set volume.
authorpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Feb 2016 07:05:58 +0000 (07:05 +0000)
committerpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Feb 2016 07:05:58 +0000 (07:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=154580

Reviewed by Alex Christensen.

* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
(WebCore::MediaPlayerPrivateMediaFoundation::paused):
(WebCore::MediaPlayerPrivateMediaFoundation::setVolume):
(WebCore::MediaPlayerPrivateMediaFoundation::supportsMuting):
(WebCore::MediaPlayerPrivateMediaFoundation::setMuted):
(WebCore::MediaPlayerPrivateMediaFoundation::networkState):
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197015 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp
Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h

index f0aba44..1698ee0 100644 (file)
@@ -1,3 +1,18 @@
+2016-02-23  Per Arne Vollan  <peavo@outlook.com>
+
+        [WinCairo][MediaFoundation] Implement methods to set volume.
+        https://bugs.webkit.org/show_bug.cgi?id=154580
+
+        Reviewed by Alex Christensen.
+
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
+        (WebCore::MediaPlayerPrivateMediaFoundation::paused):
+        (WebCore::MediaPlayerPrivateMediaFoundation::setVolume):
+        (WebCore::MediaPlayerPrivateMediaFoundation::supportsMuting):
+        (WebCore::MediaPlayerPrivateMediaFoundation::setMuted):
+        (WebCore::MediaPlayerPrivateMediaFoundation::networkState):
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
+
 2016-02-23  Chris Dumez  <cdumez@apple.com>
 
         [Reflected] IDL attributes of integer types should use HTML rules for parsing integers
index b7cbd8b..9821293 100644 (file)
@@ -288,6 +288,35 @@ bool MediaPlayerPrivateMediaFoundation::paused() const
     return m_paused;
 }
 
+void MediaPlayerPrivateMediaFoundation::setVolume(float volume)
+{
+    if (!MFGetServicePtr())
+        return;
+
+    COMPtr<IMFSimpleAudioVolume> audioVolume;
+    if (SUCCEEDED(MFGetServicePtr()(m_mediaSession.get(), MR_POLICY_VOLUME_SERVICE, __uuidof(IMFSimpleAudioVolume), (void **)&audioVolume))) {
+        HRESULT hr = audioVolume->SetMasterVolume(volume);
+        ASSERT(SUCCEEDED(hr));
+    }
+}
+
+bool MediaPlayerPrivateMediaFoundation::supportsMuting() const
+{
+    return true;
+}
+
+void MediaPlayerPrivateMediaFoundation::setMuted(bool muted)
+{
+    if (!MFGetServicePtr())
+        return;
+
+    COMPtr<IMFSimpleAudioVolume> audioVolume;
+    if (SUCCEEDED(MFGetServicePtr()(m_mediaSession.get(), MR_POLICY_VOLUME_SERVICE, __uuidof(IMFSimpleAudioVolume), (void **)&audioVolume))) {
+        HRESULT hr = audioVolume->SetMute(muted ? TRUE : FALSE);
+        ASSERT(SUCCEEDED(hr));
+    }
+}
+
 MediaPlayer::NetworkState MediaPlayerPrivateMediaFoundation::networkState() const
 { 
     notImplemented();
index 5fd9ad1..d7faf95 100644 (file)
@@ -83,6 +83,11 @@ public:
 
     virtual bool paused() const;
 
+    virtual void setVolume(float) override;
+
+    virtual bool supportsMuting() const override;
+    virtual void setMuted(bool) override;
+
     virtual MediaPlayer::NetworkState networkState() const;
     virtual MediaPlayer::ReadyState readyState() const;