[vlc-commits] android/utils: fail early if there is no private libs

Thomas Guillem git at videolan.org
Wed Oct 26 15:07:28 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Oct 26 15:01:27 2016 +0200| [6aa4e946a5c6fa2d66ecc2f4943f952ff6591525] | committer: Thomas Guillem

android/utils: fail early if there is no private libs

This will be soon the most common case.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6aa4e946a5c6fa2d66ecc2f4943f952ff6591525
---

 modules/video_output/android/utils.c | 42 ++++++++++++++++++------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/modules/video_output/android/utils.c b/modules/video_output/android/utils.c
index 9b8dd3b..dd2d1de 100644
--- a/modules/video_output/android/utils.c
+++ b/modules/video_output/android/utils.c
@@ -286,27 +286,27 @@ LoadNativeWindowAPI(AWindowHandler *p_awh)
 static int
 LoadNativeWindowPrivAPI(native_window_priv_api_t *native)
 {
-    native->connect = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_connect");
-    native->disconnect = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_disconnect");
-    native->setUsage = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_setUsage");
-    native->setBuffersGeometry = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_setBuffersGeometry");
-    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");
-    native->lock = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_lock");
-    native->lockData = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_lockData");
-    native->unlockData = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_unlockData");
-    native->queue = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_queue");
-    native->cancel = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_cancel");
-    native->setOrientation = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_setOrientation");
-
-    return native->connect && native->disconnect && native->setUsage &&
-        native->setBuffersGeometry && native->getMinUndequeued &&
-        native->getMaxBufferCount && native->setBufferCount && native->setCrop &&
-        native->dequeue && native->lock && native->lockData && native->unlockData &&
-        native->queue && native->cancel && native->setOrientation ? 0 : -1;
+#define LOAD(symbol) do { \
+if ((native->symbol = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_" #symbol)) == NULL) \
+    return -1; \
+} while(0)
+    LOAD(connect);
+    LOAD(disconnect);
+    LOAD(setUsage);
+    LOAD(setBuffersGeometry);
+    LOAD(getMinUndequeued);
+    LOAD(getMaxBufferCount);
+    LOAD(setBufferCount);
+    LOAD(setCrop);
+    LOAD(dequeue);
+    LOAD(lock);
+    LOAD(lockData);
+    LOAD(unlockData);
+    LOAD(queue);
+    LOAD(cancel);
+    LOAD(setOrientation);
+    return 0;
+#undef LOAD
 }
 
 /*



More information about the vlc-commits mailing list