]> git.sesse.net Git - vlc/commitdiff
audio methods aligned to libvlc audio functions
authorFilippo Carone <littlejohn@videolan.org>
Thu, 11 Jan 2007 23:43:18 +0000 (23:43 +0000)
committerFilippo Carone <littlejohn@videolan.org>
Thu, 11 Jan 2007 23:43:18 +0000 (23:43 +0000)
bindings/java/VLCExample.java
bindings/java/org/videolan/jvlc/Audio.java
bindings/java/org/videolan/jvlc/AudioIntf.java
bindings/java/src/audio-jni.cc

index c6e0fd150d55f47b9b6f3e8744db620c7b6df442..b02946b56bfed6dfe564e424444e96714a4315fe 100644 (file)
@@ -67,16 +67,16 @@ public class VLCExample
             System.out.print("Setting volume to 150... ");
             jvlc.audio.setVolume(150);
             System.out.println("done");
-            System.out.println("Audio channel info: " + jvlc.audio.getChannel());
-            System.out.println("Audio track info: " + jvlc.audio.getTrack());
-            System.out.print("Setting left channel... ");
-            jvlc.audio.setChannel("left");
-            System.out.print("done.");
-            Thread.sleep(3000);
-            System.out.print("Setting right channel... ");
-            jvlc.audio.setChannel(AudioIntf.RIGHT_CHANNEL);
-            System.out.print("done.");
-            Thread.sleep(3000);
+//            System.out.println("Audio channel info: " + jvlc.audio.getChannel());
+//            System.out.println("Audio track info: " + jvlc.audio.getTrack());
+//            System.out.print("Setting left channel... ");
+//            jvlc.audio.setChannel("left");
+//            System.out.print("done.");
+//            Thread.sleep(3000);
+//            System.out.print("Setting right channel... ");
+//            jvlc.audio.setChannel(AudioIntf.RIGHT_CHANNEL);
+//            System.out.print("done.");
+//            Thread.sleep(3000);
             System.out.println("INPUT INFORMATION");
             System.out.println("-----------------");
             System.out.println("Total length   (ms) :\t" + jvlc.input.getLength());
index c94e317e2318d82936a90f2f34c07a71938998be..45b1f40deae5a9b80622101e4a62f6aebd139195 100644 (file)
@@ -6,8 +6,8 @@ public class Audio implements AudioIntf {
 
        private native int      _getTrack();
        private native void     _setTrack(int track);
-       private native String   _getChannel();
-       private native void     _setChannel(String channel);
+       private native int          _getChannel();
+       private native void     _setChannel(int channel);
        private native boolean  _getMute();
     private native void                _setMute( boolean value );
     private native void                _toggleMute();
@@ -26,11 +26,11 @@ public class Audio implements AudioIntf {
                _setTrack(track);
        }
 
-       public String getChannel() throws VLCException {
+       public int getChannel() throws VLCException {
                return _getChannel();
        }
 
-       public void setChannel( String channel ) throws VLCException {
+       public void setChannel( int channel ) throws VLCException {
                _setChannel(channel);
        }    
     
index 1dd7b9e1436186384c50a8f8937b664736667521..090aeffa50c010604485bb785338888a1beb1555 100644 (file)
@@ -71,13 +71,13 @@ public interface AudioIntf {
         * @return channel
         * @throws VLCException
         */
-       String getChannel() throws VLCException;
+       int getChannel() throws VLCException;
 
        /**
         * @param channel
         * @throws VLCException
         */
-       void setChannel(String channel) throws VLCException;
+       void setChannel(int channel) throws VLCException;
 
 
     /**
index cf0549f808fd8e0c77e1eaf8f7f089a8dd174a85..8703325061dfb7dd692ecbf657e022e673b3c575 100644 (file)
@@ -57,29 +57,23 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setTrack (JNIEnv *env, job
     CHECK_EXCEPTION_FREE;
 }
 
-JNIEXPORT jstring JNICALL Java_org_videolan_jvlc_Audio__1getChannel (JNIEnv *env, jobject _this)
+JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Audio__1getChannel (JNIEnv *env, jobject _this)
 {
     INIT_FUNCTION;
 
-    char* res;
-
-    res = libvlc_audio_get_channel( ( libvlc_instance_t * ) instance, exception);
+    int res = libvlc_audio_get_channel( ( libvlc_instance_t * ) instance, exception);
 
     CHECK_EXCEPTION_FREE;
 
-    return env->NewStringUTF(res);
+    return res;
 }
 
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setChannel (JNIEnv *env, jobject _this, jstring channel)
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setChannel (JNIEnv *env, jobject _this, jint channel)
 {
     INIT_FUNCTION;
 
-    const char* value = env->GetStringUTFChars( channel, 0 );
+    libvlc_audio_set_channel( (libvlc_instance_t *) instance, channel, exception);
 
-    libvlc_audio_set_channel( (libvlc_instance_t *) instance, (char *) value, exception);
-
-    env->ReleaseStringUTFChars( channel, value );
-    
     CHECK_EXCEPTION_FREE;
 }