Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: media/blink/webmediaplayer_impl.h

Issue 1122393004: Add support for switching the audio output device for HTMLMediaElements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes to MediaPlayers so that they invoke callbacks in the correct threads. First complete implem… Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 11 matching lines...) Expand all
22 #include "media/blink/buffered_data_source.h" 22 #include "media/blink/buffered_data_source.h"
23 #include "media/blink/buffered_data_source_host_impl.h" 23 #include "media/blink/buffered_data_source_host_impl.h"
24 #include "media/blink/encrypted_media_player_support.h" 24 #include "media/blink/encrypted_media_player_support.h"
25 #include "media/blink/skcanvas_video_renderer.h" 25 #include "media/blink/skcanvas_video_renderer.h"
26 #include "media/blink/video_frame_compositor.h" 26 #include "media/blink/video_frame_compositor.h"
27 #include "media/blink/webmediaplayer_params.h" 27 #include "media/blink/webmediaplayer_params.h"
28 #include "third_party/WebKit/public/platform/WebAudioSourceProvider.h" 28 #include "third_party/WebKit/public/platform/WebAudioSourceProvider.h"
29 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" 29 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
30 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" 30 #include "third_party/WebKit/public/platform/WebMediaPlayer.h"
31 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" 31 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h"
32 #include "third_party/WebKit/public/platform/WebSetAudioOutputDeviceRequest.h"
33 #include "third_party/WebKit/public/platform/WebString.h"
32 #include "url/gurl.h" 34 #include "url/gurl.h"
33 35
34 namespace blink { 36 namespace blink {
35 class WebGraphicsContext3D; 37 class WebGraphicsContext3D;
36 class WebLocalFrame; 38 class WebLocalFrame;
37 } 39 }
38 40
39 namespace base { 41 namespace base {
40 class SingleThreadTaskRunner; 42 class SingleThreadTaskRunner;
41 } 43 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 const blink::WebURL& url, 81 const blink::WebURL& url,
80 CORSMode cors_mode); 82 CORSMode cors_mode);
81 83
82 // Playback controls. 84 // Playback controls.
83 virtual void play(); 85 virtual void play();
84 virtual void pause(); 86 virtual void pause();
85 virtual bool supportsSave() const; 87 virtual bool supportsSave() const;
86 virtual void seek(double seconds); 88 virtual void seek(double seconds);
87 virtual void setRate(double rate); 89 virtual void setRate(double rate);
88 virtual void setVolume(double volume); 90 virtual void setVolume(double volume);
91 virtual void setAudioOutputDevice(
92 const blink::WebSetAudioOutputDeviceRequest& request);
89 virtual void setPreload(blink::WebMediaPlayer::Preload preload); 93 virtual void setPreload(blink::WebMediaPlayer::Preload preload);
90 virtual blink::WebTimeRanges buffered() const; 94 virtual blink::WebTimeRanges buffered() const;
91 virtual blink::WebTimeRanges seekable() const; 95 virtual blink::WebTimeRanges seekable() const;
92 96
93 // Methods for painting. 97 // Methods for painting.
94 virtual void paint(blink::WebCanvas* canvas, 98 virtual void paint(blink::WebCanvas* canvas,
95 const blink::WebRect& rect, 99 const blink::WebRect& rect,
96 unsigned char alpha, 100 unsigned char alpha,
97 SkXfermode::Mode mode); 101 SkXfermode::Mode mode);
98 102
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 void SetCdm(const CdmAttachedCB& cdm_attached_cb, CdmContext* cdm_context); 233 void SetCdm(const CdmAttachedCB& cdm_attached_cb, CdmContext* cdm_context);
230 234
231 // Called when a CDM has been attached to the |pipeline_|. 235 // Called when a CDM has been attached to the |pipeline_|.
232 void OnCdmAttached(blink::WebContentDecryptionModuleResult result, 236 void OnCdmAttached(blink::WebContentDecryptionModuleResult result,
233 bool success); 237 bool success);
234 238
235 // Updates |paused_time_| to the current media time with consideration for the 239 // Updates |paused_time_| to the current media time with consideration for the
236 // |ended_| state by clamping current time to duration upon |ended_|. 240 // |ended_| state by clamping current time to duration upon |ended_|.
237 void UpdatePausedTime(); 241 void UpdatePausedTime();
238 242
243 static void PrepareFinishSetAudioOutputRequest(
244 WebMediaPlayerImpl* media_player,
245 const scoped_refptr<base::SingleThreadTaskRunner> task_runner,
246 blink::WebSetAudioOutputDeviceRequest* request,
247 int result);
248 void FinishSetAudioOutputRequest(
249 blink::WebSetAudioOutputDeviceRequest* request,
250 int result);
251
239 blink::WebLocalFrame* frame_; 252 blink::WebLocalFrame* frame_;
240 253
241 // TODO(hclam): get rid of these members and read from the pipeline directly. 254 // TODO(hclam): get rid of these members and read from the pipeline directly.
242 blink::WebMediaPlayer::NetworkState network_state_; 255 blink::WebMediaPlayer::NetworkState network_state_;
243 blink::WebMediaPlayer::ReadyState ready_state_; 256 blink::WebMediaPlayer::ReadyState ready_state_;
244 257
245 // Preload state for when |data_source_| is created after setPreload(). 258 // Preload state for when |data_source_| is created after setPreload().
246 BufferedDataSource::Preload preload_; 259 BufferedDataSource::Preload preload_;
247 260
248 // Task runner for posting tasks on Chrome's main thread. Also used 261 // Task runner for posting tasks on Chrome's main thread. Also used
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 EncryptedMediaPlayerSupport encrypted_media_support_; 341 EncryptedMediaPlayerSupport encrypted_media_support_;
329 342
330 scoped_ptr<RendererFactory> renderer_factory_; 343 scoped_ptr<RendererFactory> renderer_factory_;
331 344
332 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); 345 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
333 }; 346 };
334 347
335 } // namespace media 348 } // namespace media
336 349
337 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 350 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698