Chromium Code Reviews| 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 // FIXME: Remove these once the WebMediaPlayer implementation stop making th ese calls on the WebMediaPlayerClient object. | |
|
ddorwin
2014/02/27 00:37:59
Where should it be making them?
acolwell GONE FROM CHROMIUM
2014/02/27 01:11:11
This was left over from the original patch I sent
c.shu
2014/02/27 14:49:46
Done.
| |
| 84 virtual void keyAdded(const WebString& keySystem, const WebString& sessionId ) OVERRIDE; | 85 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; | 86 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; | 87 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; | 88 virtual void keyNeeded(const WebString& contentType, const unsigned char* in itData, unsigned initDataLength) OVERRIDE; |
| 88 virtual WebPlugin* createHelperPlugin(const WebString& pluginType, WebFrame* ) OVERRIDE; | 89 virtual WebPlugin* createHelperPlugin(const WebString& pluginType, WebFrame* ) OVERRIDE; |
| 89 virtual void closeHelperPluginSoon(WebFrame*) OVERRIDE; | 90 virtual void closeHelperPluginSoon(WebFrame*) OVERRIDE; |
| 91 | |
| 90 virtual bool needsWebLayerForVideo() const OVERRIDE; | 92 virtual bool needsWebLayerForVideo() const OVERRIDE; |
| 91 virtual void setWebLayer(WebLayer*) OVERRIDE; | 93 virtual void setWebLayer(WebLayer*) OVERRIDE; |
| 92 virtual void addTextTrack(WebInbandTextTrack*) OVERRIDE; | 94 virtual void addTextTrack(WebInbandTextTrack*) OVERRIDE; |
| 93 virtual void removeTextTrack(WebInbandTextTrack*) OVERRIDE; | 95 virtual void removeTextTrack(WebInbandTextTrack*) OVERRIDE; |
| 94 virtual void mediaSourceOpened(WebMediaSource*) OVERRIDE; | 96 virtual void mediaSourceOpened(WebMediaSource*) OVERRIDE; |
| 95 virtual void requestFullscreen() OVERRIDE; | 97 virtual void requestFullscreen() OVERRIDE; |
| 96 virtual void requestSeek(double) OVERRIDE; | 98 virtual void requestSeek(double) OVERRIDE; |
| 97 | 99 |
| 98 // MediaPlayer methods: | 100 // MediaPlayer methods: |
| 101 virtual WebMediaPlayer* webMediaPlayer() const OVERRIDE; | |
| 99 virtual void load(WebMediaPlayer::LoadType, const WTF::String& url) OVERRIDE ; | 102 virtual void load(WebMediaPlayer::LoadType, const WTF::String& url) OVERRIDE ; |
| 100 | |
| 101 virtual void play() OVERRIDE; | 103 virtual void play() OVERRIDE; |
| 102 virtual void pause() OVERRIDE; | 104 virtual void pause() OVERRIDE; |
| 103 virtual void prepareToPlay() OVERRIDE; | 105 virtual void prepareToPlay() OVERRIDE; |
| 104 virtual bool supportsSave() const OVERRIDE; | 106 virtual bool supportsSave() const OVERRIDE; |
| 105 virtual WebCore::IntSize naturalSize() const OVERRIDE; | 107 virtual WebCore::IntSize naturalSize() const OVERRIDE; |
| 106 virtual bool hasVideo() const OVERRIDE; | 108 virtual bool hasVideo() const OVERRIDE; |
| 107 virtual bool hasAudio() const OVERRIDE; | 109 virtual bool hasAudio() const OVERRIDE; |
| 108 virtual double duration() const OVERRIDE; | 110 virtual double duration() const OVERRIDE; |
| 109 virtual double currentTime() const OVERRIDE; | 111 virtual double currentTime() const OVERRIDE; |
| 110 virtual void seek(double time) OVERRIDE; | 112 virtual void seek(double time) OVERRIDE; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 132 virtual unsigned audioDecodedByteCount() const OVERRIDE; | 134 virtual unsigned audioDecodedByteCount() const OVERRIDE; |
| 133 virtual unsigned videoDecodedByteCount() const OVERRIDE; | 135 virtual unsigned videoDecodedByteCount() const OVERRIDE; |
| 134 virtual void showFullscreenOverlay() OVERRIDE; | 136 virtual void showFullscreenOverlay() OVERRIDE; |
| 135 virtual void hideFullscreenOverlay() OVERRIDE; | 137 virtual void hideFullscreenOverlay() OVERRIDE; |
| 136 virtual bool canShowFullscreenOverlay() const OVERRIDE; | 138 virtual bool canShowFullscreenOverlay() const OVERRIDE; |
| 137 | 139 |
| 138 #if ENABLE(WEB_AUDIO) | 140 #if ENABLE(WEB_AUDIO) |
| 139 virtual WebCore::AudioSourceProvider* audioSourceProvider() OVERRIDE; | 141 virtual WebCore::AudioSourceProvider* audioSourceProvider() OVERRIDE; |
| 140 #endif | 142 #endif |
| 141 | 143 |
| 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: | 144 private: |
| 148 explicit WebMediaPlayerClientImpl(WebCore::MediaPlayerClient*); | 145 explicit WebMediaPlayerClientImpl(WebCore::MediaPlayerClient*); |
| 149 | 146 |
| 150 void startDelayedLoad(); | 147 void startDelayedLoad(); |
| 151 void loadInternal(); | 148 void loadInternal(); |
| 152 | 149 |
| 150 WebCore::HTMLMediaElement& mediaElement() const; | |
| 151 | |
| 153 #if OS(ANDROID) | 152 #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 | 153 // 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. | 154 // texture internally. It should be removed and replaced by the normal paint path. |
| 156 // https://code.google.com/p/skia/issues/detail?id=1189 | 155 // https://code.google.com/p/skia/issues/detail?id=1189 |
| 157 void paintOnAndroid(WebCore::GraphicsContext*, WebGraphicsContext3D*, const WebCore::IntRect&, uint8_t alpha); | 156 void paintOnAndroid(WebCore::GraphicsContext*, WebGraphicsContext3D*, const WebCore::IntRect&, uint8_t alpha); |
| 158 SkBitmap m_bitmap; | 157 SkBitmap m_bitmap; |
| 159 #endif | 158 #endif |
| 160 | 159 |
| 161 WebCore::MediaPlayerClient* m_client; | 160 WebCore::MediaPlayerClient* m_client; |
| 162 OwnPtr<WebMediaPlayer> m_webMediaPlayer; | 161 OwnPtr<WebMediaPlayer> m_webMediaPlayer; |
| 163 WebCore::KURL m_url; | 162 WebCore::KURL m_url; |
| 164 bool m_delayingLoad; | 163 bool m_delayingLoad; |
| 165 WebCore::MediaPlayer::Preload m_preload; | 164 WebCore::MediaPlayer::Preload m_preload; |
| 166 OwnPtr<WebHelperPlugin> m_helperPlugin; | 165 OwnPtr<WebHelperPlugin> m_helperPlugin; |
| 167 bool m_needsWebLayerForVideo; | 166 bool m_needsWebLayerForVideo; |
| 168 double m_volume; | 167 double m_volume; |
| 169 bool m_muted; | 168 bool m_muted; |
| 170 double m_rate; | 169 double m_rate; |
| 171 WebContentDecryptionModule* m_cdm; | |
| 172 | 170 |
| 173 #if ENABLE(WEB_AUDIO) | 171 #if ENABLE(WEB_AUDIO) |
| 174 // AudioClientImpl wraps an AudioSourceProviderClient. | 172 // AudioClientImpl wraps an AudioSourceProviderClient. |
| 175 // 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. |
| 176 | 174 |
| 177 class AudioClientImpl FINAL : public blink::WebAudioSourceProviderClient { | 175 class AudioClientImpl FINAL : public blink::WebAudioSourceProviderClient { |
| 178 public: | 176 public: |
| 179 AudioClientImpl(WebCore::AudioSourceProviderClient* client) | 177 AudioClientImpl(WebCore::AudioSourceProviderClient* client) |
| 180 : m_client(client) | 178 : m_client(client) |
| 181 { | 179 { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 | 215 |
| 218 AudioSourceProviderImpl m_audioSourceProvider; | 216 AudioSourceProviderImpl m_audioSourceProvider; |
| 219 #endif | 217 #endif |
| 220 | 218 |
| 221 WebMediaPlayer::LoadType m_loadType; | 219 WebMediaPlayer::LoadType m_loadType; |
| 222 }; | 220 }; |
| 223 | 221 |
| 224 } // namespace blink | 222 } // namespace blink |
| 225 | 223 |
| 226 #endif | 224 #endif |
| OLD | NEW |