guoweis@webrtc.org 5a7dc39277 This is a code clean up. No functional change intended.
Consolidate the enum for capturer/frame rotation we use through out the code base.

BUG=4145
R=mflodman@webrtc.org, perkj@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/39859004

Cr-Commit-Position: refs/heads/master@{#8365}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8365 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-02-13 14:32:13 +00:00

113 lines
3.7 KiB
Plaintext

/*
* Copyright (c) 2013 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.
*/
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
#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/interface/trace.h"
using namespace webrtc;
using namespace videocapturemodule;
#define IOS_UNSUPPORTED() \
WEBRTC_TRACE(kTraceError, \
kTraceVideoCapture, \
_id, \
"%s is not supported on the iOS platform.", \
__FUNCTION__); \
return -1;
VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo(
const int32_t device_id) {
return new DeviceInfoIos(device_id);
}
DeviceInfoIos::DeviceInfoIos(const int32_t device_id)
: DeviceInfoImpl(device_id) {}
DeviceInfoIos::~DeviceInfoIos() {}
int32_t DeviceInfoIos::Init() { return 0; }
uint32_t DeviceInfoIos::NumberOfDevices() {
return [DeviceInfoIosObjC captureDeviceCount];
}
int32_t DeviceInfoIos::GetDeviceName(uint32_t deviceNumber,
char* deviceNameUTF8,
uint32_t deviceNameUTF8Length,
char* deviceUniqueIdUTF8,
uint32_t deviceUniqueIdUTF8Length,
char* productUniqueIdUTF8,
uint32_t productUniqueIdUTF8Length) {
NSString* deviceName = [DeviceInfoIosObjC deviceNameForIndex:deviceNumber];
NSString* deviceUniqueId =
[DeviceInfoIosObjC deviceUniqueIdForIndex:deviceNumber];
strncpy(deviceNameUTF8, [deviceName UTF8String], deviceNameUTF8Length);
deviceNameUTF8[deviceNameUTF8Length - 1] = '\0';
strncpy(deviceUniqueIdUTF8,
[deviceUniqueId UTF8String],
deviceUniqueIdUTF8Length);
deviceUniqueIdUTF8[deviceUniqueIdUTF8Length - 1] = '\0';
if (productUniqueIdUTF8) {
productUniqueIdUTF8[0] = '\0';
}
return 0;
}
int32_t DeviceInfoIos::NumberOfCapabilities(const char* deviceUniqueIdUTF8) {
IOS_UNSUPPORTED();
}
int32_t DeviceInfoIos::GetCapability(const char* deviceUniqueIdUTF8,
const uint32_t deviceCapabilityNumber,
VideoCaptureCapability& capability) {
IOS_UNSUPPORTED();
}
int32_t DeviceInfoIos::GetBestMatchedCapability(
const char* deviceUniqueIdUTF8,
const VideoCaptureCapability& requested,
VideoCaptureCapability& resulting) {
IOS_UNSUPPORTED();
}
int32_t DeviceInfoIos::DisplayCaptureSettingsDialogBox(
const char* deviceUniqueIdUTF8,
const char* dialogTitleUTF8,
void* parentWindow,
uint32_t positionX,
uint32_t positionY) {
IOS_UNSUPPORTED();
}
int32_t DeviceInfoIos::GetOrientation(const char* deviceUniqueIdUTF8,
VideoRotation& orientation) {
if (strcmp(deviceUniqueIdUTF8, "Front Camera") == 0) {
orientation = kVideoRotation_0;
} else {
orientation = kVideoRotation_90;
}
return orientation;
}
int32_t DeviceInfoIos::CreateCapabilityMap(const char* deviceUniqueIdUTF8) {
IOS_UNSUPPORTED();
}