+2012-04-13 James Robinson <jamesr@chromium.org>
+
+ [chromium] Move WebVideoFrame into Platform and remove WebCore::VideoFrameChromium wrapper API
+ https://bugs.webkit.org/show_bug.cgi?id=83851
+
+ Reviewed by Adam Barth.
+
+ Move WebVideoFrame API into Platform.
+
+ * Platform.gypi:
+ * chromium/public/WebVideoFrame.h: Renamed from Source/WebCore/platform/graphics/chromium/VideoFrameChromium.h.
+ (WebKit):
+ (WebVideoFrame):
+ (WebKit::WebVideoFrame::~WebVideoFrame):
+ (WebKit::WebVideoFrame::format):
+ (WebKit::WebVideoFrame::width):
+ (WebKit::WebVideoFrame::height):
+ (WebKit::WebVideoFrame::planes):
+ (WebKit::WebVideoFrame::stride):
+ (WebKit::WebVideoFrame::data):
+ (WebKit::WebVideoFrame::textureId):
+ (WebKit::WebVideoFrame::textureTarget):
+ * chromium/src/WebVideoFrame.cpp: Renamed from Source/WebCore/platform/graphics/chromium/VideoFrameChromium.cpp.
+ (WebKit):
+
2012-04-12 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r114075.
'chromium/src/WebCString.cpp',
'chromium/src/WebFloatQuad.cpp',
'chromium/src/WebString.cpp',
+ 'chromium/src/WebVideoFrame.cpp',
]
}
}
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef VideoFrameChromium_h
-#define VideoFrameChromium_h
+#ifndef WebVideoFrame_h
+#define WebVideoFrame_h
-#include "IntSize.h"
+namespace WebKit {
-namespace WebCore {
-
-// A class that represents a video frame in chromium.
-class VideoFrameChromium {
+// A proxy video frame interface to communicate frame data between chromium
+// and WebKit.
+// Keep in sync with chromium's media::VideoFrame::Format.
+class WebVideoFrame {
public:
static const unsigned maxPlanes;
static const unsigned numRGBPlanes;
static const unsigned uPlane;
static const unsigned vPlane;
- // These enums must be kept in sync with WebKit::WebVideoFrame.
enum Format {
- Invalid = 0,
- RGB32 = 4,
- YV12 = 6,
- YV16 = 7,
- Empty = 9,
- I420 = 11,
- NativeTexture = 12,
+ FormatInvalid = 0,
+ FormatRGB32 = 4,
+ FormatYV12 = 6,
+ FormatYV16 = 7,
+ FormatEmpty = 9,
+ FormatI420 = 11,
+ FormatNativeTexture = 12,
};
- virtual ~VideoFrameChromium();
- virtual Format format() const = 0;
- virtual unsigned width() const = 0;
- virtual unsigned width(unsigned plane) const = 0;
- virtual unsigned height() const = 0;
- virtual unsigned height(unsigned plane) const = 0;
- virtual unsigned planes() const = 0;
- virtual int stride(unsigned plane) const = 0;
- virtual const void* data(unsigned plane) const = 0;
- virtual const IntSize requiredTextureSize(unsigned plane) const = 0;
- virtual bool hasPaddingBytes(unsigned plane) const = 0;
- virtual unsigned textureId() const = 0;
- virtual unsigned textureTarget() const = 0;
+ virtual ~WebVideoFrame() { }
+ virtual Format format() const { return FormatInvalid; }
+ virtual unsigned width() const { return 0; }
+ virtual unsigned height() const { return 0; }
+ virtual unsigned planes() const { return 0; }
+ virtual int stride(unsigned plane) const { return 0; }
+ virtual const void* data(unsigned plane) const { return 0; }
+ virtual unsigned textureId() const { return 0; }
+ virtual unsigned textureTarget() const { return 0; }
};
-} // namespace WebCore
+} // namespace WebKit
#endif
#include "config.h"
-#include "VideoFrameChromium.h"
+#include <public/WebVideoFrame.h>
-namespace WebCore {
+namespace WebKit {
-const unsigned VideoFrameChromium::maxPlanes = 3;
-const unsigned VideoFrameChromium::numRGBPlanes = 1;
-const unsigned VideoFrameChromium::rgbPlane = 0;
-const unsigned VideoFrameChromium::numYUVPlanes = 3;
-const unsigned VideoFrameChromium::yPlane = 0;
-const unsigned VideoFrameChromium::uPlane = 1;
-const unsigned VideoFrameChromium::vPlane = 2;
-
-VideoFrameChromium::~VideoFrameChromium() { }
-
-} // namespace WebCore
+const unsigned WebVideoFrame::maxPlanes = 3;
+const unsigned WebVideoFrame::numRGBPlanes = 1;
+const unsigned WebVideoFrame::rgbPlane = 0;
+const unsigned WebVideoFrame::numYUVPlanes = 3;
+const unsigned WebVideoFrame::yPlane = 0;
+const unsigned WebVideoFrame::uPlane = 1;
+const unsigned WebVideoFrame::vPlane = 2;
+} // namespace WebKit
+2012-04-13 James Robinson <jamesr@chromium.org>
+
+ [chromium] Move WebVideoFrame into Platform and remove WebCore::VideoFrameChromium wrapper API
+ https://bugs.webkit.org/show_bug.cgi?id=83851
+
+ Reviewed by Adam Barth.
+
+ Remove VideoFrameChromium wrapper and converts WebCore code to using the Platform WebVideoFrame API directly.
+ Some utility code that previously existed on VideoFrameChromium and only had one caller, such as doing
+ width/height adjustements for YV12 frames, is moved into the calling code (CCVideoLayerImpl).
+
+ Covered by existing media/ and compositing/ layout tests.
+
+ * WebCore.gypi:
+ * platform/graphics/chromium/LayerRendererChromium.cpp:
+ (WebCore::LayerRendererChromium::drawYUV):
+ (WebCore::LayerRendererChromium::drawRGBA):
+ (WebCore::LayerRendererChromium::copyFrameToTextures):
+ * platform/graphics/chromium/LayerRendererChromium.h:
+ * platform/graphics/chromium/VideoFrameProvider.h:
+ (VideoFrameProvider):
+ * platform/graphics/chromium/cc/CCVideoDrawQuad.cpp:
+ (WebCore::CCVideoDrawQuad::create):
+ (WebCore::CCVideoDrawQuad::CCVideoDrawQuad):
+ * platform/graphics/chromium/cc/CCVideoDrawQuad.h:
+ (WebKit):
+ (CCVideoDrawQuad):
+ (WebCore::CCVideoDrawQuad::frame):
+ * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:
+ (WebCore):
+ (WebCore::convertVFCFormatToGC3DFormat):
+ (WebCore::CCVideoLayerImpl::willDraw):
+ (WebCore::videoFrameDimension):
+ (WebCore::hasPaddingBytes):
+ (WebCore::CCVideoLayerImpl::computeVisibleSize):
+ (WebCore::CCVideoLayerImpl::reserveTextures):
+ * platform/graphics/chromium/cc/CCVideoLayerImpl.h:
+ (WebKit):
+
2012-04-13 Rob Flack <flackr@chromium.org>
Chromium: Should enable -webkit-image-set
'platform/graphics/chromium/UniscribeHelperTextRun.h',
'platform/graphics/chromium/VDMXParser.cpp',
'platform/graphics/chromium/VDMXParser.h',
- 'platform/graphics/chromium/VideoFrameChromium.cpp',
- 'platform/graphics/chromium/VideoFrameChromium.h',
'platform/graphics/chromium/VideoFrameProvider.h',
'platform/graphics/chromium/VideoLayerChromium.cpp',
'platform/graphics/chromium/VideoLayerChromium.h',
#include "Extensions3D.h"
#include "NativeImageSkia.h"
#include "PlatformContextSkia.h"
+#include <public/WebVideoFrame.h>
#include <wtf/CurrentTime.h>
#include <wtf/MainThread.h>
const CCVideoLayerImpl::YUVProgram* program = videoLayerYUVProgram();
ASSERT(program && program->initialized());
- const CCVideoLayerImpl::Texture& yTexture = quad->textures()[VideoFrameChromium::yPlane];
- const CCVideoLayerImpl::Texture& uTexture = quad->textures()[VideoFrameChromium::uPlane];
- const CCVideoLayerImpl::Texture& vTexture = quad->textures()[VideoFrameChromium::vPlane];
+ const CCVideoLayerImpl::Texture& yTexture = quad->textures()[WebKit::WebVideoFrame::yPlane];
+ const CCVideoLayerImpl::Texture& uTexture = quad->textures()[WebKit::WebVideoFrame::uPlane];
+ const CCVideoLayerImpl::Texture& vTexture = quad->textures()[WebKit::WebVideoFrame::vPlane];
GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE1));
GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, yTexture.m_texture->textureId()));
void LayerRendererChromium::drawRGBA(const CCVideoDrawQuad* quad)
{
const CCVideoLayerImpl::RGBAProgram* program = videoLayerRGBAProgram();
- const CCVideoLayerImpl::Texture& texture = quad->textures()[VideoFrameChromium::rgbPlane];
+ const CCVideoLayerImpl::Texture& texture = quad->textures()[WebKit::WebVideoFrame::rgbPlane];
float widthScaleFactor = static_cast<float>(texture.m_visibleSize.width()) / texture.m_texture->size().width();
drawSingleTextureVideoQuad(quad, program, widthScaleFactor, texture.m_texture->textureId(), GraphicsContext3D::TEXTURE_2D);
}
bool LayerRendererChromium::copyFrameToTextures(const CCVideoDrawQuad* quad)
{
- const VideoFrameChromium* frame = quad->frame();
+ const WebKit::WebVideoFrame* frame = quad->frame();
- for (unsigned plane = 0; plane < frame->planes(); ++plane) {
- ASSERT(quad->frame()->requiredTextureSize(plane) == quad->textures()[plane].m_texture->size());
+ for (unsigned plane = 0; plane < frame->planes(); ++plane)
copyPlaneToTexture(quad, frame->data(plane), plane);
- }
+
for (unsigned plane = frame->planes(); plane < CCVideoLayerImpl::MaxPlanes; ++plane) {
CCVideoLayerImpl::Texture* texture = &quad->textures()[plane];
texture->m_texture.clear();
#include "LayerChromium.h"
#include "TextureCopier.h"
#include "TrackingTextureAllocator.h"
-#include "VideoLayerChromium.h"
#include "cc/CCDrawQuad.h"
#include "cc/CCHeadsUpDisplay.h"
#include "cc/CCLayerTreeHost.h"
#ifndef VideoFrameProvider_h
#define VideoFrameProvider_h
-#include "VideoFrameChromium.h"
+#include <public/WebVideoFrame.h>
namespace WebCore {
virtual void setVideoFrameProviderClient(Client*) = 0;
- // 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().
+ // This function places a lock on the current frame and returns a pointer to it.
+ // 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;
+ virtual WebKit::WebVideoFrame* 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;
+ virtual void putCurrentFrame(WebKit::WebVideoFrame*) = 0;
};
} // namespace WebCore
namespace WebCore {
-PassOwnPtr<CCVideoDrawQuad> CCVideoDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCVideoLayerImpl::Texture* textures, VideoFrameChromium* frame, GC3Denum format)
+PassOwnPtr<CCVideoDrawQuad> CCVideoDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCVideoLayerImpl::Texture* textures, WebKit::WebVideoFrame* frame, GC3Denum format)
{
return adoptPtr(new CCVideoDrawQuad(sharedQuadState, quadRect, textures, frame, format));
}
-CCVideoDrawQuad::CCVideoDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCVideoLayerImpl::Texture* textures, VideoFrameChromium* frame, GC3Denum format)
+CCVideoDrawQuad::CCVideoDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCVideoLayerImpl::Texture* textures, WebKit::WebVideoFrame* frame, GC3Denum format)
: CCDrawQuad(sharedQuadState, CCDrawQuad::VideoContent, quadRect)
, m_textures(textures)
, m_frame(frame)
#include "cc/CCVideoLayerImpl.h"
#include <wtf/PassOwnPtr.h>
+namespace WebKit {
+class WebVideoFrame;
+}
+
namespace WebCore {
class CCVideoDrawQuad : public CCDrawQuad {
WTF_MAKE_NONCOPYABLE(CCVideoDrawQuad);
public:
- static PassOwnPtr<CCVideoDrawQuad> create(const CCSharedQuadState*, const IntRect&, CCVideoLayerImpl::Texture* textures, VideoFrameChromium*, GC3Denum format);
+ static PassOwnPtr<CCVideoDrawQuad> create(const CCSharedQuadState*, const IntRect&, CCVideoLayerImpl::Texture* textures, WebKit::WebVideoFrame*, GC3Denum format);
CCVideoLayerImpl::Texture* textures() const { return m_textures; }
- VideoFrameChromium* frame() const { return m_frame; }
+ WebKit::WebVideoFrame* frame() const { return m_frame; }
GC3Denum format() const { return m_format; }
const float* matrix() const { return m_matrix; }
void setMatrix(const float* matrix) { m_matrix = matrix; }
private:
- CCVideoDrawQuad(const CCSharedQuadState*, const IntRect&, CCVideoLayerImpl::Texture* textures, VideoFrameChromium*, GC3Denum format);
+ CCVideoDrawQuad(const CCSharedQuadState*, const IntRect&, CCVideoLayerImpl::Texture* textures, WebKit::WebVideoFrame*, GC3Denum format);
CCVideoLayerImpl::Texture* m_textures;
- VideoFrameChromium* m_frame;
+ WebKit::WebVideoFrame* m_frame;
GC3Denum m_format;
const float* m_matrix;
};
#include "cc/CCProxy.h"
#include "cc/CCQuadCuller.h"
#include "cc/CCVideoDrawQuad.h"
+#include <public/WebVideoFrame.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
m_provider = 0;
}
-// Convert VideoFrameChromium::Format to GraphicsContext3D's format enum values.
-static GC3Denum convertVFCFormatToGC3DFormat(const VideoFrameChromium* frame)
+// Convert WebKit::WebVideoFrame::Format to GraphicsContext3D's format enum values.
+static GC3Denum convertVFCFormatToGC3DFormat(const WebKit::WebVideoFrame& frame)
{
- switch (frame->format()) {
- case VideoFrameChromium::YV12:
- case VideoFrameChromium::YV16:
+ switch (frame.format()) {
+ case WebKit::WebVideoFrame::FormatYV12:
+ case WebKit::WebVideoFrame::FormatYV16:
return GraphicsContext3D::LUMINANCE;
- case VideoFrameChromium::NativeTexture:
- return frame->textureTarget();
- case VideoFrameChromium::Invalid:
- case VideoFrameChromium::RGB32:
- case VideoFrameChromium::Empty:
- case VideoFrameChromium::I420:
+ case WebKit::WebVideoFrame::FormatNativeTexture:
+ return frame.textureTarget();
+ case WebKit::WebVideoFrame::FormatInvalid:
+ case WebKit::WebVideoFrame::FormatRGB32:
+ case WebKit::WebVideoFrame::FormatEmpty:
+ case WebKit::WebVideoFrame::FormatI420:
notImplemented();
}
return GraphicsContext3D::INVALID_VALUE;
if (!m_frame)
return;
- m_format = convertVFCFormatToGC3DFormat(m_frame);
+ m_format = convertVFCFormatToGC3DFormat(*m_frame);
if (m_format == GraphicsContext3D::INVALID_VALUE) {
m_provider->putCurrentFrame(m_frame);
return;
}
- if (!reserveTextures(m_frame, m_format, layerRenderer)) {
+ if (!reserveTextures(*m_frame, m_format, layerRenderer)) {
m_provider->putCurrentFrame(m_frame);
m_frame = 0;
}
m_frame = 0;
}
-IntSize CCVideoLayerImpl::computeVisibleSize(const VideoFrameChromium* frame, unsigned plane)
+static int videoFrameDimension(int originalDimension, unsigned plane, int format)
{
- int visibleWidth = frame->width(plane);
- int visibleHeight = frame->height(plane);
+ if (format == WebKit::WebVideoFrame::FormatYV12 && plane != WebKit::WebVideoFrame::yPlane)
+ return originalDimension / 2;
+ return originalDimension;
+}
+
+static bool hasPaddingBytes(const WebKit::WebVideoFrame& frame, unsigned plane)
+{
+ return frame.stride(plane) > videoFrameDimension(frame.width(), plane, frame.format());
+}
+
+IntSize CCVideoLayerImpl::computeVisibleSize(const WebKit::WebVideoFrame& frame, unsigned plane)
+{
+ int visibleWidth = videoFrameDimension(frame.width(), plane, frame.format());
+ int originalWidth = visibleWidth;
+ int visibleHeight = videoFrameDimension(frame.height(), plane, frame.format());
+
// When there are dead pixels at the edge of the texture, decrease
// the frame width by 1 to prevent the rightmost pixels from
// interpolating with the dead pixels.
- if (frame->hasPaddingBytes(plane))
+ if (hasPaddingBytes(frame, plane))
--visibleWidth;
// In YV12, every 2x2 square of Y values corresponds to one U and
// one V value. If we decrease the width of the UV plane, we must decrease the
// width of the Y texture by 2 for proper alignment. This must happen
// always, even if Y's texture does not have padding bytes.
- if (plane == VideoFrameChromium::yPlane && frame->format() == VideoFrameChromium::YV12) {
- if (frame->hasPaddingBytes(VideoFrameChromium::uPlane)) {
- int originalWidth = frame->width(plane);
+ if (plane == WebKit::WebVideoFrame::yPlane && frame.format() == WebKit::WebVideoFrame::FormatYV12) {
+ if (hasPaddingBytes(frame, WebKit::WebVideoFrame::uPlane))
visibleWidth = originalWidth - 2;
- }
}
return IntSize(visibleWidth, visibleHeight);
}
-bool CCVideoLayerImpl::reserveTextures(const VideoFrameChromium* frame, GC3Denum format, LayerRendererChromium* layerRenderer)
+bool CCVideoLayerImpl::reserveTextures(const WebKit::WebVideoFrame& frame, GC3Denum format, LayerRendererChromium* layerRenderer)
{
- if (frame->planes() > MaxPlanes)
+ if (frame.planes() > MaxPlanes)
return false;
int maxTextureSize = layerRenderer->capabilities().maxTextureSize;
- for (unsigned plane = 0; plane < frame->planes(); ++plane) {
- IntSize requiredTextureSize = frame->requiredTextureSize(plane);
+ for (unsigned plane = 0; plane < frame.planes(); ++plane) {
+ IntSize requiredTextureSize(frame.stride(plane), videoFrameDimension(frame.height(), plane, frame.format()));
// If the renderer cannot handle this large of a texture, return false.
// FIXME: Remove this test when tiled layers are implemented.
if (requiredTextureSize.isZero() || requiredTextureSize.width() > maxTextureSize || requiredTextureSize.height() > maxTextureSize)
#include "ManagedTexture.h"
#include "ShaderChromium.h"
-#include "VideoFrameChromium.h"
#include "VideoFrameProvider.h"
#include "VideoLayerChromium.h"
#include "cc/CCLayerImpl.h"
+namespace WebKit {
+class WebVideoFrame;
+}
+
namespace WebCore {
class CCLayerTreeHostImpl;
private:
explicit CCVideoLayerImpl(int, VideoFrameProvider*);
- static IntSize computeVisibleSize(const VideoFrameChromium*, unsigned plane);
+ static IntSize computeVisibleSize(const WebKit::WebVideoFrame&, unsigned plane);
virtual const char* layerTypeAsString() const OVERRIDE { return "VideoLayer"; }
- bool reserveTextures(const VideoFrameChromium*, GC3Denum format, LayerRendererChromium*);
+ bool reserveTextures(const WebKit::WebVideoFrame&, GC3Denum format, LayerRendererChromium*);
Mutex m_providerMutex; // Guards m_provider below.
VideoFrameProvider* m_provider;
float m_streamTextureMatrix[16];
CCLayerTreeHostImpl* m_layerTreeHostImpl;
- VideoFrameChromium* m_frame;
+ WebKit::WebVideoFrame* m_frame;
GC3Denum m_format;
};
+2012-04-13 James Robinson <jamesr@chromium.org>
+
+ [chromium] Move WebVideoFrame into Platform and remove WebCore::VideoFrameChromium wrapper API
+ https://bugs.webkit.org/show_bug.cgi?id=83851
+
+ Reviewed by Adam Barth.
+
+ Moves the WebVideoFrame interface into Platform and removes the now unnecessary VideoFrameChromiumImpl adapter
+ implementation.
+
+ * WebKit.gyp:
+ * public/WebVideoFrame.h:
+ * src/AssertMatchingEnums.cpp:
+ * src/VideoFrameChromiumImpl.cpp: Removed.
+ * src/VideoFrameChromiumImpl.h: Removed.
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::getCurrentFrame):
+ (WebKit::WebMediaPlayerClientImpl::putCurrentFrame):
+ (WebKit::WebMediaPlayerClientImpl::supportsType):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+
2012-04-13 Rob Flack <flackr@chromium.org>
Chromium: Should enable -webkit-image-set
'src/WebTextCheckingCompletionImpl.h',
'src/WebTextCheckingCompletionImpl.cpp',
'src/WebTextCheckingResult.cpp',
- 'src/VideoFrameChromiumImpl.cpp',
- 'src/VideoFrameChromiumImpl.h',
'src/WebAccessibilityObject.cpp',
'src/WebAnimationControllerImpl.cpp',
'src/WebAnimationControllerImpl.h',
'include_dirs': [
'public',
'src',
+ # WebKit unit tests are allowed to include WebKit and WebCore header files, which may include headers in the
+ # Platform API as <public/WebFoo.h>. Thus we need to have the Platform API include path, but we can't depend
+ # directly on Platform.gyp:webkit_platform since platform cannot link as a separate library. Instead, we just
+ # add the include path directly.
+ '../../Platform/chromium',
],
'conditions': [
['inside_chromium_build==1 and component=="shared_library"', {
/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012 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:
+ * 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.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
*
- * 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.
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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.
-// Keep in sync with VideoFrameChromium and chromium's media::VideoFrame::Format.
-class WebVideoFrame {
-public:
- enum Format {
- FormatInvalid = 0,
- FormatRGB32 = 4,
- FormatYV12 = 6,
- FormatYV16 = 7,
- FormatEmpty = 9,
- FormatI420 = 11,
- FormatNativeTexture = 12,
- };
-
- virtual ~WebVideoFrame() { }
- virtual Format format() const { return FormatInvalid; }
- virtual unsigned width() const { return 0; }
- virtual unsigned height() const { return 0; }
- virtual unsigned planes() const { return 0; }
- virtual int stride(unsigned plane) const { return 0; }
- virtual const void* data(unsigned plane) const { return 0; }
- virtual unsigned textureId() const { return 0; }
- virtual unsigned textureTarget() const { return 0; }
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../Platform/chromium/public/WebVideoFrame.h"
#include "UserContentTypes.h"
#include "UserScriptTypes.h"
#include "UserStyleSheetTypes.h"
-#include "VideoFrameChromium.h"
#include "WebAccessibilityNotification.h"
#include "WebAccessibilityObject.h"
#include "WebApplicationCacheHost.h"
#include "WebTextCaseSensitivity.h"
#include "WebTextCheckingResult.h"
#include "WebTextCheckingType.h"
-#include "WebVideoFrame.h"
#include "WebView.h"
#include "platform/WebClipboard.h"
#include "platform/WebFileSystem.h"
COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayerClient::DomainError, MediaPlayerClient::DomainError);
#endif
-COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatInvalid, VideoFrameChromium::Invalid);
-COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatRGB32, VideoFrameChromium::RGB32);
-COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatYV12, VideoFrameChromium::YV12);
-COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatYV16, VideoFrameChromium::YV16);
-COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatEmpty, VideoFrameChromium::Empty);
#endif
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+++ /dev/null
-/*
- * 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 {
-
-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::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::width(unsigned plane) const
-{
- unsigned planeWidth = width();
- if (format() == YV12 && plane != static_cast<unsigned>(yPlane))
- planeWidth /= 2;
- return planeWidth;
-}
-
-unsigned VideoFrameChromiumImpl::height() const
-{
- if (m_webVideoFrame)
- return m_webVideoFrame->height();
- return 0;
-}
-
-unsigned VideoFrameChromiumImpl::height(unsigned plane) const
-{
- unsigned planeHeight = height();
- if (format() == YV12 && plane != static_cast<unsigned>(yPlane))
- planeHeight /= 2;
- return planeHeight;
-}
-
-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;
-}
-
-const IntSize VideoFrameChromiumImpl::requiredTextureSize(unsigned plane) const
-{
- return IntSize(stride(plane), height(plane));
-}
-
-bool VideoFrameChromiumImpl::hasPaddingBytes(unsigned plane) const
-{
- if (m_webVideoFrame)
- return stride(plane) - width(plane) > 0;
- return false;
-}
-
-unsigned VideoFrameChromiumImpl::textureId() const
-{
- if (m_webVideoFrame)
- return m_webVideoFrame->textureId();
- return 0;
-}
-
-unsigned VideoFrameChromiumImpl::textureTarget() const
-{
- if (m_webVideoFrame)
- return m_webVideoFrame->textureTarget();
- return 0;
-}
-
-} // namespace WebKit
+++ /dev/null
-/*
- * 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"
-
-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 WebCore::VideoFrameChromium {
-public:
- // Converts a WebCore::VideoFrameChromium to a WebKit::WebVideoFrame.
- static WebVideoFrame* toWebVideoFrame(WebCore::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 Format format() const;
- virtual unsigned width() const;
- virtual unsigned width(unsigned plane) const;
- virtual unsigned height() const;
- virtual unsigned height(unsigned plane) const;
- virtual unsigned planes() const;
- virtual int stride(unsigned plane) const;
- virtual const void* data(unsigned plane) const;
- virtual const WebCore::IntSize requiredTextureSize(unsigned plane) const;
- virtual bool hasPaddingBytes(unsigned plane) const;
- virtual unsigned textureId() const;
- virtual unsigned textureTarget() const;
-
-private:
- WebVideoFrame* m_webVideoFrame;
-};
-
-} // namespace WebKit
-
-#endif
#include "PlatformContextSkia.h"
#include "RenderView.h"
#include "TimeRanges.h"
-#include "VideoFrameChromium.h"
-#include "VideoFrameChromiumImpl.h"
#include "VideoLayerChromium.h"
#include "WebAudioSourceProvider.h"
#include "WebFrameClient.h"
m_webMediaPlayer->setStreamTextureClient(client ? this : 0);
}
-VideoFrameChromium* WebMediaPlayerClientImpl::getCurrentFrame()
+WebVideoFrame* WebMediaPlayerClientImpl::getCurrentFrame()
{
MutexLocker locker(m_compositingMutex);
ASSERT(!m_currentVideoFrame);
- if (m_webMediaPlayer) {
- WebVideoFrame* webkitVideoFrame = m_webMediaPlayer->getCurrentFrame();
- if (webkitVideoFrame)
- m_currentVideoFrame = adoptPtr(new VideoFrameChromiumImpl(webkitVideoFrame));
- }
- return m_currentVideoFrame.get();
+ if (m_webMediaPlayer)
+ m_currentVideoFrame = m_webMediaPlayer->getCurrentFrame();
+ return m_currentVideoFrame;
}
-void WebMediaPlayerClientImpl::putCurrentFrame(VideoFrameChromium* videoFrame)
+void WebMediaPlayerClientImpl::putCurrentFrame(WebVideoFrame* videoFrame)
{
MutexLocker locker(m_compositingMutex);
ASSERT(videoFrame == m_currentVideoFrame);
if (!videoFrame)
return;
- if (m_webMediaPlayer) {
- m_webMediaPlayer->putCurrentFrame(
- VideoFrameChromiumImpl::toWebVideoFrame(videoFrame));
- }
- m_currentVideoFrame.clear();
+ if (m_webMediaPlayer)
+ m_webMediaPlayer->putCurrentFrame(videoFrame);
+ m_currentVideoFrame = 0;
}
#endif
WebMediaPlayerClientImpl::WebMediaPlayerClientImpl()
: m_mediaPlayer(0)
+ , m_currentVideoFrame(0)
, m_delayingLoad(false)
, m_preload(MediaPlayer::MetaData)
#if USE(ACCELERATED_COMPOSITING)
#include "AudioSourceProvider.h"
#include "MediaPlayerPrivate.h"
-#include "VideoFrameChromium.h"
#include "VideoFrameProvider.h"
#include "VideoLayerChromium.h"
#include "WebAudioSourceProviderClient.h"
// VideoFrameProvider methods:
virtual void setVideoFrameProviderClient(VideoFrameProvider::Client*);
- virtual WebCore::VideoFrameChromium* getCurrentFrame();
- virtual void putCurrentFrame(WebCore::VideoFrameChromium*);
+ virtual WebVideoFrame* getCurrentFrame();
+ virtual void putCurrentFrame(WebVideoFrame*);
#endif
#if ENABLE(MEDIA_SOURCE)
Mutex m_compositingMutex; // Guards m_currentVideoFrame and m_videoFrameProviderClient.
WebCore::MediaPlayer* m_mediaPlayer;
OwnPtr<WebMediaPlayer> m_webMediaPlayer;
- OwnPtr<WebCore::VideoFrameChromium> m_currentVideoFrame;
+ WebVideoFrame* m_currentVideoFrame;
String m_url;
bool m_delayingLoad;
WebCore::MediaPlayer::Preload m_preload;