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

Side by Side Diff: media/capture/video/video_capture_device_descriptor.h

Issue 2169013002: Change class VideoCaptureDevice::Name to struct VideoCaptureDeviceDescriptor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed emircan's comments Created 4 years, 4 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_DESCRIPTOR_H_
6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_DESCRIPTOR_H_
7
8 #include <list>
9 #include <string>
10
11 #include "media/capture/capture_export.h"
12
13 namespace media {
14
15 // A Java counterpart will be generated for this enum.
16 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.media
17 enum class VideoCaptureApiType {
mcasas 2016/07/26 23:52:03 s/VideoCaptureApiType/VideoCaptureAPI/ (or Api) T
chfremer 2016/07/27 23:10:18 Done.
18 LINUX_V4L2_SINGLE_PLANE,
19 WINDOWS_MEDIA_FOUNDATION,
20 WINDOWS_DIRECT_SHOW,
21 MACOSX_AVFOUNDATION,
22 MACOSX_DECKLINK,
23 ANDROID_API1,
24 ANDROID_API2_LEGACY,
25 ANDROID_API2_FULL,
26 ANDROID_API2_LIMITED,
27 ANDROID_TANGO,
28 API_TYPE_UNKNOWN
mcasas 2016/07/26 23:52:04 Since it's an enum class, the name will always pre
chfremer 2016/07/27 23:10:17 Done.
29 };
30
31 enum class VideoCaptureTransportType {
32 // For AVFoundation Api, identify devices that are built-in or USB.
33 MACOSX_USB_OR_BUILT_IN,
34 OTHER_TRANSPORT
35 };
36
37 // Represents information about a capture device as returned by
38 // VideoCaptureDeviceFactory::EnumerateDeviceDescriptors().
39 // |device_id| represents a unique id of a physical device. Since the same
40 // physical device may be accessible through different APIs |capture_api|
41 // disambiguates the API.
42 struct CAPTURE_EXPORT VideoCaptureDeviceDescriptor {
mcasas 2016/07/26 23:52:04 I'd err on the side of making this a class [1] [1
chfremer 2016/07/27 23:10:18 After reviewing the styleguide, I still feel struc
mcasas 2016/07/28 00:05:42 Hmm I'll leave the decision to you.
chfremer 2016/07/29 18:09:50 Okay, then I'll leave it a struct for now.
43 public:
44 VideoCaptureDeviceDescriptor();
45 VideoCaptureDeviceDescriptor(const std::string friendly_name,
46 const std::string device_id,
47 VideoCaptureApiType capture_api);
48 VideoCaptureDeviceDescriptor(const VideoCaptureDeviceDescriptor& other);
mcasas 2016/07/26 23:52:04 We used to have a ctor with a |transport_type| arg
chfremer 2016/07/27 23:10:18 True. I had removed all constructors for initializ
49 ~VideoCaptureDeviceDescriptor();
50
51 // These operators are needed due to storing the name in an STL container.
52 // In the shared build, all methods from the STL container will be exported
53 // so even though they're not used, they're still depended upon.
54 bool operator==(const VideoCaptureDeviceDescriptor& other) const {
55 return (other.device_id == device_id) && (other.capture_api == capture_api);
56 }
57 bool operator<(const VideoCaptureDeviceDescriptor& other) const {
58 if (device_id < other.device_id)
59 return true;
60 return capture_api < other.capture_api;
61 }
62
63 const char* GetCaptureApiTypeString() const;
64
65 std::string friendly_name; // Name that is intended for display in the UI
66 std::string device_id;
67 VideoCaptureApiType capture_api;
mcasas 2016/07/26 23:52:04 Make this three const? And, if possible, |transpo
chfremer 2016/07/27 23:10:18 We need the ability to assign values when we fill
mcasas 2016/07/28 00:05:42 Acknowledged.
68 VideoCaptureTransportType transport_type;
69 };
70
71 typedef std::list<VideoCaptureDeviceDescriptor> VideoCaptureDeviceDescriptors;
mcasas 2016/07/26 23:52:03 using VideoCaptureDeviceDescriptors = std::list<Vi
mcasas 2016/07/28 00:05:42 ping
chfremer 2016/07/29 18:09:50 Done.
72
73 } // namespace media
74
75 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_DESCRIPTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698