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