]> git.sesse.net Git - vlc/commitdiff
nativewindowpriv: split setup into setUsage and setBuffersGeometry
authorThomas Guillem <thomas@gllm.fr>
Thu, 22 Jan 2015 11:48:26 +0000 (12:48 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 22 Jan 2015 14:08:33 +0000 (15:08 +0100)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/codec/omxil/omxil.c
modules/video_output/android/android_window.c
modules/video_output/android/nativewindowpriv.c
modules/video_output/android/utils.c
modules/video_output/android/utils.h

index 03814d0f118ae2e31ea8bfe25f88e8d1f07e40b4..9bdedc5b0e79b24eeae4fe5196e6e3673eb06a31 100644 (file)
@@ -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;
     }
 
index 7316fab5f32cd1bd24f133f0745c3c6b09b5b26a..c956d24450805f91d6b32d9015cd5bae10d342c9 100644 (file)
@@ -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,
index 7564216d09a9a81b38e2ea14b7a17c0853528513..b38e73d7866ead5fe87014f49224a9e92e298a12 100644 (file)
@@ -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();
index 37f9e4f091b6d74096d433968064f412440ef0e5..93b57ade2db5b8b0afb51deeddee72d01d3dd1ed 100644 (file)
@@ -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;
 }
index 96d4f862d122bd7fe2340b0ea797422bd040e24c..2c649ccc3f90683870c3a09d35ee4d3f0a45c587 100644 (file)
@@ -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;