Commit 027663d0 authored by Thomas Guillem's avatar Thomas Guillem

android: remove jni_IsVideoPlayerActivityCreated

VideoPlayer is now started when surfaces are available.

If no surfaces are available, don't wait for it, and return an error (and
fallback to audio only).
parent 6ce78b99
...@@ -55,7 +55,6 @@ extern JNIEnv *jni_get_env(const char *name); ...@@ -55,7 +55,6 @@ extern JNIEnv *jni_get_env(const char *name);
extern jobject jni_LockAndGetAndroidJavaSurface(); extern jobject jni_LockAndGetAndroidJavaSurface();
extern void jni_UnlockAndroidSurface(); extern void jni_UnlockAndroidSurface();
extern void jni_EventHardwareAccelerationError(); extern void jni_EventHardwareAccelerationError();
extern bool jni_IsVideoPlayerActivityCreated();
/* Implementation of a circular buffer of timestamps with overwriting /* Implementation of a circular buffer of timestamps with overwriting
* of older values. MediaCodec has only one type of timestamp, if a * of older values. MediaCodec has only one type of timestamp, if a
...@@ -581,10 +580,7 @@ loopclean: ...@@ -581,10 +580,7 @@ loopclean:
(*env)->DeleteLocalRef(env, bytebuf); (*env)->DeleteLocalRef(env, bytebuf);
} }
/* If the VideoPlayerActivity is not started, MediaCodec opaque p_sys->direct_rendering = var_InheritBool(p_dec, CFG_PREFIX "dr");
direct rendering should be disabled since no surface will be
attached to the JNI. */
p_sys->direct_rendering = jni_IsVideoPlayerActivityCreated() && var_InheritBool(p_dec, CFG_PREFIX "dr");
/* There is no way to rotate the video using direct rendering (and using a /* There is no way to rotate the video using direct rendering (and using a
* SurfaceView) before API 21 (Lollipop). Therefore, we deactivate direct * SurfaceView) before API 21 (Lollipop). Therefore, we deactivate direct
......
...@@ -71,7 +71,6 @@ ...@@ -71,7 +71,6 @@
extern JNIEnv *jni_get_env(const char *name); extern JNIEnv *jni_get_env(const char *name);
extern jobject jni_LockAndGetAndroidJavaSurface(); extern jobject jni_LockAndGetAndroidJavaSurface();
extern void jni_UnlockAndroidSurface(); extern void jni_UnlockAndroidSurface();
extern bool jni_IsVideoPlayerActivityCreated();
#endif #endif
/***************************************************************************** /*****************************************************************************
...@@ -1077,7 +1076,7 @@ static int OpenGeneric( vlc_object_t *p_this, bool b_encode ) ...@@ -1077,7 +1076,7 @@ static int OpenGeneric( vlc_object_t *p_this, bool b_encode )
p_sys->in.p_fmt = &p_dec->fmt_in; p_sys->in.p_fmt = &p_dec->fmt_in;
OMX_FIFO_INIT (&p_sys->out.fifo, pInputPortPrivate ); OMX_FIFO_INIT (&p_sys->out.fifo, pInputPortPrivate );
#if defined(USE_IOMX) #if defined(USE_IOMX)
p_sys->out.b_direct = jni_IsVideoPlayerActivityCreated() && var_InheritBool(p_dec, CFG_PREFIX "dr"); p_sys->out.b_direct = var_InheritBool(p_dec, CFG_PREFIX "dr");
#else #else
p_sys->out.b_direct = false; p_sys->out.b_direct = false;
#endif #endif
......
...@@ -72,7 +72,6 @@ extern jobject jni_LockAndGetAndroidJavaSurface(); ...@@ -72,7 +72,6 @@ extern jobject jni_LockAndGetAndroidJavaSurface();
extern jobject jni_LockAndGetSubtitlesSurface(); extern jobject jni_LockAndGetSubtitlesSurface();
extern void jni_UnlockAndroidSurface(); extern void jni_UnlockAndroidSurface();
extern bool jni_IsVideoPlayerActivityCreated();
extern void jni_SetSurfaceLayout(int width, int height, int visible_width, int visible_height, int sar_num, int sar_den); extern void jni_SetSurfaceLayout(int width, int height, int visible_width, int visible_height, int sar_num, int sar_den);
extern int jni_ConfigureSurface(jobject jsurf, int width, int height, int hal, bool *configured); extern int jni_ConfigureSurface(jobject jsurf, int width, int height, int hal, bool *configured);
extern int jni_GetWindowSize(int *width, int *height); extern int jni_GetWindowSize(int *width, int *height);
...@@ -638,13 +637,6 @@ static int Open(vlc_object_t *p_this) ...@@ -638,13 +637,6 @@ static int Open(vlc_object_t *p_this)
if (vout_display_IsWindowed(vd)) if (vout_display_IsWindowed(vd))
return VLC_EGENERIC; return VLC_EGENERIC;
/* XXX: android_window use a surface created by VideoPlayerActivity to
* alloc pictures. Don't try to open the vout if this activity is not
* created. This need to be replaced by something like var_CreateGetAddress
* (vd, "drawable-android") in the future. */
if (!jni_IsVideoPlayerActivityCreated())
return VLC_EGENERIC;
/* Allocate structure */ /* Allocate structure */
vd->sys = sys = (struct vout_display_sys_t*)calloc(1, sizeof(*sys)); vd->sys = sys = (struct vout_display_sys_t*)calloc(1, sizeof(*sys));
if (!sys) if (!sys)
......
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