OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "third_party/skia/include/core/SkRefCnt.h" | 41 #include "third_party/skia/include/core/SkRefCnt.h" |
42 #include "third_party/skia/include/gpu/GrTexture.h" | 42 #include "third_party/skia/include/gpu/GrTexture.h" |
43 #endif | 43 #endif |
44 #include "platform/weborigin/KURL.h" | 44 #include "platform/weborigin/KURL.h" |
45 #include "wtf/OwnPtr.h" | 45 #include "wtf/OwnPtr.h" |
46 #include "wtf/PassOwnPtr.h" | 46 #include "wtf/PassOwnPtr.h" |
47 #include "wtf/ThreadingPrimitives.h" | 47 #include "wtf/ThreadingPrimitives.h" |
48 | 48 |
49 namespace WebCore { | 49 namespace WebCore { |
50 class AudioSourceProviderClient; | 50 class AudioSourceProviderClient; |
| 51 class HTMLMediaElement; |
51 } | 52 } |
52 | 53 |
53 namespace blink { | 54 namespace blink { |
54 | 55 |
55 class WebHelperPlugin; | 56 class WebHelperPlugin; |
56 class WebAudioSourceProvider; | 57 class WebAudioSourceProvider; |
57 class WebContentDecryptionModule; | 58 class WebContentDecryptionModule; |
58 class WebMediaPlayer; | 59 class WebMediaPlayer; |
59 class WebGraphicsContext3D; | 60 class WebGraphicsContext3D; |
60 | 61 |
61 // This class serves as a bridge between WebCore::MediaPlayer and | 62 // This class serves as a bridge between WebCore::MediaPlayer and |
62 // blink::WebMediaPlayer. | 63 // blink::WebMediaPlayer. |
63 class WebMediaPlayerClientImpl FINAL : public WebCore::MediaPlayer, public WebMe
diaPlayerClient { | 64 class WebMediaPlayerClientImpl FINAL : public WebCore::MediaPlayer, public WebMe
diaPlayerClient { |
64 | 65 |
65 public: | 66 public: |
66 static PassOwnPtr<WebCore::MediaPlayer> create(WebCore::MediaPlayerClient*); | 67 static PassOwnPtr<WebCore::MediaPlayer> create(WebCore::MediaPlayerClient*); |
67 | 68 |
68 virtual ~WebMediaPlayerClientImpl(); | 69 virtual ~WebMediaPlayerClientImpl(); |
69 | 70 |
70 // Returns the encapsulated blink::WebMediaPlayer. | |
71 WebMediaPlayer* mediaPlayer() const; | |
72 | |
73 // WebMediaPlayerClient methods: | 71 // WebMediaPlayerClient methods: |
74 virtual void networkStateChanged() OVERRIDE; | 72 virtual void networkStateChanged() OVERRIDE; |
75 virtual void readyStateChanged() OVERRIDE; | 73 virtual void readyStateChanged() OVERRIDE; |
76 virtual void timeChanged() OVERRIDE; | 74 virtual void timeChanged() OVERRIDE; |
77 virtual void repaint() OVERRIDE; | 75 virtual void repaint() OVERRIDE; |
78 virtual void durationChanged() OVERRIDE; | 76 virtual void durationChanged() OVERRIDE; |
79 virtual void sizeChanged() OVERRIDE; | 77 virtual void sizeChanged() OVERRIDE; |
80 virtual void setOpaque(bool) OVERRIDE; | 78 virtual void setOpaque(bool) OVERRIDE; |
81 virtual double volume() const OVERRIDE; | 79 virtual double volume() const OVERRIDE; |
82 virtual void playbackStateChanged() OVERRIDE; | 80 virtual void playbackStateChanged() OVERRIDE; |
83 virtual WebMediaPlayer::Preload preload() const OVERRIDE; | 81 virtual WebMediaPlayer::Preload preload() const OVERRIDE; |
| 82 |
| 83 // WebEncryptedMediaPlayerClient methods: |
84 virtual void keyAdded(const WebString& keySystem, const WebString& sessionId
) OVERRIDE; | 84 virtual void keyAdded(const WebString& keySystem, const WebString& sessionId
) OVERRIDE; |
85 virtual void keyError(const WebString& keySystem, const WebString& sessionId
, MediaKeyErrorCode, unsigned short systemCode) OVERRIDE; | 85 virtual void keyError(const WebString& keySystem, const WebString& sessionId
, MediaKeyErrorCode, unsigned short systemCode) OVERRIDE; |
86 virtual void keyMessage(const WebString& keySystem, const WebString& session
Id, const unsigned char* message, unsigned messageLength, const WebURL& defaultU
RL) OVERRIDE; | 86 virtual void keyMessage(const WebString& keySystem, const WebString& session
Id, const unsigned char* message, unsigned messageLength, const WebURL& defaultU
RL) OVERRIDE; |
87 virtual void keyNeeded(const WebString& contentType, const unsigned char* in
itData, unsigned initDataLength) OVERRIDE; | 87 virtual void keyNeeded(const WebString& contentType, const unsigned char* in
itData, unsigned initDataLength) OVERRIDE; |
88 virtual WebPlugin* createHelperPlugin(const WebString& pluginType, WebFrame*
) OVERRIDE; | 88 virtual WebPlugin* createHelperPlugin(const WebString& pluginType, WebFrame*
) OVERRIDE; |
89 virtual void closeHelperPluginSoon(WebFrame*) OVERRIDE; | 89 virtual void closeHelperPluginSoon(WebFrame*) OVERRIDE; |
| 90 |
90 virtual bool needsWebLayerForVideo() const OVERRIDE; | 91 virtual bool needsWebLayerForVideo() const OVERRIDE; |
91 virtual void setWebLayer(WebLayer*) OVERRIDE; | 92 virtual void setWebLayer(WebLayer*) OVERRIDE; |
92 virtual void addTextTrack(WebInbandTextTrack*) OVERRIDE; | 93 virtual void addTextTrack(WebInbandTextTrack*) OVERRIDE; |
93 virtual void removeTextTrack(WebInbandTextTrack*) OVERRIDE; | 94 virtual void removeTextTrack(WebInbandTextTrack*) OVERRIDE; |
94 virtual void mediaSourceOpened(WebMediaSource*) OVERRIDE; | 95 virtual void mediaSourceOpened(WebMediaSource*) OVERRIDE; |
95 virtual void requestFullscreen() OVERRIDE; | 96 virtual void requestFullscreen() OVERRIDE; |
96 virtual void requestSeek(double) OVERRIDE; | 97 virtual void requestSeek(double) OVERRIDE; |
97 | 98 |
98 // MediaPlayer methods: | 99 // MediaPlayer methods: |
| 100 virtual WebMediaPlayer* webMediaPlayer() const OVERRIDE; |
99 virtual void load(WebMediaPlayer::LoadType, const WTF::String& url) OVERRIDE
; | 101 virtual void load(WebMediaPlayer::LoadType, const WTF::String& url) OVERRIDE
; |
100 | |
101 virtual void play() OVERRIDE; | 102 virtual void play() OVERRIDE; |
102 virtual void pause() OVERRIDE; | 103 virtual void pause() OVERRIDE; |
103 virtual void prepareToPlay() OVERRIDE; | 104 virtual void prepareToPlay() OVERRIDE; |
104 virtual bool supportsSave() const OVERRIDE; | 105 virtual bool supportsSave() const OVERRIDE; |
105 virtual WebCore::IntSize naturalSize() const OVERRIDE; | 106 virtual WebCore::IntSize naturalSize() const OVERRIDE; |
106 virtual bool hasVideo() const OVERRIDE; | 107 virtual bool hasVideo() const OVERRIDE; |
107 virtual bool hasAudio() const OVERRIDE; | 108 virtual bool hasAudio() const OVERRIDE; |
108 virtual double duration() const OVERRIDE; | 109 virtual double duration() const OVERRIDE; |
109 virtual double currentTime() const OVERRIDE; | 110 virtual double currentTime() const OVERRIDE; |
110 virtual void seek(double time) OVERRIDE; | 111 virtual void seek(double time) OVERRIDE; |
(...skipping 21 matching lines...) Expand all Loading... |
132 virtual unsigned audioDecodedByteCount() const OVERRIDE; | 133 virtual unsigned audioDecodedByteCount() const OVERRIDE; |
133 virtual unsigned videoDecodedByteCount() const OVERRIDE; | 134 virtual unsigned videoDecodedByteCount() const OVERRIDE; |
134 virtual void showFullscreenOverlay() OVERRIDE; | 135 virtual void showFullscreenOverlay() OVERRIDE; |
135 virtual void hideFullscreenOverlay() OVERRIDE; | 136 virtual void hideFullscreenOverlay() OVERRIDE; |
136 virtual bool canShowFullscreenOverlay() const OVERRIDE; | 137 virtual bool canShowFullscreenOverlay() const OVERRIDE; |
137 | 138 |
138 #if ENABLE(WEB_AUDIO) | 139 #if ENABLE(WEB_AUDIO) |
139 virtual WebCore::AudioSourceProvider* audioSourceProvider() OVERRIDE; | 140 virtual WebCore::AudioSourceProvider* audioSourceProvider() OVERRIDE; |
140 #endif | 141 #endif |
141 | 142 |
142 virtual WebCore::MediaPlayer::MediaKeyException generateKeyRequest(const Str
ing& keySystem, const unsigned char* initData, unsigned initDataLength) OVERRIDE
; | |
143 virtual WebCore::MediaPlayer::MediaKeyException addKey(const String& keySyst
em, const unsigned char* key, unsigned keyLength, const unsigned char* initData,
unsigned initDataLength, const String& sessionId) OVERRIDE; | |
144 virtual WebCore::MediaPlayer::MediaKeyException cancelKeyRequest(const Strin
g& keySystem, const String& sessionId) OVERRIDE; | |
145 virtual void setContentDecryptionModule(WebContentDecryptionModule*) OVERRID
E; | |
146 | |
147 private: | 143 private: |
148 explicit WebMediaPlayerClientImpl(WebCore::MediaPlayerClient*); | 144 explicit WebMediaPlayerClientImpl(WebCore::MediaPlayerClient*); |
149 | 145 |
150 void startDelayedLoad(); | 146 void startDelayedLoad(); |
151 void loadInternal(); | 147 void loadInternal(); |
152 | 148 |
| 149 WebCore::HTMLMediaElement& mediaElement() const; |
| 150 |
153 #if OS(ANDROID) | 151 #if OS(ANDROID) |
154 // FIXME: This path "only works" on Android. It is a workaround for the prob
lem that Skia could not handle Android's GL_TEXTURE_EXTERNAL_OES | 152 // FIXME: This path "only works" on Android. It is a workaround for the prob
lem that Skia could not handle Android's GL_TEXTURE_EXTERNAL_OES |
155 // texture internally. It should be removed and replaced by the normal paint
path. | 153 // texture internally. It should be removed and replaced by the normal paint
path. |
156 // https://code.google.com/p/skia/issues/detail?id=1189 | 154 // https://code.google.com/p/skia/issues/detail?id=1189 |
157 void paintOnAndroid(WebCore::GraphicsContext*, WebGraphicsContext3D*, const
WebCore::IntRect&, uint8_t alpha); | 155 void paintOnAndroid(WebCore::GraphicsContext*, WebGraphicsContext3D*, const
WebCore::IntRect&, uint8_t alpha); |
158 SkBitmap m_bitmap; | 156 SkBitmap m_bitmap; |
159 #endif | 157 #endif |
160 | 158 |
161 WebCore::MediaPlayerClient* m_client; | 159 WebCore::MediaPlayerClient* m_client; |
162 OwnPtr<WebMediaPlayer> m_webMediaPlayer; | 160 OwnPtr<WebMediaPlayer> m_webMediaPlayer; |
163 WebCore::KURL m_url; | 161 WebCore::KURL m_url; |
164 bool m_delayingLoad; | 162 bool m_delayingLoad; |
165 WebCore::MediaPlayer::Preload m_preload; | 163 WebCore::MediaPlayer::Preload m_preload; |
166 OwnPtr<WebHelperPlugin> m_helperPlugin; | 164 OwnPtr<WebHelperPlugin> m_helperPlugin; |
167 bool m_needsWebLayerForVideo; | 165 bool m_needsWebLayerForVideo; |
168 double m_volume; | 166 double m_volume; |
169 bool m_muted; | 167 bool m_muted; |
170 double m_rate; | 168 double m_rate; |
171 WebContentDecryptionModule* m_cdm; | |
172 | 169 |
173 #if ENABLE(WEB_AUDIO) | 170 #if ENABLE(WEB_AUDIO) |
174 // AudioClientImpl wraps an AudioSourceProviderClient. | 171 // AudioClientImpl wraps an AudioSourceProviderClient. |
175 // When the audio format is known, Chromium calls setFormat() which then dis
patches into WebCore. | 172 // When the audio format is known, Chromium calls setFormat() which then dis
patches into WebCore. |
176 | 173 |
177 class AudioClientImpl FINAL : public blink::WebAudioSourceProviderClient { | 174 class AudioClientImpl FINAL : public blink::WebAudioSourceProviderClient { |
178 public: | 175 public: |
179 AudioClientImpl(WebCore::AudioSourceProviderClient* client) | 176 AudioClientImpl(WebCore::AudioSourceProviderClient* client) |
180 : m_client(client) | 177 : m_client(client) |
181 { | 178 { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 214 |
218 AudioSourceProviderImpl m_audioSourceProvider; | 215 AudioSourceProviderImpl m_audioSourceProvider; |
219 #endif | 216 #endif |
220 | 217 |
221 WebMediaPlayer::LoadType m_loadType; | 218 WebMediaPlayer::LoadType m_loadType; |
222 }; | 219 }; |
223 | 220 |
224 } // namespace blink | 221 } // namespace blink |
225 | 222 |
226 #endif | 223 #endif |
OLD | NEW |