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 #include "media/video/capture/mac/video_capture_device_mac.h" | 5 #include "media/video/capture/mac/video_capture_device_mac.h" |
6 | 6 |
7 #import <QTKit/QTKit.h> | 7 #import <QTKit/QTKit.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 return; | 63 return; |
64 } | 64 } |
65 if (![capture_device_ setCaptureHeight:height | 65 if (![capture_device_ setCaptureHeight:height |
66 width:width | 66 width:width |
67 frameRate:frame_rate]) { | 67 frameRate:frame_rate]) { |
68 SetErrorState("Could not configure capture device."); | 68 SetErrorState("Could not configure capture device."); |
69 return; | 69 return; |
70 } | 70 } |
71 | 71 |
72 state_ = kAllocated; | 72 state_ = kAllocated; |
73 Capability current_settings; | 73 VideoCaptureCapability current_settings; |
74 current_settings.color = kARGB; | 74 current_settings.color = VideoCaptureCapability::kARGB; |
75 current_settings.width = width; | 75 current_settings.width = width; |
76 current_settings.height = height; | 76 current_settings.height = height; |
77 current_settings.frame_rate = frame_rate; | 77 current_settings.frame_rate = frame_rate; |
| 78 current_settings.expected_capture_delay = 0; |
| 79 current_settings.interlaced = false; |
78 | 80 |
79 observer_->OnFrameInfo(current_settings); | 81 observer_->OnFrameInfo(current_settings); |
80 } | 82 } |
81 | 83 |
82 void VideoCaptureDeviceMac::Start() { | 84 void VideoCaptureDeviceMac::Start() { |
83 DCHECK_EQ(state_, kAllocated); | 85 DCHECK_EQ(state_, kAllocated); |
84 if (![capture_device_ startCapture]) { | 86 if (![capture_device_ startCapture]) { |
85 SetErrorState("Could not start capture device."); | 87 SetErrorState("Could not start capture device."); |
86 return; | 88 return; |
87 } | 89 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 if (!capture_device_) { | 125 if (!capture_device_) { |
124 return false; | 126 return false; |
125 } | 127 } |
126 state_ = kIdle; | 128 state_ = kIdle; |
127 return true; | 129 return true; |
128 } | 130 } |
129 } | 131 } |
130 return false; | 132 return false; |
131 } | 133 } |
132 | 134 |
133 void VideoCaptureDeviceMac::ReceiveFrame(const uint8* video_frame, | 135 void VideoCaptureDeviceMac::ReceiveFrame( |
134 int video_frame_length, | 136 const uint8* video_frame, |
135 const Capability& frame_info) { | 137 int video_frame_length, |
| 138 const VideoCaptureCapability& frame_info) { |
136 observer_->OnIncomingCapturedFrame(video_frame, video_frame_length, | 139 observer_->OnIncomingCapturedFrame(video_frame, video_frame_length, |
137 base::Time::Now()); | 140 base::Time::Now()); |
138 } | 141 } |
139 | 142 |
140 void VideoCaptureDeviceMac::SetErrorState(const std::string& reason) { | 143 void VideoCaptureDeviceMac::SetErrorState(const std::string& reason) { |
141 DLOG(ERROR) << reason; | 144 DLOG(ERROR) << reason; |
142 state_ = kError; | 145 state_ = kError; |
143 observer_->OnError(); | 146 observer_->OnError(); |
144 } | 147 } |
145 | 148 |
146 } // namespace media | 149 } // namespace media |
OLD | NEW |