[Android] PopupLayout: handle opengl vout
Thomas Guillem
git at videolan.org
Mon Nov 28 16:39:17 CET 2016
vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Nov 28 16:27:42 2016 +0100| [6d15ca36a5fed8380aec350a64d3d659040ebe49] | committer: Thomas Guillem
PopupLayout: handle opengl vout
> https://code.videolan.org/videolan/vlc-android/commit/6d15ca36a5fed8380aec350a64d3d659040ebe49
---
.../src/org/videolan/vlc/gui/video/PopupManager.java | 17 ++++++++++++-----
.../src/org/videolan/vlc/gui/view/PopupLayout.java | 9 +++++++++
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java b/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
index ad8db95..02c8584 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
@@ -107,6 +107,9 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
final IVLCVout vlcVout = mService.getVLCVout();
vlcVout.setVideoView((SurfaceView) mRootView.findViewById(R.id.player_surface));
vlcVout.attachViews();
+ mRootView.setVLCVOut(vlcVout);
+ mService.setVideoAspectRatio(null);
+ mService.setVideoScale(0);
mService.setVideoTrackEnabled(true);
vlcVout.addCallback(this);
if (!mService.isPlaying())
@@ -168,18 +171,22 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
@Override
public void onNewLayout(IVLCVout vlcVout, int width, int height, int visibleWidth, int visibleHeight, int sarNum, int sarDen) {
- if (width * height == 0)
- return;
-
- double dw = mRootView.getWidth(), dh = mRootView.getHeight();
+ int displayW = mRootView.getWidth(), displayH = mRootView.getHeight();
// sanity check
- if (dw * dh == 0) {
+ if (displayW * displayH == 0) {
Log.e(TAG, "Invalid surface size");
return;
}
+ if (width == 0 || height == 0) {
+ vlcVout.setWindowSize(displayW, displayH);
+ mRootView.setViewSize(displayW, displayH);
+ return;
+ }
+
// compute the aspect ratio
+ double dw = displayW, dh = displayH;
double ar;
if (sarDen == sarNum) {
/* No indication about the density, assuming 1:1 */
diff --git a/vlc-android/src/org/videolan/vlc/gui/view/PopupLayout.java b/vlc-android/src/org/videolan/vlc/gui/view/PopupLayout.java
index 6af493c..16295ad 100644
--- a/vlc-android/src/org/videolan/vlc/gui/view/PopupLayout.java
+++ b/vlc-android/src/org/videolan/vlc/gui/view/PopupLayout.java
@@ -38,6 +38,7 @@ import android.view.View;
import android.view.WindowManager;
import android.widget.RelativeLayout;
+import org.videolan.libvlc.IVLCVout;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
@@ -45,6 +46,7 @@ import org.videolan.vlc.VLCApplication;
public class PopupLayout extends RelativeLayout implements ScaleGestureDetector.OnScaleGestureListener, View.OnTouchListener {
private static final String TAG = "VLC/PopupView";
+ private IVLCVout mVLCVout;
private WindowManager mWindowManager;
private GestureDetectorCompat mGestureDetector;
private ScaleGestureDetector mScaleGestureDetector;
@@ -71,6 +73,10 @@ public class PopupLayout extends RelativeLayout implements ScaleGestureDetector.
init(context);
}
+ public void setVLCVOut(IVLCVout vout) {
+ mVLCVout = vout;
+ }
+
/*
* Remove layout from window manager
*/
@@ -78,6 +84,7 @@ public class PopupLayout extends RelativeLayout implements ScaleGestureDetector.
setKeepScreenOn(false);
mWindowManager.removeView(this);
mWindowManager = null;
+ mVLCVout = null;
}
public void setGestureDetector(GestureDetectorCompat gdc) {
@@ -189,6 +196,8 @@ public class PopupLayout extends RelativeLayout implements ScaleGestureDetector.
lp.height *= mScaleFactor;
setViewSize(mPopupWidth, mPopupHeight);
mScaleFactor = 1.0d;
+ if (mVLCVout != null)
+ mVLCVout.setWindowSize(mPopupWidth, mPopupHeight);
}
private void containInScreen(int width, int height) {
More information about the Android
mailing list