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

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

Issue 17402002: Reconnect support for DirectShow video capture devices in parallel to MediaFoundation ones. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CaptureApiType wrapped into a CaptureApiClass for default value. Created 7 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 e5be4139e7056256a478a9be1169ed44229aa2dd..d00ab056434c1c8402e0a96bc764fa489bfe4f48 100644
--- a/media/video/capture/video_capture_device.h
+++ b/media/video/capture/video_capture_device.h
@@ -15,6 +15,7 @@
#include <list>
#include <string>
+#include "base/logging.h"
#include "base/time/time.h"
#include "media/base/media_export.h"
#include "media/video/capture/video_capture_types.h"
@@ -36,6 +37,20 @@ class MEDIA_EXPORT VideoCaptureDevice {
Name() {}
Name(const std::string& name, const std::string& id)
: device_name_(name), unique_id_(id) {}
+
+#if defined(OS_WIN)
+ // Windows targets Capture Api type: it can only be set on construction.
+ enum CaptureApiType {
+ MEDIA_FOUNDATION,
+ DIRECT_SHOW,
+ API_TYPE_UNKNOWN
+ };
+
+ Name(const std::string& name,
+ const std::string& id,
+ const CaptureApiType api_type)
+ : device_name_(name), unique_id_(id), capture_api_class_(api_type) {}
+#endif // if defined(OS_WIN)
~Name() {}
// Friendly name of a device
@@ -55,9 +70,33 @@ class MEDIA_EXPORT VideoCaptureDevice {
return unique_id_ < other.id();
}
+#if defined(OS_WIN)
+ CaptureApiType capture_api_type() const {
+ return capture_api_class_.capture_api_type();
+ }
+#endif // if defined(OS_WIN)
+
private:
std::string device_name_;
std::string unique_id_;
+#if defined(OS_WIN)
+ // This class wraps the CaptureApiType, so it has a by default value if not
+ // inititalized, and I (mcasas) do a DCHECK on reading its value.
+ 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(capture_api_type_ != API_TYPE_UNKNOWN);
tommi (sloooow) - chröme 2013/07/03 15:27:26 nit: DCHECK_NE
mcasas 2013/07/04 10:40:42 Done.
+ return capture_api_type_;
+ }
+ private:
+ CaptureApiType capture_api_type_;
+ };
+
+ CaptureApiClass capture_api_class_;
+#endif // if defined(OS_WIN)
// Allow generated copy constructor and assignment.
};

Powered by Google App Engine
This is Rietveld 408576698