[vlc-devel] [PATCH] LibVLC/AWindow: add methods manage SurfaceTexture

Louis Regnier louis.videolabs at gmail.com
Mon Apr 6 11:51:59 CEST 2020


In the NDK API, the onFrameAvailableListener callback doesnt exist and
we cannot use the Java one without relying on JNI again, which defeat
the purpose of the patchset.

In any case, the listener doesn't seem useful as the updateTexImage is called
after the frame has been written and the matching vlc picture has been sent by
the decoder and received in the display.

refs videolan/vlc#20344
---
 libvlc/src/org/videolan/libvlc/AWindow.java | 24 +++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/libvlc/src/org/videolan/libvlc/AWindow.java b/libvlc/src/org/videolan/libvlc/AWindow.java
index 6bdcd77bf..4fbe0e2c0 100644
--- a/libvlc/src/org/videolan/libvlc/AWindow.java
+++ b/libvlc/src/org/videolan/libvlc/AWindow.java
@@ -690,6 +690,14 @@ public class AWindow implements IVLCVout {
             return mSurface;
         }
 
+        private synchronized SurfaceTexture getSurfaceTexture() {
+            return mSurfaceTexture;
+        }
+
+        private synchronized void removeFrameAvailableListener() {
+            mSurfaceTexture.setOnFrameAvailableListener(null);
+        }
+
         private synchronized void release() {
             if (mSurfaceTexture != null) {
                 if (mIsAttached) {
@@ -741,4 +749,20 @@ public class AWindow implements IVLCVout {
     private Surface SurfaceTexture_getSurface() {
         return mSurfaceTextureThread.getSurface();
     }
+
+    /**
+     * Get SurfaceTexture
+     */
+    @SuppressWarnings("unused") /* used by JNI */
+    private SurfaceTexture SurfaceTexture_getSurfaceTexture() {
+        return mSurfaceTextureThread.getSurfaceTexture();
+    }
+
+    /**
+     * Remove frameAvailableListener
+     */
+    @SuppressWarnings("unused") /* used by JNI */
+    private void SurfaceTexture_removeFrameAvailableListener() {
+        mSurfaceTextureThread.removeFrameAvailableListener();
+    }
 }
-- 
2.26.0



More information about the vlc-devel mailing list