Title: [181863] trunk/Source/WebCore
Revision
181863
Author
achristen...@apple.com
Date
2015-03-23 13:31:56 -0700 (Mon, 23 Mar 2015)

Log Message

[MediaFoundation] Implement seek.
https://bugs.webkit.org/show_bug.cgi?id=142594

Reviewed by Darin Adler.

* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
(WebCore::MediaPlayerPrivateMediaFoundation::seeking):
(WebCore::MediaPlayerPrivateMediaFoundation::seekDouble):
(WebCore::MediaPlayerPrivateMediaFoundation::durationDouble):
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (181862 => 181863)


--- trunk/Source/WebCore/ChangeLog	2015-03-23 20:17:32 UTC (rev 181862)
+++ trunk/Source/WebCore/ChangeLog	2015-03-23 20:31:56 UTC (rev 181863)
@@ -1,3 +1,16 @@
+2015-03-23  Alex Christensen  <achristen...@webkit.org>
+
+        [MediaFoundation] Implement seek.
+        https://bugs.webkit.org/show_bug.cgi?id=142594
+
+        Reviewed by Darin Adler.
+
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
+        (WebCore::MediaPlayerPrivateMediaFoundation::seeking):
+        (WebCore::MediaPlayerPrivateMediaFoundation::seekDouble):
+        (WebCore::MediaPlayerPrivateMediaFoundation::durationDouble):
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
+
 2015-03-23  Dan Bernstein  <m...@apple.com>
 
         Fixed the build.

Modified: trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp (181862 => 181863)


--- trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp	2015-03-23 20:17:32 UTC (rev 181862)
+++ trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp	2015-03-23 20:31:56 UTC (rev 181863)
@@ -166,10 +166,41 @@
 
 bool MediaPlayerPrivateMediaFoundation::seeking() const
 {
-    notImplemented();
+    // We assume seeking is immediately complete.
     return false;
 }
 
+void MediaPlayerPrivateMediaFoundation::seekDouble(double time)
+{
+    const double tenMegahertz = 10000000;
+    PROPVARIANT propVariant;
+    PropVariantInit(&propVariant);
+    propVariant.vt = VT_I8;
+    propVariant.hVal.QuadPart = static_cast<__int64>(time * tenMegahertz);
+    
+    HRESULT hr = m_mediaSession->Start(&GUID_NULL, &propVariant);
+    ASSERT(SUCCEEDED(hr));
+    PropVariantClear(&propVariant);
+}
+
+double MediaPlayerPrivateMediaFoundation::durationDouble() const
+{
+    const double tenMegahertz = 10000000;
+    if (!m_mediaSource)
+        return 0;
+
+    IMFPresentationDescriptor* descriptor;
+    if (!SUCCEEDED(m_mediaSource->CreatePresentationDescriptor(&descriptor)))
+        return 0;
+    
+    UINT64 duration;
+    if (!SUCCEEDED(descriptor->GetUINT64(MF_PD_DURATION, &duration)))
+        duration = 0;
+    descriptor->Release();
+    
+    return static_cast<double>(duration) / tenMegahertz;
+}
+
 bool MediaPlayerPrivateMediaFoundation::paused() const
 {
     return m_paused;

Modified: trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h (181862 => 181863)


--- trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h	2015-03-23 20:17:32 UTC (rev 181862)
+++ trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h	2015-03-23 20:31:56 UTC (rev 181863)
@@ -59,6 +59,8 @@
     virtual void setVisible(bool);
 
     virtual bool seeking() const;
+    virtual void seekDouble(double) override;
+    virtual double durationDouble() const override;
 
     virtual bool paused() const;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to