]> git.sesse.net Git - vlc/commitdiff
Add libvlc_media_instance_release(input) call to correctly release
authorPhilippe Morin <phmo95@videolan.org>
Sun, 15 Jul 2007 08:06:29 +0000 (08:06 +0000)
committerPhilippe Morin <phmo95@videolan.org>
Sun, 15 Jul 2007 08:06:29 +0000 (08:06 +0000)
the media instance.

bindings/java/src/audio-jni.cc
bindings/java/src/input-jni.cc
bindings/java/src/video-jni.cc

index 8703325061dfb7dd692ecbf657e022e673b3c575..efd50edc1983858b25c878c3a20695d070dda597 100644 (file)
@@ -41,7 +41,8 @@ JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Audio__1getTrack (JNIEnv *env, job
     jint res = 0;
     
     res = libvlc_audio_get_track( input, exception );
-    
+    libvlc_media_instance_release(input);   
     CHECK_EXCEPTION_FREE;
     
     return res;
@@ -54,6 +55,7 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setTrack (JNIEnv *env, job
 
     libvlc_audio_set_track( input, value, exception );
 
+    libvlc_media_instance_release(input);   
     CHECK_EXCEPTION_FREE;
 }
 
index 714fa31d0b738ee205f2880de8ab998c326c34bf..4141aa2e841051194110ce30d8c6726d3492e3ca 100644 (file)
@@ -39,6 +39,8 @@ JNIEXPORT jlong JNICALL Java_org_videolan_jvlc_Input__1getLength (JNIEnv *env, j
     GET_INPUT_THREAD ;
 
     res = libvlc_media_instance_get_length( input, exception );
+
+    libvlc_media_instance_release(input);
     CHECK_EXCEPTION_FREE;
 
     return res;
@@ -52,6 +54,7 @@ JNIEXPORT jfloat JNICALL Java_org_videolan_jvlc_Input__1getPosition (JNIEnv *env
     GET_INPUT_THREAD ;
 
     res = libvlc_media_instance_get_position( input, exception );
+    libvlc_media_instance_release(input);
     CHECK_EXCEPTION_FREE;
 
     return res;
@@ -65,6 +68,7 @@ JNIEXPORT jlong JNICALL Java_org_videolan_jvlc_Input__1getTime (JNIEnv *env, job
     GET_INPUT_THREAD ;
 
     res = libvlc_media_instance_get_time( input, exception );
+    libvlc_media_instance_release(input);
     CHECK_EXCEPTION_FREE ;
 
     return res;
@@ -78,6 +82,7 @@ JNIEXPORT jfloat JNICALL Java_org_videolan_jvlc_Input__1getFPS (JNIEnv *env, job
     GET_INPUT_THREAD ;
 
     res = libvlc_media_instance_get_fps( input, exception );
+    libvlc_media_instance_release(input);
     CHECK_EXCEPTION_FREE ;
 
     return res;
@@ -90,6 +95,7 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Input__1setTime (JNIEnv *env, jobj
     GET_INPUT_THREAD ;
 
     libvlc_media_instance_set_time( input, time, exception );
+    libvlc_media_instance_release(input);
     CHECK_EXCEPTION_FREE;
         
 }
@@ -101,6 +107,7 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Input__1setPosition (JNIEnv *env,
     GET_INPUT_THREAD ;
 
     libvlc_media_instance_set_position( input, position, exception );
+    libvlc_media_instance_release(input);
     CHECK_EXCEPTION_FREE;
 }
 
@@ -112,6 +119,7 @@ JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_Input__1isPlaying (JNIEnv *env
     GET_INPUT_THREAD ;
     
     res = libvlc_media_instance_will_play( input, exception );
+    libvlc_media_instance_release(input);
     CHECK_EXCEPTION_FREE ;
     
     return res;
@@ -125,6 +133,7 @@ JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_Input__1hasVout (JNIEnv *env,
     GET_INPUT_THREAD ;
     
     res = libvlc_media_instance_has_vout( input, exception );
+    libvlc_media_instance_release(input);
     CHECK_EXCEPTION_FREE ;
     
     return res;
index 15645dc5a996a4a2fcd65d4aebfcb04ed424da46..d933c742c5200dd5ef654e45298a9d9216f274d4 100644 (file)
@@ -42,6 +42,8 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1toggleFullscreen (JNIEnv *
     
     libvlc_toggle_fullscreen( input, exception );
 
+    libvlc_media_instance_release(input);
+
     CHECK_EXCEPTION_FREE ;
 }
 
@@ -53,6 +55,7 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1setFullscreen (JNIEnv *env
 
     libvlc_set_fullscreen( input, value, exception );
 
+    libvlc_media_instance_release(input);
     CHECK_EXCEPTION_FREE ;
 }
 
@@ -65,6 +68,7 @@ JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_Video__1getFullscreen (JNIEnv
 
     res = libvlc_get_fullscreen( input, exception );
 
+    libvlc_media_instance_release(input);
     CHECK_EXCEPTION_FREE ;
     
     return res;
@@ -79,6 +83,7 @@ JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Video__1getHeight (JNIEnv *env, jo
 
     res = libvlc_video_get_height( input, exception );
 
+    libvlc_media_instance_release(input);
     CHECK_EXCEPTION_FREE ;
 
     return res;
@@ -93,6 +98,7 @@ JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Video__1getWidth (JNIEnv *env, job
 
     res = libvlc_video_get_width( input, exception );
 
+    libvlc_media_instance_release(input);
     CHECK_EXCEPTION_FREE ;
 
     return res;
@@ -108,6 +114,7 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1getSnapshot (JNIEnv *env,
 
     libvlc_video_take_snapshot( input, (char *) psz_filepath, exception );
 
+    libvlc_media_instance_release(input);
     CHECK_EXCEPTION_FREE ;
     
     if (psz_filepath != NULL) {
@@ -124,6 +131,7 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1destroyVideo (JNIEnv *env,
 
     libvlc_video_destroy( input, exception );
 
+    libvlc_media_instance_release(input);
     CHECK_EXCEPTION_FREE;
 }
 
@@ -150,6 +158,7 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1reparent (JNIEnv *env, job
     awt.version = JAWT_VERSION_1_3;
     if (JAWT_GetAWT(env, &awt) == JNI_FALSE) {
         printf("AWT Not found\n");
+       libvlc_media_instance_release(input);
         return;
     }
 
@@ -157,6 +166,7 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1reparent (JNIEnv *env, job
     ds = awt.GetDrawingSurface(env, canvas);
     if (ds == NULL) {
         printf("NULL drawing surface\n");
+       libvlc_media_instance_release(input);
         return;
     }
 
@@ -165,6 +175,7 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1reparent (JNIEnv *env, job
     if((lock & JAWT_LOCK_ERROR) != 0) {
         printf("Error locking surface\n");
         awt.FreeDrawingSurface(ds);
+       libvlc_media_instance_release(input);
         return;
     }
 
@@ -174,6 +185,7 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1reparent (JNIEnv *env, job
         printf("Error getting surface info\n");
         ds->Unlock(ds);
         awt.FreeDrawingSurface(ds);
+       libvlc_media_instance_release(input);
         return;
     }
 
@@ -184,6 +196,7 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1reparent (JNIEnv *env, job
     drawable = reinterpret_cast<int>(dsi_win->hwnd);
 
     libvlc_video_set_parent((libvlc_instance_t *) instance, drawable, exception );
+    libvlc_media_instance_release(input);
 
     CHECK_EXCEPTION_FREE ;
     
@@ -311,5 +324,6 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1setSize (JNIEnv *env, jobj
     
     libvlc_video_resize( input, width, height, exception );
 
+    libvlc_media_instance_release(input);
     CHECK_EXCEPTION_FREE ;
 }