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

Unified Diff: media/video/capture/mac/video_capture_device_mac.h

Issue 8177008: Adding VideoCaptureDevice for Mac. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Changes based on comments by dmac and scherkus. Created 9 years, 2 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/mac/video_capture_device_mac.h
diff --git a/media/video/capture/mac/video_capture_device_mac.h b/media/video/capture/mac/video_capture_device_mac.h
new file mode 100644
index 0000000000000000000000000000000000000000..97a4fab8af8417e2260792f4fb9121620e9266c9
--- /dev/null
+++ b/media/video/capture/mac/video_capture_device_mac.h
@@ -0,0 +1,65 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// OS X implementation of VideoCaptureDevice, using QTKit as native capture API.
+
+#ifndef MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_
+#define MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_
+
+#include <string>
+
+#include "base/compiler_specific.h"
+#include "media/video/capture/video_capture_device.h"
+
+@class VideoCaptureDeviceMacQTKit;
+
+namespace media {
+
+// Called by VideoCaptureManager to open, close and start, stop video capture
+// devices.
+class VideoCaptureDeviceMac : public VideoCaptureDevice {
+ public:
+ explicit VideoCaptureDeviceMac(const Name& device_name);
+ virtual ~VideoCaptureDeviceMac();
+
+ // VideoCaptureDevice implementation.
+ virtual void Allocate(int width,
+ int height,
+ int frame_rate,
+ VideoCaptureDevice::EventHandler* observer) OVERRIDE;
+ virtual void Start() OVERRIDE;
+ virtual void Stop() OVERRIDE;
+ virtual void DeAllocate() OVERRIDE;
+ virtual const Name& device_name() OVERRIDE;
+
+ bool Init();
+
+ // Called to deliver captured video frames.
+ void ReceiveFrame(const uint8* video_frame, int video_frame_length,
+ const Capability& frame_info);
+
+ private:
+ void SetErrorState(const std::string& reason);
+
+ // Flag indicating the internal state.
+ enum InternalState {
+ kNotInitialized,
+ kIdle,
+ kAllocated,
+ kCapturing,
+ kError
+ };
+
+ VideoCaptureDevice::Name device_name_;
+ VideoCaptureDevice::EventHandler* observer_;
+ InternalState state_;
+
+ VideoCaptureDeviceMacQTKit* capture_device_;
+
+ DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceMac);
+};
+
+} // namespace media
+
+#endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_

Powered by Google App Engine
This is Rietveld 408576698