OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 /* |
2 // Use of this source code is governed by a BSD-style license that can be | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 // found in the LICENSE file. | 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 */ |
4 | 30 |
5 #ifndef WEBKIT_GLUE_WEBMEDIAPLAYERCLIENT_IMPL_H_ | 31 #ifndef WebMediaPlayerClientImpl_h |
6 #define WEBKIT_GLUE_WEBMEDIAPLAYERCLIENT_IMPL_H_ | 32 #define WebMediaPlayerClientImpl_h |
7 | 33 |
8 #if ENABLE(VIDEO) | 34 #if ENABLE(VIDEO) |
9 | 35 |
10 #include "webkit/api/public/WebMediaPlayerClient.h" | 36 #include "WebMediaPlayerClient.h" |
11 | 37 |
12 #include "MediaPlayerPrivate.h" | 38 #include "MediaPlayerPrivate.h" |
13 | 39 #include <wtf/OwnPtr.h> |
14 namespace WebCore { | |
15 class MediaPlayerPrivate; | |
16 } // namespace WebCore | |
17 | 40 |
18 namespace WebKit { | 41 namespace WebKit { |
19 class WebMediaPlayer; | 42 class WebMediaPlayer; |
20 } // namespace WebKit | |
21 | 43 |
22 class WebMediaPlayerClientImpl : public WebKit::WebMediaPlayerClient, | 44 // This class serves as a bridge between WebCore::MediaPlayer and |
23 public WebCore::MediaPlayerPrivateInterface { | 45 // WebKit::WebMediaPlayer. |
24 public: | 46 class WebMediaPlayerClientImpl : public WebMediaPlayerClient |
25 virtual ~WebMediaPlayerClientImpl(); | 47 , public WebCore::MediaPlayerPrivateInterface { |
| 48 public: |
| 49 static void setIsEnabled(bool); |
| 50 static void registerSelf(WebCore::MediaEngineRegistrar); |
26 | 51 |
27 //////////////////////////////////////////////////////////////////////////// | 52 // WebMediaPlayerClient methods: |
28 // WebMediaPlayerPlayerClient methods | 53 virtual void networkStateChanged(); |
29 virtual void networkStateChanged(); | 54 virtual void readyStateChanged(); |
30 virtual void readyStateChanged(); | 55 virtual void volumeChanged(); |
31 virtual void volumeChanged(); | 56 virtual void timeChanged(); |
32 virtual void timeChanged(); | 57 virtual void repaint(); |
33 virtual void repaint(); | 58 virtual void durationChanged(); |
34 virtual void durationChanged(); | 59 virtual void rateChanged(); |
35 virtual void rateChanged(); | 60 virtual void sizeChanged(); |
36 virtual void sizeChanged(); | 61 virtual void sawUnsupportedTracks(); |
37 virtual void sawUnsupportedTracks(); | |
38 | 62 |
39 //////////////////////////////////////////////////////////////////////////// | 63 // MediaPlayerPrivateInterface methods: |
40 // MediaPlayerPrivateInterface methods | 64 virtual void load(const WebCore::String& url); |
41 virtual void load(const WebCore::String& url); | 65 virtual void cancelLoad(); |
42 virtual void cancelLoad(); | 66 virtual void play(); |
| 67 virtual void pause(); |
| 68 virtual WebCore::IntSize naturalSize() const; |
| 69 virtual bool hasVideo() const; |
| 70 virtual void setVisible(bool); |
| 71 virtual float duration() const; |
| 72 virtual float currentTime() const; |
| 73 virtual void seek(float time); |
| 74 virtual bool seeking() const; |
| 75 virtual void setEndTime(float time); |
| 76 virtual void setRate(float); |
| 77 virtual bool paused() const; |
| 78 virtual void setVolume(float); |
| 79 virtual WebCore::MediaPlayer::NetworkState networkState() const; |
| 80 virtual WebCore::MediaPlayer::ReadyState readyState() const; |
| 81 virtual float maxTimeSeekable() const; |
| 82 virtual float maxTimeBuffered() const; |
| 83 virtual int dataRate() const; |
| 84 virtual void setAutobuffer(bool); |
| 85 virtual bool totalBytesKnown() const; |
| 86 virtual unsigned totalBytes() const; |
| 87 virtual unsigned bytesLoaded() const; |
| 88 virtual void setSize(const WebCore::IntSize&); |
| 89 virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); |
43 | 90 |
44 virtual void play(); | 91 private: |
45 virtual void pause(); | 92 WebMediaPlayerClientImpl(); |
46 | 93 |
47 virtual WebCore::IntSize naturalSize() const; | 94 static WebCore::MediaPlayerPrivateInterface* create(WebCore::MediaPlayer*); |
| 95 static void getSupportedTypes(WTF::HashSet<WebCore::String>&); |
| 96 static WebCore::MediaPlayer::SupportsType supportsType( |
| 97 const WebCore::String& type, const WebCore::String& codecs); |
48 | 98 |
49 virtual bool hasVideo() const; | 99 WebCore::MediaPlayer* m_mediaPlayer; |
| 100 OwnPtr<WebMediaPlayer> m_webMediaPlayer; |
| 101 }; |
50 | 102 |
51 virtual void setVisible(bool); | 103 } // namespace WebKit |
52 | 104 |
53 virtual float duration() const; | 105 #endif |
54 | 106 |
55 virtual float currentTime() const; | 107 #endif |
56 virtual void seek(float time); | |
57 virtual bool seeking() const; | |
58 | |
59 virtual void setEndTime(float time); | |
60 | |
61 virtual void setRate(float); | |
62 virtual bool paused() const; | |
63 | |
64 virtual void setVolume(float); | |
65 | |
66 virtual WebCore::MediaPlayer::NetworkState networkState() const; | |
67 virtual WebCore::MediaPlayer::ReadyState readyState() const; | |
68 | |
69 virtual float maxTimeSeekable() const; | |
70 virtual float maxTimeBuffered() const; | |
71 | |
72 virtual int dataRate() const; | |
73 virtual void setAutobuffer(bool); | |
74 | |
75 virtual bool totalBytesKnown() const; | |
76 virtual unsigned totalBytes() const; | |
77 virtual unsigned bytesLoaded() const; | |
78 | |
79 virtual void setSize(const WebCore::IntSize&); | |
80 virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); | |
81 | |
82 private: | |
83 friend class WebCore::MediaPlayerPrivate; | |
84 | |
85 WebMediaPlayerClientImpl(); | |
86 | |
87 // Static methods used by WebKit for construction. | |
88 static WebCore::MediaPlayerPrivateInterface* create( | |
89 WebCore::MediaPlayer* player); | |
90 static void getSupportedTypes( | |
91 WTF::HashSet<WebCore::String>& supportedTypes); | |
92 static WebCore::MediaPlayer::SupportsType supportsType( | |
93 const WebCore::String& type, const WebCore::String& codecs); | |
94 | |
95 WebCore::MediaPlayer* m_mediaPlayer; | |
96 WebKit::WebMediaPlayer* m_webMediaPlayer; | |
97 }; | |
98 | |
99 #endif // ENABLE(VIDEO) | |
100 | |
101 #endif // WEBKIT_GLUE_WEBMEDIAPLAYERCLIENT_IMPL_H_ | |
OLD | NEW |