Index: media/capture/video/video_capture_device.h |
diff --git a/media/capture/video/video_capture_device.h b/media/capture/video/video_capture_device.h |
index 4671df63f364c5dde04c4f08fa7f3e875983af6c..cbdc8adde4c6e44dd2d764957a6873c267d02109 100644 |
--- a/media/capture/video/video_capture_device.h |
+++ b/media/capture/video/video_capture_device.h |
@@ -30,6 +30,7 @@ |
#include "media/base/video_frame.h" |
#include "media/capture/capture_export.h" |
#include "media/capture/video/scoped_result_callback.h" |
+#include "media/capture/video/video_capture_device_descriptor.h" |
#include "media/mojo/interfaces/image_capture.mojom.h" |
#include "mojo/public/cpp/bindings/array.h" |
#include "ui/gfx/gpu_memory_buffer.h" |
@@ -42,139 +43,6 @@ namespace media { |
class CAPTURE_EXPORT VideoCaptureDevice { |
public: |
- // Represents a capture device name and ID. |
- // You should not create an instance of this class directly by e.g. setting |
- // various properties directly. Instead use |
- // VideoCaptureDevice::GetDeviceNames to do this for you and if you need to |
- // cache your own copy of a name, you can do so via the copy constructor. |
- // The reason for this is that a device name might contain platform specific |
- // settings that are relevant only to the platform specific implementation of |
- // VideoCaptureDevice::Create. |
- class CAPTURE_EXPORT Name { |
- public: |
- Name(); |
- Name(const std::string& name, const std::string& id); |
- |
-#if defined(OS_LINUX) |
- // Linux/CrOS targets Capture Api type: it can only be set on construction. |
- enum CaptureApiType { |
- V4L2_SINGLE_PLANE, |
- API_TYPE_UNKNOWN |
- }; |
-#elif defined(OS_WIN) |
- // Windows targets Capture Api type: it can only be set on construction. |
- enum CaptureApiType { MEDIA_FOUNDATION, DIRECT_SHOW, API_TYPE_UNKNOWN }; |
-#elif defined(OS_MACOSX) |
- // Mac targets Capture Api type: it can only be set on construction. |
- enum CaptureApiType { AVFOUNDATION, DECKLINK, API_TYPE_UNKNOWN }; |
- // For AVFoundation Api, identify devices that are built-in or USB. |
- enum TransportType { USB_OR_BUILT_IN, OTHER_TRANSPORT }; |
-#elif defined(OS_ANDROID) |
- // Android targets Capture Api type: it can only be set on construction. |
- // Automatically generated enum to interface with Java world. |
- // |
- // A Java counterpart will be generated for this enum. |
- // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.media |
- enum CaptureApiType { |
- API1, |
- API2_LEGACY, |
- API2_FULL, |
- API2_LIMITED, |
- TANGO, |
- API_TYPE_UNKNOWN |
- }; |
-#endif |
- |
-#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ |
- defined(OS_ANDROID) |
- Name(const std::string& name, |
- const std::string& id, |
- const CaptureApiType api_type); |
-#endif |
-#if defined(OS_MACOSX) |
- Name(const std::string& name, |
- const std::string& id, |
- const CaptureApiType api_type, |
- const TransportType transport_type); |
-#endif |
- Name(const Name& other); |
- ~Name(); |
- |
- // Friendly name of a device |
- const std::string& name() const { return device_name_; } |
- |
- // Unique name of a device. Even if there are multiple devices with the same |
- // friendly name connected to the computer this will be unique. |
- const std::string& id() const { return unique_id_; } |
- |
- // The unique hardware model identifier of the capture device. Returns |
- // "[vid]:[pid]" when a USB device is detected, otherwise "". |
- // The implementation of this method is platform-dependent. |
- const std::string GetModel() const; |
- |
- // Friendly name of a device, plus the model identifier in parentheses. |
- const std::string GetNameAndModel() const; |
- |
- // These operators are needed due to storing the name in an STL container. |
- // In the shared build, all methods from the STL container will be exported |
- // so even though they're not used, they're still depended upon. |
- bool operator==(const Name& other) const { |
- return other.id() == unique_id_; |
- } |
- bool operator<(const Name& other) const { return unique_id_ < other.id(); } |
- |
-#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ |
- defined(OS_ANDROID) |
- CaptureApiType capture_api_type() const { |
- return capture_api_class_.capture_api_type(); |
- } |
- const char* GetCaptureApiTypeString() const; |
-#endif |
-#if defined(OS_WIN) |
- // Certain devices need an ID different from the |unique_id_| for |
- // capabilities retrieval. |
- const std::string& capabilities_id() const { return capabilities_id_; } |
- void set_capabilities_id(const std::string& id) { capabilities_id_ = id; } |
-#endif // if defined(OS_WIN) |
-#if defined(OS_MACOSX) |
- TransportType transport_type() const { return transport_type_; } |
-#endif // if defined(OS_MACOSX) |
- |
- private: |
- std::string device_name_; |
- std::string unique_id_; |
-#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ |
- defined(OS_ANDROID) |
- // This class wraps the CaptureApiType to give it a by default value if not |
- // initialized. |
- class CaptureApiClass { |
- public: |
- CaptureApiClass() : capture_api_type_(API_TYPE_UNKNOWN) {} |
- CaptureApiClass(const CaptureApiType api_type) |
- : capture_api_type_(api_type) {} |
- CaptureApiType capture_api_type() const { |
- DCHECK_NE(capture_api_type_, API_TYPE_UNKNOWN); |
- return capture_api_type_; |
- } |
- |
- private: |
- CaptureApiType capture_api_type_; |
- }; |
- |
- CaptureApiClass capture_api_class_; |
-#endif |
-#if defined(OS_WIN) |
- // ID used for capabilities retrieval. By default is equal to |unique_id|. |
- std::string capabilities_id_; |
-#endif |
-#if defined(OS_MACOSX) |
- TransportType transport_type_; |
-#endif |
- // Allow generated copy constructor and assignment. |
- }; |
- |
- // Manages a list of Name entries. |
- typedef std::list<Name> Names; |
// Interface defining the methods that clients of VideoCapture must have. It |
// is actually two-in-one: clients may implement OnIncomingCapturedData() or |