File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -289,13 +289,12 @@ - (void) setVideoZoomFactor:(float)videoZoomFactor
289289{
290290 _videoZoomFactor = videoZoomFactor;
291291 if (m_positionTransform) {
292- // We could use AVCaptureConnection's zoom factor, but in reality it's
293- // doing the exact same thing as this (in terms of the algorithm used),
294- // but it is not clear how CoreVideo accomplishes it.
295- // In this case this is just modifying the matrix
296- // multiplication that is already happening once per frame.
297- m_positionTransform->setSize (self.videoSize .width * videoZoomFactor,
298- self.videoSize .height * videoZoomFactor);
292+ // Switched to Hardware zoom to better support iPhone 7 Plus
293+ m_cameraSource->setVideoZoomFactor (MAX (1.0 , MIN (videoZoomFactor, 6.4 )));
294+
295+ // Original VideoCore code:
296+ // m_positionTransform->setSize(self.videoSize.width * videoZoomFactor,
297+ // self.videoSize.height * videoZoomFactor);
299298 }
300299}
301300- (void ) setAudioChannelCount : (int )channelCount
Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ namespace videocore { namespace iOS {
114114
115115 bool setContinuousExposure (bool wantsContinuous);
116116
117+ bool setVideoZoomFactor (float zoomFactor);
117118
118119 public:
119120 /* ! Used by Objective-C Capture Session */
Original file line number Diff line number Diff line change @@ -503,5 +503,17 @@ - (void) orientationChanged: (NSNotification*) notification
503503 return ret;
504504 }
505505
506+ bool
507+ CameraSource::setVideoZoomFactor (float zoomFactor) {
508+ AVCaptureDevice* device = (AVCaptureDevice*)m_captureDevice;
509+ NSError * err = nil ;
510+ if ([device lockForConfiguration: &err]) {
511+ device.videoZoomFactor = zoomFactor;
512+ return YES ;
513+ } else {
514+ return NO ;
515+ }
516+ }
517+
506518}
507519}
You can’t perform that action at this time.
0 commit comments