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

Unified Diff: media/base/output_device_info.h

Issue 1809093003: Moving SwitchOutputDevice out of OutputDevice interface, eliminating OutputDevice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing guidou's comments Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: media/base/output_device_info.h
diff --git a/media/base/output_device_info.h b/media/base/output_device_info.h
new file mode 100644
index 0000000000000000000000000000000000000000..9b8981eb410bd156d9464f8a0620edbcf7f1b9fb
--- /dev/null
+++ b/media/base/output_device_info.h
@@ -0,0 +1,68 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
Henrik Grunell 2016/03/25 10:44:40 I think "(c)" should be omitted. Check the style g
o1ka 2016/03/29 13:39:54 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_BASE_OUTPUT_DEVICE_INFO_H_
+#define MEDIA_BASE_OUTPUT_DEVICE_INFO_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "media/audio/audio_parameters.h"
+#include "media/base/media_export.h"
+
+namespace media {
+
+// Result of an audio output device switch operation
+enum OutputDeviceStatus {
+ OUTPUT_DEVICE_STATUS_OK = 0,
+ OUTPUT_DEVICE_STATUS_ERROR_NOT_FOUND,
+ OUTPUT_DEVICE_STATUS_ERROR_NOT_AUTHORIZED,
+ OUTPUT_DEVICE_STATUS_ERROR_INTERNAL,
+ OUTPUT_DEVICE_STATUS_LAST = OUTPUT_DEVICE_STATUS_ERROR_INTERNAL,
+};
+
+typedef base::Callback<void(OutputDeviceStatus)> OutputDeviceStatusCB;
+
+class MEDIA_EXPORT OutputDeviceInfo {
Henrik Grunell 2016/03/25 10:44:40 Add a comment with brief high-level description of
o1ka 2016/03/29 13:39:54 Done.
Henrik Grunell 2016/04/04 11:15:29 I don't see the comment/description.
+ public:
+ // Use this constructor to initialize with "no info available" values.
+ OutputDeviceInfo();
+
+ // Use this constructor to indicate a specific error status of the device.
+ explicit OutputDeviceInfo(OutputDeviceStatus device_status);
+
+ OutputDeviceInfo(const std::string& device_id,
+ OutputDeviceStatus device_status,
+ const AudioParameters& output_params);
+
+ OutputDeviceInfo(const OutputDeviceInfo& other);
miu 2016/03/24 21:32:02 nit: Copy constructor and assignment operator shou
o1ka 2016/03/29 13:39:54 Done.
+
+ ~OutputDeviceInfo();
+
+ OutputDeviceInfo& operator=(const OutputDeviceInfo&);
+
+ // Returns the device ID.
+ const std::string& device_id() const { return device_id_; }
+
+ // Returns the status of output device.
+ OutputDeviceStatus device_status() const { return device_status_; }
+
+ // Returns the device's audio output parameters.
+ // The return value is undefined if the device status (as returned by
+ // device_status()) is different from OUTPUT_DEVICE_STATUS_OK.
+ const AudioParameters& output_params() const { return output_params_; };
+
+ // Returns a human-readable string describing |*this|. For debugging & test
+ // output only.
+ std::string AsHumanReadableString() const;
+
+ private:
+ std::string device_id_;
+ OutputDeviceStatus device_status_;
+ AudioParameters output_params_;
+};
+
+} // namespace media
+
+#endif // MEDIA_BASE_OUTPUT_DEVICE_INFO_H_

Powered by Google App Engine
This is Rietveld 408576698