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

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

Issue 23693004: Change Mac Video Capture format change ARGB->YUY2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Corrected the CVPixelFormat to UYUV 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
« no previous file with comments | « media/video/capture/mac/video_capture_device_mac.mm ('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 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h" 5 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h"
6 6
7 #import <QTKit/QTKit.h> 7 #import <QTKit/QTKit.h>
8 8
9 #include "base/debug/crash_logging.h" 9 #include "base/debug/crash_logging.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 frameHeight_ = height; 164 frameHeight_ = height;
165 frameRate_ = frameRate; 165 frameRate_ = frameRate;
166 166
167 // Set up desired output properties. 167 // Set up desired output properties.
168 NSDictionary *captureDictionary = 168 NSDictionary *captureDictionary =
169 [NSDictionary dictionaryWithObjectsAndKeys: 169 [NSDictionary dictionaryWithObjectsAndKeys:
170 [NSNumber numberWithDouble:frameWidth_], 170 [NSNumber numberWithDouble:frameWidth_],
171 (id)kCVPixelBufferWidthKey, 171 (id)kCVPixelBufferWidthKey,
172 [NSNumber numberWithDouble:frameHeight_], 172 [NSNumber numberWithDouble:frameHeight_],
173 (id)kCVPixelBufferHeightKey, 173 (id)kCVPixelBufferHeightKey,
174 [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA], 174 [NSNumber numberWithUnsignedInt:kCVPixelFormatType_422YpCbCr8],
175 (id)kCVPixelBufferPixelFormatTypeKey, 175 (id)kCVPixelBufferPixelFormatTypeKey,
176 nil]; 176 nil];
177 [[[captureSession_ outputs] objectAtIndex:0] 177 [[[captureSession_ outputs] objectAtIndex:0]
178 setPixelBufferAttributes:captureDictionary]; 178 setPixelBufferAttributes:captureDictionary];
179 179
180 [[[captureSession_ outputs] objectAtIndex:0] 180 [[[captureSession_ outputs] objectAtIndex:0]
181 setMinimumVideoFrameInterval:(NSTimeInterval)1/(float)frameRate]; 181 setMinimumVideoFrameInterval:(NSTimeInterval)1/(float)frameRate];
182 return YES; 182 return YES;
183 } 183 }
184 184
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 expectedBytesPerRow); 259 expectedBytesPerRow);
260 } 260 }
261 261
262 addressToPass = adjustedAddress; 262 addressToPass = adjustedAddress;
263 frameSize = frameHeight * expectedBytesPerRow; 263 frameSize = frameHeight * expectedBytesPerRow;
264 } 264 }
265 media::VideoCaptureCapability captureCapability; 265 media::VideoCaptureCapability captureCapability;
266 captureCapability.width = frameWidth_; 266 captureCapability.width = frameWidth_;
267 captureCapability.height = frameHeight_; 267 captureCapability.height = frameHeight_;
268 captureCapability.frame_rate = frameRate_; 268 captureCapability.frame_rate = frameRate_;
269 captureCapability.color = media::PIXEL_FORMAT_ARGB; 269 captureCapability.color = media::PIXEL_FORMAT_UYVY;
270 captureCapability.expected_capture_delay = 0; 270 captureCapability.expected_capture_delay = 0;
271 captureCapability.interlaced = false; 271 captureCapability.interlaced = false;
272 272
273 // Deliver the captured video frame. 273 // Deliver the captured video frame.
274 frameReceiver_->ReceiveFrame(addressToPass, frameSize, captureCapability); 274 frameReceiver_->ReceiveFrame(addressToPass, frameSize, captureCapability);
275 275
276 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags); 276 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags);
277 } 277 }
278 [lock_ unlock]; 278 [lock_ unlock];
279 } 279 }
280 280
281 - (void)handleNotification:(NSNotification *)errorNotification { 281 - (void)handleNotification:(NSNotification *)errorNotification {
282 NSError * error = (NSError *)[[errorNotification userInfo] 282 NSError * error = (NSError *)[[errorNotification userInfo]
283 objectForKey:QTCaptureSessionErrorKey]; 283 objectForKey:QTCaptureSessionErrorKey];
284 frameReceiver_->ReceiveError([[error localizedDescription] UTF8String]); 284 frameReceiver_->ReceiveError([[error localizedDescription] UTF8String]);
285 } 285 }
286 286
287 @end 287 @end
OLDNEW
« no previous file with comments | « media/video/capture/mac/video_capture_device_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698