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 "WebMediaPlayerClient.h" | |
38 #include <wtf/OwnPtr.h> | |
39 | |
40 namespace WebKit { | |
41 | |
42 class WebMediaPlayer; | |
43 | |
44 // This class serves as a bridge between WebCore::MediaPlayer and | |
45 // WebKit::WebMediaPlayer. | |
46 class WebMediaPlayerClientImpl : public WebMediaPlayerClient | |
47 , public WebCore::MediaPlayerPrivateInterface { | |
48 public: | |
49 static bool isEnabled(); | |
50 static void setIsEnabled(bool); | |
51 static void registerSelf(WebCore::MediaEngineRegistrar); | |
52 | |
53 // WebMediaPlayerClient methods: | |
54 virtual void networkStateChanged(); | |
55 virtual void readyStateChanged(); | |
56 virtual void volumeChanged(); | |
57 virtual void timeChanged(); | |
58 virtual void repaint(); | |
59 virtual void durationChanged(); | |
60 virtual void rateChanged(); | |
61 virtual void sizeChanged(); | |
62 virtual void sawUnsupportedTracks(); | |
63 | |
64 // MediaPlayerPrivateInterface methods: | |
65 virtual void load(const WebCore::String& url); | |
66 virtual void cancelLoad(); | |
67 virtual void play(); | |
68 virtual void pause(); | |
69 virtual bool supportsFullscreen() const; | |
70 virtual bool supportsSave() const; | |
71 virtual WebCore::IntSize naturalSize() const; | |
72 virtual bool hasVideo() const; | |
73 virtual bool hasAudio() const; | |
74 virtual void setVisible(bool); | |
75 virtual float duration() const; | |
76 virtual float currentTime() const; | |
77 virtual void seek(float time); | |
78 virtual bool seeking() const; | |
79 virtual void setEndTime(float time); | |
80 virtual void setRate(float); | |
81 virtual bool paused() const; | |
82 virtual void setVolume(float); | |
83 virtual WebCore::MediaPlayer::NetworkState networkState() const; | |
84 virtual WebCore::MediaPlayer::ReadyState readyState() const; | |
85 virtual float maxTimeSeekable() const; | |
86 virtual WTF::PassRefPtr<WebCore::TimeRanges> buffered() const; | |
87 virtual int dataRate() const; | |
88 virtual void setAutobuffer(bool); | |
89 virtual bool totalBytesKnown() const; | |
90 virtual unsigned totalBytes() const; | |
91 virtual unsigned bytesLoaded() const; | |
92 virtual void setSize(const WebCore::IntSize&); | |
93 virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); | |
94 virtual bool hasSingleSecurityOrigin() const; | |
95 virtual WebCore::MediaPlayer::MovieLoadType movieLoadType() const; | |
96 | |
97 private: | |
98 WebMediaPlayerClientImpl(); | |
99 | |
100 static WebCore::MediaPlayerPrivateInterface* create(WebCore::MediaPlayer*); | |
101 static void getSupportedTypes(WTF::HashSet<WebCore::String>&); | |
102 static WebCore::MediaPlayer::SupportsType supportsType( | |
103 const WebCore::String& type, const WebCore::String& codecs); | |
104 | |
105 WebCore::MediaPlayer* m_mediaPlayer; | |
106 OwnPtr<WebMediaPlayer> m_webMediaPlayer; | |
107 static bool m_isEnabled; | |
108 }; | |
109 | |
110 } // namespace WebKit | |
111 | |
112 #endif | |
113 | |
114 #endif | |
OLD | NEW |