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

Side by Side Diff: media/video/capture/mac/video_capture_device_mac.mm

Issue 24079003: Add VideoCaptureDevice::GetDeviceSupportedFormats to interface + implementation for Linux and Fake (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed parameter device_name from GetDeviceSupportedFormats. Added explanation to VCD interface. Created 7 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 if (state_ != kIdle) { 115 if (state_ != kIdle) {
116 return; 116 return;
117 } 117 }
118 int width = capture_format.width; 118 int width = capture_format.width;
119 int height = capture_format.height; 119 int height = capture_format.height;
120 int frame_rate = capture_format.frame_rate; 120 int frame_rate = capture_format.frame_rate;
121 121
122 // QTKit can scale captured frame to any size requested, which would lead to 122 // QTKit can scale captured frame to any size requested, which would lead to
123 // undesired aspect ratio change. Tries to open the camera with a natively 123 // undesired aspect ratio change. Tries to open the camera with a natively
124 // supported format and let the client to crop/pad the captured frames. 124 // supported format and let the client to crop/pad the captured frames.
125 GetBestMatchSupportedResolution(&width, 125 GetBestMatchSupportedResolution(&width, &height);
126 &height);
127 126
128 observer_ = observer; 127 observer_ = observer;
129 NSString* deviceId = 128 NSString* deviceId =
130 [NSString stringWithUTF8String:device_name_.id().c_str()]; 129 [NSString stringWithUTF8String:device_name_.id().c_str()];
131 130
132 [capture_device_ setFrameReceiver:this]; 131 [capture_device_ setFrameReceiver:this];
133 132
134 if (![capture_device_ setCaptureDevice:deviceId]) { 133 if (![capture_device_ setCaptureDevice:deviceId]) {
135 SetErrorState("Could not open capture device."); 134 SetErrorState("Could not open capture device.");
136 return; 135 return;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 [capture_device_ setCaptureDevice:nil]; 186 [capture_device_ setCaptureDevice:nil];
188 [capture_device_ setFrameReceiver:nil]; 187 [capture_device_ setFrameReceiver:nil];
189 188
190 state_ = kIdle; 189 state_ = kIdle;
191 } 190 }
192 191
193 const VideoCaptureDevice::Name& VideoCaptureDeviceMac::device_name() { 192 const VideoCaptureDevice::Name& VideoCaptureDeviceMac::device_name() {
194 return device_name_; 193 return device_name_;
195 } 194 }
196 195
196 void VideoCaptureDeviceMac::GetDeviceSupportedFormats(
197 VideoCaptureFormats* capture_formats){
198 NOTIMPLEMENTED();
199 }
200
197 bool VideoCaptureDeviceMac::Init() { 201 bool VideoCaptureDeviceMac::Init() {
198 DCHECK_EQ(loop_proxy_, base::MessageLoopProxy::current()); 202 DCHECK_EQ(loop_proxy_, base::MessageLoopProxy::current());
199 DCHECK_EQ(state_, kNotInitialized); 203 DCHECK_EQ(state_, kNotInitialized);
200 204
201 Names device_names; 205 Names device_names;
202 GetDeviceNames(&device_names); 206 GetDeviceNames(&device_names);
203 Name* found = device_names.FindById(device_name_.id()); 207 Name* found = device_names.FindById(device_name_.id());
204 if (!found) 208 if (!found)
205 return false; 209 return false;
206 210
(...skipping 23 matching lines...) Expand all
230 } 234 }
231 235
232 void VideoCaptureDeviceMac::SetErrorState(const std::string& reason) { 236 void VideoCaptureDeviceMac::SetErrorState(const std::string& reason) {
233 DCHECK_EQ(loop_proxy_, base::MessageLoopProxy::current()); 237 DCHECK_EQ(loop_proxy_, base::MessageLoopProxy::current());
234 DLOG(ERROR) << reason; 238 DLOG(ERROR) << reason;
235 state_ = kError; 239 state_ = kError;
236 observer_->OnError(); 240 observer_->OnError();
237 } 241 }
238 242
239 } // namespace media 243 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698