Commit d959364c authored by Filippo Carone's avatar Filippo Carone

audio methods aligned to libvlc audio functions

parent 4db4b3af
...@@ -67,16 +67,16 @@ public class VLCExample ...@@ -67,16 +67,16 @@ public class VLCExample
System.out.print("Setting volume to 150... "); System.out.print("Setting volume to 150... ");
jvlc.audio.setVolume(150); jvlc.audio.setVolume(150);
System.out.println("done"); System.out.println("done");
System.out.println("Audio channel info: " + jvlc.audio.getChannel()); // System.out.println("Audio channel info: " + jvlc.audio.getChannel());
System.out.println("Audio track info: " + jvlc.audio.getTrack()); // System.out.println("Audio track info: " + jvlc.audio.getTrack());
System.out.print("Setting left channel... "); // System.out.print("Setting left channel... ");
jvlc.audio.setChannel("left"); // jvlc.audio.setChannel("left");
System.out.print("done."); // System.out.print("done.");
Thread.sleep(3000); // Thread.sleep(3000);
System.out.print("Setting right channel... "); // System.out.print("Setting right channel... ");
jvlc.audio.setChannel(AudioIntf.RIGHT_CHANNEL); // jvlc.audio.setChannel(AudioIntf.RIGHT_CHANNEL);
System.out.print("done."); // System.out.print("done.");
Thread.sleep(3000); // Thread.sleep(3000);
System.out.println("INPUT INFORMATION"); System.out.println("INPUT INFORMATION");
System.out.println("-----------------"); System.out.println("-----------------");
System.out.println("Total length (ms) :\t" + jvlc.input.getLength()); System.out.println("Total length (ms) :\t" + jvlc.input.getLength());
......
...@@ -6,8 +6,8 @@ public class Audio implements AudioIntf { ...@@ -6,8 +6,8 @@ public class Audio implements AudioIntf {
private native int _getTrack(); private native int _getTrack();
private native void _setTrack(int track); private native void _setTrack(int track);
private native String _getChannel(); private native int _getChannel();
private native void _setChannel(String channel); private native void _setChannel(int channel);
private native boolean _getMute(); private native boolean _getMute();
private native void _setMute( boolean value ); private native void _setMute( boolean value );
private native void _toggleMute(); private native void _toggleMute();
...@@ -26,11 +26,11 @@ public class Audio implements AudioIntf { ...@@ -26,11 +26,11 @@ public class Audio implements AudioIntf {
_setTrack(track); _setTrack(track);
} }
public String getChannel() throws VLCException { public int getChannel() throws VLCException {
return _getChannel(); return _getChannel();
} }
public void setChannel( String channel ) throws VLCException { public void setChannel( int channel ) throws VLCException {
_setChannel(channel); _setChannel(channel);
} }
......
...@@ -71,13 +71,13 @@ public interface AudioIntf { ...@@ -71,13 +71,13 @@ public interface AudioIntf {
* @return channel * @return channel
* @throws VLCException * @throws VLCException
*/ */
String getChannel() throws VLCException; int getChannel() throws VLCException;
/** /**
* @param channel * @param channel
* @throws VLCException * @throws VLCException
*/ */
void setChannel(String channel) throws VLCException; void setChannel(int channel) throws VLCException;
/** /**
......
...@@ -57,29 +57,23 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setTrack (JNIEnv *env, job ...@@ -57,29 +57,23 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setTrack (JNIEnv *env, job
CHECK_EXCEPTION_FREE; 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; INIT_FUNCTION;
char* res; int res = libvlc_audio_get_channel( ( libvlc_instance_t * ) instance, exception);
res = libvlc_audio_get_channel( ( libvlc_instance_t * ) instance, exception);
CHECK_EXCEPTION_FREE; 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; 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; CHECK_EXCEPTION_FREE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment