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 28 matching lines...) Expand all Loading... |
39 #if OS(ANDROID) | 39 #if OS(ANDROID) |
40 #include "third_party/skia/include/core/SkBitmap.h" | 40 #include "third_party/skia/include/core/SkBitmap.h" |
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 blink { |
50 class AudioSourceProviderClient; | 50 class AudioSourceProviderClient; |
51 class HTMLMediaElement; | 51 class HTMLMediaElement; |
52 } | 52 } |
53 | 53 |
54 namespace blink { | 54 namespace blink { |
55 | 55 |
56 class WebAudioSourceProvider; | 56 class WebAudioSourceProvider; |
57 class WebContentDecryptionModule; | 57 class WebContentDecryptionModule; |
58 class WebMediaPlayer; | 58 class WebMediaPlayer; |
59 class WebGraphicsContext3D; | 59 class WebGraphicsContext3D; |
60 | 60 |
61 // This class serves as a bridge between WebCore::MediaPlayer and | 61 // This class serves as a bridge between blink::MediaPlayer and |
62 // blink::WebMediaPlayer. | 62 // blink::WebMediaPlayer. |
63 class WebMediaPlayerClientImpl FINAL : public WebCore::MediaPlayer, public WebMe
diaPlayerClient { | 63 class WebMediaPlayerClientImpl FINAL : public blink::MediaPlayer, public WebMedi
aPlayerClient { |
64 | 64 |
65 public: | 65 public: |
66 static PassOwnPtr<WebCore::MediaPlayer> create(WebCore::MediaPlayerClient*); | 66 static PassOwnPtr<blink::MediaPlayer> create(blink::MediaPlayerClient*); |
67 | 67 |
68 virtual ~WebMediaPlayerClientImpl(); | 68 virtual ~WebMediaPlayerClientImpl(); |
69 | 69 |
70 // WebMediaPlayerClient methods: | 70 // WebMediaPlayerClient methods: |
71 virtual void networkStateChanged() OVERRIDE; | 71 virtual void networkStateChanged() OVERRIDE; |
72 virtual void readyStateChanged() OVERRIDE; | 72 virtual void readyStateChanged() OVERRIDE; |
73 virtual void timeChanged() OVERRIDE; | 73 virtual void timeChanged() OVERRIDE; |
74 virtual void repaint() OVERRIDE; | 74 virtual void repaint() OVERRIDE; |
75 virtual void durationChanged() OVERRIDE; | 75 virtual void durationChanged() OVERRIDE; |
76 virtual void sizeChanged() OVERRIDE; | 76 virtual void sizeChanged() OVERRIDE; |
(...skipping 14 matching lines...) Expand all Loading... |
91 virtual void removeVideoTrack(WebMediaPlayer::TrackId) OVERRIDE; | 91 virtual void removeVideoTrack(WebMediaPlayer::TrackId) OVERRIDE; |
92 virtual void addTextTrack(WebInbandTextTrack*) OVERRIDE; | 92 virtual void addTextTrack(WebInbandTextTrack*) OVERRIDE; |
93 virtual void removeTextTrack(WebInbandTextTrack*) OVERRIDE; | 93 virtual void removeTextTrack(WebInbandTextTrack*) OVERRIDE; |
94 virtual void mediaSourceOpened(WebMediaSource*) OVERRIDE; | 94 virtual void mediaSourceOpened(WebMediaSource*) OVERRIDE; |
95 virtual void requestFullscreen() OVERRIDE; | 95 virtual void requestFullscreen() OVERRIDE; |
96 virtual void requestSeek(double) OVERRIDE; | 96 virtual void requestSeek(double) OVERRIDE; |
97 | 97 |
98 // MediaPlayer methods: | 98 // MediaPlayer methods: |
99 virtual WebMediaPlayer* webMediaPlayer() const OVERRIDE; | 99 virtual WebMediaPlayer* webMediaPlayer() const OVERRIDE; |
100 virtual void load(WebMediaPlayer::LoadType, const WTF::String& url, WebMedia
Player::CORSMode) OVERRIDE; | 100 virtual void load(WebMediaPlayer::LoadType, const WTF::String& url, WebMedia
Player::CORSMode) OVERRIDE; |
101 virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&) OVERR
IDE; | 101 virtual void paint(blink::GraphicsContext*, const blink::IntRect&) OVERRIDE; |
102 virtual bool copyVideoTextureToPlatformTexture(WebGraphicsContext3D*, Platfo
rm3DObject texture, GLint level, GLenum type, GLenum internalFormat, bool premul
tiplyAlpha, bool flipY) OVERRIDE; | 102 virtual bool copyVideoTextureToPlatformTexture(WebGraphicsContext3D*, Platfo
rm3DObject texture, GLint level, GLenum type, GLenum internalFormat, bool premul
tiplyAlpha, bool flipY) OVERRIDE; |
103 virtual void setPreload(WebCore::MediaPlayer::Preload) OVERRIDE; | 103 virtual void setPreload(blink::MediaPlayer::Preload) OVERRIDE; |
104 | 104 |
105 #if ENABLE(WEB_AUDIO) | 105 #if ENABLE(WEB_AUDIO) |
106 virtual WebCore::AudioSourceProvider* audioSourceProvider() OVERRIDE; | 106 virtual blink::AudioSourceProvider* audioSourceProvider() OVERRIDE; |
107 #endif | 107 #endif |
108 | 108 |
109 private: | 109 private: |
110 explicit WebMediaPlayerClientImpl(WebCore::MediaPlayerClient*); | 110 explicit WebMediaPlayerClientImpl(blink::MediaPlayerClient*); |
111 | 111 |
112 WebCore::HTMLMediaElement& mediaElement() const; | 112 blink::HTMLMediaElement& mediaElement() const; |
113 | 113 |
114 WebCore::MediaPlayerClient* m_client; | 114 blink::MediaPlayerClient* m_client; |
115 OwnPtr<WebMediaPlayer> m_webMediaPlayer; | 115 OwnPtr<WebMediaPlayer> m_webMediaPlayer; |
116 WebCore::MediaPlayer::Preload m_preload; | 116 blink::MediaPlayer::Preload m_preload; |
117 | 117 |
118 #if OS(ANDROID) | 118 #if OS(ANDROID) |
119 // 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 | 119 // 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 |
120 // texture internally. It should be removed and replaced by the normal paint
path. | 120 // texture internally. It should be removed and replaced by the normal paint
path. |
121 // https://code.google.com/p/skia/issues/detail?id=1189 | 121 // https://code.google.com/p/skia/issues/detail?id=1189 |
122 void paintOnAndroid(WebCore::GraphicsContext*, const WebCore::IntRect&, uint
8_t alpha); | 122 void paintOnAndroid(blink::GraphicsContext*, const blink::IntRect&, uint8_t
alpha); |
123 SkBitmap m_bitmap; | 123 SkBitmap m_bitmap; |
124 bool m_usePaintOnAndroid; | 124 bool m_usePaintOnAndroid; |
125 #endif | 125 #endif |
126 | 126 |
127 #if ENABLE(WEB_AUDIO) | 127 #if ENABLE(WEB_AUDIO) |
128 // AudioClientImpl wraps an AudioSourceProviderClient. | 128 // AudioClientImpl wraps an AudioSourceProviderClient. |
129 // When the audio format is known, Chromium calls setFormat() which then dis
patches into WebCore. | 129 // When the audio format is known, Chromium calls setFormat() which then dis
patches into WebCore. |
130 | 130 |
131 class AudioClientImpl FINAL : public blink::WebAudioSourceProviderClient { | 131 class AudioClientImpl FINAL : public blink::WebAudioSourceProviderClient { |
132 public: | 132 public: |
133 AudioClientImpl(WebCore::AudioSourceProviderClient* client) | 133 AudioClientImpl(blink::AudioSourceProviderClient* client) |
134 : m_client(client) | 134 : m_client(client) |
135 { | 135 { |
136 } | 136 } |
137 | 137 |
138 virtual ~AudioClientImpl() { } | 138 virtual ~AudioClientImpl() { } |
139 | 139 |
140 // WebAudioSourceProviderClient | 140 // WebAudioSourceProviderClient |
141 virtual void setFormat(size_t numberOfChannels, float sampleRate) OVERRI
DE; | 141 virtual void setFormat(size_t numberOfChannels, float sampleRate) OVERRI
DE; |
142 | 142 |
143 private: | 143 private: |
144 WebCore::AudioSourceProviderClient* m_client; | 144 blink::AudioSourceProviderClient* m_client; |
145 }; | 145 }; |
146 | 146 |
147 // AudioSourceProviderImpl wraps a WebAudioSourceProvider. | 147 // AudioSourceProviderImpl wraps a WebAudioSourceProvider. |
148 // provideInput() calls into Chromium to get a rendered audio stream. | 148 // provideInput() calls into Chromium to get a rendered audio stream. |
149 | 149 |
150 class AudioSourceProviderImpl FINAL : public WebCore::AudioSourceProvider { | 150 class AudioSourceProviderImpl FINAL : public blink::AudioSourceProvider { |
151 public: | 151 public: |
152 AudioSourceProviderImpl() | 152 AudioSourceProviderImpl() |
153 : m_webAudioSourceProvider(0) | 153 : m_webAudioSourceProvider(0) |
154 { | 154 { |
155 } | 155 } |
156 | 156 |
157 virtual ~AudioSourceProviderImpl() { } | 157 virtual ~AudioSourceProviderImpl() { } |
158 | 158 |
159 // Wraps the given WebAudioSourceProvider. | 159 // Wraps the given WebAudioSourceProvider. |
160 void wrap(WebAudioSourceProvider*); | 160 void wrap(WebAudioSourceProvider*); |
161 | 161 |
162 // WebCore::AudioSourceProvider | 162 // blink::AudioSourceProvider |
163 virtual void setClient(WebCore::AudioSourceProviderClient*) OVERRIDE; | 163 virtual void setClient(blink::AudioSourceProviderClient*) OVERRIDE; |
164 virtual void provideInput(WebCore::AudioBus*, size_t framesToProcess) OV
ERRIDE; | 164 virtual void provideInput(blink::AudioBus*, size_t framesToProcess) OVER
RIDE; |
165 | 165 |
166 private: | 166 private: |
167 WebAudioSourceProvider* m_webAudioSourceProvider; | 167 WebAudioSourceProvider* m_webAudioSourceProvider; |
168 OwnPtr<AudioClientImpl> m_client; | 168 OwnPtr<AudioClientImpl> m_client; |
169 Mutex provideInputLock; | 169 Mutex provideInputLock; |
170 }; | 170 }; |
171 | 171 |
172 AudioSourceProviderImpl m_audioSourceProvider; | 172 AudioSourceProviderImpl m_audioSourceProvider; |
173 #endif | 173 #endif |
174 }; | 174 }; |
175 | 175 |
176 } // namespace blink | 176 } // namespace blink |
177 | 177 |
178 #endif | 178 #endif |
OLD | NEW |