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

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

Issue 2166713002: ImageCapture: replace Mojo String/Array with stl/wtf string/vector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: forgot media/.../mojo_bindings.gyp Created 4 years, 5 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/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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 437
438 void VideoCaptureDeviceMac::OnPhotoTaken(const uint8_t* image_data, 438 void VideoCaptureDeviceMac::OnPhotoTaken(const uint8_t* image_data,
439 size_t image_length, 439 size_t image_length,
440 const std::string& mime_type) { 440 const std::string& mime_type) {
441 DCHECK(photo_callback_); 441 DCHECK(photo_callback_);
442 if (!image_data || !image_length) { 442 if (!image_data || !image_length) {
443 OnPhotoError(); 443 OnPhotoError();
444 return; 444 return;
445 } 445 }
446 446
447 photo_callback_->Run(mojo::String::From(mime_type), 447 photo_callback_->Run(
448 mojo::Array<uint8_t>(std::vector<uint8_t>( 448 mime_type, std::vector<uint8_t>(image_data, image_data + image_length));
449 image_data, image_data + image_length)));
450 photo_callback_.reset(); 449 photo_callback_.reset();
451 } 450 }
452 451
453 void VideoCaptureDeviceMac::OnPhotoError() { 452 void VideoCaptureDeviceMac::OnPhotoError() {
454 DLOG(ERROR) << __FUNCTION__ << " error taking picture"; 453 DLOG(ERROR) << __FUNCTION__ << " error taking picture";
455 photo_callback_.reset(); 454 photo_callback_.reset();
456 } 455 }
457 456
458 void VideoCaptureDeviceMac::ReceiveError( 457 void VideoCaptureDeviceMac::ReceiveError(
459 const tracked_objects::Location& from_here, 458 const tracked_objects::Location& from_here,
(...skipping 21 matching lines...) Expand all
481 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() 480 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height()
482 width:capture_format_.frame_size.width() 481 width:capture_format_.frame_size.width()
483 frameRate:capture_format_.frame_rate]) { 482 frameRate:capture_format_.frame_rate]) {
484 ReceiveError(FROM_HERE, "Could not configure capture device."); 483 ReceiveError(FROM_HERE, "Could not configure capture device.");
485 return false; 484 return false;
486 } 485 }
487 return true; 486 return true;
488 } 487 }
489 488
490 } // namespace media 489 } // namespace media
OLDNEW
« no previous file with comments | « media/capture/video/fake_video_capture_device_unittest.cc ('k') | media/capture/video/video_capture_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698