| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions | |
| 6 * are met: | |
| 7 * 1. Redistributions of source code must retain the above copyright | |
| 8 * notice, this list of conditions and the following disclaimer. | |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | |
| 10 * notice, this list of conditions and the following disclaimer in the | |
| 11 * documentation and/or other materials provided with the distribution. | |
| 12 * | |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 24 */ | |
| 25 | |
| 26 #ifndef HTMLVideoElement_h | |
| 27 #define HTMLVideoElement_h | |
| 28 | |
| 29 #include "core/html/HTMLMediaElement.h" | |
| 30 #include "core/html/canvas/CanvasImageSource.h" | |
| 31 #include "platform/graphics/GraphicsTypes3D.h" | |
| 32 | |
| 33 namespace blink { | |
| 34 class WebGraphicsContext3D; | |
| 35 } | |
| 36 | |
| 37 namespace blink { | |
| 38 | |
| 39 class ExceptionState; | |
| 40 class HTMLImageLoader; | |
| 41 class GraphicsContext; | |
| 42 | |
| 43 // GL types as defined in OpenGL ES 2.0 header file gl2.h from khronos.org. | |
| 44 // That header cannot be included directly due to a conflict with NPAPI headers. | |
| 45 // See crbug.com/328085. | |
| 46 typedef unsigned GLenum; | |
| 47 typedef int GC3Dint; | |
| 48 | |
| 49 class HTMLVideoElement final : public HTMLMediaElement, public CanvasImageSource
{ | |
| 50 DEFINE_WRAPPERTYPEINFO(); | |
| 51 public: | |
| 52 static PassRefPtr<HTMLVideoElement> create(Document&); | |
| 53 | |
| 54 unsigned videoWidth() const; | |
| 55 unsigned videoHeight() const; | |
| 56 | |
| 57 // Used by canvas to gain raw pixel access | |
| 58 void paintCurrentFrameInContext(GraphicsContext*, const IntRect&) const; | |
| 59 | |
| 60 // Used by WebGL to do GPU-GPU textures copy if possible. | |
| 61 // See more details at MediaPlayer::copyVideoTextureToPlatformTexture() defi
ned in engine/WebCore/platform/graphics/MediaPlayer.h. | |
| 62 bool copyVideoTextureToPlatformTexture(WebGraphicsContext3D*, Platform3DObje
ct texture, GC3Dint level, GLenum internalFormat, GLenum type, bool premultiplyA
lpha, bool flipY); | |
| 63 | |
| 64 bool shouldDisplayPosterImage() const { return displayMode() == Poster || di
splayMode() == PosterWaitingForVideo; } | |
| 65 | |
| 66 KURL posterImageURL() const; | |
| 67 | |
| 68 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d
epend on it. | |
| 69 virtual KURL mediaPlayerPosterURL() override; | |
| 70 | |
| 71 // CanvasImageSource implementation | |
| 72 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceIma
geStatus*) const override; | |
| 73 virtual bool isVideoElement() const override { return true; } | |
| 74 virtual FloatSize sourceSize() const override; | |
| 75 virtual const KURL& sourceURL() const override { return currentSrc(); } | |
| 76 | |
| 77 virtual bool isHTMLVideoElement() const override { return true; } | |
| 78 | |
| 79 private: | |
| 80 HTMLVideoElement(Document&); | |
| 81 | |
| 82 virtual bool rendererIsNeeded(const RenderStyle&) override; | |
| 83 virtual RenderObject* createRenderer(RenderStyle*) override; | |
| 84 virtual void attach(const AttachContext& = AttachContext()) override; | |
| 85 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr
ide; | |
| 86 virtual bool hasVideo() const override { return webMediaPlayer() && webMedia
Player()->hasVideo(); } | |
| 87 virtual bool isURLAttribute(const Attribute&) const override; | |
| 88 virtual const AtomicString imageSourceURL() const override; | |
| 89 | |
| 90 bool hasAvailableVideoFrame() const; | |
| 91 virtual void updateDisplayState() override; | |
| 92 virtual void didMoveToNewDocument(Document& oldDocument) override; | |
| 93 virtual void setDisplayMode(DisplayMode) override; | |
| 94 | |
| 95 OwnPtr<HTMLImageLoader> m_imageLoader; | |
| 96 | |
| 97 AtomicString m_defaultPosterURL; | |
| 98 }; | |
| 99 | |
| 100 } // namespace blink | |
| 101 | |
| 102 #endif // HTMLVideoElement_h | |
| OLD | NEW |