Commit 42f415dc authored by Guillaume BIENKOWSKI's avatar Guillaume BIENKOWSKI
Browse files

Revert "Detect device orientation when initalizing iOS capture device"

This reverts commit 1451d9c7.
parent b495df94
......@@ -34,9 +34,6 @@
#if !TARGET_IPHONE_SIMULATOR
static AVCaptureVideoOrientation Angle2AVCaptureVideoOrientation(int deviceOrientation);
static AVCaptureVideoOrientation UIDeviceOrientation2AVCaptureVideoOrientation( UIDeviceOrientation orientation );
// AVCaptureVideoPreviewLayer with AVCaptureSession creation
@interface AVCaptureVideoPreviewLayerEx : AVCaptureVideoPreviewLayer
......@@ -135,8 +132,7 @@ static void capture_queue_cleanup(void* p) {
/* Set the layer */
AVCaptureVideoPreviewLayer *previewLayer = (AVCaptureVideoPreviewLayer *)self.layer;
AVCaptureVideoOrientation orientation = UIDeviceOrientation2AVCaptureVideoOrientation([[UIDevice currentDevice] orientation]);
[previewLayer setOrientation:orientation];
[previewLayer setOrientation:AVCaptureVideoOrientationPortrait];
[previewLayer setBackgroundColor:[[UIColor clearColor] CGColor]];
[previewLayer setOpaque:YES];
start_time=0;
......@@ -362,7 +358,7 @@ static void capture_queue_cleanup(void* p) {
return 0;
}
static AVCaptureVideoOrientation Angle2AVCaptureVideoOrientation(int deviceOrientation) {
static AVCaptureVideoOrientation deviceOrientation2AVCaptureVideoOrientation(int deviceOrientation) {
switch (deviceOrientation) {
case 0: return AVCaptureVideoOrientationPortrait;
case 90: return AVCaptureVideoOrientationLandscapeLeft;
......@@ -377,30 +373,6 @@ static AVCaptureVideoOrientation Angle2AVCaptureVideoOrientation(int deviceOrien
return AVCaptureVideoOrientationPortrait;
}
static AVCaptureVideoOrientation UIDeviceOrientation2AVCaptureVideoOrientation( UIDeviceOrientation orientation ) {
switch (orientation) {
case UIDeviceOrientationPortraitUpsideDown:
return AVCaptureVideoOrientationPortraitUpsideDown;
// see http://stackoverflow.com/questions/7845520/why-does-avcapturevideoorientation-landscape-modes-result-in-upside-down-still-i
// landscape left on UI means landscape right on AVCapture.
case UIDeviceOrientationLandscapeLeft:
return AVCaptureVideoOrientationLandscapeRight;
case UIDeviceOrientationLandscapeRight:
return AVCaptureVideoOrientationLandscapeLeft;
case UIDeviceOrientationFaceUp:
case UIDeviceOrientationPortrait:
case UIDeviceOrientationUnknown:
case UIDeviceOrientationFaceDown:
default:
return AVCaptureVideoOrientationPortrait;
break;
}
}
- (void)configureSize:(MSVideoSize) outputSize
withSession:(AVCaptureSession *) session {
if (((outputSize.width * outputSize.height) == (MS_VIDEO_SIZE_1080P_W * MS_VIDEO_SIZE_1080P_H))
......@@ -670,7 +642,7 @@ static int ioscapture_set_device_orientation_display (MSFilter *f, void *arg) {
if (thiz != NULL) {
AVCaptureVideoPreviewLayer *previewLayer = (AVCaptureVideoPreviewLayer *)thiz.layer;
if ([previewLayer isOrientationSupported])
previewLayer.orientation = Angle2AVCaptureVideoOrientation(*(int*)(arg));
previewLayer.orientation = deviceOrientation2AVCaptureVideoOrientation(*(int*)(arg));
}
return 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment