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

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

Issue 84393002: Revert 236927 "Reorganize media::VideoCapture* types" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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 | Annotate | Revision Log
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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 for (size_t y = 0; y < frameHeight; ++y) { 275 for (size_t y = 0; y < frameHeight; ++y) {
276 memcpy(adjustedAddress + y * expectedBytesPerRow, 276 memcpy(adjustedAddress + y * expectedBytesPerRow,
277 addressToPass + y * bytesPerRow, 277 addressToPass + y * bytesPerRow,
278 expectedBytesPerRow); 278 expectedBytesPerRow);
279 } 279 }
280 280
281 addressToPass = adjustedAddress; 281 addressToPass = adjustedAddress;
282 frameSize = frameHeight * expectedBytesPerRow; 282 frameSize = frameHeight * expectedBytesPerRow;
283 } 283 }
284 284 media::VideoCaptureCapability captureCapability;
285 media::VideoCaptureFormat captureFormat(gfx::Size(frameWidth, frameHeight), 285 captureCapability.width = frameWidth;
286 frameRate_, 286 captureCapability.height = frameHeight;
287 media::PIXEL_FORMAT_UYVY); 287 captureCapability.frame_rate = frameRate_;
288 captureCapability.color = media::PIXEL_FORMAT_UYVY;
288 289
289 // The aspect ratio dictionary is often missing, in which case we report 290 // The aspect ratio dictionary is often missing, in which case we report
290 // a pixel aspect ratio of 0:0. 291 // a pixel aspect ratio of 0:0.
291 int aspectNumerator = 0, aspectDenominator = 0; 292 int aspectNumerator = 0, aspectDenominator = 0;
292 CFDictionaryRef aspectRatioDict = (CFDictionaryRef)CVBufferGetAttachment( 293 CFDictionaryRef aspectRatioDict = (CFDictionaryRef)CVBufferGetAttachment(
293 videoFrame, kCVImageBufferPixelAspectRatioKey, NULL); 294 videoFrame, kCVImageBufferPixelAspectRatioKey, NULL);
294 if (aspectRatioDict) { 295 if (aspectRatioDict) {
295 CFNumberRef aspectNumeratorRef = (CFNumberRef)CFDictionaryGetValue( 296 CFNumberRef aspectNumeratorRef = (CFNumberRef)CFDictionaryGetValue(
296 aspectRatioDict, kCVImageBufferPixelAspectRatioHorizontalSpacingKey); 297 aspectRatioDict, kCVImageBufferPixelAspectRatioHorizontalSpacingKey);
297 CFNumberRef aspectDenominatorRef = (CFNumberRef)CFDictionaryGetValue( 298 CFNumberRef aspectDenominatorRef = (CFNumberRef)CFDictionaryGetValue(
298 aspectRatioDict, kCVImageBufferPixelAspectRatioVerticalSpacingKey); 299 aspectRatioDict, kCVImageBufferPixelAspectRatioVerticalSpacingKey);
299 DCHECK(aspectNumeratorRef && aspectDenominatorRef) << 300 DCHECK(aspectNumeratorRef && aspectDenominatorRef) <<
300 "Aspect Ratio dictionary missing its entries."; 301 "Aspect Ratio dictionary missing its entries.";
301 CFNumberGetValue(aspectNumeratorRef, kCFNumberIntType, &aspectNumerator); 302 CFNumberGetValue(aspectNumeratorRef, kCFNumberIntType, &aspectNumerator);
302 CFNumberGetValue( 303 CFNumberGetValue(
303 aspectDenominatorRef, kCFNumberIntType, &aspectDenominator); 304 aspectDenominatorRef, kCFNumberIntType, &aspectDenominator);
304 } 305 }
305 306
306 // Deliver the captured video frame. 307 // Deliver the captured video frame.
307 frameReceiver_->ReceiveFrame(addressToPass, frameSize, captureFormat, 308 frameReceiver_->ReceiveFrame(addressToPass, frameSize, captureCapability,
308 aspectNumerator, aspectDenominator); 309 aspectNumerator, aspectDenominator);
309 310
310 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags); 311 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags);
311 } 312 }
312 [lock_ unlock]; 313 [lock_ unlock];
313 } 314 }
314 315
315 - (void)handleNotification:(NSNotification*)errorNotification { 316 - (void)handleNotification:(NSNotification*)errorNotification {
316 NSError * error = (NSError*)[[errorNotification userInfo] 317 NSError * error = (NSError*)[[errorNotification userInfo]
317 objectForKey:QTCaptureSessionErrorKey]; 318 objectForKey:QTCaptureSessionErrorKey];
318 frameReceiver_->ReceiveError([[error localizedDescription] UTF8String]); 319 frameReceiver_->ReceiveError([[error localizedDescription] UTF8String]);
319 } 320 }
320 321
321 @end 322 @end
OLDNEW
« no previous file with comments | « trunk/src/media/video/capture/mac/video_capture_device_mac.mm ('k') | trunk/src/media/video/capture/video_capture_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698