[vlc-commits] nativewindowpriv: split setup into setUsage and setBuffersGeometry

Thomas Guillem git at videolan.org
Thu Jan 22 15:08:37 CET 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jan 22 12:48:26 2015 +0100| [aadd0e16a6f5acf52e6c2d705c7fa4c8b7bae0f1] | committer: Jean-Baptiste Kempf

nativewindowpriv: split setup into setUsage and setBuffersGeometry

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

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

 modules/codec/omxil/omxil.c                     |   20 ++++++++++++--------
 modules/video_output/android/android_window.c   |   11 +++++++----
 modules/video_output/android/nativewindowpriv.c |   14 +++++++++++---
 modules/video_output/android/utils.c            |    9 +++++----
 modules/video_output/android/utils.h            |    6 ++++--
 5 files changed, 39 insertions(+), 21 deletions(-)

diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index 03814d0..9bdedc5 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -2215,14 +2215,18 @@ static int HwBuffer_AllocateBuffers( decoder_t *p_dec, OmxPort *p_port )
                                                  i_angle );
     }
 
-    if( p_port->p_hwbuf->anwpriv.setup( p_port->p_hwbuf->window_priv,
-                                        def->format.video.nFrameWidth,
-                                        def->format.video.nFrameHeight,
-                                        colorFormat,
-                                        true,
-                                        (int) i_hw_usage ) != 0 )
-    {
-        msg_Err( p_dec, "can't setup OMXHWBuffer" );
+    if( p_port->p_hwbuf->anwpriv.setUsage( p_port->p_hwbuf->window_priv,
+                                           true, (int) i_hw_usage ) != 0 )
+    {
+        msg_Err( p_dec, "can't set usage" );
+        goto error;
+    }
+    if( p_port->p_hwbuf->anwpriv.setBuffersGeometry( p_port->p_hwbuf->window_priv,
+                                                     def->format.video.nFrameWidth,
+                                                     def->format.video.nFrameHeight,
+                                                     colorFormat ) != 0 )
+    {
+        msg_Err( p_dec, "can't set buffers geometry" );
         goto error;
     }
 
diff --git a/modules/video_output/android/android_window.c b/modules/video_output/android/android_window.c
index 7316fab..c956d24 100644
--- a/modules/video_output/android/android_window.c
+++ b/modules/video_output/android/android_window.c
@@ -384,10 +384,13 @@ static int AndroidWindow_SetupANWP(vout_display_sys_t *sys,
     if (!p_window->p_handle_priv)
         goto error;
 
-    if (sys->anwp.setup(p_window->p_handle_priv,
-                        p_window->fmt.i_width, p_window->fmt.i_height,
-                        p_window->i_android_hal,
-                        false, 0) != 0)
+    if (sys->anwp.setUsage(p_window->p_handle_priv, false, 0) != 0)
+        goto error;
+
+    if (sys->anwp.setBuffersGeometry(p_window->p_handle_priv,
+                                     p_window->fmt.i_width,
+                                     p_window->fmt.i_height,
+                                     p_window->i_android_hal) != 0)
         goto error;
 
     sys->anwp.getMinUndequeued(p_window->p_handle_priv,
diff --git a/modules/video_output/android/nativewindowpriv.c b/modules/video_output/android/nativewindowpriv.c
index 7564216..b38e73d 100644
--- a/modules/video_output/android/nativewindowpriv.c
+++ b/modules/video_output/android/nativewindowpriv.c
@@ -144,12 +144,11 @@ int ANativeWindowPriv_disconnect( native_window_priv *priv )
     return 0;
 }
 
-int ANativeWindowPriv_setup( native_window_priv *priv, int w, int h, int hal_format, bool is_hw, int hw_usage )
+int ANativeWindowPriv_setUsage( native_window_priv *priv,  bool is_hw, int hw_usage )
 {
     status_t err;
 
-    LOGD( "setup: %p, %d, %d, %X, %X\n",
-          priv->anw, w, h, hal_format, hw_usage );
+    LOGD( "setUsage: %p, %d %X\n", priv->anw, is_hw, hw_usage );
 
     if( is_hw )
     {
@@ -164,6 +163,15 @@ int ANativeWindowPriv_setup( native_window_priv *priv, int w, int h, int hal_for
     err = native_window_set_usage( priv->anw, priv->usage );
     CHECK_ERR();
 
+    return 0;
+}
+
+int ANativeWindowPriv_setBuffersGeometry( native_window_priv *priv, int w, int h, int hal_format )
+{
+    status_t err;
+
+    LOGD( "setBuffersGeometry: %p, %d, %d", priv->anw, w, h );
+
 #if ANDROID_ICS_OR_LATER
     err = native_window_set_buffers_format( priv->anw, hal_format );
     CHECK_ERR();
diff --git a/modules/video_output/android/utils.c b/modules/video_output/android/utils.c
index 37f9e4f..93b57ad 100644
--- a/modules/video_output/android/utils.c
+++ b/modules/video_output/android/utils.c
@@ -57,7 +57,8 @@ int LoadNativeWindowPrivAPI(native_window_priv_api_t *native)
 {
     native->connect = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_connect");
     native->disconnect = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_disconnect");
-    native->setup = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_setup");
+    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");
@@ -70,9 +71,9 @@ int LoadNativeWindowPrivAPI(native_window_priv_api_t *native)
     native->cancel = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_cancel");
     native->setOrientation = dlsym(RTLD_DEFAULT, "ANativeWindowPriv_setOrientation");
 
-    return native->connect && native->disconnect && native->setup &&
-        native->getMinUndequeued && native->getMaxBufferCount &&
-        native->setBufferCount && native->setCrop &&
+    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;
 }
diff --git a/modules/video_output/android/utils.h b/modules/video_output/android/utils.h
index 96d4f86..2c649cc 100644
--- a/modules/video_output/android/utils.h
+++ b/modules/video_output/android/utils.h
@@ -73,7 +73,8 @@ static inline int ChromaToAndroidHal(vlc_fourcc_t i_chroma)
 typedef struct native_window_priv native_window_priv;
 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_setUsage) (native_window_priv *, bool, int );
+typedef int (*ptr_ANativeWindowPriv_setBuffersGeometry) (native_window_priv *, int, int, 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 );
@@ -90,7 +91,8 @@ typedef struct
 {
     ptr_ANativeWindowPriv_connect connect;
     ptr_ANativeWindowPriv_disconnect disconnect;
-    ptr_ANativeWindowPriv_setup setup;
+    ptr_ANativeWindowPriv_setUsage setUsage;
+    ptr_ANativeWindowPriv_setBuffersGeometry setBuffersGeometry;
     ptr_ANativeWindowPriv_getMinUndequeued getMinUndequeued;
     ptr_ANativeWindowPriv_getMaxBufferCount getMaxBufferCount;
     ptr_ANativeWindowPriv_setBufferCount setBufferCount;



More information about the vlc-commits mailing list