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

Side by Side Diff: media/base/pipeline.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BASE_PIPELINE_H_ 5 #ifndef MEDIA_BASE_PIPELINE_H_
6 #define MEDIA_BASE_PIPELINE_H_ 6 #define MEDIA_BASE_PIPELINE_H_
7 7
8 #include <string>
9
8 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
9 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
11 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
12 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
13 #include "base/time/default_tick_clock.h" 15 #include "base/time/default_tick_clock.h"
14 #include "media/base/buffering_state.h" 16 #include "media/base/buffering_state.h"
15 #include "media/base/cdm_context.h" 17 #include "media/base/cdm_context.h"
16 #include "media/base/demuxer.h" 18 #include "media/base/demuxer.h"
17 #include "media/base/media_export.h" 19 #include "media/base/media_export.h"
18 #include "media/base/pipeline_status.h" 20 #include "media/base/pipeline_status.h"
19 #include "media/base/ranges.h" 21 #include "media/base/ranges.h"
20 #include "media/base/serial_runner.h" 22 #include "media/base/serial_runner.h"
21 #include "media/base/text_track.h" 23 #include "media/base/text_track.h"
22 #include "media/base/video_rotation.h" 24 #include "media/base/video_rotation.h"
23 #include "ui/gfx/geometry/size.h" 25 #include "ui/gfx/geometry/size.h"
26 #include "url/gurl.h"
24 27
25 namespace base { 28 namespace base {
26 class SingleThreadTaskRunner; 29 class SingleThreadTaskRunner;
27 class TimeDelta; 30 class TimeDelta;
28 } 31 }
29 32
30 namespace media { 33 namespace media {
31 34
32 class MediaLog; 35 class MediaLog;
33 class Renderer; 36 class Renderer;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Gets the current volume setting being used by the audio renderer. When 159 // Gets the current volume setting being used by the audio renderer. When
157 // the pipeline is started, this value will be 1.0f. Valid values range 160 // the pipeline is started, this value will be 1.0f. Valid values range
158 // from 0.0f to 1.0f. 161 // from 0.0f to 1.0f.
159 float GetVolume() const; 162 float GetVolume() const;
160 163
161 // Attempt to set the volume of the audio renderer. Valid values for volume 164 // Attempt to set the volume of the audio renderer. Valid values for volume
162 // range from 0.0f (muted) to 1.0f (full volume). This value affects all 165 // range from 0.0f (muted) to 1.0f (full volume). This value affects all
163 // channels proportionately for multi-channel audio streams. 166 // channels proportionately for multi-channel audio streams.
164 void SetVolume(float volume); 167 void SetVolume(float volume);
165 168
169 // Attempt to switch the audio output device.
170 void SwitchAudioOutputDevice(const std::string& device_id,
171 const GURL& security_origin,
172 const base::Callback<void(int)>& callback);
173
166 // Returns the current media playback time, which progresses from 0 until 174 // Returns the current media playback time, which progresses from 0 until
167 // GetMediaDuration(). 175 // GetMediaDuration().
168 base::TimeDelta GetMediaTime() const; 176 base::TimeDelta GetMediaTime() const;
169 177
170 // Get approximate time ranges of buffered media. 178 // Get approximate time ranges of buffered media.
171 Ranges<base::TimeDelta> GetBufferedTimeRanges() const; 179 Ranges<base::TimeDelta> GetBufferedTimeRanges() const;
172 180
173 // Get the duration of the media in microseconds. If the duration has not 181 // Get the duration of the media in microseconds. If the duration has not
174 // been determined yet, then returns 0. 182 // been determined yet, then returns 0.
175 base::TimeDelta GetMediaDuration() const; 183 base::TimeDelta GetMediaDuration() const;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // Carries out stopping and destroying all filters, placing the pipeline in 248 // Carries out stopping and destroying all filters, placing the pipeline in
241 // the kStopped state. 249 // the kStopped state.
242 void ErrorChangedTask(PipelineStatus error); 250 void ErrorChangedTask(PipelineStatus error);
243 251
244 // Carries out notifying filters that the playback rate has changed. 252 // Carries out notifying filters that the playback rate has changed.
245 void PlaybackRateChangedTask(double playback_rate); 253 void PlaybackRateChangedTask(double playback_rate);
246 254
247 // Carries out notifying filters that the volume has changed. 255 // Carries out notifying filters that the volume has changed.
248 void VolumeChangedTask(float volume); 256 void VolumeChangedTask(float volume);
249 257
258 // Carries out notifying filters that the audio output device has been
259 // switched.
260 void AudioOutputDeviceSwitchedTask(const std::string& device_id,
261 const GURL& security_origin,
262 const base::Callback<void(int)>& callback);
263
250 // Carries out notifying filters that we are seeking to a new timestamp. 264 // Carries out notifying filters that we are seeking to a new timestamp.
251 void SeekTask(base::TimeDelta time, const PipelineStatusCB& seek_cb); 265 void SeekTask(base::TimeDelta time, const PipelineStatusCB& seek_cb);
252 266
253 // Carries out setting the |cdm_context| in |renderer_|, and then fires 267 // Carries out setting the |cdm_context| in |renderer_|, and then fires
254 // |cdm_attached_cb| with the result. If |renderer_| is null, 268 // |cdm_attached_cb| with the result. If |renderer_| is null,
255 // |cdm_attached_cb| will be fired immediately with true, and |cdm_context| 269 // |cdm_attached_cb| will be fired immediately with true, and |cdm_context|
256 // will be set in |renderer_| later when |renderer_| is created. 270 // will be set in |renderer_| later when |renderer_| is created.
257 void SetCdmTask(CdmContext* cdm_context, 271 void SetCdmTask(CdmContext* cdm_context,
258 const CdmAttachedCB& cdm_attached_cb); 272 const CdmAttachedCB& cdm_attached_cb);
259 273
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 396
383 // NOTE: Weak pointers must be invalidated before all other member variables. 397 // NOTE: Weak pointers must be invalidated before all other member variables.
384 base::WeakPtrFactory<Pipeline> weak_factory_; 398 base::WeakPtrFactory<Pipeline> weak_factory_;
385 399
386 DISALLOW_COPY_AND_ASSIGN(Pipeline); 400 DISALLOW_COPY_AND_ASSIGN(Pipeline);
387 }; 401 };
388 402
389 } // namespace media 403 } // namespace media
390 404
391 #endif // MEDIA_BASE_PIPELINE_H_ 405 #endif // MEDIA_BASE_PIPELINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698