--- a/media/webrtc/moz.build
+++ b/media/webrtc/moz.build
@@ -32,18 +32,16 @@ webrtc_non_unified_sources = [
'trunk/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc', # Because of needing to define _USE_MATH_DEFINES before including <cmath>
'trunk/webrtc/modules/audio_processing/echo_cancellation_impl.cc', # Because of name clash in the MapError function
'trunk/webrtc/modules/audio_processing/echo_control_mobile_impl.cc', # Because of name clash in the MapError function
'trunk/webrtc/modules/audio_processing/gain_control_impl.cc', # Because of name clash in the Handle typedef
'trunk/webrtc/modules/audio_processing/high_pass_filter_impl.cc', # Because of name clash in the Handle typedef
'trunk/webrtc/modules/audio_processing/noise_suppression_impl.cc', # Because of name clash in the Handle typedef
'trunk/webrtc/modules/remote_bitrate_estimator/mimd_rate_control.cc', # Because of duplicate definitions of static consts against aimd_rate_control.cc
'trunk/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc', # Because of duplicate definitions of static consts against remote_bitrate_estimator_abs_send_time.cc
- 'trunk/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit.mm', # Because of name clash in the nsAutoreleasePool class
- 'trunk/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info.mm', # Because of name clash in the nsAutoreleasePool class
'trunk/webrtc/modules/video_capture/windows/device_info_ds.cc', # Because of the MEDIASUBTYPE_HDYC variable
'trunk/webrtc/modules/video_capture/windows/help_functions_ds.cc', # Because of initguid.h
'trunk/webrtc/modules/video_capture/windows/sink_filter_ds.cc', # Because of the MEDIASUBTYPE_HDYC variable and initguid.h
'trunk/webrtc/video_engine/overuse_frame_detector.cc', # Because of name clash with call_stats.cc on kWeightFactor
]
GYP_DIRS += ['trunk']
--- a/media/webrtc/signaling/test/common.build
+++ b/media/webrtc/signaling/test/common.build
@@ -58,17 +58,16 @@ if CONFIG['OS_TARGET'] == 'Darwin':
'/media/mtransport/third_party/nrappkit/src/port/darwin/include',
]
OS_LIBS += [
'-framework AudioToolbox',
'-framework AudioUnit',
'-framework Carbon',
'-framework CoreAudio',
'-framework OpenGL',
- '-framework QTKit',
'-framework AVFoundation',
'-framework CoreMedia',
'-framework QuartzCore',
'-framework Security',
'-framework SystemConfiguration',
'-framework IOKit',
'-F%s' % CONFIG['MACOS_PRIVATE_FRAMEWORKS_DIR'],
'-framework CoreUI',
--- a/media/webrtc/trunk/webrtc/modules/video_capture/BUILD.gn
+++ b/media/webrtc/trunk/webrtc/modules/video_capture/BUILD.gn
@@ -87,40 +87,30 @@ if (!build_with_chromium) {
"linux/device_info_linux.h",
"linux/video_capture_linux.cc",
"linux/video_capture_linux.h",
]
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/avfoundation/video_capture_avfoundation.h",
"mac/avfoundation/video_capture_avfoundation.mm",
"mac/avfoundation/video_capture_avfoundation_info.h",
"mac/avfoundation/video_capture_avfoundation_info.mm",
"mac/avfoundation/video_capture_avfoundation_info_objc.h",
"mac/avfoundation/video_capture_avfoundation_info_objc.mm",
"mac/avfoundation/video_capture_avfoundation_objc.h",
"mac/avfoundation/video_capture_avfoundation_objc.mm",
"mac/avfoundation/video_capture_avfoundation_utility.h",
"mac/video_capture_mac.mm",
]
libs = [
"CoreVideo.framework",
- "QTKit.framework",
]
}
if (is_win) {
sources = [
"windows/device_info_ds.cc",
"windows/device_info_ds.h",
"windows/device_info_mf.cc",
"windows/device_info_mf.h",
deleted file mode 100644
--- a/media/webrtc/trunk/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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_
deleted file mode 100644
--- a/media/webrtc/trunk/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit.mm
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * 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/interface/critical_section_wrapper.h"
-#include "webrtc/system_wrappers/interface/trace.h"
-
-class nsAutoreleasePool {
-public:
- nsAutoreleasePool()
- {
- mLocalPool = [[NSAutoreleasePool alloc] init];
- }
- ~nsAutoreleasePool()
- {
- [mLocalPool release];
- }
-private:
- NSAutoreleasePool *mLocalPool;
-};
-
-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()
-{
-
- nsAutoreleasePool localPool;
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, _id,
- "~VideoCaptureMacQTKit() called");
- if(_captureDevice)
- {
- [_captureDevice registerOwner:nil];
- [_captureDevice performSelectorOnMainThread:@selector(stopCapture)
- withObject:nil
- waitUntilDone:NO];
- [_captureDevice performSelectorOnMainThread:@selector(release)
- withObject:nil
- waitUntilDone:NO];
- }
-
- 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);
-
- nsAutoreleasePool localPool;
-
- _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)
-{
-
- nsAutoreleasePool localPool;
- _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()
-{
- nsAutoreleasePool localPool;
- [_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
deleted file mode 100644
--- a/media/webrtc/trunk/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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_
deleted file mode 100644
--- a/media/webrtc/trunk/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info.mm
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * 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/include/video_capture.h"
-#include "webrtc/modules/video_capture/video_capture_config.h"
-#include "webrtc/system_wrappers/interface/trace.h"
-
-class nsAutoreleasePool {
-public:
- nsAutoreleasePool()
- {
- mLocalPool = [[NSAutoreleasePool alloc] init];
- }
- ~nsAutoreleasePool()
- {
- [mLocalPool release];
- }
-private:
- NSAutoreleasePool *mLocalPool;
-};
-
-namespace webrtc
-{
-namespace videocapturemodule
-{
-
-VideoCaptureMacQTKitInfo::VideoCaptureMacQTKitInfo(const int32_t id) :
- DeviceInfoImpl(id)
-{
- nsAutoreleasePool localPool;
- _captureInfo = [[VideoCaptureMacQTKitInfoObjC alloc] init];
-}
-
-VideoCaptureMacQTKitInfo::~VideoCaptureMacQTKitInfo()
-{
- nsAutoreleasePool localPool;
- [_captureInfo release];
-}
-
-int32_t VideoCaptureMacQTKitInfo::Init()
-{
-
- return 0;
-}
-
-uint32_t VideoCaptureMacQTKitInfo::NumberOfDevices()
-{
-
- nsAutoreleasePool localPool;
- 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)
-{
- nsAutoreleasePool localPool;
- 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)
-{
-
- nsAutoreleasePool localPool;
- 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
deleted file mode 100644
--- a/media/webrtc/trunk/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info_objc.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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;
- 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_
deleted file mode 100644
--- a/media/webrtc/trunk/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info_objc.mm
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * 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/interface/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];
- }
-
- if ([_captureDevicesInfo count] <= index)
- {
- 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];
- }
-
- _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
deleted file mode 100644
--- a/media/webrtc/trunk/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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_
deleted file mode 100644
--- a/media/webrtc/trunk/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.mm
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * 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/interface/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;
-
- // This method is often called on a secondary thread. Which means
- // that the following can sometimes run "too early", causing crashes
- // and/or weird errors concerning initialization. On OS X 10.7 and
- // 10.8, the CoreMediaIO method CMIOUninitializeGraph() is called from
- // -[QTCaptureSession stopRunning]. If this is called too early,
- // low-level session data gets uninitialized before low-level code
- // is finished trying to use it. The solution is to make stopRunning
- // always run on the main thread. See bug 837539.
- [_captureSession performSelectorOnMainThread:@selector(stopRunning)
- withObject:nil
- waitUntilDone:NO];
- _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 {
- // TODO(mflodman) Experiment more when this happens.
-}
-
-- (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
deleted file mode 100644
--- a/media/webrtc/trunk/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_utility.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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_
--- a/media/webrtc/trunk/webrtc/modules/video_capture/mac/video_capture_mac.mm
+++ b/media/webrtc/trunk/webrtc/modules/video_capture/mac/video_capture_mac.mm
@@ -8,96 +8,56 @@
* be found in the AUTHORS file in the root of the source tree.
*/
/*
* video_capture_mac.cc
*
*/
-#include <QuickTime/QuickTime.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/interface/ref_count.h"
#include "webrtc/system_wrappers/interface/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>
-#elseif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_7
-#include "webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit.h"
-#include "webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info.h"
-#else
#include "webrtc/modules/video_capture/mac/avfoundation/video_capture_avfoundation.h"
#include "webrtc/modules/video_capture/mac/avfoundation/video_capture_avfoundation_info.h"
-#endif
namespace webrtc
{
namespace videocapturemodule
{
// static
bool CheckOSVersion()
{
- // Check OSX version
- OSErr err = noErr;
-
- SInt32 version;
+ // Check OSX version is at least 10.7 (min for AVFoundation)
+ int major = 0;
+ int minor = 0;
- 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;
+ NSString* versionString = [[NSDictionary dictionaryWithContentsOfFile:
+ @"/System/Library/CoreServices/SystemVersion.plist"] objectForKey:@"ProductVersion"];
+ NSArray* versions = [versionString componentsSeparatedByString:@"."];
+ NSUInteger count = [versions count];
+ if (count > 0) {
+ major = [(NSString *)[versions objectAtIndex:0] integerValue];
+ if (count > 1) {
+ minor = [(NSString *)[versions objectAtIndex:1] integerValue];
+ }
}
- 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)
+ if (major < 10)
{
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
- "Could not get QuickTime version");
- return false;
+ return false;
+ }
+ if ((major == 10) && (minor < 7)) {
+ 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
*
***************************************************************************/
@@ -119,90 +79,16 @@ VideoCaptureModule* VideoCaptureImpl::Cr
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_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, id,
- "%s line %d. QTKit is not supported on this machine. Using "
- "QuickTime framework to capture video",
- __FILE__, __LINE__);
-
- RefCountImpl<videocapturemodule::VideoCaptureMacQuickTime>*
- newCaptureModule =
- new RefCountImpl<videocapturemodule::VideoCaptureMacQuickTime>(id);
-
- if (!newCaptureModule)
- {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, id,
- "could not Create for unique device %s, !newCaptureModule",
- deviceUniqueIdUTF8);
- return NULL;
- }
-
- if (newCaptureModule->Init(id, deviceUniqueIdUTF8) != 0)
- {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, id,
- "could not Create for unique device %s, "
- "newCaptureModule->Init()!=0",
- deviceUniqueIdUTF8);
- delete newCaptureModule;
- return NULL;
- }
-
- // 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;
-
-#elseif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_7 // QTKit version
-
- WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, id,
- "Using QTKit framework to capture video", id);
-
- RefCountImpl<videocapturemodule::VideoCaptureMacQTKit>* newCaptureModule =
- new RefCountImpl<videocapturemodule::VideoCaptureMacQTKit>(id);
-
- if(!newCaptureModule)
- {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, id,
- "could not Create for unique device %s, !newCaptureModule",
- deviceUniqueIdUTF8);
- return NULL;
- }
- if(newCaptureModule->Init(id, deviceUniqueIdUTF8) != 0)
- {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, id,
- "could not Create for unique device %s, "
- "newCaptureModule->Init()!=0", deviceUniqueIdUTF8);
- delete newCaptureModule;
- return NULL;
- }
-
- // 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;
-#else // AVFoundation version
-
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, id,
"Using AVFoundation framework to capture video", id);
RefCountImpl<videocapturemodule::VideoCaptureMacAVFoundation>* newCaptureModule =
new RefCountImpl<videocapturemodule::VideoCaptureMacAVFoundation>(id);
if(!newCaptureModule)
{
@@ -220,17 +106,16 @@ VideoCaptureModule* VideoCaptureImpl::Cr
return NULL;
}
// Successfully created VideoCaptureMacQuicktime. Return it
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, id,
"Module created for unique device %s, will use AVFoundation "
"framework",deviceUniqueIdUTF8);
return newCaptureModule;
-#endif
}
/**************************************************************************
*
* Create/Destroy a DeviceInfo
*
***************************************************************************/
@@ -242,77 +127,32 @@ VideoCaptureImpl::CreateDeviceInfo(const
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;
-
-#elseif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_7 // 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;
-
-#else // AVFoundation version
webrtc::videocapturemodule::VideoCaptureMacAVFoundationInfo* newCaptureInfoModule =
new webrtc::videocapturemodule::VideoCaptureMacAVFoundationInfo(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
*
***************************************************************************/
--- a/media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi
+++ b/media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi
@@ -73,42 +73,32 @@
'linux/device_info_linux.cc',
'linux/device_info_linux.h',
'linux/video_capture_linux.cc',
'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/avfoundation/video_capture_avfoundation.h',
'mac/avfoundation/video_capture_avfoundation.mm',
'mac/avfoundation/video_capture_avfoundation_info.h',
'mac/avfoundation/video_capture_avfoundation_info.mm',
'mac/avfoundation/video_capture_avfoundation_info_objc.h',
'mac/avfoundation/video_capture_avfoundation_info_objc.mm',
'mac/avfoundation/video_capture_avfoundation_objc.h',
'mac/avfoundation/video_capture_avfoundation_objc.mm',
'mac/avfoundation/video_capture_avfoundation_utility.h',
'mac/video_capture_mac.mm',
],
'link_settings': {
'xcode_settings': {
'OTHER_LDFLAGS': [
'-framework Cocoa',
'-framework CoreVideo',
- '-framework QTKit',
],
},
},
}], # mac
['OS=="win"', {
'conditions': [
['build_with_mozilla==0', {
'dependencies': [
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -147,17 +147,16 @@ if CONFIG['MOZ_WEBRTC']:
'msdmo',
'wininet',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
OS_LIBS += [
'-framework OpenGL',
'-framework SystemConfiguration',
- '-framework QTKit',
'-framework AVFoundation',
'-framework CoreMedia',
'-framework IOKit',
'-F%s' % CONFIG['MACOS_PRIVATE_FRAMEWORKS_DIR'],
'-framework CoreUI',
'-framework CoreSymbolication',
'cups',
]