OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 // OS X implementation of VideoCaptureDevice, using QTKit as native capture API. |
| 6 |
| 7 #ifndef MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ |
| 8 #define MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ |
| 9 |
| 10 #include <string> |
| 11 |
| 12 #include "base/compiler_specific.h" |
| 13 #include "media/video/capture/video_capture_device.h" |
| 14 |
| 15 @class VideoCaptureDeviceMacQTKit; |
| 16 |
| 17 namespace media { |
| 18 |
| 19 // Called by VideoCaptureManager to open, close and start, stop video capture |
| 20 // devices. |
| 21 class VideoCaptureDeviceMac : public VideoCaptureDevice { |
| 22 public: |
| 23 explicit VideoCaptureDeviceMac(const Name& device_name); |
| 24 virtual ~VideoCaptureDeviceMac(); |
| 25 |
| 26 // VideoCaptureDevice implementation. |
| 27 virtual void Allocate(int width, |
| 28 int height, |
| 29 int frame_rate, |
| 30 VideoCaptureDevice::EventHandler* observer) OVERRIDE; |
| 31 virtual void Start() OVERRIDE; |
| 32 virtual void Stop() OVERRIDE; |
| 33 virtual void DeAllocate() OVERRIDE; |
| 34 virtual const Name& device_name() OVERRIDE; |
| 35 |
| 36 bool Init(); |
| 37 |
| 38 // Called to deliver captured video frames. |
| 39 void ReceiveFrame(const uint8* video_frame, int video_frame_length, |
| 40 const Capability& frame_info); |
| 41 |
| 42 private: |
| 43 void SetErrorState(const std::string& reason); |
| 44 |
| 45 // Flag indicating the internal state. |
| 46 enum InternalState { |
| 47 kNotInitialized, |
| 48 kIdle, |
| 49 kAllocated, |
| 50 kCapturing, |
| 51 kError |
| 52 }; |
| 53 |
| 54 VideoCaptureDevice::Name device_name_; |
| 55 VideoCaptureDevice::EventHandler* observer_; |
| 56 InternalState state_; |
| 57 |
| 58 VideoCaptureDeviceMacQTKit* capture_device_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceMac); |
| 61 }; |
| 62 |
| 63 } // namespace media |
| 64 |
| 65 #endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ |
OLD | NEW |