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

Side by Side Diff: media/base/output_device.h

Issue 1323403005: Allow AudioOutputDevice objects to be initialized with a specific hardware output device and store … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 3 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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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_OUTPUT_DEVICE_H_ 5 #ifndef MEDIA_BASE_OUTPUT_DEVICE_H_
6 #define MEDIA_BASE_OUTPUT_DEVICE_H_ 6 #define MEDIA_BASE_OUTPUT_DEVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "media/audio/audio_parameters.h" 11 #include "media/audio/audio_parameters.h"
12 #include "media/base/media_export.h" 12 #include "media/base/media_export.h"
13 #include "url/gurl.h" 13 #include "url/gurl.h"
14 14
15 namespace media { 15 namespace media {
16 16
17 // Result of an audio output device switch operation 17 // Result of an audio output device switch operation
18 enum SwitchOutputDeviceResult { 18 enum SwitchOutputDeviceResult {
19 SWITCH_OUTPUT_DEVICE_RESULT_SUCCESS = 0, 19 SWITCH_OUTPUT_DEVICE_RESULT_SUCCESS = 0,
20 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_FOUND, 20 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_FOUND,
21 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_AUTHORIZED, 21 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_AUTHORIZED,
22 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_OBSOLETE, 22 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_INTERNAL,
23 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_SUPPORTED, 23 SWITCH_OUTPUT_DEVICE_RESULT_LAST = SWITCH_OUTPUT_DEVICE_RESULT_ERROR_INTERNAL,
24 SWITCH_OUTPUT_DEVICE_RESULT_LAST =
25 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_SUPPORTED,
26 }; 24 };
27 25
28 typedef base::Callback<void(SwitchOutputDeviceResult)> SwitchOutputDeviceCB; 26 typedef base::Callback<void(SwitchOutputDeviceResult)> SwitchOutputDeviceCB;
29 27
30 // OutputDevice is an interface that allows performing operations related 28 // OutputDevice is an interface that allows performing operations related
31 // audio output devices. 29 // audio output devices.
32 30
33 class OutputDevice { 31 class OutputDevice {
34 public: 32 public:
35 // Attempts to switch the audio output device. 33 // Attempts to switch the audio output device.
36 // Once the attempt is finished, |callback| is invoked with the 34 // Once the attempt is finished, |callback| is invoked with the
37 // result of the operation passed as a parameter. The result is a value from 35 // result of the operation passed as a parameter. The result is a value from
38 // the media::SwitchOutputDeviceResult enum. 36 // the media::SwitchOutputDeviceResult enum.
39 // There is no guarantee about the thread where |callback| will 37 // There is no guarantee about the thread where |callback| will
40 // be invoked, so users are advised to use media::BindToCurrentLoop() to 38 // be invoked, so users are advised to use media::BindToCurrentLoop() to
41 // ensure that |callback| runs on the correct thread. 39 // ensure that |callback| runs on the correct thread.
42 // Note also that copy constructors and destructors for arguments bound to 40 // Note also that copy constructors and destructors for arguments bound to
43 // |callback| may run on arbitrary threads as |callback| is moved across 41 // |callback| may run on arbitrary threads as |callback| is moved across
44 // threads. It is advisable to bind arguments such that they are released by 42 // threads. It is advisable to bind arguments such that they are released by
45 // |callback| when it runs in order to avoid surprises. 43 // |callback| when it runs in order to avoid surprises.
46 virtual void SwitchOutputDevice(const std::string& device_id, 44 virtual void SwitchOutputDevice(const std::string& device_id,
47 const GURL& security_origin, 45 const GURL& security_origin,
48 const SwitchOutputDeviceCB& callback) = 0; 46 const SwitchOutputDeviceCB& callback) = 0;
49 47
48 // Returns the device's audio output parameters.
49 // If the parameters are not available, this method blocks until they
50 // become available.
DaleCurtis 2015/09/12 01:17:19 Add a clause saying it must never be called on the
Guido Urdaneta 2015/09/14 11:35:48 Done.
51 virtual AudioParameters GetOutputParameters() = 0;
52
50 protected: 53 protected:
51 virtual ~OutputDevice() {} 54 virtual ~OutputDevice() {}
52 }; 55 };
53 56
54 } // namespace media 57 } // namespace media
55 58
56 #endif // MEDIA_BASE_OUTPUT_DEVICE_H_ 59 #endif // MEDIA_BASE_OUTPUT_DEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698