Revert of Unify the macOS and iOS capturer implementations (patchset #4 id:60001 of https://codereview.webrtc.org/2309253005/ )

Reason for revert:
Breaks internal project

Original issue's description:
> Unify the macOS and iOS capturer implementations
>
> This removes the QTKit based capturer for mac, and removes the need
> to link against deprecated system libraries on macOS.
>
> BUG=webrtc:3968,webrtc:6275,webrtc:6333
>
> Committed: https://crrev.com/242d8bdddd77109781cbb70c59d161be7566ac98
> Cr-Commit-Position: refs/heads/master@{#14418}

TBR=magjed@webrtc.org,tkchin@webrtc.org,perkj@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:3968,webrtc:6275,webrtc:6333

Review-Url: https://codereview.webrtc.org/2381853002
Cr-Commit-Position: refs/heads/master@{#14429}
diff --git a/webrtc/modules/video_capture/BUILD.gn b/webrtc/modules/video_capture/BUILD.gn
index cd4d3c9..60573ba 100644
--- a/webrtc/modules/video_capture/BUILD.gn
+++ b/webrtc/modules/video_capture/BUILD.gn
@@ -60,7 +60,7 @@
 
 if (!build_with_chromium) {
   config("video_capture_internal_impl_config") {
-    if (is_ios || is_mac) {
+    if (is_ios) {
       libs = [
         "AVFoundation.framework",
         "CoreMedia.framework",
@@ -104,6 +104,30 @@
       ]
       deps += [ "../..:webrtc_common" ]
     }
+    if (is_mac) {
+      sources = [
+        "mac/qtkit/video_capture_qtkit.h",
+        "mac/qtkit/video_capture_qtkit.mm",
+        "mac/qtkit/video_capture_qtkit_info.h",
+        "mac/qtkit/video_capture_qtkit_info.mm",
+        "mac/qtkit/video_capture_qtkit_info_objc.h",
+        "mac/qtkit/video_capture_qtkit_info_objc.mm",
+        "mac/qtkit/video_capture_qtkit_objc.h",
+        "mac/qtkit/video_capture_qtkit_objc.mm",
+        "mac/qtkit/video_capture_qtkit_utility.h",
+        "mac/video_capture_mac.mm",
+      ]
+
+      libs = [
+        # For NSAlert in video_capture_qtkit_info_objc.mm.
+        "Cocoa.framework",
+
+        # For GetGestalt in video_capture_mac.mm.
+        "CoreServices.framework",
+        "CoreVideo.framework",
+        "QTKit.framework",
+      ]
+    }
     if (is_win) {
       sources = [
         "windows/device_info_ds.cc",
@@ -125,16 +149,16 @@
 
       deps += [ "//third_party/winsdk_samples" ]
     }
-    if (is_ios || is_mac) {
+    if (is_ios) {
       sources = [
-        "objc/device_info.h",
-        "objc/device_info.mm",
-        "objc/device_info_objc.h",
-        "objc/device_info_objc.mm",
-        "objc/rtc_video_capture_objc.h",
-        "objc/rtc_video_capture_objc.mm",
-        "objc/video_capture.h",
-        "objc/video_capture.mm",
+        "ios/device_info_ios.h",
+        "ios/device_info_ios.mm",
+        "ios/device_info_ios_objc.h",
+        "ios/device_info_ios_objc.mm",
+        "ios/rtc_video_capture_ios_objc.h",
+        "ios/rtc_video_capture_ios_objc.mm",
+        "ios/video_capture_ios.h",
+        "ios/video_capture_ios.mm",
       ]
 
       cflags = [
@@ -159,6 +183,7 @@
   if (!is_android && rtc_include_tests) {
     rtc_test("video_capture_tests") {
       sources = [
+        "test/video_capture_main_mac.mm",
         "test/video_capture_unittest.cc",
       ]
 
@@ -190,7 +215,11 @@
         "../utility",
         "//testing/gtest",
       ]
-      deps += [ "//webrtc/test:test_support_main" ]
+      if (is_mac) {
+        deps += [ "//webrtc/test:test_support_main_threaded_mac" ]
+      } else {
+        deps += [ "//webrtc/test:test_support_main" ]
+      }
 
       if (is_clang) {
         # Suppress warnings from Chrome's Clang plugins.
diff --git a/webrtc/modules/video_capture/objc/device_info.h b/webrtc/modules/video_capture/ios/device_info_ios.h
similarity index 91%
rename from webrtc/modules/video_capture/objc/device_info.h
rename to webrtc/modules/video_capture/ios/device_info_ios.h
index bec5c69..6af7c33 100644
--- a/webrtc/modules/video_capture/objc/device_info.h
+++ b/webrtc/modules/video_capture/ios/device_info_ios.h
@@ -8,13 +8,12 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_OBJC_DEVICE_INFO_H_
-#define WEBRTC_MODULES_VIDEO_CAPTURE_OBJC_DEVICE_INFO_H_
+#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_IOS_DEVICE_INFO_IOS_H_
+#define WEBRTC_MODULES_VIDEO_CAPTURE_IOS_DEVICE_INFO_IOS_H_
 
 #include "webrtc/modules/video_capture/device_info_impl.h"
 
 #include <map>
-#include <string>
 
 namespace webrtc {
 namespace videocapturemodule {
@@ -58,4 +57,4 @@
 }  // namespace videocapturemodule
 }  // namespace webrtc
 
-#endif  // WEBRTC_MODULES_VIDEO_CAPTURE_OBJC_DEVICE_INFO_H_
+#endif  // WEBRTC_MODULES_VIDEO_CAPTURE_IOS_DEVICE_INFO_IOS_H_
diff --git a/webrtc/modules/video_capture/objc/device_info.mm b/webrtc/modules/video_capture/ios/device_info_ios.mm
similarity index 81%
rename from webrtc/modules/video_capture/objc/device_info.mm
rename to webrtc/modules/video_capture/ios/device_info_ios.mm
index 2535f1c..307e5d3 100644
--- a/webrtc/modules/video_capture/objc/device_info.mm
+++ b/webrtc/modules/video_capture/ios/device_info_ios.mm
@@ -16,22 +16,26 @@
 
 #include <string>
 
-#include "webrtc/modules/video_capture/objc/device_info.h"
-#include "webrtc/modules/video_capture/objc/device_info_objc.h"
+#include "webrtc/modules/video_capture/ios/device_info_ios.h"
+#include "webrtc/modules/video_capture/ios/device_info_ios_objc.h"
 #include "webrtc/modules/video_capture/video_capture_impl.h"
 #include "webrtc/system_wrappers/include/trace.h"
 
 using namespace webrtc;
 using namespace videocapturemodule;
 
-static NSArray* camera_presets = @[
-  AVCaptureSessionPreset352x288, AVCaptureSessionPreset640x480,
-  AVCaptureSessionPreset1280x720
-];
+static NSArray *camera_presets = @[AVCaptureSessionPreset352x288,
+                                   AVCaptureSessionPreset640x480,
+                                   AVCaptureSessionPreset1280x720,
+                                   AVCaptureSessionPreset1920x1080];
 
-#define IOS_UNSUPPORTED()                                                 \
-  WEBRTC_TRACE(kTraceError, kTraceVideoCapture, _id,                      \
-               "%s is not supported on the iOS platform.", __FUNCTION__); \
+
+#define IOS_UNSUPPORTED()                                  \
+  WEBRTC_TRACE(kTraceError,                                \
+               kTraceVideoCapture,                         \
+               _id,                                        \
+               "%s is not supported on the iOS platform.", \
+               __FUNCTION__);                              \
   return -1;
 
 VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo(
@@ -52,10 +56,10 @@
   int deviceCount = [DeviceInfoIosObjC captureDeviceCount];
 
   for (int i = 0; i < deviceCount; i++) {
-    AVCaptureDevice* avDevice = [DeviceInfoIosObjC captureDeviceForIndex:i];
+    AVCaptureDevice *avDevice = [DeviceInfoIosObjC captureDeviceForIndex:i];
     VideoCaptureCapabilities capabilityVector;
 
-    for (NSString* preset in camera_presets) {
+    for (NSString *preset in camera_presets) {
       BOOL support = [avDevice supportsAVCaptureSessionPreset:preset];
       if (support) {
         VideoCaptureCapability capability =
@@ -69,8 +73,8 @@
     this->GetDeviceName(i, deviceNameUTF8, 256, deviceId, 256);
     std::string deviceIdCopy(deviceId);
     std::pair<std::string, VideoCaptureCapabilities> mapPair =
-        std::pair<std::string, VideoCaptureCapabilities>(deviceIdCopy,
-                                                         capabilityVector);
+        std::pair<std::string, VideoCaptureCapabilities>
+            (deviceIdCopy, capabilityVector);
     _capabilitiesMap.insert(mapPair);
   }
 
@@ -96,7 +100,9 @@
   strncpy(deviceNameUTF8, [deviceName UTF8String], deviceNameUTF8Length);
   deviceNameUTF8[deviceNameUTF8Length - 1] = '\0';
 
-  strncpy(deviceUniqueIdUTF8, deviceUniqueId.UTF8String, deviceUniqueIdUTF8Length);
+  strncpy(deviceUniqueIdUTF8,
+          [deviceUniqueId UTF8String],
+          deviceUniqueIdUTF8Length);
   deviceUniqueIdUTF8[deviceUniqueIdUTF8Length - 1] = '\0';
 
   if (productUniqueIdUTF8) {
diff --git a/webrtc/modules/video_capture/objc/device_info_objc.h b/webrtc/modules/video_capture/ios/device_info_ios_objc.h
similarity index 82%
rename from webrtc/modules/video_capture/objc/device_info_objc.h
rename to webrtc/modules/video_capture/ios/device_info_ios_objc.h
index b5db689..d67b559 100644
--- a/webrtc/modules/video_capture/objc/device_info_objc.h
+++ b/webrtc/modules/video_capture/ios/device_info_ios_objc.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_OBJC_DEVICE_INFO_OBJC_H_
-#define WEBRTC_MODULES_VIDEO_CAPTURE_OBJC_DEVICE_INFO_OBJC_H_
+#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_IOS_DEVICE_INFO_IOS_OBJC_H_
+#define WEBRTC_MODULES_VIDEO_CAPTURE_IOS_DEVICE_INFO_IOS_OBJC_H_
 
 #import <AVFoundation/AVFoundation.h>
 
@@ -26,4 +26,4 @@
 
 @end
 
-#endif  // WEBRTC_MODULES_VIDEO_CAPTURE_OBJC_DEVICE_INFO_OBJC_H_
+#endif  // WEBRTC_MODULES_VIDEO_CAPTURE_IOS_DEVICE_INFO_IOS_OBJC_H_
diff --git a/webrtc/modules/video_capture/objc/device_info_objc.mm b/webrtc/modules/video_capture/ios/device_info_ios_objc.mm
similarity index 86%
rename from webrtc/modules/video_capture/objc/device_info_objc.mm
rename to webrtc/modules/video_capture/ios/device_info_ios_objc.mm
index d46fa5c..818f862 100644
--- a/webrtc/modules/video_capture/objc/device_info_objc.mm
+++ b/webrtc/modules/video_capture/ios/device_info_ios_objc.mm
@@ -14,7 +14,7 @@
 
 #import <AVFoundation/AVFoundation.h>
 
-#import "webrtc/modules/video_capture/objc/device_info_objc.h"
+#import "webrtc/modules/video_capture/ios/device_info_ios_objc.h"
 #include "webrtc/modules/video_capture/video_capture_config.h"
 
 @implementation DeviceInfoIosObjC
@@ -83,6 +83,15 @@
     capability.rawType = webrtc::kVideoNV12;
     capability.codecType = webrtc::kVideoCodecUnknown;
     capability.interlaced = false;
+  } else if ([preset isEqualToString:AVCaptureSessionPreset1920x1080]) {
+    capability.width = 1920;
+    capability.height = 1080;
+    capability.maxFPS = 30;
+    capability.expectedCaptureDelay =
+        webrtc::videocapturemodule::kDefaultCaptureDelay;
+    capability.rawType = webrtc::kVideoNV12;
+    capability.codecType = webrtc::kVideoCodecUnknown;
+    capability.interlaced = false;
   }
 
   return capability;
diff --git a/webrtc/modules/video_capture/objc/rtc_video_capture_objc.h b/webrtc/modules/video_capture/ios/rtc_video_capture_ios_objc.h
similarity index 77%
rename from webrtc/modules/video_capture/objc/rtc_video_capture_objc.h
rename to webrtc/modules/video_capture/ios/rtc_video_capture_ios_objc.h
index e108ee1..2653958 100644
--- a/webrtc/modules/video_capture/objc/rtc_video_capture_objc.h
+++ b/webrtc/modules/video_capture/ios/rtc_video_capture_ios_objc.h
@@ -8,15 +8,13 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_OBJC_RTC_VIDEO_CAPTURE_OBJC_H_
-#define WEBRTC_MODULES_VIDEO_CAPTURE_OBJC_RTC_VIDEO_CAPTURE_OBJC_H_
+#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_IOS_VIDEO_CAPTURE_IOS_OBJC_H_
+#define WEBRTC_MODULES_VIDEO_CAPTURE_IOS_VIDEO_CAPTURE_IOS_OBJC_H_
 
 #import <Foundation/Foundation.h>
-#ifdef WEBRTC_IOS
 #import <UIKit/UIKit.h>
-#endif
 
-#include "webrtc/modules/video_capture/objc/video_capture.h"
+#include "webrtc/modules/video_capture/ios/video_capture_ios.h"
 
 // The following class listens to a notification with name:
 // 'StatusBarOrientationDidChange'.
@@ -34,8 +32,8 @@
           captureId:(int)captureId;
 - (BOOL)setCaptureDeviceByUniqueId:(NSString*)uniqueId;
 - (BOOL)startCaptureWithCapability:
-    (const webrtc::VideoCaptureCapability&)capability;
+        (const webrtc::VideoCaptureCapability&)capability;
 - (BOOL)stopCapture;
 
 @end
-#endif  // WEBRTC_MODULES_VIDEO_CAPTURE_OBJC_RTC_VIDEO_CAPTURE_OBJC_H_
+#endif  // WEBRTC_MODULES_VIDEO_CAPTURE_IOS_VIDEO_CAPTURE_IOS_OBJC_H_
diff --git a/webrtc/modules/video_capture/objc/rtc_video_capture_objc.mm b/webrtc/modules/video_capture/ios/rtc_video_capture_ios_objc.mm
similarity index 78%
rename from webrtc/modules/video_capture/objc/rtc_video_capture_objc.mm
rename to webrtc/modules/video_capture/ios/rtc_video_capture_ios_objc.mm
index 10671eb..e36c83b 100644
--- a/webrtc/modules/video_capture/objc/rtc_video_capture_objc.mm
+++ b/webrtc/modules/video_capture/ios/rtc_video_capture_ios_objc.mm
@@ -12,13 +12,10 @@
 #error "This file requires ARC support."
 #endif
 
-#import <AVFoundation/AVFoundation.h>
-#ifdef WEBRTC_IOS
 #import <UIKit/UIKit.h>
-#endif
 
-#import "webrtc/modules/video_capture/objc/device_info_objc.h"
-#import "webrtc/modules/video_capture/objc/rtc_video_capture_objc.h"
+#import "webrtc/modules/video_capture/ios/device_info_ios_objc.h"
+#import "webrtc/modules/video_capture/ios/rtc_video_capture_ios_objc.h"
 
 #include "webrtc/system_wrappers/include/trace.h"
 
@@ -47,8 +44,7 @@
     _owner = owner;
     _captureId = captureId;
     _captureSession = [[AVCaptureSession alloc] init];
-#if defined(__IPHONE_7_0) && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) \
-    && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_7_0
+#if defined(__IPHONE_7_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_7_0
     NSString* version = [[UIDevice currentDevice] systemVersion];
     if ([version integerValue] >= 7) {
       _captureSession.usesApplicationAudioSession = NO;
@@ -76,12 +72,15 @@
     if ([_captureSession canAddOutput:captureOutput]) {
       [_captureSession addOutput:captureOutput];
     } else {
-      WEBRTC_TRACE(kTraceError, kTraceVideoCapture, _captureId,
+      WEBRTC_TRACE(kTraceError,
+                   kTraceVideoCapture,
+                   _captureId,
                    "%s:%s:%d Could not add output to AVCaptureSession ",
-                   __FILE__, __FUNCTION__, __LINE__);
+                   __FILE__,
+                   __FUNCTION__,
+                   __LINE__);
     }
 
-#ifdef WEBRTC_IOS
     [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
 
     NSNotificationCenter* notify = [NSNotificationCenter defaultCenter];
@@ -93,7 +92,6 @@
                selector:@selector(deviceOrientationDidChange:)
                    name:UIDeviceOrientationDidChangeNotification
                  object:nil];
-#endif
   }
 
   return self;
@@ -146,7 +144,12 @@
     return NO;
   }
 
-  if ([_captureSession canSetSessionPreset:AVCaptureSessionPreset1280x720]) {
+  if ([_captureSession canSetSessionPreset:AVCaptureSessionPreset1920x1080]) {
+    if (capability.width > 1920 || capability.height > 1080) {
+      return NO;
+    }
+  } else if ([_captureSession
+                 canSetSessionPreset:AVCaptureSessionPreset1280x720]) {
     if (capability.width > 1280 || capability.height > 720) {
       return NO;
     }
@@ -174,10 +177,9 @@
 
   _orientationHasChanged = NO;
   _captureChanging = YES;
-  dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
-                 ^{
-                   [self startCaptureInBackgroundWithOutput:currentOutput];
-                 });
+  dispatch_async(
+      dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
+      ^(void) { [self startCaptureInBackgroundWithOutput:currentOutput]; });
   return YES;
 }
 
@@ -186,10 +188,13 @@
 }
 
 - (void)startCaptureInBackgroundWithOutput:
-    (AVCaptureVideoDataOutput*)currentOutput {
+            (AVCaptureVideoDataOutput*)currentOutput {
   NSString* captureQuality =
       [NSString stringWithString:AVCaptureSessionPresetLow];
-  if (_capability.width >= 1280 || _capability.height >= 720) {
+  if (_capability.width >= 1920 || _capability.height >= 1080) {
+    captureQuality =
+        [NSString stringWithString:AVCaptureSessionPreset1920x1080];
+  } else if (_capability.width >= 1280 || _capability.height >= 720) {
     captureQuality = [NSString stringWithString:AVCaptureSessionPreset1280x720];
   } else if (_capability.width >= 640 || _capability.height >= 480) {
     captureQuality = [NSString stringWithString:AVCaptureSessionPreset640x480];
@@ -203,6 +208,30 @@
   // picture resolution
   [_captureSession setSessionPreset:captureQuality];
 
+  // take care of capture framerate now
+  NSArray* sessionInputs = _captureSession.inputs;
+  AVCaptureDeviceInput* deviceInput = [sessionInputs count] > 0 ?
+      sessionInputs[0] : nil;
+  AVCaptureDevice* inputDevice = deviceInput.device;
+  if (inputDevice) {
+    AVCaptureDeviceFormat* activeFormat = inputDevice.activeFormat;
+    NSArray* supportedRanges = activeFormat.videoSupportedFrameRateRanges;
+    AVFrameRateRange* targetRange = [supportedRanges count] > 0 ?
+        supportedRanges[0] : nil;
+    // Find the largest supported framerate less than capability maxFPS.
+    for (AVFrameRateRange* range in supportedRanges) {
+      if (range.maxFrameRate <= _capability.maxFPS &&
+          targetRange.maxFrameRate <= range.maxFrameRate) {
+        targetRange = range;
+      }
+    }
+    if (targetRange && [inputDevice lockForConfiguration:NULL]) {
+      inputDevice.activeVideoMinFrameDuration = targetRange.minFrameDuration;
+      inputDevice.activeVideoMaxFrameDuration = targetRange.minFrameDuration;
+      [inputDevice unlockForConfiguration];
+    }
+  }
+
   _connection = [currentOutput connectionWithMediaType:AVMediaTypeVideo];
   [self setRelativeVideoOrientation];
 
@@ -217,47 +246,49 @@
   if (!_connection.supportsVideoOrientation) {
     return;
   }
-#ifndef WEBRTC_IOS
-  _connection.videoOrientation = AVCaptureVideoOrientationLandscapeRight;
-  return;
-#else
+
   switch ([UIDevice currentDevice].orientation) {
     case UIDeviceOrientationPortrait:
-      _connection.videoOrientation = AVCaptureVideoOrientationPortrait;
+      _connection.videoOrientation =
+          AVCaptureVideoOrientationPortrait;
       break;
     case UIDeviceOrientationPortraitUpsideDown:
       _connection.videoOrientation =
           AVCaptureVideoOrientationPortraitUpsideDown;
       break;
     case UIDeviceOrientationLandscapeLeft:
-      _connection.videoOrientation = AVCaptureVideoOrientationLandscapeRight;
+      _connection.videoOrientation =
+          AVCaptureVideoOrientationLandscapeRight;
       break;
     case UIDeviceOrientationLandscapeRight:
-      _connection.videoOrientation = AVCaptureVideoOrientationLandscapeLeft;
+      _connection.videoOrientation =
+          AVCaptureVideoOrientationLandscapeLeft;
       break;
     case UIDeviceOrientationFaceUp:
     case UIDeviceOrientationFaceDown:
     case UIDeviceOrientationUnknown:
       if (!_orientationHasChanged) {
-        _connection.videoOrientation = AVCaptureVideoOrientationPortrait;
+        _connection.videoOrientation =
+            AVCaptureVideoOrientationPortrait;
       }
       break;
   }
-#endif
 }
 
 - (void)onVideoError:(NSNotification*)notification {
   NSLog(@"onVideoError: %@", notification);
   // TODO(sjlee): make the specific error handling with this notification.
-  WEBRTC_TRACE(kTraceError, kTraceVideoCapture, _captureId,
-               "%s:%s:%d [AVCaptureSession startRunning] error.", __FILE__,
-               __FUNCTION__, __LINE__);
+  WEBRTC_TRACE(kTraceError,
+               kTraceVideoCapture,
+               _captureId,
+               "%s:%s:%d [AVCaptureSession startRunning] error.",
+               __FILE__,
+               __FUNCTION__,
+               __LINE__);
 }
 
 - (BOOL)stopCapture {
-#ifdef WEBRTC_IOS
   [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
-#endif
   _orientationHasChanged = NO;
   [self waitForCaptureChangeToFinish];
   [self directOutputToNil];
@@ -268,9 +299,7 @@
 
   _captureChanging = YES;
   dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
-                 ^(void) {
-                   [self stopCaptureInBackground];
-                 });
+                 ^(void) { [self stopCaptureInBackground]; });
   return YES;
 }
 
@@ -313,9 +342,14 @@
   if (!newCaptureInput) {
     const char* errorMessage = [[deviceError localizedDescription] UTF8String];
 
-    WEBRTC_TRACE(kTraceError, kTraceVideoCapture, _captureId,
-                 "%s:%s:%d deviceInputWithDevice error:%s", __FILE__,
-                 __FUNCTION__, __LINE__, errorMessage);
+    WEBRTC_TRACE(kTraceError,
+                 kTraceVideoCapture,
+                 _captureId,
+                 "%s:%s:%d deviceInputWithDevice error:%s",
+                 __FILE__,
+                 __FUNCTION__,
+                 __LINE__,
+                 errorMessage);
 
     return NO;
   }
diff --git a/webrtc/modules/video_capture/objc/video_capture.h b/webrtc/modules/video_capture/ios/video_capture_ios.h
similarity index 86%
rename from webrtc/modules/video_capture/objc/video_capture.h
rename to webrtc/modules/video_capture/ios/video_capture_ios.h
index 1f9f420..5172855 100644
--- a/webrtc/modules/video_capture/objc/video_capture.h
+++ b/webrtc/modules/video_capture/ios/video_capture_ios.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_OBJC_VIDEO_CAPTURE_H_
-#define WEBRTC_MODULES_VIDEO_CAPTURE_OBJC_VIDEO_CAPTURE_H_
+#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_IOS_VIDEO_CAPTURE_IOS_H_
+#define WEBRTC_MODULES_VIDEO_CAPTURE_IOS_VIDEO_CAPTURE_IOS_H_
 
 #include "webrtc/base/scoped_ref_ptr.h"
 #include "webrtc/modules/video_capture/video_capture_impl.h"
@@ -43,4 +43,4 @@
 }  // namespace videocapturemodule
 }  // namespace webrtc
 
-#endif  // WEBRTC_MODULES_VIDEO_CAPTURE_OBJC_VIDEO_CAPTURE_H_
+#endif  // WEBRTC_MODULES_VIDEO_CAPTURE_IOS_VIDEO_CAPTURE_IOS_H_
diff --git a/webrtc/modules/video_capture/objc/video_capture.mm b/webrtc/modules/video_capture/ios/video_capture_ios.mm
similarity index 86%
rename from webrtc/modules/video_capture/objc/video_capture.mm
rename to webrtc/modules/video_capture/ios/video_capture_ios.mm
index e73b47a..7a1f17b 100644
--- a/webrtc/modules/video_capture/objc/video_capture.mm
+++ b/webrtc/modules/video_capture/ios/video_capture_ios.mm
@@ -14,8 +14,8 @@
 
 #include "webrtc/base/refcount.h"
 #include "webrtc/base/scoped_ref_ptr.h"
-#include "webrtc/modules/video_capture/objc/device_info_objc.h"
-#include "webrtc/modules/video_capture/objc/rtc_video_capture_objc.h"
+#include "webrtc/modules/video_capture/ios/device_info_ios_objc.h"
+#include "webrtc/modules/video_capture/ios/rtc_video_capture_ios_objc.h"
 #include "webrtc/system_wrappers/include/trace.h"
 
 using namespace webrtc;
@@ -67,10 +67,9 @@
     return nullptr;
   }
 
-  if (![capture_module->capture_device_
-          setCaptureDeviceByUniqueId:
-              [[NSString alloc] initWithCString:deviceUniqueIdUTF8
-                                       encoding:NSUTF8StringEncoding]]) {
+  if (![capture_module->capture_device_ setCaptureDeviceByUniqueId:[
+              [NSString alloc] initWithCString:deviceUniqueIdUTF8
+                                      encoding:NSUTF8StringEncoding]]) {
     return nullptr;
   }
   return capture_module;
@@ -98,9 +97,7 @@
   return 0;
 }
 
-bool VideoCaptureIos::CaptureStarted() {
-  return is_capturing_;
-}
+bool VideoCaptureIos::CaptureStarted() { return is_capturing_; }
 
 int32_t VideoCaptureIos::CaptureSettings(VideoCaptureCapability& settings) {
   settings = capability_;
diff --git a/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit.h b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit.h
new file mode 100644
index 0000000..e3ddd9f
--- /dev/null
+++ b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit.h
@@ -0,0 +1,79 @@
+/*
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_QTKIT_VIDEO_CAPTURE_QTKIT_H_
+#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_QTKIT_VIDEO_CAPTURE_QTKIT_H_
+
+#import <QTKit/QTKit.h>
+#include <stdio.h>
+
+#include "webrtc/modules/video_capture/device_info_impl.h"
+#include "webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_utility.h"
+#include "webrtc/modules/video_capture/video_capture_impl.h"
+
+@class VideoCaptureMacQTKitObjC;
+@class VideoCaptureMacQTKitInfoObjC;
+
+namespace webrtc
+{
+namespace videocapturemodule
+{
+
+class VideoCaptureMacQTKit : public VideoCaptureImpl
+{
+public:
+    VideoCaptureMacQTKit(const int32_t id);
+    virtual ~VideoCaptureMacQTKit();
+
+    /*
+    *   Create a video capture module object
+    *
+    *   id - unique identifier of this video capture module object
+    *   deviceUniqueIdUTF8 -  name of the device. Available names can be found
+    *       by using GetDeviceName
+    *   deviceUniqueIdUTF8Length - length of deviceUniqueIdUTF8
+    */
+    static void Destroy(VideoCaptureModule* module);
+
+    int32_t Init(const int32_t id, const char* deviceUniqueIdUTF8);
+
+
+    // Start/Stop
+    virtual int32_t StartCapture(
+        const VideoCaptureCapability& capability);
+    virtual int32_t StopCapture();
+
+    // Properties of the set device
+
+    virtual bool CaptureStarted();
+
+    int32_t CaptureSettings(VideoCaptureCapability& settings);
+
+protected:
+    // Help functions
+    int32_t SetCameraOutput();
+
+private:
+    VideoCaptureMacQTKitObjC*        _captureDevice;
+    VideoCaptureMacQTKitInfoObjC*    _captureInfo;
+    bool                    _isCapturing;
+    int32_t            _id;
+    int32_t            _captureWidth;
+    int32_t            _captureHeight;
+    int32_t            _captureFrameRate;
+    char                     _currentDeviceNameUTF8[MAX_NAME_LENGTH];
+    char                     _currentDeviceUniqueIdUTF8[MAX_NAME_LENGTH];
+    char                     _currentDeviceProductUniqueIDUTF8[MAX_NAME_LENGTH];
+    int32_t            _frameCount;
+};
+}  // namespace videocapturemodule
+}  // namespace webrtc
+
+#endif  // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_QTKIT_VIDEO_CAPTURE_QTKIT_H_
diff --git a/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit.mm b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit.mm
new file mode 100644
index 0000000..ad057b4
--- /dev/null
+++ b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit.mm
@@ -0,0 +1,211 @@
+/*
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit.h"
+#import "webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info_objc.h"
+#import "webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.h"
+#include "webrtc/modules/video_capture/video_capture_config.h"
+#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
+#include "webrtc/system_wrappers/include/trace.h"
+
+namespace webrtc
+{
+
+namespace videocapturemodule
+{
+
+VideoCaptureMacQTKit::VideoCaptureMacQTKit(const int32_t id) :
+    VideoCaptureImpl(id),
+    _captureDevice(NULL),
+    _captureInfo(NULL),
+    _isCapturing(false),
+    _id(id),
+    _captureWidth(QTKIT_DEFAULT_WIDTH),
+    _captureHeight(QTKIT_DEFAULT_HEIGHT),
+    _captureFrameRate(QTKIT_DEFAULT_FRAME_RATE),
+    _frameCount(0)
+{
+
+    memset(_currentDeviceNameUTF8, 0, MAX_NAME_LENGTH);
+    memset(_currentDeviceUniqueIdUTF8, 0, MAX_NAME_LENGTH);
+    memset(_currentDeviceProductUniqueIDUTF8, 0, MAX_NAME_LENGTH);
+}
+
+VideoCaptureMacQTKit::~VideoCaptureMacQTKit()
+{
+
+    WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, _id,
+                 "~VideoCaptureMacQTKit() called");
+    if(_captureDevice)
+    {
+        [_captureDevice registerOwner:nil];
+        [_captureDevice stopCapture];
+        [_captureDevice release];
+    }
+
+    if(_captureInfo)
+    {
+        [_captureInfo release];
+    }
+}
+
+int32_t VideoCaptureMacQTKit::Init(
+    const int32_t id, const char* iDeviceUniqueIdUTF8)
+{
+    CriticalSectionScoped cs(&_apiCs);
+
+
+    const int32_t nameLength =
+        (int32_t) strlen((char*)iDeviceUniqueIdUTF8);
+    if(nameLength>kVideoCaptureUniqueNameLength)
+        return -1;
+
+    // Store the device name
+    _deviceUniqueId = new char[nameLength+1];
+    memcpy(_deviceUniqueId, iDeviceUniqueIdUTF8,nameLength+1);
+
+    _captureDevice = [[VideoCaptureMacQTKitObjC alloc] init];
+    if(NULL == _captureDevice)
+    {
+        WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, id,
+                     "Failed to create an instance of "
+                     "VideoCaptureMacQTKitObjC");
+        return -1;
+    }
+
+    [_captureDevice registerOwner:this];
+
+    if(0 == strcmp((char*)iDeviceUniqueIdUTF8, ""))
+    {
+        // the user doesn't want to set a capture device at this time
+        return 0;
+    }
+
+    _captureInfo = [[VideoCaptureMacQTKitInfoObjC alloc]init];
+    if(nil == _captureInfo)
+    {
+        WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, id,
+        "Failed to create an instance of VideoCaptureMacQTKitInfoObjC");
+        return -1;
+    }
+
+    int captureDeviceCount = [[_captureInfo getCaptureDeviceCount]intValue];
+    if(captureDeviceCount < 0)
+    {
+        WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, id,
+                     "No Capture Devices Present");
+        return -1;
+    }
+
+    const int NAME_LENGTH = 1024;
+    char deviceNameUTF8[1024] = "";
+    char deviceUniqueIdUTF8[1024] = "";
+    char deviceProductUniqueIDUTF8[1024] = "";
+
+    bool captureDeviceFound = false;
+    for(int index = 0; index < captureDeviceCount; index++){
+
+        memset(deviceNameUTF8, 0, NAME_LENGTH);
+        memset(deviceUniqueIdUTF8, 0, NAME_LENGTH);
+        memset(deviceProductUniqueIDUTF8, 0, NAME_LENGTH);
+        if(-1 == [[_captureInfo getDeviceNamesFromIndex:index
+                   DefaultName:deviceNameUTF8 WithLength:NAME_LENGTH
+                   AndUniqueID:deviceUniqueIdUTF8 WithLength:NAME_LENGTH
+                   AndProductID:deviceProductUniqueIDUTF8
+                   WithLength:NAME_LENGTH]intValue])
+        {
+            WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+                         "GetDeviceName returned -1 for index %d", index);
+            return -1;
+        }
+        if(0 == strcmp((const char*)iDeviceUniqueIdUTF8,
+                       (char*)deviceUniqueIdUTF8))
+        {
+            // we have a match
+            captureDeviceFound = true;
+            break;
+        }
+    }
+
+    if(false == captureDeviceFound)
+    {
+        WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id,
+                     "Failed to find capture device unique ID %s",
+                     iDeviceUniqueIdUTF8);
+        return -1;
+    }
+
+    // at this point we know that the user has passed in a valid camera. Let's
+    // set it as the current.
+    if(![_captureDevice setCaptureDeviceById:(char*)deviceUniqueIdUTF8])
+    {
+        strcpy((char*)_deviceUniqueId, (char*)deviceUniqueIdUTF8);
+        WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+                     "Failed to set capture device %s (unique ID %s) even "
+                     "though it was a valid return from "
+                     "VideoCaptureMacQTKitInfo", deviceNameUTF8,
+                     iDeviceUniqueIdUTF8);
+        return -1;
+    }
+
+    WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id,
+                 "successfully Init VideoCaptureMacQTKit" );
+    return 0;
+}
+
+int32_t VideoCaptureMacQTKit::StartCapture(
+    const VideoCaptureCapability& capability)
+{
+
+    _captureWidth = capability.width;
+    _captureHeight = capability.height;
+    _captureFrameRate = capability.maxFPS;
+    _captureDelay = 120;
+
+    [_captureDevice setCaptureHeight:_captureHeight
+                               width:_captureWidth
+                           frameRate:_captureFrameRate];
+
+    [_captureDevice startCapture];
+    _isCapturing = true;
+    return 0;
+}
+
+int32_t VideoCaptureMacQTKit::StopCapture()
+{
+    [_captureDevice stopCapture];
+    _isCapturing = false;
+    return 0;
+}
+
+bool VideoCaptureMacQTKit::CaptureStarted()
+{
+    return _isCapturing;
+}
+
+int32_t VideoCaptureMacQTKit::CaptureSettings(VideoCaptureCapability& settings)
+{
+    settings.width = _captureWidth;
+    settings.height = _captureHeight;
+    settings.maxFPS = _captureFrameRate;
+    return 0;
+}
+
+
+// ********** begin functions inherited from DeviceInfoImpl **********
+
+struct VideoCaptureCapabilityMacQTKit:public VideoCaptureCapability
+{
+    VideoCaptureCapabilityMacQTKit()
+    {
+    }
+};
+}  // namespace videocapturemodule
+}  // namespace webrtc
diff --git a/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info.h b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info.h
new file mode 100644
index 0000000..fd994ad
--- /dev/null
+++ b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info.h
@@ -0,0 +1,93 @@
+/*
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_QTKIT_VIDEO_CAPTURE_QTKIT_INFO_H_
+#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_QTKIT_VIDEO_CAPTURE_QTKIT_INFO_H_
+
+#include "webrtc/modules/video_capture/device_info_impl.h"
+#include "webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_utility.h"
+#include "webrtc/modules/video_capture/video_capture_impl.h"
+
+
+@class VideoCaptureMacQTKitInfoObjC;
+
+namespace webrtc
+{
+namespace videocapturemodule
+{
+
+class VideoCaptureMacQTKitInfo: public DeviceInfoImpl
+{
+public:
+
+   VideoCaptureMacQTKitInfo(const int32_t id);
+    virtual ~VideoCaptureMacQTKitInfo();
+
+    int32_t Init();
+
+    virtual uint32_t NumberOfDevices();
+
+    /*
+     * Returns the available capture devices.
+     * deviceNumber   -[in] index of capture device
+     * deviceNameUTF8 - friendly name of the capture device
+     * deviceUniqueIdUTF8 - unique name of the capture device if it exist.
+     *      Otherwise same as deviceNameUTF8
+     * productUniqueIdUTF8 - unique product id if it exist. Null terminated
+     *      otherwise.
+     */
+    virtual int32_t GetDeviceName(
+        uint32_t deviceNumber, char* deviceNameUTF8,
+        uint32_t deviceNameLength, char* deviceUniqueIdUTF8,
+        uint32_t deviceUniqueIdUTF8Length,
+        char* productUniqueIdUTF8 = 0,
+        uint32_t productUniqueIdUTF8Length = 0);
+
+    /*
+     *   Returns the number of capabilities for this device
+     */
+    virtual int32_t NumberOfCapabilities(
+        const char* deviceUniqueIdUTF8);
+
+    /*
+     *   Gets the capabilities of the named device
+     */
+    virtual int32_t GetCapability(
+        const char* deviceUniqueIdUTF8,
+        const uint32_t deviceCapabilityNumber,
+        VideoCaptureCapability& capability);
+
+    /*
+     *  Gets the capability that best matches the requested width, height and frame rate.
+     *  Returns the deviceCapabilityNumber on success.
+     */
+    virtual int32_t GetBestMatchedCapability(
+        const char* deviceUniqueIdUTF8,
+        const VideoCaptureCapability& requested,
+        VideoCaptureCapability& resulting);
+
+    /*
+     * Display OS /capture device specific settings dialog
+     */
+    virtual int32_t DisplayCaptureSettingsDialogBox(
+        const char* deviceUniqueIdUTF8,
+        const char* dialogTitleUTF8, void* parentWindow,
+        uint32_t positionX, uint32_t positionY);
+
+protected:
+    virtual int32_t CreateCapabilityMap(
+        const char* deviceUniqueIdUTF8);
+
+    VideoCaptureMacQTKitInfoObjC*    _captureInfo;
+};
+}  // namespace videocapturemodule
+}  // namespace webrtc
+
+#endif  // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_QTKIT_VIDEO_CAPTURE_QTKIT_INFO_H_
diff --git a/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info.mm b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info.mm
new file mode 100644
index 0000000..0c0c6a1
--- /dev/null
+++ b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info.mm
@@ -0,0 +1,125 @@
+/*
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#import "webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info_objc.h"
+#include "webrtc/modules/video_capture/video_capture.h"
+#include "webrtc/modules/video_capture/video_capture_config.h"
+#include "webrtc/system_wrappers/include/trace.h"
+
+namespace webrtc
+{
+namespace videocapturemodule
+{
+
+VideoCaptureMacQTKitInfo::VideoCaptureMacQTKitInfo(const int32_t id) :
+    DeviceInfoImpl(id)
+{
+    _captureInfo = [[VideoCaptureMacQTKitInfoObjC alloc] init];
+}
+
+VideoCaptureMacQTKitInfo::~VideoCaptureMacQTKitInfo()
+{
+    [_captureInfo release];
+
+}
+
+int32_t VideoCaptureMacQTKitInfo::Init()
+{
+
+    return 0;
+}
+
+uint32_t VideoCaptureMacQTKitInfo::NumberOfDevices()
+{
+
+    uint32_t captureDeviceCount =
+        [[_captureInfo getCaptureDeviceCount]intValue];
+    return captureDeviceCount;
+
+}
+
+int32_t VideoCaptureMacQTKitInfo::GetDeviceName(
+    uint32_t deviceNumber, char* deviceNameUTF8,
+    uint32_t deviceNameLength, char* deviceUniqueIdUTF8,
+    uint32_t deviceUniqueIdUTF8Length, char* productUniqueIdUTF8,
+    uint32_t productUniqueIdUTF8Length)
+{
+    int errNum = [[_captureInfo getDeviceNamesFromIndex:deviceNumber
+                   DefaultName:deviceNameUTF8 WithLength:deviceNameLength
+                   AndUniqueID:deviceUniqueIdUTF8
+                   WithLength:deviceUniqueIdUTF8Length
+                   AndProductID:productUniqueIdUTF8
+                   WithLength:productUniqueIdUTF8Length]intValue];
+    return errNum;
+}
+
+int32_t VideoCaptureMacQTKitInfo::NumberOfCapabilities(
+    const char* deviceUniqueIdUTF8)
+{
+    // Not implemented. Mac doesn't use discrete steps in capabilities, rather
+    // "analog". QTKit will do it's best to convert frames to what ever format
+    // you ask for.
+    WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+                 "NumberOfCapabilities is not supported on the Mac platform.");
+    return -1;
+}
+
+
+int32_t VideoCaptureMacQTKitInfo::GetCapability(
+    const char* deviceUniqueIdUTF8,
+    const uint32_t deviceCapabilityNumber,
+    VideoCaptureCapability& capability)
+{
+    // Not implemented. Mac doesn't use discrete steps in capabilities, rather
+    // "analog". QTKit will do it's best to convert frames to what ever format
+    // you ask for.
+    WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+                 "NumberOfCapabilities is not supported on the Mac platform.");
+    return -1;
+}
+
+
+int32_t VideoCaptureMacQTKitInfo::GetBestMatchedCapability(
+    const char*deviceUniqueIdUTF8,
+    const VideoCaptureCapability& requested, VideoCaptureCapability& resulting)
+{
+    // Not implemented. Mac doesn't use discrete steps in capabilities, rather
+    // "analog". QTKit will do it's best to convert frames to what ever format
+    // you ask for.
+    WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id,
+                 "NumberOfCapabilities is not supported on the Mac platform.");
+    return -1;
+}
+
+int32_t VideoCaptureMacQTKitInfo::DisplayCaptureSettingsDialogBox(
+    const char* deviceUniqueIdUTF8,
+    const char* dialogTitleUTF8, void* parentWindow,
+    uint32_t positionX, uint32_t positionY)
+{
+
+    return [[_captureInfo
+             displayCaptureSettingsDialogBoxWithDevice:deviceUniqueIdUTF8
+             AndTitle:dialogTitleUTF8
+             AndParentWindow:parentWindow AtX:positionX AndY:positionY]
+             intValue];
+}
+
+int32_t VideoCaptureMacQTKitInfo::CreateCapabilityMap(
+    const char* deviceUniqueIdUTF8)
+{
+    // Not implemented. Mac doesn't use discrete steps in capabilities, rather
+    // "analog". QTKit will do it's best to convert frames to what ever format
+    // you ask for.
+    WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id,
+                 "NumberOfCapabilities is not supported on the Mac platform.");
+     return -1;
+}
+}  // namespace videocapturemodule
+}  // namespace webrtc
diff --git a/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info_objc.h b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info_objc.h
new file mode 100644
index 0000000..c03aa93
--- /dev/null
+++ b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info_objc.h
@@ -0,0 +1,67 @@
+/*
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+//
+//  video_capture_qtkit_info_objc.h
+//
+//
+
+#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_QTKIT_VIDEO_CAPTURE_QTKIT_INFO_OBJC_H_
+#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_QTKIT_VIDEO_CAPTURE_QTKIT_INFO_OBJC_H_
+
+#import <Foundation/Foundation.h>
+#import <QTKit/QTKit.h>
+
+#include "webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info.h"
+#include "webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_utility.h"
+
+@interface VideoCaptureMacQTKitInfoObjC : NSObject{
+    bool                                _OSSupportedInfo;
+    NSArray*                            _captureDevicesInfo;
+    NSAutoreleasePool*                    _poolInfo;
+    int                                    _captureDeviceCountInfo;
+
+}
+
+/**************************************************************************
+ *
+ *   The following functions are considered to be private
+ *
+ ***************************************************************************/
+
+- (NSNumber*)getCaptureDevices;
+- (NSNumber*)initializeVariables;
+- (void)checkOSSupported;
+
+
+/**************************************************************************
+ *
+ *   The following functions are considered to be public and called by VideoCaptureMacQTKitInfo class
+ *
+ ***************************************************************************/
+
+- (NSNumber*)getCaptureDeviceCount;
+
+- (NSNumber*)getDeviceNamesFromIndex:(uint32_t)index
+    DefaultName:(char*)deviceName
+    WithLength:(uint32_t)deviceNameLength
+    AndUniqueID:(char*)deviceUniqueID
+    WithLength:(uint32_t)deviceUniqueIDLength
+    AndProductID:(char*)deviceProductID
+    WithLength:(uint32_t)deviceProductIDLength;
+
+- (NSNumber*)displayCaptureSettingsDialogBoxWithDevice:
+        (const char*)deviceUniqueIdUTF8
+    AndTitle:(const char*)dialogTitleUTF8
+    AndParentWindow:(void*) parentWindow AtX:(uint32_t)positionX
+    AndY:(uint32_t) positionY;
+@end
+
+#endif  // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_QTKIT_VIDEO_CAPTURE_QTKIT_INFO_OBJC_H_
diff --git a/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info_objc.mm b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info_objc.mm
new file mode 100644
index 0000000..d3f2188
--- /dev/null
+++ b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info_objc.mm
@@ -0,0 +1,191 @@
+/*
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#pragma mark **** imports/includes
+
+#import "webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info_objc.h"
+
+#include "webrtc/system_wrappers/include/trace.h"
+
+using namespace webrtc;
+
+#pragma mark **** hidden class interface
+
+@implementation VideoCaptureMacQTKitInfoObjC
+
+// ****************** over-written OS methods ***********************
+#pragma mark **** over-written OS methods
+
+/// ***** Objective-C. Similar to C++ constructor, although invoked manually
+/// ***** Potentially returns an instance of self
+-(id)init{
+    self = [super init];
+    if(nil != self){
+        [self checkOSSupported];
+        [self initializeVariables];
+    }
+    else
+    {
+        return nil;
+    }
+    return self;
+}
+
+/// ***** Objective-C. Similar to C++ destructor
+/// ***** Returns nothing
+- (void)dealloc {
+
+    [_captureDevicesInfo release];
+
+    [super dealloc];
+}
+
+// ****************** public methods ******************
+#pragma mark **** public method implementations
+
+/// ***** Creates a message box with Cocoa framework
+/// ***** Returns 0 on success, -1 otherwise.
+- (NSNumber*)displayCaptureSettingsDialogBoxWithDevice:(const char*)deviceUniqueIdUTF8
+                    AndTitle:(const char*)dialogTitleUTF8
+                    AndParentWindow:(void*) parentWindow
+                    AtX:(uint32_t)positionX
+                    AndY:(uint32_t) positionY
+{
+    NSString* strTitle = [NSString stringWithFormat:@"%s", dialogTitleUTF8];
+    NSString* strButton = @"Alright";
+    NSAlert* alert = [NSAlert alertWithMessageText:strTitle
+                      defaultButton:strButton
+                      alternateButton:nil otherButton:nil
+                      informativeTextWithFormat:@"Device %s is capturing", deviceUniqueIdUTF8];
+    [alert setAlertStyle:NSInformationalAlertStyle];
+    [alert runModal];
+    return [NSNumber numberWithInt:0];
+}
+
+- (NSNumber*)getCaptureDeviceCount{
+    [self getCaptureDevices];
+    return [NSNumber numberWithInt:_captureDeviceCountInfo];
+}
+
+
+- (NSNumber*)getDeviceNamesFromIndex:(uint32_t)index
+    DefaultName:(char*)deviceName
+    WithLength:(uint32_t)deviceNameLength
+    AndUniqueID:(char*)deviceUniqueID
+    WithLength:(uint32_t)deviceUniqueIDLength
+    AndProductID:(char*)deviceProductID
+    WithLength:(uint32_t)deviceProductIDLength
+{
+    if(NO == _OSSupportedInfo)
+    {
+        return [NSNumber numberWithInt:0];
+    }
+
+    if(index >= (uint32_t)_captureDeviceCountInfo)
+    {
+        return [NSNumber numberWithInt:-1];
+    }
+
+    QTCaptureDevice* tempCaptureDevice =
+        (QTCaptureDevice*)[_captureDevicesInfo objectAtIndex:index];
+    if(!tempCaptureDevice)
+    {
+        return [NSNumber numberWithInt:-1];
+    }
+
+    memset(deviceName, 0, deviceNameLength);
+    memset(deviceUniqueID, 0, deviceUniqueIDLength);
+
+    bool successful = NO;
+
+    NSString* tempString = [tempCaptureDevice localizedDisplayName];
+    successful = [tempString getCString:(char*)deviceName
+                  maxLength:deviceNameLength encoding:NSUTF8StringEncoding];
+    if(NO == successful)
+    {
+        memset(deviceName, 0, deviceNameLength);
+        return [NSNumber numberWithInt:-1];
+    }
+
+    tempString = [tempCaptureDevice uniqueID];
+    successful = [tempString getCString:(char*)deviceUniqueID
+                  maxLength:deviceUniqueIDLength encoding:NSUTF8StringEncoding];
+    if(NO == successful)
+    {
+        memset(deviceUniqueID, 0, deviceNameLength);
+        return [NSNumber numberWithInt:-1];
+    }
+
+    return [NSNumber numberWithInt:0];
+
+}
+
+// ****************** "private" category functions below here  ******************
+#pragma mark **** "private" method implementations
+
+- (NSNumber*)initializeVariables
+{
+    if(NO == _OSSupportedInfo)
+    {
+        return [NSNumber numberWithInt:0];
+    }
+
+    _poolInfo = [[NSAutoreleasePool alloc]init];
+    _captureDeviceCountInfo = 0;
+    [self getCaptureDevices];
+
+    return [NSNumber numberWithInt:0];
+}
+
+// ***** Checks to see if the QTCaptureSession framework is available in the OS
+// ***** If it is not, isOSSupprted = NO
+// ***** Throughout the rest of the class isOSSupprted is checked and functions
+// ***** are/aren't called depending
+// ***** The user can use weak linking to the QTKit framework and run on older
+// ***** versions of the OS
+// ***** I.E. Backwards compaitibility
+// ***** Returns nothing. Sets member variable
+- (void)checkOSSupported
+{
+    Class osSupportedTest = NSClassFromString(@"QTCaptureSession");
+    if(nil == osSupportedTest)
+    {
+      _OSSupportedInfo = NO;
+    }
+    else
+    {
+      _OSSupportedInfo = YES;
+    }
+}
+
+/// ***** Retrieves the number of capture devices currently available
+/// ***** Stores them in an NSArray instance
+/// ***** Returns 0 on success, -1 otherwise.
+- (NSNumber*)getCaptureDevices
+{
+    if(NO == _OSSupportedInfo)
+    {
+        return [NSNumber numberWithInt:0];
+    }
+
+    if(_captureDevicesInfo)
+    {
+        [_captureDevicesInfo release];
+    }
+    _captureDevicesInfo = [[NSArray alloc]
+                            initWithArray:[QTCaptureDevice
+                                           inputDevicesWithMediaType:QTMediaTypeVideo]];
+
+    _captureDeviceCountInfo = _captureDevicesInfo.count;
+
+    return [NSNumber numberWithInt:0];
+}
+
+@end
diff --git a/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.h b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.h
new file mode 100644
index 0000000..5007600
--- /dev/null
+++ b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.h
@@ -0,0 +1,61 @@
+/*
+ *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+//
+//  video_capture_qtkit_objc.h
+//
+//
+
+#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_QTKIT_VIDEO_CAPTURE_QTKIT_OBJC_H_
+#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_QTKIT_VIDEO_CAPTURE_QTKIT_OBJC_H_
+
+#import <AppKit/AppKit.h>
+#import <CoreData/CoreData.h>
+#import <CoreFoundation/CoreFoundation.h>
+#import <CoreVideo/CoreVideo.h>
+#import <Foundation/Foundation.h>
+#import <QTKit/QTKit.h>
+
+#include "webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit.h"
+
+@interface VideoCaptureMacQTKitObjC : NSObject {
+  bool _capturing;
+  int _frameRate;
+  int _frameWidth;
+  int _frameHeight;
+  int _framesDelivered;
+  int _framesRendered;
+  bool _captureInitialized;
+
+  webrtc::videocapturemodule::VideoCaptureMacQTKit* _owner;
+  NSLock* _lock;
+
+  QTCaptureSession* _captureSession;
+  QTCaptureDeviceInput* _captureVideoDeviceInput;
+  QTCaptureDecompressedVideoOutput* _captureDecompressedVideoOutput;
+  NSArray* _captureDevices;
+  int _captureDeviceCount;
+  char _captureDeviceNameUTF8[1024];
+  char _captureDeviceNameUniqueID[1024];
+}
+
+- (void)getCaptureDevices;
+- (BOOL)initializeVideoCapture;
+- (BOOL)initializeVariables;
+
+- (void)registerOwner:(webrtc::videocapturemodule::VideoCaptureMacQTKit*)owner;
+- (BOOL)setCaptureDeviceById:(char*)uniqueId;
+- (void)setCaptureHeight:(int)height width:(int)width frameRate:(int)frameRate;
+- (void)startCapture;
+- (void)stopCapture;
+
+@end
+
+#endif  // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_QTKIT_VIDEO_CAPTURE_QTKIT_OBJC_H_
diff --git a/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.mm b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.mm
new file mode 100644
index 0000000..53e9db7
--- /dev/null
+++ b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.mm
@@ -0,0 +1,259 @@
+/*
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#define DEFAULT_CAPTURE_DEVICE_INDEX    1
+#define DEFAULT_FRAME_RATE              30
+#define DEFAULT_FRAME_WIDTH             352
+#define DEFAULT_FRAME_HEIGHT            288
+#define ROTATE_CAPTURED_FRAME           1
+#define LOW_QUALITY                     1
+
+#import "webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.h"
+
+#include "webrtc/system_wrappers/include/trace.h"
+
+using namespace webrtc;
+using namespace videocapturemodule;
+
+@implementation VideoCaptureMacQTKitObjC
+
+-(id)init {
+  self = [super init];
+  if (self) {
+    [self initializeVariables];
+  }
+  return self;
+}
+
+- (void)dealloc {
+  if (_captureSession)
+    [_captureSession stopRunning];
+
+  if (_captureVideoDeviceInput) {
+    if ([[_captureVideoDeviceInput device] isOpen])
+      [[_captureVideoDeviceInput device] close];
+
+    [_captureVideoDeviceInput release];
+  }
+
+  [_captureDecompressedVideoOutput release];
+  [_captureSession release];
+  [_captureDevices release];
+  [_lock release];
+
+  [super dealloc];
+}
+
+#pragma mark Public methods
+
+- (void)registerOwner:(VideoCaptureMacQTKit*)owner {
+  [_lock lock];
+  _owner = owner;
+  [_lock unlock];
+}
+
+- (BOOL)setCaptureDeviceById:(char*)uniqueId {
+  if (uniqueId == nil || !strcmp("", uniqueId)) {
+    WEBRTC_TRACE(kTraceInfo, kTraceVideoCapture, 0,
+                 "Incorrect capture id argument");
+    return NO;
+  }
+
+  if (!strcmp(uniqueId, _captureDeviceNameUniqueID))
+    return YES;
+
+  QTCaptureDevice* captureDevice;
+  for(int index = 0; index < _captureDeviceCount; index++) {
+    captureDevice = (QTCaptureDevice*)[_captureDevices objectAtIndex:index];
+    char captureDeviceId[1024] = "";
+    [[captureDevice uniqueID] getCString:captureDeviceId
+                               maxLength:1024
+                                encoding:NSUTF8StringEncoding];
+    if (strcmp(uniqueId, captureDeviceId) == 0) {
+      WEBRTC_TRACE(kTraceInfo, kTraceVideoCapture, 0,
+                   "%s:%d Found capture device id %s as index %d",
+                   __FUNCTION__, __LINE__, captureDeviceId, index);
+      [[captureDevice localizedDisplayName] getCString:_captureDeviceNameUTF8
+                                             maxLength:1024
+                                              encoding:NSUTF8StringEncoding];
+      [[captureDevice uniqueID] getCString:_captureDeviceNameUniqueID
+                                 maxLength:1024
+                                  encoding:NSUTF8StringEncoding];
+      break;
+    }
+    captureDevice = nil;
+  }
+
+  if (!captureDevice)
+    return NO;
+
+  NSError* error;
+  if (![captureDevice open:&error]) {
+    WEBRTC_TRACE(kTraceError, kTraceVideoCapture, 0,
+                 "Failed to open capture device: %s", _captureDeviceNameUTF8);
+    return NO;
+  }
+
+  if (_captureVideoDeviceInput) {
+    [_captureVideoDeviceInput release];
+  }
+  _captureVideoDeviceInput =
+      [[QTCaptureDeviceInput alloc] initWithDevice:captureDevice];
+
+  if (![_captureSession addInput:_captureVideoDeviceInput error:&error]) {
+    WEBRTC_TRACE(kTraceError, kTraceVideoCapture, 0,
+                 "Failed to add input from %s to the capture session",
+                 _captureDeviceNameUTF8);
+    return NO;
+  }
+
+  WEBRTC_TRACE(kTraceInfo, kTraceVideoCapture, 0,
+               "%s:%d successfully added capture device: %s", __FUNCTION__,
+               __LINE__, _captureDeviceNameUTF8);
+  return YES;
+}
+
+- (void)setCaptureHeight:(int)height width:(int)width frameRate:(int)frameRate {
+  _frameWidth = width;
+  _frameHeight = height;
+  _frameRate = frameRate;
+
+  NSDictionary* captureDictionary =
+      [NSDictionary dictionaryWithObjectsAndKeys:
+          [NSNumber numberWithDouble:_frameWidth],
+          (id)kCVPixelBufferWidthKey,
+          [NSNumber numberWithDouble:_frameHeight],
+          (id)kCVPixelBufferHeightKey,
+          [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32ARGB],
+          (id)kCVPixelBufferPixelFormatTypeKey,
+          nil];
+  [_captureDecompressedVideoOutput
+      performSelectorOnMainThread:@selector(setPixelBufferAttributes:)
+                       withObject:captureDictionary
+                    waitUntilDone:YES];
+}
+
+- (void)startCapture {
+  if (_capturing)
+    return;
+
+  [_captureSession startRunning];
+  _capturing = YES;
+}
+
+- (void)stopCapture {
+  if (!_capturing)
+    return;
+
+  [_captureSession stopRunning];
+  _capturing = NO;
+}
+
+#pragma mark Private methods
+
+- (BOOL)initializeVariables {
+  if (NSClassFromString(@"QTCaptureSession") == nil)
+    return NO;
+
+  memset(_captureDeviceNameUTF8, 0, 1024);
+  _framesDelivered = 0;
+  _framesRendered = 0;
+  _captureDeviceCount = 0;
+  _capturing = NO;
+  _captureInitialized = NO;
+  _frameRate = DEFAULT_FRAME_RATE;
+  _frameWidth = DEFAULT_FRAME_WIDTH;
+  _frameHeight = DEFAULT_FRAME_HEIGHT;
+  _lock = [[NSLock alloc] init];
+  _captureSession = [[QTCaptureSession alloc] init];
+  _captureDecompressedVideoOutput =
+      [[QTCaptureDecompressedVideoOutput alloc] init];
+  [_captureDecompressedVideoOutput setDelegate:self];
+
+  [self getCaptureDevices];
+  if (![self initializeVideoCapture])
+    return NO;
+
+  return NO;
+}
+
+- (void)getCaptureDevices {
+  if (_captureDevices)
+    [_captureDevices release];
+
+  _captureDevices = [[NSArray alloc] initWithArray:
+      [QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo]];
+
+  _captureDeviceCount = _captureDevices.count;
+}
+
+- (BOOL)initializeVideoCapture{
+  NSDictionary *captureDictionary =
+      [NSDictionary dictionaryWithObjectsAndKeys:
+          [NSNumber numberWithDouble:_frameWidth],
+          (id)kCVPixelBufferWidthKey,
+          [NSNumber numberWithDouble:_frameHeight],
+          (id)kCVPixelBufferHeightKey,
+          [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32ARGB],
+          (id)kCVPixelBufferPixelFormatTypeKey,
+          nil];
+
+  [_captureDecompressedVideoOutput setPixelBufferAttributes:captureDictionary];
+  [_captureDecompressedVideoOutput setAutomaticallyDropsLateVideoFrames:YES];
+  [_captureDecompressedVideoOutput
+      setMinimumVideoFrameInterval:(NSTimeInterval)1/(float)_frameRate];
+
+  NSError *error;
+  if (![_captureSession addOutput:_captureDecompressedVideoOutput error:&error])
+    return NO;
+
+  return YES;
+}
+
+- (void)captureOutput:(QTCaptureOutput *)captureOutput
+    didDropVideoFrameWithSampleBuffer:(QTSampleBuffer *)sampleBuffer
+                       fromConnection:(QTCaptureConnection *)connection {
+}
+
+- (void)captureOutput:(QTCaptureOutput *)captureOutput
+  didOutputVideoFrame:(CVImageBufferRef)videoFrame
+     withSampleBuffer:(QTSampleBuffer *)sampleBuffer
+       fromConnection:(QTCaptureConnection *)connection {
+
+  [_lock lock];
+  if (!_owner) {
+    [_lock unlock];
+    return;
+  }
+
+  const int kFlags = 0;
+  if (CVPixelBufferLockBaseAddress(videoFrame, kFlags) == kCVReturnSuccess) {
+    void *baseAddress = CVPixelBufferGetBaseAddress(videoFrame);
+    size_t bytesPerRow = CVPixelBufferGetBytesPerRow(videoFrame);
+    size_t frameHeight = CVPixelBufferGetHeight(videoFrame);
+    size_t frameSize = bytesPerRow * frameHeight;
+
+    VideoCaptureCapability tempCaptureCapability;
+    tempCaptureCapability.width = _frameWidth;
+    tempCaptureCapability.height = _frameHeight;
+    tempCaptureCapability.maxFPS = _frameRate;
+    // TODO(wu) : Update actual type and not hard-coded value.
+    tempCaptureCapability.rawType = kVideoBGRA;
+
+    _owner->IncomingFrame((unsigned char*)baseAddress, frameSize,
+                          tempCaptureCapability, 0);
+    CVPixelBufferUnlockBaseAddress(videoFrame, kFlags);
+  }
+  [_lock unlock];
+  _framesDelivered++;
+  _framesRendered++;
+}
+
+@end
diff --git a/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_utility.h b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_utility.h
new file mode 100644
index 0000000..5ef0b96
--- /dev/null
+++ b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_utility.h
@@ -0,0 +1,36 @@
+/*
+ *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+/*
+ *  video_capture_qtkit_utility.h
+ *
+ */
+
+
+#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_QTKIT_VIDEO_CAPTURE_QTKIT_UTILITY_H_
+#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_QTKIT_VIDEO_CAPTURE_QTKIT_UTILITY_H_
+
+#define MAX_NAME_LENGTH                1024
+
+#define QTKIT_MIN_WIDTH                0
+#define QTKIT_MAX_WIDTH                2560
+#define QTKIT_DEFAULT_WIDTH            352
+
+#define QTKIT_MIN_HEIGHT            0
+#define QTKIT_MAX_HEIGHT            1440
+#define QTKIT_DEFAULT_HEIGHT        288
+
+#define QTKIT_MIN_FRAME_RATE        1
+#define QTKIT_MAX_FRAME_RATE        60
+#define QTKIT_DEFAULT_FRAME_RATE    30
+
+#define RELEASE_AND_CLEAR(p)        if (p) { (p) -> Release () ; (p) = NULL ; }
+
+#endif  // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_QTKIT_VIDEO_CAPTURE_QTKIT_UTILITY_H_
diff --git a/webrtc/modules/video_capture/mac/video_capture_mac.mm b/webrtc/modules/video_capture/mac/video_capture_mac.mm
new file mode 100644
index 0000000..08b2aeb
--- /dev/null
+++ b/webrtc/modules/video_capture/mac/video_capture_mac.mm
@@ -0,0 +1,252 @@
+/*
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+/*
+ *  video_capture_mac.cc
+ *
+ */
+
+#include <QuickTime/QuickTime.h>
+
+#include "webrtc/base/refcount.h"
+#include "webrtc/base/scoped_ref_ptr.h"
+#include "webrtc/modules/video_capture/device_info_impl.h"
+#include "webrtc/modules/video_capture/video_capture_config.h"
+#include "webrtc/modules/video_capture/video_capture_impl.h"
+#include "webrtc/system_wrappers/include/trace.h"
+
+// 10.4 support must be decided runtime. We will just decide which framework to
+// use at compile time "work" classes. One for QTKit, one for QuickTime
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
+#include <QuickTime/video_capture_quick_time.h>
+#include <QuickTime/video_capture_quick_time_info.h>
+#else
+#include "webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit.h"
+#include "webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info.h"
+#endif
+
+namespace webrtc
+{
+namespace videocapturemodule
+{
+
+// static
+bool CheckOSVersion()
+{
+    // Check OSX version
+    OSErr err = noErr;
+
+    SInt32 version;
+
+    err = Gestalt(gestaltSystemVersion, &version);
+    if (err != noErr)
+    {
+        WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
+                     "Could not get OS version");
+        return false;
+    }
+
+    if (version < 0x00001040) // Older version than Mac OSX 10.4
+    {
+        WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
+                     "OS version too old: 0x%x", version);
+        return false;
+    }
+
+    WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, 0,
+                 "OS version compatible: 0x%x", version);
+
+    return true;
+}
+
+// static
+bool CheckQTVersion()
+{
+    // Check OSX version
+    OSErr err = noErr;
+
+    SInt32 version;
+
+    err = Gestalt(gestaltQuickTime, &version);
+    if (err != noErr)
+    {
+        WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
+                     "Could not get QuickTime version");
+        return false;
+    }
+
+    if (version < 0x07000000) // QT v. 7.x or newer (QT 5.0.2 0x05020000)
+    {
+        WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
+                     "QuickTime version too old: 0x%x", version);
+        return false;
+    }
+
+    WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, 0,
+                 "QuickTime version compatible: 0x%x", version);
+    return true;
+}
+
+/**************************************************************************
+ *
+ *    Create/Destroy a VideoCaptureModule
+ *
+ ***************************************************************************/
+
+/*
+ *   Returns version of the module and its components
+ *
+ *   version                 - buffer to which the version will be written
+ *   remainingBufferInBytes  - remaining number of int8_t in the version
+ *                             buffer
+ *   position                - position of the next empty int8_t in the
+ *                             version buffer
+ */
+
+rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(
+    const int32_t id,
+    const char* deviceUniqueIdUTF8) {
+    if (!CheckOSVersion()) {
+        WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, id,
+                     "OS version is too old. Could not create video capture "
+                     "module. Returning NULL");
+        return nullptr;
+    }
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
+    if (!CheckQTVersion())
+    {
+        WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, id,
+                     "QuickTime version is too old. Could not create video "
+                     "capture module. Returning NULL");
+        return nullptr;
+    }
+
+    WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, id,
+                 "%s line %d. QTKit is not supported on this machine. Using "
+                 "QuickTime framework to capture video",
+                 __FILE__, __LINE__);
+
+    rtc::scoped_refptr<VideoCaptureMacQuickTime> newCaptureModule(
+        new rtc::RefCountedObject<VideoCaptureMacQuickTime>(id));
+
+    if (newCaptureModule->Init(id, deviceUniqueIdUTF8) != 0)
+    {
+        WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, id,
+                     "could not Create for unique device %s, "
+                     "newCaptureModule->Init()!=0",
+                     deviceUniqueIdUTF8);
+        return nullptr;
+    }
+
+    // Successfully created VideoCaptureMacQuicktime. Return it
+    WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, id,
+                 "Module created for unique device %s. Will use QuickTime "
+                 "framework to capture",
+                 deviceUniqueIdUTF8);
+    return newCaptureModule;
+
+#else // QTKit version
+
+    WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, id,
+                 "Using QTKit framework to capture video", id);
+
+    rtc::scoped_refptr<VideoCaptureMacQTKit> newCaptureModule(
+        new rtc::RefCountedObject<VideoCaptureMacQTKit>(id));
+
+    if(newCaptureModule->Init(id, deviceUniqueIdUTF8) != 0)
+    {
+        WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, id,
+                     "could not Create for unique device %s, "
+                     "newCaptureModule->Init()!=0", deviceUniqueIdUTF8);
+        return nullptr;
+    }
+
+    // Successfully created VideoCaptureMacQuicktime. Return it
+    WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, id,
+                 "Module created for unique device %s, will use QTKit "
+                 "framework",deviceUniqueIdUTF8);
+    return newCaptureModule;
+#endif
+}
+
+/**************************************************************************
+ *
+ *    Create/Destroy a DeviceInfo
+ *
+ ***************************************************************************/
+
+VideoCaptureModule::DeviceInfo*
+VideoCaptureImpl::CreateDeviceInfo(const int32_t id)
+{
+
+
+    if (webrtc::videocapturemodule::CheckOSVersion() == false)
+    {
+        WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, id,
+                     "OS version is too old. Could not create video capture "
+                     "module. Returning NULL");
+        return NULL;
+    }
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
+    if (webrtc::videocapturemodule::CheckQTVersion() == false)
+    {
+        WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, id,
+                     "QuickTime version is too old. Could not create video "
+                     "capture module. Returning NULL");
+        return NULL;
+    }
+
+    webrtc::videocapturemodule::VideoCaptureMacQuickTimeInfo* newCaptureInfoModule =
+        new webrtc::videocapturemodule::VideoCaptureMacQuickTimeInfo(id);
+
+    if (!newCaptureInfoModule || newCaptureInfoModule->Init() != 0)
+    {
+        Destroy(newCaptureInfoModule);
+        newCaptureInfoModule = NULL;
+        WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, id,
+                     "Failed to Init newCaptureInfoModule created with id %d "
+                     "and device \"\" ", id);
+        return NULL;
+    }
+    WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, id,
+                 "VideoCaptureModule created for id", id);
+    return newCaptureInfoModule;
+
+#else // QTKit version
+    webrtc::videocapturemodule::VideoCaptureMacQTKitInfo* newCaptureInfoModule =
+        new webrtc::videocapturemodule::VideoCaptureMacQTKitInfo(id);
+
+    if(!newCaptureInfoModule || newCaptureInfoModule->Init() != 0)
+    {
+        //Destroy(newCaptureInfoModule);
+        delete newCaptureInfoModule;
+        newCaptureInfoModule = NULL;
+        WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, id,
+                     "Failed to Init newCaptureInfoModule created with id %d "
+                     "and device \"\" ", id);
+        return NULL;
+    }
+    WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, id,
+                 "VideoCaptureModule created for id", id);
+    return newCaptureInfoModule;
+
+#endif
+
+}
+
+/**************************************************************************
+ *
+ *    End Create/Destroy VideoCaptureModule
+ *
+ ***************************************************************************/
+}  // namespace videocapturemodule
+}  // namespace webrtc
diff --git a/webrtc/modules/video_capture/video_capture.gypi b/webrtc/modules/video_capture/video_capture.gypi
index 0f4820c..eb10147 100644
--- a/webrtc/modules/video_capture/video_capture.gypi
+++ b/webrtc/modules/video_capture/video_capture.gypi
@@ -68,6 +68,29 @@
                 'linux/video_capture_linux.h',
               ],
             }],  # linux
