| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 namespace blink { | 53 namespace blink { |
| 54 | 54 |
| 55 class WebHelperPluginImpl; | 55 class WebHelperPluginImpl; |
| 56 class WebAudioSourceProvider; | 56 class WebAudioSourceProvider; |
| 57 class WebContentDecryptionModule; | 57 class WebContentDecryptionModule; |
| 58 class WebMediaPlayer; | 58 class WebMediaPlayer; |
| 59 | 59 |
| 60 // This class serves as a bridge between WebCore::MediaPlayer and | 60 // This class serves as a bridge between WebCore::MediaPlayer and |
| 61 // blink::WebMediaPlayer. | 61 // blink::WebMediaPlayer. |
| 62 class WebMediaPlayerClientImpl : public WebCore::MediaPlayer, public WebMediaPla
yerClient { | 62 class WebMediaPlayerClientImpl FINAL : public WebCore::MediaPlayer, public WebMe
diaPlayerClient { |
| 63 | 63 |
| 64 public: | 64 public: |
| 65 static PassOwnPtr<WebCore::MediaPlayer> create(WebCore::MediaPlayerClient*); | 65 static PassOwnPtr<WebCore::MediaPlayer> create(WebCore::MediaPlayerClient*); |
| 66 | 66 |
| 67 virtual ~WebMediaPlayerClientImpl(); |
| 68 |
| 67 // Returns the encapsulated blink::WebMediaPlayer. | 69 // Returns the encapsulated blink::WebMediaPlayer. |
| 68 WebMediaPlayer* mediaPlayer() const; | 70 WebMediaPlayer* mediaPlayer() const; |
| 69 | 71 |
| 70 // WebMediaPlayerClient methods: | 72 // WebMediaPlayerClient methods: |
| 71 virtual ~WebMediaPlayerClientImpl(); | 73 virtual void networkStateChanged() OVERRIDE; |
| 72 virtual void networkStateChanged(); | 74 virtual void readyStateChanged() OVERRIDE; |
| 73 virtual void readyStateChanged(); | 75 virtual void timeChanged() OVERRIDE; |
| 74 virtual void timeChanged(); | 76 virtual void repaint() OVERRIDE; |
| 75 virtual void repaint(); | 77 virtual void durationChanged() OVERRIDE; |
| 76 virtual void durationChanged(); | 78 virtual void sizeChanged() OVERRIDE; |
| 77 virtual void sizeChanged(); | 79 virtual void setOpaque(bool) OVERRIDE; |
| 78 virtual void setOpaque(bool); | 80 virtual double volume() const OVERRIDE; |
| 79 virtual double volume() const; | 81 virtual void playbackStateChanged() OVERRIDE; |
| 80 virtual void playbackStateChanged(); | 82 virtual WebMediaPlayer::Preload preload() const OVERRIDE; |
| 81 virtual WebMediaPlayer::Preload preload() const; | 83 virtual void keyAdded(const WebString& keySystem, const WebString& sessionId
) OVERRIDE; |
| 82 virtual void keyAdded(const WebString& keySystem, const WebString& sessionId
); | 84 virtual void keyError(const WebString& keySystem, const WebString& sessionId
, MediaKeyErrorCode, unsigned short systemCode) OVERRIDE; |
| 83 virtual void keyError(const WebString& keySystem, const WebString& sessionId
, MediaKeyErrorCode, unsigned short systemCode); | 85 virtual void keyMessage(const WebString& keySystem, const WebString& session
Id, const unsigned char* message, unsigned messageLength, const WebURL& defaultU
RL) OVERRIDE; |
| 84 virtual void keyMessage(const WebString& keySystem, const WebString& session
Id, const unsigned char* message, unsigned messageLength, const WebURL& defaultU
RL); | 86 virtual void keyNeeded(const WebString& contentType, const unsigned char* in
itData, unsigned initDataLength) OVERRIDE; |
| 85 virtual void keyNeeded(const WebString& contentType, const unsigned char* in
itData, unsigned initDataLength); | 87 virtual WebPlugin* createHelperPlugin(const WebString& pluginType, WebFrame*
) OVERRIDE; |
| 86 virtual WebPlugin* createHelperPlugin(const WebString& pluginType, WebFrame*
); | 88 virtual void closeHelperPluginSoon(WebFrame*) OVERRIDE; |
| 87 virtual void closeHelperPluginSoon(WebFrame*); | 89 virtual bool needsWebLayerForVideo() const OVERRIDE; |
| 88 virtual bool needsWebLayerForVideo() const; | 90 virtual void setWebLayer(WebLayer*) OVERRIDE; |
| 89 virtual void setWebLayer(WebLayer*); | 91 virtual void addTextTrack(WebInbandTextTrack*) OVERRIDE; |
| 90 virtual void addTextTrack(WebInbandTextTrack*); | 92 virtual void removeTextTrack(WebInbandTextTrack*) OVERRIDE; |
| 91 virtual void removeTextTrack(WebInbandTextTrack*); | 93 virtual void mediaSourceOpened(WebMediaSource*) OVERRIDE; |
| 92 virtual void mediaSourceOpened(WebMediaSource*); | 94 virtual void requestFullscreen() OVERRIDE; |
| 93 virtual void requestFullscreen(); | 95 virtual void requestSeek(double) OVERRIDE; |
| 94 virtual void requestSeek(double); | |
| 95 | 96 |
| 96 // MediaPlayer methods: | 97 // MediaPlayer methods: |
| 97 virtual void load(WebMediaPlayer::LoadType, const WTF::String& url) OVERRIDE
; | 98 virtual void load(WebMediaPlayer::LoadType, const WTF::String& url) OVERRIDE
; |
| 98 | 99 |
| 99 virtual void play() OVERRIDE; | 100 virtual void play() OVERRIDE; |
| 100 virtual void pause() OVERRIDE; | 101 virtual void pause() OVERRIDE; |
| 101 virtual void prepareToPlay() OVERRIDE; | 102 virtual void prepareToPlay() OVERRIDE; |
| 102 virtual bool supportsSave() const OVERRIDE; | 103 virtual bool supportsSave() const OVERRIDE; |
| 103 virtual WebCore::IntSize naturalSize() const OVERRIDE; | 104 virtual WebCore::IntSize naturalSize() const OVERRIDE; |
| 104 virtual bool hasVideo() const OVERRIDE; | 105 virtual bool hasVideo() const OVERRIDE; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 bool m_needsWebLayerForVideo; | 165 bool m_needsWebLayerForVideo; |
| 165 double m_volume; | 166 double m_volume; |
| 166 bool m_muted; | 167 bool m_muted; |
| 167 double m_rate; | 168 double m_rate; |
| 168 WebContentDecryptionModule* m_cdm; | 169 WebContentDecryptionModule* m_cdm; |
| 169 | 170 |
| 170 #if ENABLE(WEB_AUDIO) | 171 #if ENABLE(WEB_AUDIO) |
| 171 // AudioClientImpl wraps an AudioSourceProviderClient. | 172 // AudioClientImpl wraps an AudioSourceProviderClient. |
| 172 // When the audio format is known, Chromium calls setFormat() which then dis
patches into WebCore. | 173 // When the audio format is known, Chromium calls setFormat() which then dis
patches into WebCore. |
| 173 | 174 |
| 174 class AudioClientImpl : public blink::WebAudioSourceProviderClient { | 175 class AudioClientImpl FINAL : public blink::WebAudioSourceProviderClient { |
| 175 public: | 176 public: |
| 176 AudioClientImpl(WebCore::AudioSourceProviderClient* client) | 177 AudioClientImpl(WebCore::AudioSourceProviderClient* client) |
| 177 : m_client(client) | 178 : m_client(client) |
| 178 { | 179 { |
| 179 } | 180 } |
| 180 | 181 |
| 181 virtual ~AudioClientImpl() { } | 182 virtual ~AudioClientImpl() { } |
| 182 | 183 |
| 183 // WebAudioSourceProviderClient | 184 // WebAudioSourceProviderClient |
| 184 virtual void setFormat(size_t numberOfChannels, float sampleRate); | 185 virtual void setFormat(size_t numberOfChannels, float sampleRate) OVERRI
DE; |
| 185 | 186 |
| 186 private: | 187 private: |
| 187 WebCore::AudioSourceProviderClient* m_client; | 188 WebCore::AudioSourceProviderClient* m_client; |
| 188 }; | 189 }; |
| 189 | 190 |
| 190 // AudioSourceProviderImpl wraps a WebAudioSourceProvider. | 191 // AudioSourceProviderImpl wraps a WebAudioSourceProvider. |
| 191 // provideInput() calls into Chromium to get a rendered audio stream. | 192 // provideInput() calls into Chromium to get a rendered audio stream. |
| 192 | 193 |
| 193 class AudioSourceProviderImpl : public WebCore::AudioSourceProvider { | 194 class AudioSourceProviderImpl FINAL : public WebCore::AudioSourceProvider { |
| 194 public: | 195 public: |
| 195 AudioSourceProviderImpl() | 196 AudioSourceProviderImpl() |
| 196 : m_webAudioSourceProvider(0) | 197 : m_webAudioSourceProvider(0) |
| 197 { | 198 { |
| 198 } | 199 } |
| 199 | 200 |
| 200 virtual ~AudioSourceProviderImpl() { } | 201 virtual ~AudioSourceProviderImpl() { } |
| 201 | 202 |
| 202 // Wraps the given WebAudioSourceProvider. | 203 // Wraps the given WebAudioSourceProvider. |
| 203 void wrap(WebAudioSourceProvider*); | 204 void wrap(WebAudioSourceProvider*); |
| 204 | 205 |
| 205 // WebCore::AudioSourceProvider | 206 // WebCore::AudioSourceProvider |
| 206 virtual void setClient(WebCore::AudioSourceProviderClient*); | 207 virtual void setClient(WebCore::AudioSourceProviderClient*) OVERRIDE; |
| 207 virtual void provideInput(WebCore::AudioBus*, size_t framesToProcess); | 208 virtual void provideInput(WebCore::AudioBus*, size_t framesToProcess) OV
ERRIDE; |
| 208 | 209 |
| 209 private: | 210 private: |
| 210 WebAudioSourceProvider* m_webAudioSourceProvider; | 211 WebAudioSourceProvider* m_webAudioSourceProvider; |
| 211 OwnPtr<AudioClientImpl> m_client; | 212 OwnPtr<AudioClientImpl> m_client; |
| 212 Mutex provideInputLock; | 213 Mutex provideInputLock; |
| 213 }; | 214 }; |
| 214 | 215 |
| 215 AudioSourceProviderImpl m_audioSourceProvider; | 216 AudioSourceProviderImpl m_audioSourceProvider; |
| 216 #endif | 217 #endif |
| 217 | 218 |
| 218 WebMediaPlayer::LoadType m_loadType; | 219 WebMediaPlayer::LoadType m_loadType; |
| 219 }; | 220 }; |
| 220 | 221 |
| 221 } // namespace blink | 222 } // namespace blink |
| 222 | 223 |
| 223 #endif | 224 #endif |
| OLD | NEW |