[vlc-commits] nativewindowpriv: add setOrientation

Thomas Guillem git at videolan.org
Wed Oct 1 10:38:27 CEST 2014


vlc | branch: master | Thomas Guillem <thomas.guillem at gmail.com> | Tue Sep 30 12:18:10 2014 +0200| [842b6578ae0e9a4d47024ab45441b5211663d4c3] | committer: Jean-Baptiste Kempf

nativewindowpriv: add setOrientation

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/video_output/android/nativewindowpriv.c |   29 +++++++++++++++++++++++
 modules/video_output/android/utils.c            |    5 ++--
 modules/video_output/android/utils.h            |    3 +++
 3 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/modules/video_output/android/nativewindowpriv.c b/modules/video_output/android/nativewindowpriv.c
index 3fb9356..72b853b 100644
--- a/modules/video_output/android/nativewindowpriv.c
+++ b/modules/video_output/android/nativewindowpriv.c
@@ -259,3 +259,32 @@ int ANativeWindowPriv_cancel( void *window, void *p_handle )
 
     return 0;
 }
+
+int ANativeWindowPriv_setOrientation( void *window, int orientation )
+{
+    ANativeWindow *anw = (ANativeWindow *)window;
+    status_t err = NO_ERROR;
+    int transform;
+
+    CHECK_ANW();
+
+    switch( orientation )
+    {
+        case 90:
+            transform = NATIVE_WINDOW_TRANSFORM_ROT_90;
+            break;
+        case 180:
+            transform = NATIVE_WINDOW_TRANSFORM_ROT_180;
+            break;
+        case 270:
+            transform = NATIVE_WINDOW_TRANSFORM_ROT_270;
+            break;
+        default:
+            transform = 0;
+    }
+
+    err = native_window_set_buffers_transform( anw, transform );
+    CHECK_ERR();
+
+    return 0;
+}
diff --git a/modules/video_output/android/utils.c b/modules/video_output/android/utils.c
index a2239db..ed3b905 100644
--- a/modules/video_output/android/utils.c
+++ b/modules/video_output/android/utils.c
@@ -61,11 +61,12 @@ int LoadNativeWindowPrivAPI(native_window_priv_api_t *native)
     native->lock = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_lock");
     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->setup &&
         native->getMinUndequeued && native->setBufferCount && native->setCrop &&
-        native->dequeue && native->lock && native->queue && native->cancel
-        ? 0 : -1;
+        native->dequeue && native->lock && native->queue && native->cancel &&
+        native->setOrientation ? 0 : -1;
 }
 
 extern void jni_getMouseCoordinates(int *, int *, int *, int *);
diff --git a/modules/video_output/android/utils.h b/modules/video_output/android/utils.h
index 2500c53..e78c688 100644
--- a/modules/video_output/android/utils.h
+++ b/modules/video_output/android/utils.h
@@ -59,6 +59,8 @@ typedef int (*ptr_ANativeWindowPriv_dequeue) (void *, void **);
 typedef int (*ptr_ANativeWindowPriv_lock) (void *, void *);
 typedef int (*ptr_ANativeWindowPriv_queue) (void *, void *);
 typedef int (*ptr_ANativeWindowPriv_cancel) (void *, void *);
+typedef int (*ptr_ANativeWindowPriv_setOrientation) (void *, int);
+
 typedef struct
 {
     ptr_ANativeWindowPriv_connect connect;
@@ -71,6 +73,7 @@ typedef struct
     ptr_ANativeWindowPriv_lock lock;
     ptr_ANativeWindowPriv_queue queue;
     ptr_ANativeWindowPriv_cancel cancel;
+    ptr_ANativeWindowPriv_setOrientation setOrientation;
 } native_window_priv_api_t;
 
 /* Fill the structure passed as parameter and return 0 if all symbols are



More information about the vlc-commits mailing list