[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
hclam at chromium.org
hclam at chromium.org
Wed Dec 22 12:37:17 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 5641b59f926e2207fa48f34a41fc21d67cac85cd
Author: hclam at chromium.org <hclam at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Aug 26 01:45:43 2010 +0000
WebCore: Adding a means of communication between WebKit/WebCore and
chromium in order to share video frames. This adds the necessary
WebKit-side classes and methods, but does not actually use them
yet - that will be committed in a separate patch after the
corresponding Chromium side is committed.
Reviewed by Darin Fisher.
Submitted for Victoria Kirst (vrk at google.com).
https://bugs.webkit.org/show_bug.cgi?id=44539
No new tests, as these new classes/APIs are not yet used.
* platform/graphics/chromium/VideoFrameChromium.h: Added.
(WebCore::VideoFrameChromium::):
* platform/graphics/chromium/VideoFrameProvider.h: Added.
* platform/graphics/chromium/VideoLayerChromium.cpp:
(WebCore::VideoLayerChromium::create):
(WebCore::VideoLayerChromium::VideoLayerChromium):
* platform/graphics/chromium/VideoLayerChromium.h:
WebKit/chromium: Adding a way to communicate video frames between Chromium and WebKit.
The WebKit side acts as a middleman between Chromium and WebCore.
The VideoFrameChromiumImpl is not being used by WebCore yet, as there
still needs to be an implementation of WebVideoFrame in Chromium
-- coming soon in a subsequent patch.
Reviewed by Darin Fisher.
Submitted for Victoria Kirst (vrk at google.com).
API changes for Video Frame sharing between WebKit and Chromium
https://bugs.webkit.org/show_bug.cgi?id=44539
* WebKit.gyp:
* public/WebMediaPlayer.h:
(WebKit::WebMediaPlayer::getCurrentFrame):
(WebKit::WebMediaPlayer::putCurrentFrame):
* public/WebVideoFrame.h: Added.
* src/VideoFrameChromiumImpl.cpp: Added.
(WebKit::VideoFrameChromiumImpl::toWebVideoFrame):
(WebKit::VideoFrameChromiumImpl::VideoFrameChromiumImpl):
(WebKit::VideoFrameChromiumImpl::type):
(WebKit::VideoFrameChromiumImpl::format):
(WebKit::VideoFrameChromiumImpl::width):
(WebKit::VideoFrameChromiumImpl::height):
(WebKit::VideoFrameChromiumImpl::planes):
(WebKit::VideoFrameChromiumImpl::stride):
(WebKit::VideoFrameChromiumImpl::data):
* src/VideoFrameChromiumImpl.h: Added.
* src/WebMediaPlayerClientImpl.cpp:
(WebKit::WebMediaPlayerClientImpl::getCurrentFrame):
(WebKit::WebMediaPlayerClientImpl::putCurrentFrame):
(WebKit::WebMediaPlayerClientImpl::create):
* src/WebMediaPlayerClientImpl.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66071 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index adcf3bc..3f184cf 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2010-08-24 Victoria Kirst <vrk at google.com>
+
+ Reviewed by Darin Fisher.
+
+ Adding a means of communication between WebKit/WebCore and
+ chromium in order to share video frames. This adds the necessary
+ WebKit-side classes and methods, but does not actually use them
+ yet - that will be committed in a separate patch after the
+ corresponding Chromium side is committed.
+
+ https://bugs.webkit.org/show_bug.cgi?id=44539
+
+ No new tests, as these new classes/APIs are not yet used.
+
+ * platform/graphics/chromium/VideoFrameChromium.h: Added.
+ (WebCore::VideoFrameChromium::):
+ * platform/graphics/chromium/VideoFrameProvider.h: Added.
+ * platform/graphics/chromium/VideoLayerChromium.cpp:
+ (WebCore::VideoLayerChromium::create):
+ (WebCore::VideoLayerChromium::VideoLayerChromium):
+ * platform/graphics/chromium/VideoLayerChromium.h:
+
2010-08-25 Kenneth Russell <kbr at google.com>
Reviewed by Simon Fraser.
diff --git a/WebCore/platform/graphics/chromium/VideoFrameChromium.h b/WebCore/platform/graphics/chromium/VideoFrameChromium.h
new file mode 100644
index 0000000..bbd677e
--- /dev/null
+++ b/WebCore/platform/graphics/chromium/VideoFrameChromium.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef VideoFrameChromium_h
+#define VideoFrameChromium_h
+
+namespace WebCore {
+
+// A class that represents a video frame in chromium.
+class VideoFrameChromium {
+public:
+ static const unsigned cMaxPlanes;
+ static const unsigned cNumRGBPlanes;
+ static const unsigned cRGBPlane;
+ static const unsigned cNumYUVPlanes;
+ static const unsigned cYPlane;
+ static const unsigned cUPlane;
+ static const unsigned cVPlane;
+
+ // These enums must be kept in sync with WebKit::WebVideoFrame.
+ enum Format {
+ Invalid,
+ RGB555,
+ RGB565,
+ RGB24,
+ RGB32,
+ RGBA,
+ YV12,
+ YV16,
+ NV12,
+ Empty,
+ ASCII,
+ };
+
+ enum SurfaceType {
+ TypeSystemMemory,
+ TypeOMXBufferHead,
+ TypeEGLImage,
+ TypeMFBuffer,
+ TypeDirect3DSurface
+ };
+
+ virtual SurfaceType surfaceType() const = 0;
+ virtual Format format() const = 0;
+ virtual unsigned width() const = 0;
+ virtual unsigned height() const = 0;
+ virtual unsigned planes() const = 0;
+ virtual int stride(unsigned plane) const = 0;
+ virtual const void* data(unsigned plane) const = 0;
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/platform/graphics/chromium/VideoFrameProvider.h b/WebCore/platform/graphics/chromium/VideoFrameProvider.h
new file mode 100644
index 0000000..f0bad08
--- /dev/null
+++ b/WebCore/platform/graphics/chromium/VideoFrameProvider.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef VideoFrameProvider_h
+#define VideoFrameProvider_h
+
+#include "VideoFrameChromium.h"
+
+namespace WebCore {
+
+class VideoFrameProvider {
+public:
+ // This function returns a pointer to a VideoFrameChromium, which is
+ // the WebCore wrapper for a video frame in Chromium. getCurrentFrame()
+ // places a lock on the frame in Chromium. Calls to this method should
+ // always be followed with a call to putCurrentFrame().
+ // The ownership of the object is not transferred to the caller and
+ // the caller should not free the returned object.
+ virtual VideoFrameChromium* getCurrentFrame() = 0;
+ // This function releases the lock on the video frame in chromium. It should
+ // always be called after getCurrentFrame(). Frames passed into this method
+ // should no longer be referenced after the call is made.
+ virtual void putCurrentFrame(VideoFrameChromium*) = 0;
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
index ebb8bce..7ff98b9 100644
--- a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
@@ -48,18 +48,20 @@
namespace WebCore {
-PassRefPtr<VideoLayerChromium> VideoLayerChromium::create(GraphicsLayerChromium* owner)
+PassRefPtr<VideoLayerChromium> VideoLayerChromium::create(GraphicsLayerChromium* owner,
+ VideoFrameProvider* provider)
{
- return adoptRef(new VideoLayerChromium(owner));
+ return adoptRef(new VideoLayerChromium(owner, provider));
}
-VideoLayerChromium::VideoLayerChromium(GraphicsLayerChromium* owner)
+VideoLayerChromium::VideoLayerChromium(GraphicsLayerChromium* owner, VideoFrameProvider* provider)
: ContentLayerChromium(owner)
#if PLATFORM(SKIA)
, m_canvas(0)
, m_skiaContext(0)
#endif
, m_graphicsContext(0)
+ , m_provider(provider)
{
}
diff --git a/WebCore/platform/graphics/chromium/VideoLayerChromium.h b/WebCore/platform/graphics/chromium/VideoLayerChromium.h
index b062e62..3507cb2 100644
--- a/WebCore/platform/graphics/chromium/VideoLayerChromium.h
+++ b/WebCore/platform/graphics/chromium/VideoLayerChromium.h
@@ -35,18 +35,20 @@
#if USE(ACCELERATED_COMPOSITING)
#include "ContentLayerChromium.h"
+#include "VideoFrameProvider.h"
namespace WebCore {
// A Layer that contains a Video element.
class VideoLayerChromium : public ContentLayerChromium {
public:
- static PassRefPtr<VideoLayerChromium> create(GraphicsLayerChromium* owner = 0);
+ static PassRefPtr<VideoLayerChromium> create(GraphicsLayerChromium* owner = 0,
+ VideoFrameProvider* = 0);
virtual bool drawsContent() { return true; }
virtual void updateContents();
private:
- VideoLayerChromium(GraphicsLayerChromium* owner);
+ VideoLayerChromium(GraphicsLayerChromium* owner, VideoFrameProvider*);
void createTextureRect(const IntSize& requiredTextureSize, const IntRect& updateRect, unsigned textureId);
void updateTextureRect(const IntRect& updateRect, unsigned textureId);
void updateCompleted();
@@ -56,6 +58,7 @@ private:
OwnPtr<PlatformContextSkia> m_skiaContext;
#endif
OwnPtr<GraphicsContext> m_graphicsContext;
+ OwnPtr<VideoFrameProvider> m_provider;
};
}
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 5cc7fd6..e81c895 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,38 @@
+2010-08-24 Victoria Kirst <vrk at google.com>
+
+ Reviewed by Darin Fisher.
+
+ Adding a way to communicate video frames between Chromium and WebKit.
+ The WebKit side acts as a middleman between Chromium and WebCore.
+ The VideoFrameChromiumImpl is not being used by WebCore yet, as there
+ still needs to be an implementation of WebVideoFrame in Chromium
+ -- coming soon in a subsequent patch.
+
+ API changes for Video Frame sharing between WebKit and Chromium
+ https://bugs.webkit.org/show_bug.cgi?id=44539
+
+ * WebKit.gyp:
+ * public/WebMediaPlayer.h:
+ (WebKit::WebMediaPlayer::getCurrentFrame):
+ (WebKit::WebMediaPlayer::putCurrentFrame):
+ * public/WebVideoFrame.h: Added.
+ * src/VideoFrameChromiumImpl.cpp: Added.
+ (WebKit::VideoFrameChromiumImpl::toWebVideoFrame):
+ (WebKit::VideoFrameChromiumImpl::VideoFrameChromiumImpl):
+ (WebKit::VideoFrameChromiumImpl::type):
+ (WebKit::VideoFrameChromiumImpl::format):
+ (WebKit::VideoFrameChromiumImpl::width):
+ (WebKit::VideoFrameChromiumImpl::height):
+ (WebKit::VideoFrameChromiumImpl::planes):
+ (WebKit::VideoFrameChromiumImpl::stride):
+ (WebKit::VideoFrameChromiumImpl::data):
+ * src/VideoFrameChromiumImpl.h: Added.
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::getCurrentFrame):
+ (WebKit::WebMediaPlayerClientImpl::putCurrentFrame):
+ (WebKit::WebMediaPlayerClientImpl::create):
+ * src/WebMediaPlayerClientImpl.h:
+
2010-08-25 Eric Seidel <eric at webkit.org>
Unreviewed. Build fix.
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index 564b9f9..9443d8e 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -382,6 +382,8 @@
'src/StorageNamespaceProxy.cpp',
'src/StorageNamespaceProxy.h',
'src/TemporaryGlue.h',
+ 'src/VideoFrameChromiumImpl.cpp',
+ 'src/VideoFrameChromiumImpl.h',
'src/WebAccessibilityCache.cpp',
'src/WebAccessibilityCacheImpl.cpp',
'src/WebAccessibilityCacheImpl.h',
diff --git a/WebKit/chromium/public/WebMediaPlayer.h b/WebKit/chromium/public/WebMediaPlayer.h
index 6f51345..6cec0f5 100644
--- a/WebKit/chromium/public/WebMediaPlayer.h
+++ b/WebKit/chromium/public/WebMediaPlayer.h
@@ -33,6 +33,7 @@
#include "WebCanvas.h"
#include "WebVector.h"
+#include "WebVideoFrame.h"
namespace WebKit {
@@ -127,6 +128,18 @@ public:
virtual bool hasSingleSecurityOrigin() const = 0;
virtual MovieLoadType movieLoadType() const = 0;
+
+ // This function returns a pointer to a WebVideoFrame, which is
+ // a WebKit wrapper for a video frame in chromium. This places a lock
+ // on the frame in chromium, and calls to this method should always be
+ // followed with a call to putCurrentFrame(). The ownership of this object
+ // is not transferred to the caller, and the caller should not free the
+ // returned object.
+ virtual WebVideoFrame* getCurrentFrame() { return 0; }
+ // This function releases the lock on the current video frame in Chromium.
+ // It should always be called after getCurrentFrame(). Frame passed to this
+ // method should no longer be referenced after the call is made.
+ virtual void putCurrentFrame(WebVideoFrame*) { }
};
} // namespace WebKit
diff --git a/WebKit/chromium/public/WebVideoFrame.h b/WebKit/chromium/public/WebVideoFrame.h
new file mode 100644
index 0000000..5e34f2a
--- /dev/null
+++ b/WebKit/chromium/public/WebVideoFrame.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebVideoFrame_h
+#define WebVideoFrame_h
+
+namespace WebKit {
+
+// A proxy video frame interface to communicate frame data between chromium
+// and WebKit.
+class WebVideoFrame {
+public:
+ enum Format {
+ FormatInvalid,
+ FormatRGB555,
+ FormatRGB565,
+ FormatRGB24,
+ FormatRGB32,
+ FormatRGBA,
+ FormatYV12,
+ FormatYV16,
+ FormatNV12,
+ FormatEmpty,
+ FormatASCII,
+ };
+
+ enum SurfaceType {
+ SurfaceTypeSystemMemory,
+ SurfaceTypeOMXBufferHead,
+ SurfaceTypeEGLImage,
+ SurfaceTypeMFBuffer,
+ SurfaceTypeDirect3DSurface
+ };
+
+ virtual SurfaceType surfaceType() const = 0;
+ virtual Format format() const = 0;
+ virtual unsigned width() const = 0;
+ virtual unsigned height() const = 0;
+ virtual unsigned planes() const = 0;
+ virtual int stride(unsigned plane) const = 0;
+ virtual const void* data(unsigned plane) const = 0;
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/src/AssertMatchingEnums.cpp b/WebKit/chromium/src/AssertMatchingEnums.cpp
index b93d4bb..a117fc2 100644
--- a/WebKit/chromium/src/AssertMatchingEnums.cpp
+++ b/WebKit/chromium/src/AssertMatchingEnums.cpp
@@ -48,6 +48,7 @@
#include "TextAffinity.h"
#include "UserContentTypes.h"
#include "UserScriptTypes.h"
+#include "VideoFrameChromium.h"
#include "WebAccessibilityObject.h"
#include "WebApplicationCacheHost.h"
#include "WebClipboard.h"
@@ -62,6 +63,7 @@
#include "WebSettings.h"
#include "WebTextAffinity.h"
#include "WebTextCaseSensitivity.h"
+#include "WebVideoFrame.h"
#include "WebView.h"
#include <wtf/Assertions.h>
#include <wtf/text/StringImpl.h>
@@ -327,6 +329,24 @@ COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Unknown, MediaPlayer::Unknown);
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Download, MediaPlayer::Download);
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::StoredStream, MediaPlayer::StoredStream);
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::LiveStream, MediaPlayer::LiveStream);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatInvalid, VideoFrameChromium::Invalid);
+COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatRGB555, VideoFrameChromium::RGB555);
+COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatRGB565, VideoFrameChromium::RGB565);
+COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatRGB24, VideoFrameChromium::RGB24);
+COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatRGB32, VideoFrameChromium::RGB32);
+COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatRGBA, VideoFrameChromium::RGBA);
+COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatYV12, VideoFrameChromium::YV12);
+COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatYV16, VideoFrameChromium::YV16);
+COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatNV12, VideoFrameChromium::NV12);
+COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatEmpty, VideoFrameChromium::Empty);
+COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatASCII, VideoFrameChromium::ASCII);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::SurfaceTypeSystemMemory, VideoFrameChromium::TypeSystemMemory);
+COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::SurfaceTypeOMXBufferHead, VideoFrameChromium::TypeOMXBufferHead);
+COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::SurfaceTypeEGLImage, VideoFrameChromium::TypeEGLImage);
+COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::SurfaceTypeMFBuffer, VideoFrameChromium::TypeMFBuffer);
+COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::SurfaceTypeDirect3DSurface, VideoFrameChromium::TypeDirect3DSurface);
#endif
#if ENABLE(NOTIFICATIONS)
@@ -360,5 +380,3 @@ COMPILE_ASSERT_MATCHING_ENUM(WebView::UserContentInjectInTopFrameOnly, InjectInT
COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::NullType, IDBKey::NullType);
COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::StringType, IDBKey::StringType);
COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::NumberType, IDBKey::NumberType);
-
-
diff --git a/WebKit/chromium/src/VideoFrameChromiumImpl.cpp b/WebKit/chromium/src/VideoFrameChromiumImpl.cpp
new file mode 100644
index 0000000..2b98320
--- /dev/null
+++ b/WebKit/chromium/src/VideoFrameChromiumImpl.cpp
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "VideoFrameChromiumImpl.h"
+
+#include "VideoFrameChromium.h"
+#include "WebVideoFrame.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+const unsigned cMaxPlanes = 3;
+const unsigned cNumRGBPlanes = 1;
+const unsigned cRGBPlane = 0;
+const unsigned cNumYUVPlanes = 3;
+const unsigned cYPlane = 0;
+const unsigned cUPlane = 1;
+const unsigned cVPlane = 2;
+
+WebVideoFrame* VideoFrameChromiumImpl::toWebVideoFrame(VideoFrameChromium* videoFrame)
+{
+ VideoFrameChromiumImpl* wrappedFrame = static_cast<VideoFrameChromiumImpl*>(videoFrame);
+ if (wrappedFrame)
+ return wrappedFrame->m_webVideoFrame;
+ return 0;
+}
+
+VideoFrameChromiumImpl::VideoFrameChromiumImpl(WebVideoFrame* webVideoFrame)
+ : m_webVideoFrame(webVideoFrame)
+{
+}
+
+VideoFrameChromium::SurfaceType VideoFrameChromiumImpl::surfaceType() const
+{
+ if (m_webVideoFrame)
+ return static_cast<VideoFrameChromium::SurfaceType>(m_webVideoFrame->surfaceType());
+ return TypeSystemMemory;
+}
+
+VideoFrameChromium::Format VideoFrameChromiumImpl::format() const
+{
+ if (m_webVideoFrame)
+ return static_cast<VideoFrameChromium::Format>(m_webVideoFrame->format());
+ return Invalid;
+}
+
+unsigned VideoFrameChromiumImpl::width() const
+{
+ if (m_webVideoFrame)
+ return m_webVideoFrame->width();
+ return 0;
+}
+
+unsigned VideoFrameChromiumImpl::height() const
+{
+ if (m_webVideoFrame)
+ return m_webVideoFrame->height();
+ return 0;
+}
+
+unsigned VideoFrameChromiumImpl::planes() const
+{
+ if (m_webVideoFrame)
+ return m_webVideoFrame->planes();
+ return 0;
+}
+
+int VideoFrameChromiumImpl::stride(unsigned plane) const
+{
+ if (m_webVideoFrame)
+ return m_webVideoFrame->stride(plane);
+ return 0;
+}
+
+const void* VideoFrameChromiumImpl::data(unsigned plane) const
+{
+ if (m_webVideoFrame)
+ return m_webVideoFrame->data(plane);
+ return 0;
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/VideoFrameChromiumImpl.h b/WebKit/chromium/src/VideoFrameChromiumImpl.h
new file mode 100644
index 0000000..3ad424c
--- /dev/null
+++ b/WebKit/chromium/src/VideoFrameChromiumImpl.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef VideoFrameChromiumImpl_h
+#define VideoFrameChromiumImpl_h
+
+#include "VideoFrameChromium.h"
+#include "WebVideoFrame.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+// A wrapper class for WebKit::WebVideoFrame. Objects can be created in WebKit
+// and used in WebCore because of the VideoFrameChromium interface.
+class VideoFrameChromiumImpl : public VideoFrameChromium {
+public:
+ // Converts a WebCore::VideoFrameChromium to a WebKit::WebVideoFrame.
+ static WebVideoFrame* toWebVideoFrame(VideoFrameChromium*);
+
+ // Creates a VideoFrameChromiumImpl object to wrap the given WebVideoFrame.
+ // The VideoFrameChromiumImpl does not take ownership of the WebVideoFrame
+ // and should not free the frame's memory.
+ VideoFrameChromiumImpl(WebVideoFrame*);
+ virtual SurfaceType surfaceType() const;
+ virtual Format format() const;
+ virtual unsigned width() const;
+ virtual unsigned height() const;
+ virtual unsigned planes() const;
+ virtual int stride(unsigned plane) const;
+ virtual const void* data(unsigned plane) const;
+
+private:
+ WebVideoFrame* m_webVideoFrame;
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
index 8f210a0..f0ece0d 100644
--- a/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
+++ b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
@@ -22,6 +22,8 @@
#include "RenderLayerCompositor.h"
#endif
+#include "VideoFrameChromium.h"
+#include "VideoFrameChromiumImpl.h"
#include "WebCanvas.h"
#include "WebCString.h"
#include "WebFrameClient.h"
@@ -416,6 +418,28 @@ MediaPlayer::MovieLoadType WebMediaPlayerClientImpl::movieLoadType() const
return MediaPlayer::Unknown;
}
+VideoFrameChromium* WebMediaPlayerClientImpl::getCurrentFrame()
+{
+ VideoFrameChromium* videoFrame = 0;
+ if (m_webMediaPlayer.get()) {
+ WebVideoFrame* webkitVideoFrame = m_webMediaPlayer->getCurrentFrame();
+ if (webkitVideoFrame)
+ videoFrame = new VideoFrameChromiumImpl(webkitVideoFrame);
+ }
+ return videoFrame;
+}
+
+void WebMediaPlayerClientImpl::putCurrentFrame(VideoFrameChromium* videoFrame)
+{
+ if (videoFrame) {
+ if (m_webMediaPlayer.get()) {
+ m_webMediaPlayer->putCurrentFrame(
+ VideoFrameChromiumImpl::toWebVideoFrame(videoFrame));
+ }
+ delete videoFrame;
+ }
+}
+
MediaPlayerPrivateInterface* WebMediaPlayerClientImpl::create(MediaPlayer* player)
{
WebMediaPlayerClientImpl* client = new WebMediaPlayerClientImpl();
@@ -433,7 +457,7 @@ MediaPlayerPrivateInterface* WebMediaPlayerClientImpl::create(MediaPlayer* playe
frame->contentRenderer()->compositor()->hasAcceleratedCompositing();
if (client->m_supportsAcceleratedCompositing)
- client->m_videoLayer = VideoLayerChromium::create(0);
+ client->m_videoLayer = VideoLayerChromium::create(0, client);
#endif
return client;
diff --git a/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/WebKit/chromium/src/WebMediaPlayerClientImpl.h
index df179a8..e014871 100644
--- a/WebKit/chromium/src/WebMediaPlayerClientImpl.h
+++ b/WebKit/chromium/src/WebMediaPlayerClientImpl.h
@@ -34,6 +34,8 @@
#if ENABLE(VIDEO)
#include "MediaPlayerPrivate.h"
+#include "VideoFrameChromium.h"
+#include "VideoFrameProvider.h"
#include "WebMediaPlayerClient.h"
#include <wtf/OwnPtr.h>
@@ -44,8 +46,10 @@ class WebMediaPlayer;
// This class serves as a bridge between WebCore::MediaPlayer and
// WebKit::WebMediaPlayer.
-class WebMediaPlayerClientImpl : public WebMediaPlayerClient
- , public WebCore::MediaPlayerPrivateInterface {
+class WebMediaPlayerClientImpl : public WebCore::MediaPlayerPrivateInterface
+ , public WebCore::VideoFrameProvider
+ , public WebMediaPlayerClient {
+
public:
static bool isEnabled();
static void setIsEnabled(bool);
@@ -110,6 +114,10 @@ public:
virtual WebCore::MediaPlayer::MovieLoadType movieLoadType() const;
+ // VideoFrameProvider methods:
+ virtual WebCore::VideoFrameChromium* getCurrentFrame();
+ virtual void putCurrentFrame(WebCore::VideoFrameChromium*);
+
private:
WebMediaPlayerClientImpl();
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list