OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (C) 2009 Google 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 are |
| 6 * met: |
| 7 * |
| 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the |
| 13 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. |
| 17 * |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ |
| 30 |
| 31 #ifndef WebMediaPlayerClientImpl_h |
| 32 #define WebMediaPlayerClientImpl_h |
| 33 |
| 34 #if ENABLE(VIDEO) |
| 35 |
| 36 #include "MediaPlayerPrivate.h" |
| 37 #include "VideoFrameChromium.h" |
| 38 #include "VideoFrameProvider.h" |
| 39 #include "WebMediaPlayerClient.h" |
| 40 #include <wtf/OwnPtr.h> |
| 41 |
| 42 namespace WebKit { |
| 43 |
| 44 class WebMediaElement; |
| 45 class WebMediaPlayer; |
| 46 |
| 47 // This class serves as a bridge between WebCore::MediaPlayer and |
| 48 // WebKit::WebMediaPlayer. |
| 49 class WebMediaPlayerClientImpl : public WebCore::MediaPlayerPrivateInterface |
| 50 , public WebCore::VideoFrameProvider |
| 51 , public WebMediaPlayerClient { |
| 52 |
| 53 public: |
| 54 static bool isEnabled(); |
| 55 static void setIsEnabled(bool); |
| 56 static void registerSelf(WebCore::MediaEngineRegistrar); |
| 57 |
| 58 static WebMediaPlayerClientImpl* fromMediaElement(const WebMediaElement* ele
ment); |
| 59 |
| 60 // Returns the encapsulated WebKit::WebMediaPlayer. |
| 61 WebMediaPlayer* mediaPlayer() const; |
| 62 |
| 63 // WebMediaPlayerClient methods: |
| 64 virtual void networkStateChanged(); |
| 65 virtual void readyStateChanged(); |
| 66 virtual void volumeChanged(float); |
| 67 virtual void muteChanged(bool); |
| 68 virtual void timeChanged(); |
| 69 virtual void repaint(); |
| 70 virtual void durationChanged(); |
| 71 virtual void rateChanged(); |
| 72 virtual void sizeChanged(); |
| 73 virtual void sawUnsupportedTracks(); |
| 74 virtual float volume() const; |
| 75 |
| 76 // MediaPlayerPrivateInterface methods: |
| 77 virtual void load(const WebCore::String& url); |
| 78 virtual void cancelLoad(); |
| 79 #if USE(ACCELERATED_COMPOSITING) |
| 80 virtual WebCore::PlatformLayer* platformLayer() const; |
| 81 #endif |
| 82 virtual WebCore::PlatformMedia platformMedia() const; |
| 83 virtual void play(); |
| 84 virtual void pause(); |
| 85 virtual bool supportsFullscreen() const; |
| 86 virtual bool supportsSave() const; |
| 87 virtual WebCore::IntSize naturalSize() const; |
| 88 virtual bool hasVideo() const; |
| 89 virtual bool hasAudio() const; |
| 90 virtual void setVisible(bool); |
| 91 virtual float duration() const; |
| 92 virtual float currentTime() const; |
| 93 virtual void seek(float time); |
| 94 virtual bool seeking() const; |
| 95 virtual void setEndTime(float time); |
| 96 virtual void setRate(float); |
| 97 virtual bool paused() const; |
| 98 virtual void setVolume(float); |
| 99 virtual WebCore::MediaPlayer::NetworkState networkState() const; |
| 100 virtual WebCore::MediaPlayer::ReadyState readyState() const; |
| 101 virtual float maxTimeSeekable() const; |
| 102 virtual WTF::PassRefPtr<WebCore::TimeRanges> buffered() const; |
| 103 virtual int dataRate() const; |
| 104 virtual void setAutobuffer(bool); |
| 105 virtual bool totalBytesKnown() const; |
| 106 virtual unsigned totalBytes() const; |
| 107 virtual unsigned bytesLoaded() const; |
| 108 virtual void setSize(const WebCore::IntSize&); |
| 109 virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); |
| 110 virtual bool hasSingleSecurityOrigin() const; |
| 111 #if USE(ACCELERATED_COMPOSITING) |
| 112 virtual bool supportsAcceleratedRendering() const; |
| 113 #endif |
| 114 |
| 115 virtual WebCore::MediaPlayer::MovieLoadType movieLoadType() const; |
| 116 |
| 117 // VideoFrameProvider interface |
| 118 virtual void getCurrentFrame(WebCore::VideoFrameChromium** frameOut); |
| 119 virtual void putCurrentFrame(WebCore::VideoFrameChromium* frame); |
| 120 |
| 121 private: |
| 122 WebMediaPlayerClientImpl(); |
| 123 |
| 124 static WebCore::MediaPlayerPrivateInterface* create(WebCore::MediaPlayer*); |
| 125 static void getSupportedTypes(WTF::HashSet<WebCore::String>&); |
| 126 static WebCore::MediaPlayer::SupportsType supportsType( |
| 127 const WebCore::String& type, const WebCore::String& codecs); |
| 128 |
| 129 WebCore::MediaPlayer* m_mediaPlayer; |
| 130 OwnPtr<WebMediaPlayer> m_webMediaPlayer; |
| 131 #if USE(ACCELERATED_COMPOSITING) |
| 132 RefPtr<WebCore::PlatformLayer> m_videoLayer; |
| 133 bool m_supportsAcceleratedCompositing; |
| 134 #endif |
| 135 static bool m_isEnabled; |
| 136 }; |
| 137 |
| 138 } // namespace WebKit |
| 139 |
| 140 #endif |
| 141 |
| 142 #endif |
OLD | NEW |