+            ['OS=="mac"', {
+              'sources': [
+                'mac/qtkit/video_capture_qtkit.h',
+                'mac/qtkit/video_capture_qtkit.mm',
+                'mac/qtkit/video_capture_qtkit_info.h',
+                'mac/qtkit/video_capture_qtkit_info.mm',
+                'mac/qtkit/video_capture_qtkit_info_objc.h',
+                'mac/qtkit/video_capture_qtkit_info_objc.mm',
+                'mac/qtkit/video_capture_qtkit_objc.h',
+                'mac/qtkit/video_capture_qtkit_objc.mm',
+                'mac/qtkit/video_capture_qtkit_utility.h',
+                'mac/video_capture_mac.mm',
+              ],
+              'link_settings': {
+                'xcode_settings': {
+                  'OTHER_LDFLAGS': [
+                    '-framework Cocoa',
+                    '-framework CoreVideo',
+                    '-framework QTKit',
+                  ],
+                },
+              },
+            }],  # mac
             ['OS=="win"', {
               'dependencies': [
                 '<(DEPTH)/third_party/winsdk_samples/winsdk_samples.gyp:directshow_baseclasses',
@@ -110,16 +133,16 @@
                 },
               },
             }],
-            ['OS=="ios" or OS=="mac"', {
+            ['OS=="ios"', {
               'sources': [
-                'apple/device_info.h',
-                'apple/device_info.mm',
-                'apple/device_info_objc.h',
-                'apple/device_info_objc.mm',
-                'apple/rtc_video_capture_objc.h',
-                'apple/rtc_video_capture_objc.mm',
-                'apple/video_capture.h',
-                'apple/video_capture.mm',
+                'ios/device_info_ios.h',
+                'ios/device_info_ios.mm',
+                'ios/device_info_ios_objc.h',
+                'ios/device_info_ios_objc.mm',
+                'ios/rtc_video_capture_ios_objc.h',
+                'ios/rtc_video_capture_ios_objc.mm',
+                'ios/video_capture_ios.h',
+                'ios/video_capture_ios.mm',
               ],
               'xcode_settings': {
                 'CLANG_ENABLE_OBJC_ARC': 'YES',
@@ -130,14 +153,6 @@
                     '-framework AVFoundation',
                     '-framework CoreMedia',
                     '-framework CoreVideo',
-                  ],
-                },
-              },
-            }],  # ios
-            ['OS=="ios"', {
-              'all_dependent_settings': {
-                'xcode_settings': {
-                  'OTHER_LDFLAGS': [
                     '-framework UIKit',
                   ],
                 },