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)
VLCExample.java
org/videolan/jvlc/Audio.java
org/videolan/jvlc/AudioIntf.java
src/audio-jni.cc

index c6e0fd1..b02946b 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 c94e317..45b1f40 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 1dd7b9e..090aeff 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 cf0549f..8703325 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;
 }