| 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 WebAudioSourceProvider; | 56 class WebAudioSourceProvider; |
| 56 class WebContentDecryptionModule; | 57 class WebContentDecryptionModule; |
| 57 class WebMediaPlayer; | 58 class WebMediaPlayer; |
| 58 class WebGraphicsContext3D; | 59 class WebGraphicsContext3D; |
| 59 | 60 |
| 60 // This class serves as a bridge between WebCore::MediaPlayer and | 61 // This class serves as a bridge between WebCore::MediaPlayer and |
| 61 // blink::WebMediaPlayer. | 62 // blink::WebMediaPlayer. |
| 62 class WebMediaPlayerClientImpl FINAL : public WebCore::MediaPlayer, public WebMe
diaPlayerClient { | 63 class WebMediaPlayerClientImpl FINAL : public WebCore::MediaPlayer, public WebMe
diaPlayerClient { |
| 63 | 64 |
| 64 public: | 65 public: |
| 65 static PassOwnPtr<WebCore::MediaPlayer> create(WebCore::MediaPlayerClient*); | 66 static PassOwnPtr<WebCore::MediaPlayer> create(WebCore::MediaPlayerClient*); |
| 66 | 67 |
| 67 virtual ~WebMediaPlayerClientImpl(); | 68 virtual ~WebMediaPlayerClientImpl(); |
| 68 | 69 |
| 69 // Returns the encapsulated blink::WebMediaPlayer. | |
| 70 WebMediaPlayer* mediaPlayer() const; | |
| 71 | |
| 72 // WebMediaPlayerClient methods: | 70 // WebMediaPlayerClient methods: |
| 73 virtual void networkStateChanged() OVERRIDE; | 71 virtual void networkStateChanged() OVERRIDE; |
| 74 virtual void readyStateChanged() OVERRIDE; | 72 virtual void readyStateChanged() OVERRIDE; |
| 75 virtual void timeChanged() OVERRIDE; | 73 virtual void timeChanged() OVERRIDE; |
| 76 virtual void repaint() OVERRIDE; | 74 virtual void repaint() OVERRIDE; |
| 77 virtual void durationChanged() OVERRIDE; | 75 virtual void durationChanged() OVERRIDE; |
| 78 virtual void sizeChanged() OVERRIDE; | 76 virtual void sizeChanged() OVERRIDE; |
| 79 virtual void setOpaque(bool) OVERRIDE; | 77 virtual void setOpaque(bool) OVERRIDE; |
| 80 virtual double volume() const OVERRIDE; | 78 virtual double volume() const OVERRIDE; |
| 81 virtual void playbackStateChanged() OVERRIDE; | 79 virtual void playbackStateChanged() OVERRIDE; |
| 82 virtual WebMediaPlayer::Preload preload() const OVERRIDE; | 80 virtual WebMediaPlayer::Preload preload() const OVERRIDE; |
| 81 |
| 82 // WebEncryptedMediaPlayerClient methods: |
| 83 virtual void keyAdded(const WebString& keySystem, const WebString& sessionId
) OVERRIDE; | 83 virtual void keyAdded(const WebString& keySystem, const WebString& sessionId
) OVERRIDE; |
| 84 virtual void keyError(const WebString& keySystem, const WebString& sessionId
, MediaKeyErrorCode, unsigned short systemCode) OVERRIDE; | 84 virtual void keyError(const WebString& keySystem, const WebString& sessionId
, MediaKeyErrorCode, unsigned short systemCode) OVERRIDE; |
| 85 virtual void keyMessage(const WebString& keySystem, const WebString& session
Id, const unsigned char* message, unsigned messageLength, const WebURL& defaultU
RL) OVERRIDE; | 85 virtual void keyMessage(const WebString& keySystem, const WebString& session
Id, const unsigned char* message, unsigned messageLength, const WebURL& defaultU
RL) OVERRIDE; |
| 86 virtual void keyNeeded(const WebString& contentType, const unsigned char* in
itData, unsigned initDataLength) OVERRIDE; | 86 virtual void keyNeeded(const WebString& contentType, const unsigned char* in
itData, unsigned initDataLength) OVERRIDE; |
| 87 |
| 87 virtual bool needsWebLayerForVideo() const OVERRIDE; | 88 virtual bool needsWebLayerForVideo() const OVERRIDE; |
| 88 virtual void setWebLayer(WebLayer*) OVERRIDE; | 89 virtual void setWebLayer(WebLayer*) OVERRIDE; |
| 89 virtual void addTextTrack(WebInbandTextTrack*) OVERRIDE; | 90 virtual void addTextTrack(WebInbandTextTrack*) OVERRIDE; |
| 90 virtual void removeTextTrack(WebInbandTextTrack*) OVERRIDE; | 91 virtual void removeTextTrack(WebInbandTextTrack*) OVERRIDE; |
| 91 virtual void mediaSourceOpened(WebMediaSource*) OVERRIDE; | 92 virtual void mediaSourceOpened(WebMediaSource*) OVERRIDE; |
| 92 virtual void requestFullscreen() OVERRIDE; | 93 virtual void requestFullscreen() OVERRIDE; |
| 93 virtual void requestSeek(double) OVERRIDE; | 94 virtual void requestSeek(double) OVERRIDE; |
| 94 | 95 |
| 95 // MediaPlayer methods: | 96 // MediaPlayer methods: |
| 97 virtual WebMediaPlayer* webMediaPlayer() const OVERRIDE; |
| 96 virtual void load(WebMediaPlayer::LoadType, const WTF::String& url) OVERRIDE
; | 98 virtual void load(WebMediaPlayer::LoadType, const WTF::String& url) OVERRIDE
; |
| 97 | |
| 98 virtual void play() OVERRIDE; | 99 virtual void play() OVERRIDE; |
| 99 virtual void pause() OVERRIDE; | 100 virtual void pause() OVERRIDE; |
| 100 virtual void prepareToPlay() OVERRIDE; | 101 virtual void prepareToPlay() OVERRIDE; |
| 101 virtual bool supportsSave() const OVERRIDE; | 102 virtual bool supportsSave() const OVERRIDE; |
| 102 virtual WebCore::IntSize naturalSize() const OVERRIDE; | 103 virtual WebCore::IntSize naturalSize() const OVERRIDE; |
| 103 virtual bool hasVideo() const OVERRIDE; | 104 virtual bool hasVideo() const OVERRIDE; |
| 104 virtual bool hasAudio() const OVERRIDE; | 105 virtual bool hasAudio() const OVERRIDE; |
| 105 virtual double duration() const OVERRIDE; | 106 virtual double duration() const OVERRIDE; |
| 106 virtual double currentTime() const OVERRIDE; | 107 virtual double currentTime() const OVERRIDE; |
| 107 virtual void seek(double time) OVERRIDE; | 108 virtual void seek(double time) OVERRIDE; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 129 virtual unsigned audioDecodedByteCount() const OVERRIDE; | 130 virtual unsigned audioDecodedByteCount() const OVERRIDE; |
| 130 virtual unsigned videoDecodedByteCount() const OVERRIDE; | 131 virtual unsigned videoDecodedByteCount() const OVERRIDE; |
| 131 virtual void showFullscreenOverlay() OVERRIDE; | 132 virtual void showFullscreenOverlay() OVERRIDE; |
| 132 virtual void hideFullscreenOverlay() OVERRIDE; | 133 virtual void hideFullscreenOverlay() OVERRIDE; |
| 133 virtual bool canShowFullscreenOverlay() const OVERRIDE; | 134 virtual bool canShowFullscreenOverlay() const OVERRIDE; |
| 134 | 135 |
| 135 #if ENABLE(WEB_AUDIO) | 136 #if ENABLE(WEB_AUDIO) |
| 136 virtual WebCore::AudioSourceProvider* audioSourceProvider() OVERRIDE; | 137 virtual WebCore::AudioSourceProvider* audioSourceProvider() OVERRIDE; |
| 137 #endif | 138 #endif |
| 138 | 139 |
| 139 virtual WebCore::MediaPlayer::MediaKeyException generateKeyRequest(const Str
ing& keySystem, const unsigned char* initData, unsigned initDataLength) OVERRIDE
; | |
| 140 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; | |
| 141 virtual WebCore::MediaPlayer::MediaKeyException cancelKeyRequest(const Strin
g& keySystem, const String& sessionId) OVERRIDE; | |
| 142 virtual void setContentDecryptionModule(WebContentDecryptionModule*) OVERRID
E; | |
| 143 | |
| 144 private: | 140 private: |
| 145 explicit WebMediaPlayerClientImpl(WebCore::MediaPlayerClient*); | 141 explicit WebMediaPlayerClientImpl(WebCore::MediaPlayerClient*); |
| 146 | 142 |
| 147 void startDelayedLoad(); | 143 void startDelayedLoad(); |
| 148 void loadInternal(); | 144 void loadInternal(); |
| 149 | 145 |
| 146 WebCore::HTMLMediaElement& mediaElement() const; |
| 147 |
| 150 #if OS(ANDROID) | 148 #if OS(ANDROID) |
| 151 // 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 | 149 // 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 // texture internally. It should be removed and replaced by the normal paint
path. | 150 // texture internally. It should be removed and replaced by the normal paint
path. |
| 153 // https://code.google.com/p/skia/issues/detail?id=1189 | 151 // https://code.google.com/p/skia/issues/detail?id=1189 |
| 154 void paintOnAndroid(WebCore::GraphicsContext*, WebGraphicsContext3D*, const
WebCore::IntRect&, uint8_t alpha); | 152 void paintOnAndroid(WebCore::GraphicsContext*, WebGraphicsContext3D*, const
WebCore::IntRect&, uint8_t alpha); |
| 155 SkBitmap m_bitmap; | 153 SkBitmap m_bitmap; |
| 156 #endif | 154 #endif |
| 157 | 155 |
| 158 WebCore::MediaPlayerClient* m_client; | 156 WebCore::MediaPlayerClient* m_client; |
| 159 OwnPtr<WebMediaPlayer> m_webMediaPlayer; | 157 OwnPtr<WebMediaPlayer> m_webMediaPlayer; |
| 160 WebCore::KURL m_url; | 158 WebCore::KURL m_url; |
| 161 bool m_delayingLoad; | 159 bool m_delayingLoad; |
| 162 WebCore::MediaPlayer::Preload m_preload; | 160 WebCore::MediaPlayer::Preload m_preload; |
| 163 bool m_needsWebLayerForVideo; | 161 bool m_needsWebLayerForVideo; |
| 164 double m_volume; | 162 double m_volume; |
| 165 bool m_muted; | 163 bool m_muted; |
| 166 double m_rate; | 164 double m_rate; |
| 167 WebContentDecryptionModule* m_cdm; | |
| 168 | 165 |
| 169 #if ENABLE(WEB_AUDIO) | 166 #if ENABLE(WEB_AUDIO) |
| 170 // AudioClientImpl wraps an AudioSourceProviderClient. | 167 // AudioClientImpl wraps an AudioSourceProviderClient. |
| 171 // When the audio format is known, Chromium calls setFormat() which then dis
patches into WebCore. | 168 // When the audio format is known, Chromium calls setFormat() which then dis
patches into WebCore. |
| 172 | 169 |
| 173 class AudioClientImpl FINAL : public blink::WebAudioSourceProviderClient { | 170 class AudioClientImpl FINAL : public blink::WebAudioSourceProviderClient { |
| 174 public: | 171 public: |
| 175 AudioClientImpl(WebCore::AudioSourceProviderClient* client) | 172 AudioClientImpl(WebCore::AudioSourceProviderClient* client) |
| 176 : m_client(client) | 173 : m_client(client) |
| 177 { | 174 { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 210 |
| 214 AudioSourceProviderImpl m_audioSourceProvider; | 211 AudioSourceProviderImpl m_audioSourceProvider; |
| 215 #endif | 212 #endif |
| 216 | 213 |
| 217 WebMediaPlayer::LoadType m_loadType; | 214 WebMediaPlayer::LoadType m_loadType; |
| 218 }; | 215 }; |
| 219 | 216 |
| 220 } // namespace blink | 217 } // namespace blink |
| 221 | 218 |
| 222 #endif | 219 #endif |
| OLD | NEW |