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

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

Issue 2868393004: Image Capture: fill in PhotoCapabilities.{height,width} in Linux/CrOs/Mac (Closed)
Patch Set: reillyg@ comment Created 3 years, 7 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
« no previous file with comments | « media/capture/video/mac/video_capture_device_mac.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/capture/video/mac/video_capture_device_mac.h" 5 #include "media/capture/video/mac/video_capture_device_mac.h"
6 6
7 #include <IOKit/IOCFPlugIn.h> 7 #include <IOKit/IOCFPlugIn.h>
8 #include <IOKit/usb/IOUSBLib.h> 8 #include <IOKit/usb/IOUSBLib.h>
9 #include <IOKit/usb/USBSpec.h> 9 #include <IOKit/usb/USBSpec.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 DCHECK(task_runner_->BelongsToCurrentThread()); 377 DCHECK(task_runner_->BelongsToCurrentThread());
378 DCHECK(state_ == kCapturing) << state_; 378 DCHECK(state_ == kCapturing) << state_;
379 379
380 if (photo_callback_) // Only one picture can be in flight at a time. 380 if (photo_callback_) // Only one picture can be in flight at a time.
381 return; 381 return;
382 382
383 photo_callback_.reset(new TakePhotoCallback(std::move(callback))); 383 photo_callback_.reset(new TakePhotoCallback(std::move(callback)));
384 [capture_device_ takePhoto]; 384 [capture_device_ takePhoto];
385 } 385 }
386 386
387 void VideoCaptureDeviceMac::GetPhotoCapabilities(
388 GetPhotoCapabilitiesCallback callback) {
389 DCHECK(task_runner_->BelongsToCurrentThread());
390
391 auto photo_capabilities = mojom::PhotoCapabilities::New();
392
393 photo_capabilities->exposure_compensation = mojom::Range::New();
394 photo_capabilities->color_temperature = mojom::Range::New();
395 photo_capabilities->iso = mojom::Range::New();
396
397 photo_capabilities->brightness = mojom::Range::New();
398 photo_capabilities->contrast = mojom::Range::New();
399 photo_capabilities->saturation = mojom::Range::New();
400 photo_capabilities->sharpness = mojom::Range::New();
401
402 photo_capabilities->zoom = mojom::Range::New();
403
404 photo_capabilities->red_eye_reduction = mojom::RedEyeReduction::NEVER;
405 photo_capabilities->height = mojom::Range::New(
406 capture_format_.frame_size.height(), capture_format_.frame_size.height(),
407 capture_format_.frame_size.height(), 0 /* step */);
408 photo_capabilities->width = mojom::Range::New(
409 capture_format_.frame_size.width(), capture_format_.frame_size.width(),
410 capture_format_.frame_size.width(), 0 /* step */);
411 photo_capabilities->torch = false;
412
413 callback.Run(std::move(photo_capabilities));
414 }
415
387 bool VideoCaptureDeviceMac::Init(VideoCaptureApi capture_api_type) { 416 bool VideoCaptureDeviceMac::Init(VideoCaptureApi capture_api_type) {
388 DCHECK(task_runner_->BelongsToCurrentThread()); 417 DCHECK(task_runner_->BelongsToCurrentThread());
389 DCHECK_EQ(state_, kNotInitialized); 418 DCHECK_EQ(state_, kNotInitialized);
390 419
391 if (capture_api_type != VideoCaptureApi::MACOSX_AVFOUNDATION) 420 if (capture_api_type != VideoCaptureApi::MACOSX_AVFOUNDATION)
392 return false; 421 return false;
393 422
394 capture_device_.reset( 423 capture_device_.reset(
395 [[VideoCaptureDeviceAVFoundation alloc] initWithFrameReceiver:this]); 424 [[VideoCaptureDeviceAVFoundation alloc] initWithFrameReceiver:this]);
396 425
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() 518 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height()
490 width:capture_format_.frame_size.width() 519 width:capture_format_.frame_size.width()
491 frameRate:capture_format_.frame_rate]) { 520 frameRate:capture_format_.frame_rate]) {
492 ReceiveError(FROM_HERE, "Could not configure capture device."); 521 ReceiveError(FROM_HERE, "Could not configure capture device.");
493 return false; 522 return false;
494 } 523 }
495 return true; 524 return true;
496 } 525 }
497 526
498 } // namespace media 527 } // namespace media
OLDNEW
« no previous file with comments | « media/capture/video/mac/video_capture_device_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698