[vlc-devel] [PATCH 1/5] nativewindowpriv: add getMaxBufferCount

Thomas Guillem thomas at gllm.fr
Wed Nov 19 12:04:12 CET 2014


---
 modules/video_output/android/nativewindowpriv.c | 10 ++++++++++
 modules/video_output/android/utils.c            |  4 +++-
 modules/video_output/android/utils.h            |  2 ++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/android/nativewindowpriv.c b/modules/video_output/android/nativewindowpriv.c
index 989236a..a55c03e 100644
--- a/modules/video_output/android/nativewindowpriv.c
+++ b/modules/video_output/android/nativewindowpriv.c
@@ -184,6 +184,16 @@ int ANativeWindowPriv_getMinUndequeued( native_window_priv *priv, unsigned int *
     return 0;
 }
 
+int ANativeWindowPriv_getMaxBufferCount( native_window_priv *priv, unsigned int *max_buffer_count )
+{
+#if ANDROID_API >= 14
+    *max_buffer_count = 32;
+#else
+    *max_buffer_count = 15;
+#endif
+    return 0;
+}
+
 int ANativeWindowPriv_setBufferCount(native_window_priv *priv, unsigned int count )
 {
     status_t err;
diff --git a/modules/video_output/android/utils.c b/modules/video_output/android/utils.c
index fdf3952..37f9e4f 100644
--- a/modules/video_output/android/utils.c
+++ b/modules/video_output/android/utils.c
@@ -59,6 +59,7 @@ int LoadNativeWindowPrivAPI(native_window_priv_api_t *native)
     native->disconnect = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_disconnect");
     native->setup = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_setup");
     native->getMinUndequeued = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_getMinUndequeued");
+    native->getMaxBufferCount = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_getMaxBufferCount");
     native->setBufferCount = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_setBufferCount");
     native->setCrop = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_setCrop");
     native->dequeue = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_dequeue");
@@ -70,7 +71,8 @@ int LoadNativeWindowPrivAPI(native_window_priv_api_t *native)
     native->setOrientation = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_setOrientation");
 
     return native->connect && native->disconnect && native->setup &&
-        native->getMinUndequeued && native->setBufferCount && native->setCrop &&
+        native->getMinUndequeued && native->getMaxBufferCount &&
+        native->setBufferCount && native->setCrop &&
         native->dequeue && native->lock && native->lockData && native->unlockData &&
         native->queue && native->cancel && native->setOrientation ? 0 : -1;
 }
diff --git a/modules/video_output/android/utils.h b/modules/video_output/android/utils.h
index 5db540e..97b74bf 100644
--- a/modules/video_output/android/utils.h
+++ b/modules/video_output/android/utils.h
@@ -75,6 +75,7 @@ typedef native_window_priv *(*ptr_ANativeWindowPriv_connect) (void *);
 typedef int (*ptr_ANativeWindowPriv_disconnect) (native_window_priv *);
 typedef int (*ptr_ANativeWindowPriv_setup) (native_window_priv *, int, int, int, bool, int );
 typedef int (*ptr_ANativeWindowPriv_getMinUndequeued) (native_window_priv *, unsigned int *);
+typedef int (*ptr_ANativeWindowPriv_getMaxBufferCount) (native_window_priv *, unsigned int *);
 typedef int (*ptr_ANativeWindowPriv_setBufferCount) (native_window_priv *, unsigned int );
 typedef int (*ptr_ANativeWindowPriv_setCrop) (native_window_priv *, int, int, int, int);
 typedef int (*ptr_ANativeWindowPriv_dequeue) (native_window_priv *, void **);
@@ -91,6 +92,7 @@ typedef struct
     ptr_ANativeWindowPriv_disconnect disconnect;
     ptr_ANativeWindowPriv_setup setup;
     ptr_ANativeWindowPriv_getMinUndequeued getMinUndequeued;
+    ptr_ANativeWindowPriv_getMaxBufferCount getMaxBufferCount;
     ptr_ANativeWindowPriv_setBufferCount setBufferCount;
     ptr_ANativeWindowPriv_setCrop setCrop;
     ptr_ANativeWindowPriv_dequeue dequeue;
-- 
2.1.1




More information about the vlc-devel mailing list