diff --git a/bindings/java/src/graphics-jni.cc b/bindings/java/src/graphics-jni.cc index 6627feccde..634aca727e 100644 --- a/bindings/java/src/graphics-jni.cc +++ b/bindings/java/src/graphics-jni.cc @@ -97,7 +97,7 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLCCanvas_paint (JNIEnv *env, job drawable = reinterpret_cast(dsi_win->hwnd); long vlcInstance = getJVLCInstance( env, canvas ); - libvlc_set_video_drawable( (libvlc_instance_t *) vlcInstance, drawable, exception ); + libvlc_video_set_parent( (libvlc_instance_t *) vlcInstance, drawable, exception ); #else // UNIX /* Get the platform-specific drawing info */ @@ -109,7 +109,7 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLCCanvas_paint (JNIEnv *env, job drawable = dsi_x11->drawable; long vlcInstance = getJVLCInstance( env, canvas ); - libvlc_set_video_drawable( (libvlc_instance_t *)vlcInstance, drawable, exception ); + libvlc_video_set_parent( (libvlc_instance_t *)vlcInstance, drawable, exception ); XFreeGC(dsi_x11->display, gc); diff --git a/bindings/java/src/video-jni.cc b/bindings/java/src/video-jni.cc index 0700d8ed53..161b52dd08 100644 --- a/bindings/java/src/video-jni.cc +++ b/bindings/java/src/video-jni.cc @@ -133,6 +133,8 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1reparent (JNIEnv *env, job GET_INPUT_THREAD ; + libvlc_drawable_t drawable; + JAWT awt; JAWT_DrawingSurface* ds; JAWT_DrawingSurfaceInfo* dsi; @@ -144,8 +146,6 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1reparent (JNIEnv *env, job #endif jint lock; - vlc_value_t value; - /* Get the AWT */ awt.version = JAWT_VERSION_1_3; if (JAWT_GetAWT(env, &awt) == JNI_FALSE) { @@ -181,15 +181,12 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1reparent (JNIEnv *env, job #ifdef WIN32 /* Get the platform-specific drawing info */ dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo; + drawable = reinterpret_cast(dsi_win->hwnd); - libvlc_video_reparent( input, (libvlc_drawable_t)dsi_win->hwnd, exception ); + libvlc_video_reparent( input, drawable, exception ); CHECK_EXCEPTION_FREE ; - /* Now paint */ - value.i_int = reinterpret_cast(dsi_win->hwnd); - VLC_VariableSet( 1, "drawable", value ); - #else // UNIX /* Get the platform-specific drawing info */ @@ -200,14 +197,11 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1reparent (JNIEnv *env, job XSetBackground(dsi_x11->display, gc, 0); /* and reparent */ - libvlc_video_reparent( input, (libvlc_drawable_t)dsi_x11->drawable, exception ); + drawable = dsi_x11->drawable; + libvlc_video_reparent( input, drawable, exception ); CHECK_EXCEPTION_FREE ; - /* also update the drawable variable value */ - value.i_int = dsi_x11->drawable; - VLC_VariableSet( 0, "drawable", value ); - XFreeGC(dsi_x11->display, gc); #endif diff --git a/include/vlc/libvlc.h b/include/vlc/libvlc.h index 40e0ec3fa3..10a8b7400d 100644 --- a/include/vlc/libvlc.h +++ b/include/vlc/libvlc.h @@ -297,14 +297,6 @@ typedef int libvlc_drawable_t; vlc_bool_t libvlc_input_has_vout ( libvlc_input_t *, libvlc_exception_t *); float libvlc_input_get_fps ( libvlc_input_t *, libvlc_exception_t *); -/** - * Toggle fullscreen status on video output - * \param p_input the input - * \param drawable the drawable where the video output thread will display the video - * \param p_exception an initialized exception - */ -void libvlc_set_video_drawable( libvlc_instance_t *, libvlc_drawable_t, libvlc_exception_t *); - /** * Toggle fullscreen status on video output * \param p_input the input diff --git a/src/control/video.c b/src/control/video.c index fd176cb0ad..1f7aaf7638 100644 --- a/src/control/video.c +++ b/src/control/video.c @@ -69,18 +69,6 @@ static vout_thread_t *GetVout( libvlc_input_t *p_input, * Exported functions **********************************************************************/ -void libvlc_set_video_drawable( libvlc_instance_t *p_instance, - libvlc_drawable_t drawable, - libvlc_exception_t *p_e ) -{ - vlc_value_t value; - value.i_int = drawable; - - var_Set( p_instance->p_libvlc_int, "drawable", value); -} - - - void libvlc_set_fullscreen( libvlc_input_t *p_input, int b_fullscreen, libvlc_exception_t *p_e ) { @@ -226,6 +214,13 @@ int libvlc_video_reparent( libvlc_input_t *p_input, libvlc_drawable_t d, libvlc_exception_t *p_e ) { vout_thread_t *p_vout = GetVout( p_input, p_e ); + + if ( p_vout == NULL) + { + /// \todo: set exception + return 0; + } + vout_Control( p_vout , VOUT_REPARENT, d); vlc_object_release( p_vout ); @@ -242,7 +237,7 @@ void libvlc_video_resize( libvlc_input_t *p_input, int width, int height, libvlc /* global video settings */ void libvlc_video_set_parent( libvlc_instance_t *p_instance, libvlc_drawable_t d, - libvlc_exception_t *p_e ) + libvlc_exception_t *p_e ) { /* set as default for future vout instances */ var_SetInteger(p_instance->p_libvlc_int, "drawable", (int)d);