OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "web/WebMediaPlayerClientImpl.h" | 6 #include "web/WebMediaPlayerClientImpl.h" |
7 | 7 |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "core/html/HTMLMediaElement.h" | 9 #include "core/html/HTMLMediaElement.h" |
10 #include "core/html/TimeRanges.h" | 10 #include "core/html/TimeRanges.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "GrContext.h" | 41 #include "GrContext.h" |
42 #include "GrTypes.h" | 42 #include "GrTypes.h" |
43 #include "SkCanvas.h" | 43 #include "SkCanvas.h" |
44 #include "SkGrPixelRef.h" | 44 #include "SkGrPixelRef.h" |
45 #endif | 45 #endif |
46 | 46 |
47 | 47 |
48 #include "wtf/Assertions.h" | 48 #include "wtf/Assertions.h" |
49 #include "wtf/text/CString.h" | 49 #include "wtf/text/CString.h" |
50 | 50 |
51 using namespace WebCore; | 51 using namespace blink; |
52 | 52 |
53 namespace blink { | 53 namespace blink { |
54 | 54 |
55 static PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(WebMediaPlayerClient* cli
ent, const WebURL& url, LocalFrame* frame) | 55 static PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(WebMediaPlayerClient* cli
ent, const WebURL& url, LocalFrame* frame) |
56 { | 56 { |
57 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame); | 57 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame); |
58 | 58 |
59 if (!webFrame || !webFrame->client()) | 59 if (!webFrame || !webFrame->client()) |
60 return nullptr; | 60 return nullptr; |
61 return adoptPtr(webFrame->client()->createMediaPlayer(webFrame, url, client)
); | 61 return adoptPtr(webFrame->client()->createMediaPlayer(webFrame, url, client)
); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 return &m_audioSourceProvider; | 269 return &m_audioSourceProvider; |
270 } | 270 } |
271 #endif | 271 #endif |
272 | 272 |
273 PassOwnPtr<MediaPlayer> WebMediaPlayerClientImpl::create(MediaPlayerClient* clie
nt) | 273 PassOwnPtr<MediaPlayer> WebMediaPlayerClientImpl::create(MediaPlayerClient* clie
nt) |
274 { | 274 { |
275 return adoptPtr(new WebMediaPlayerClientImpl(client)); | 275 return adoptPtr(new WebMediaPlayerClientImpl(client)); |
276 } | 276 } |
277 | 277 |
278 #if OS(ANDROID) | 278 #if OS(ANDROID) |
279 void WebMediaPlayerClientImpl::paintOnAndroid(WebCore::GraphicsContext* context,
const IntRect& rect, uint8_t alpha) | 279 void WebMediaPlayerClientImpl::paintOnAndroid(blink::GraphicsContext* context, c
onst IntRect& rect, uint8_t alpha) |
280 { | 280 { |
281 OwnPtr<blink::WebGraphicsContext3DProvider> provider = adoptPtr(blink::Platf
orm::current()->createSharedOffscreenGraphicsContext3DProvider()); | 281 OwnPtr<blink::WebGraphicsContext3DProvider> provider = adoptPtr(blink::Platf
orm::current()->createSharedOffscreenGraphicsContext3DProvider()); |
282 if (!provider) | 282 if (!provider) |
283 return; | 283 return; |
284 WebGraphicsContext3D* context3D = provider->context3d(); | 284 WebGraphicsContext3D* context3D = provider->context3d(); |
285 if (!context || !context3D || !m_webMediaPlayer || context->paintingDisabled
()) | 285 if (!context || !context3D || !m_webMediaPlayer || context->paintingDisabled
()) |
286 return; | 286 return; |
287 | 287 |
288 if (!context3D->makeContextCurrent()) | 288 if (!context3D->makeContextCurrent()) |
289 return; | 289 return; |
(...skipping 25 matching lines...) Expand all Loading... |
315 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl(MediaPlayerClient* client) | 315 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl(MediaPlayerClient* client) |
316 : m_client(client) | 316 : m_client(client) |
317 , m_preload(MediaPlayer::Auto) | 317 , m_preload(MediaPlayer::Auto) |
318 #if OS(ANDROID) | 318 #if OS(ANDROID) |
319 , m_usePaintOnAndroid(false) | 319 , m_usePaintOnAndroid(false) |
320 #endif | 320 #endif |
321 { | 321 { |
322 ASSERT(m_client); | 322 ASSERT(m_client); |
323 } | 323 } |
324 | 324 |
325 WebCore::HTMLMediaElement& WebMediaPlayerClientImpl::mediaElement() const | 325 blink::HTMLMediaElement& WebMediaPlayerClientImpl::mediaElement() const |
326 { | 326 { |
327 return *static_cast<HTMLMediaElement*>(m_client); | 327 return *static_cast<HTMLMediaElement*>(m_client); |
328 } | 328 } |
329 | 329 |
330 #if ENABLE(WEB_AUDIO) | 330 #if ENABLE(WEB_AUDIO) |
331 void WebMediaPlayerClientImpl::AudioSourceProviderImpl::wrap(WebAudioSourceProvi
der* provider) | 331 void WebMediaPlayerClientImpl::AudioSourceProviderImpl::wrap(WebAudioSourceProvi
der* provider) |
332 { | 332 { |
333 MutexLocker locker(provideInputLock); | 333 MutexLocker locker(provideInputLock); |
334 | 334 |
335 if (m_webAudioSourceProvider && provider != m_webAudioSourceProvider) | 335 if (m_webAudioSourceProvider && provider != m_webAudioSourceProvider) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 376 |
377 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) | 377 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) |
378 { | 378 { |
379 if (m_client) | 379 if (m_client) |
380 m_client->setFormat(numberOfChannels, sampleRate); | 380 m_client->setFormat(numberOfChannels, sampleRate); |
381 } | 381 } |
382 | 382 |
383 #endif | 383 #endif |
384 | 384 |
385 } // namespace blink | 385 } // namespace blink |
OLD | NEW |