[Android] Mark off FOV value & use scale factor for zooming

Geoffrey Métais git at videolan.org
Wed Mar 22 18:14:32 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar 22 18:13:34 2017 +0100| [f483b4e722711bcd834dfe62409e68c6034ad89c] | committer: Geoffrey Métais

Mark off FOV value & use scale factor for zooming

> https://code.videolan.org/videolan/vlc-android/commit/f483b4e722711bcd834dfe62409e68c6034ad89c
---

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java    | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 46b565c..eb49a03 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -169,6 +169,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     public final static int RESULT_HARDWARE_ACCELERATION_ERROR = RESULT_FIRST_USER + 3;
     public final static int RESULT_VIDEO_TRACK_LOST = RESULT_FIRST_USER + 4;
     private static final float DEFAULT_FOV = 80f;
+    public static final float MIN_FOV = 20f;
+    public static final float MAX_FOV = 150f;
 
     private final PlaybackServiceActivity.Helper mHelper = new PlaybackServiceActivity.Helper(this, this);
     protected PlaybackService mService;
@@ -1779,7 +1781,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         } else if (voutCount > 0) {
             Media.VideoTrack vt = mService.getCurrentVideoTrack();
             if (vt != null)
-                mFov = vt.projection == Media.VideoTrack.Projection.Rectangular ? 0f : 80f;
+                mFov = vt.projection == Media.VideoTrack.Projection.Rectangular ? 0f : DEFAULT_FOV;
         }
     }
 
@@ -2455,9 +2457,9 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     }
     @Override
     public boolean onScale(ScaleGestureDetector detector) {
-        float fov_changed = DEFAULT_FOV * (detector.getPreviousSpan()-detector.getCurrentSpan())/(float)mSurfaceXDisplayRange;
-        if (mService.updateViewpoint(0, 0, 0, fov_changed, false)) {
-            mFov += fov_changed;
+        float diff = DEFAULT_FOV * (1 - detector.getScaleFactor());
+        if (mService.updateViewpoint(0, 0, 0, diff, false)) {
+            mFov = Math.min(Math.max(MIN_FOV, mFov + diff), MAX_FOV);
             return true;
         }
         return false;



More information about the Android mailing list