[vlc-commits] nativewindowpriv: fix connect before ics

Thomas Guillem git at videolan.org
Sat Nov 15 12:27:22 CET 2014


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Nov 14 17:09:56 2014 +0100| [c9640234ce3d46a5a7e3e735c98d83bbb62ba426] | committer: Jean-Baptiste Kempf

nativewindowpriv: fix connect before ics

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

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

 modules/video_output/android/nativewindowpriv.c |   30 ++++++++++++++++-------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/modules/video_output/android/nativewindowpriv.c b/modules/video_output/android/nativewindowpriv.c
index 446f9b3..3c382bb 100644
--- a/modules/video_output/android/nativewindowpriv.c
+++ b/modules/video_output/android/nativewindowpriv.c
@@ -77,6 +77,24 @@ struct native_window_priv
     }\
 } while (0)
 
+static int window_connect( ANativeWindow *anw )
+{
+#if ANDROID_API >= 14
+    return native_window_api_connect( anw, NATIVE_WINDOW_API_MEDIA );
+#else
+    return native_window_connect( anw, NATIVE_WINDOW_API_EGL );
+#endif
+}
+
+static int window_disconnect( ANativeWindow *anw )
+{
+#if ANDROID_API >= 14
+    return native_window_api_disconnect( anw, NATIVE_WINDOW_API_MEDIA );
+#else
+    return native_window_disconnect( anw, NATIVE_WINDOW_API_EGL );
+#endif
+}
+
 native_window_priv *ANativeWindowPriv_connect( void *window )
 {
     native_window_priv *priv;
@@ -93,19 +111,15 @@ native_window_priv *ANativeWindowPriv_connect( void *window )
                         &module ) != 0 )
         return NULL;
 
-#if ANDROID_API >= 14
-    if (native_window_api_connect( anw, NATIVE_WINDOW_API_MEDIA ) != 0) {
+    if( window_connect( anw ) != 0 ) {
         LOGE( "native_window_api_connect FAIL"  );
         return NULL;
     }
-#endif
 
     priv = calloc( 1, sizeof(native_window_priv) );
 
     if( !priv ) {
-#if ANDROID_API >= 14
-        native_window_api_disconnect( anw, NATIVE_WINDOW_API_MEDIA );
-#endif
+        window_disconnect( anw );
         return NULL;
     }
     priv->anw = anw;
@@ -116,9 +130,7 @@ native_window_priv *ANativeWindowPriv_connect( void *window )
 
 int ANativeWindowPriv_disconnect( native_window_priv *priv )
 {
-#if ANDROID_API >= 14
-    native_window_api_disconnect( priv->anw, NATIVE_WINDOW_API_MEDIA );
-#endif
+    window_disconnect( priv->anw );
     free(priv);
 
     return 0;



More information about the vlc-commits mailing list