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

Unified Diff: media/video/capture/video_capture_device.h

Issue 366593003: Mac VideoCapture: return empty GetModel() for non-USB non-built-in cameras. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: media/video/capture/video_capture_device.h
diff --git a/media/video/capture/video_capture_device.h b/media/video/capture/video_capture_device.h
index afb4c3567ac3362a9a9cae08c14fada1b507067a..2f63139a3c65348001b3328907bd580bd7129846 100644
--- a/media/video/capture/video_capture_device.h
+++ b/media/video/capture/video_capture_device.h
@@ -38,9 +38,8 @@ class MEDIA_EXPORT VideoCaptureDevice {
// VideoCaptureDevice::Create.
class MEDIA_EXPORT Name {
public:
- Name() {}
- Name(const std::string& name, const std::string& id)
- : device_name_(name), unique_id_(id) {}
+ Name();
+ Name(const std::string& name, const std::string& id);
#if defined(OS_WIN)
// Windows targets Capture Api type: it can only be set on construction.
@@ -57,14 +56,24 @@ class MEDIA_EXPORT VideoCaptureDevice {
QTKIT,
API_TYPE_UNKNOWN
};
+ // For AVFoundation Api, identify devices that are built-in or USB.
+ enum TransportType {
+ USB_OR_BUILT_IN,
+ OTHER_TRANSPORT
+ };
#endif
#if defined(OS_WIN) || defined(OS_MACOSX)
Name(const std::string& name,
const std::string& id,
- const CaptureApiType api_type)
- : device_name_(name), unique_id_(id), capture_api_class_(api_type) {}
+ 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() {}
+ ~Name();
// Friendly name of a device
const std::string& name() const { return device_name_; }
@@ -95,6 +104,11 @@ class MEDIA_EXPORT VideoCaptureDevice {
CaptureApiType capture_api_type() const {
return capture_api_class_.capture_api_type();
}
+#endif
+#if defined(OS_MACOSX)
+ TransportType transport_type() const {
+ return transport_class_.transport_type();
+ }
#endif // if defined(OS_WIN)
private:
@@ -118,6 +132,23 @@ class MEDIA_EXPORT VideoCaptureDevice {
CaptureApiClass capture_api_class_;
#endif
+#if defined(OS_MACOSX)
+ // This class wraps the TransportType to give it a by default value if not
+ // initialized.
+ class TransportClass {
Robert Sesek 2014/07/01 14:16:07 Could you just use a struct instead? I guess that'
mcasas 2014/07/01 16:06:10 I was doubting about this one but your comment dec
+ public:
+ TransportClass(): transport_type_(OTHER_TRANSPORT) {}
+ TransportClass(const TransportType transport_type)
+ : transport_type_(transport_type) {}
+ TransportType transport_type() const {
+ return transport_type_;
+ }
+ private:
+ TransportType transport_type_;
+ };
+
+ TransportClass transport_class_;
+#endif
// Allow generated copy constructor and assignment.
};

Powered by Google App Engine
This is Rietveld 408576698