GET_INPUT_THREAD ;
- libvlc_toggle_fullscreen( input, exception );
+ libvlc_toggle_fullscreen( input, &exception );
- CHECK_EXCEPTION_FREE ;
+ libvlc_media_instance_release(input);
+
+ CHECK_EXCEPTION ;
}
JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1setFullscreen (JNIEnv *env, jobject _this, jboolean value)
GET_INPUT_THREAD ;
- libvlc_set_fullscreen( input, value, exception );
+ libvlc_set_fullscreen( input, value, &exception );
- CHECK_EXCEPTION_FREE ;
+ libvlc_media_instance_release(input);
+ CHECK_EXCEPTION ;
}
JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_Video__1getFullscreen (JNIEnv *env, jobject _this)
GET_INPUT_THREAD ;
- res = libvlc_get_fullscreen( input, exception );
+ res = libvlc_get_fullscreen( input, &exception );
- CHECK_EXCEPTION_FREE ;
+ libvlc_media_instance_release(input);
+ CHECK_EXCEPTION ;
return res;
}
GET_INPUT_THREAD ;
- res = libvlc_video_get_height( input, exception );
+ res = libvlc_video_get_height( input, &exception );
- CHECK_EXCEPTION_FREE ;
+ libvlc_media_instance_release(input);
+ CHECK_EXCEPTION ;
return res;
}
GET_INPUT_THREAD ;
- res = libvlc_video_get_width( input, exception );
+ res = libvlc_video_get_width( input, &exception );
- CHECK_EXCEPTION_FREE ;
+ libvlc_media_instance_release(input);
+ CHECK_EXCEPTION ;
return res;
}
GET_INPUT_THREAD ;
- libvlc_video_take_snapshot( input, (char *) psz_filepath, exception );
+ libvlc_video_take_snapshot( input, (char *) psz_filepath, &exception );
- CHECK_EXCEPTION_FREE ;
+ libvlc_media_instance_release(input);
+ CHECK_EXCEPTION ;
if (psz_filepath != NULL) {
env->ReleaseStringUTFChars( filepath, psz_filepath );
GET_INPUT_THREAD ;
- libvlc_video_destroy( input, exception );
+ libvlc_video_destroy( input, &exception );
- CHECK_EXCEPTION_FREE;
+ libvlc_media_instance_release(input);
+ CHECK_EXCEPTION;
}
JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1reparent (JNIEnv *env, jobject _this, jobject canvas)
GET_INPUT_THREAD ;
+ libvlc_drawable_t drawable;
+
JAWT awt;
JAWT_DrawingSurface* ds;
JAWT_DrawingSurfaceInfo* dsi;
#endif
jint lock;
- vlc_value_t value;
-
/* Get the AWT */
awt.version = JAWT_VERSION_1_3;
if (JAWT_GetAWT(env, &awt) == JNI_FALSE) {
printf("AWT Not found\n");
+ libvlc_media_instance_release(input);
return;
}
ds = awt.GetDrawingSurface(env, canvas);
if (ds == NULL) {
printf("NULL drawing surface\n");
+ libvlc_media_instance_release(input);
return;
}
if((lock & JAWT_LOCK_ERROR) != 0) {
printf("Error locking surface\n");
awt.FreeDrawingSurface(ds);
+ libvlc_media_instance_release(input);
return;
}
printf("Error getting surface info\n");
ds->Unlock(ds);
awt.FreeDrawingSurface(ds);
+ libvlc_media_instance_release(input);
return;
}
#ifdef WIN32
/* Get the platform-specific drawing info */
dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
+ drawable = reinterpret_cast<int>(dsi_win->hwnd);
- libvlc_video_reparent( input, (libvlc_drawable_t)dsi_win->hwnd, exception );
+ libvlc_video_set_parent((libvlc_instance_t *) instance, drawable, &exception );
+ libvlc_media_instance_release(input);
- CHECK_EXCEPTION_FREE ;
+ CHECK_EXCEPTION ;
+#else // UNIX
+ /* Get the platform-specific drawing info */
+
+ dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo;
+
/* Now paint */
- value.i_int = reinterpret_cast<int>(dsi_win->hwnd);
- VLC_VariableSet( 1, "drawable", value );
+ gc = XCreateGC(dsi_x11->display, dsi_x11->drawable, 0, 0);
+ XSetBackground(dsi_x11->display, gc, 0);
+
+ /* and reparent */
+ drawable = dsi_x11->drawable;
+ libvlc_video_set_parent( (libvlc_instance_t *) instance, drawable, &exception );
+
+ CHECK_EXCEPTION ;
+
+ XFreeGC(dsi_x11->display, gc);
+
+#endif
+ /* Free the drawing surface info */
+ ds->FreeDrawingSurfaceInfo(dsi);
+
+ /* Unlock the drawing surface */
+ ds->Unlock(ds);
+
+ /* Free the drawing surface */
+ awt.FreeDrawingSurface(ds);
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1paint (JNIEnv *env, jobject _this, jobject canvas, jobject graphics)
+{
+ INIT_FUNCTION ;
+
+ libvlc_drawable_t drawable;
+
+ JAWT awt;
+ JAWT_DrawingSurface* ds;
+ JAWT_DrawingSurfaceInfo* dsi;
+#ifdef WIN32
+ JAWT_Win32DrawingSurfaceInfo* dsi_win;
+#else
+ JAWT_X11DrawingSurfaceInfo* dsi_x11;
+ GC gc;
+#endif
+ jint lock;
+
+ /* Get the AWT */
+ awt.version = JAWT_VERSION_1_3;
+ if (JAWT_GetAWT(env, &awt) == JNI_FALSE) {
+ printf("AWT Not found\n");
+ return;
+ }
+ /* Get the drawing surface */
+ ds = awt.GetDrawingSurface(env, canvas);
+ if (ds == NULL) {
+ printf("NULL drawing surface\n");
+ return;
+ }
+
+ /* Lock the drawing surface */
+ lock = ds->Lock(ds);
+ if((lock & JAWT_LOCK_ERROR) != 0) {
+ printf("Error locking surface\n");
+ awt.FreeDrawingSurface(ds);
+ return;
+ }
+
+ /* Get the drawing surface info */
+ dsi = ds->GetDrawingSurfaceInfo(ds);
+ if (dsi == NULL) {
+ printf("Error getting surface info\n");
+ ds->Unlock(ds);
+ awt.FreeDrawingSurface(ds);
+ return;
+ }
+
+
+#ifdef WIN32
+ /* Get the platform-specific drawing info */
+ dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
+ drawable = reinterpret_cast<int>(dsi_win->hwnd);
+
+ libvlc_video_set_parent( (libvlc_instance_t *) instance, drawable, &exception );
+
+ CHECK_EXCEPTION ;
+
#else // UNIX
/* Get the platform-specific drawing info */
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_set_parent( (libvlc_instance_t *) instance, drawable, &exception );
- CHECK_EXCEPTION_FREE ;
+ CHECK_EXCEPTION ;
- /* also update the drawable variable value */
- value.i_int = dsi_x11->drawable;
- VLC_VariableSet( 0, "drawable", value );
-
XFreeGC(dsi_x11->display, gc);
#endif
awt.FreeDrawingSurface(ds);
}
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1setSize__II (JNIEnv *env, jobject _this, jint width, jint height)
+
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1setSize (JNIEnv *env, jobject _this, jint width, jint height)
{
INIT_FUNCTION ;
GET_INPUT_THREAD ;
- libvlc_video_resize( input, width, height, exception );
+ libvlc_video_resize( input, width, height, &exception );
- CHECK_EXCEPTION_FREE ;
+ libvlc_media_instance_release(input);
+ CHECK_EXCEPTION ;
}