Commit c9640234 authored by Thomas Guillem's avatar Thomas Guillem Committed by Jean-Baptiste Kempf

nativewindowpriv: fix connect before ics

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 65c6b73a
...@@ -77,6 +77,24 @@ struct native_window_priv ...@@ -77,6 +77,24 @@ struct native_window_priv
}\ }\
} while (0) } 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 *ANativeWindowPriv_connect( void *window )
{ {
native_window_priv *priv; native_window_priv *priv;
...@@ -93,19 +111,15 @@ native_window_priv *ANativeWindowPriv_connect( void *window ) ...@@ -93,19 +111,15 @@ native_window_priv *ANativeWindowPriv_connect( void *window )
&module ) != 0 ) &module ) != 0 )
return NULL; return NULL;
#if ANDROID_API >= 14 if( window_connect( anw ) != 0 ) {
if (native_window_api_connect( anw, NATIVE_WINDOW_API_MEDIA ) != 0) {
LOGE( "native_window_api_connect FAIL" ); LOGE( "native_window_api_connect FAIL" );
return NULL; return NULL;
} }
#endif
priv = calloc( 1, sizeof(native_window_priv) ); priv = calloc( 1, sizeof(native_window_priv) );
if( !priv ) { if( !priv ) {
#if ANDROID_API >= 14 window_disconnect( anw );
native_window_api_disconnect( anw, NATIVE_WINDOW_API_MEDIA );
#endif
return NULL; return NULL;
} }
priv->anw = anw; priv->anw = anw;
...@@ -116,9 +130,7 @@ native_window_priv *ANativeWindowPriv_connect( void *window ) ...@@ -116,9 +130,7 @@ native_window_priv *ANativeWindowPriv_connect( void *window )
int ANativeWindowPriv_disconnect( native_window_priv *priv ) int ANativeWindowPriv_disconnect( native_window_priv *priv )
{ {
#if ANDROID_API >= 14 window_disconnect( priv->anw );
native_window_api_disconnect( priv->anw, NATIVE_WINDOW_API_MEDIA );
#endif
free(priv); free(priv);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment