boolean videoInput = false;
JVLC jvlc = new JVLC(args);
try {
- jvlc.playlist.add("file://" + System.getProperty( "user.dir" ) + "/a.avi", "a.avi");
+ //jvlc.playlist.add("file://" + System.getProperty( "user.dir" ) + "/a.avi", "a.avi");
+ jvlc.playlist.add("file:///home/little/a.avi", "a.avi");
jvlc.playlist.add("file://" + System.getProperty( "user.dir" ) + "/a.mp3", "a.mp3");
jvlc.playlist.play( -1 , null );
} catch (VLCException e) {
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("right");
+ System.out.print("done.");
Thread.sleep(3000);
System.out.println("INPUT INFORMATION");
System.out.println("-----------------");
{
System.out.println("Something was wrong. I die :(.");
jvlc.destroy();
+ e.printStackTrace();
}
System.out.println("Everything fine ;)");
private long libvlcInstance;
+ private native int _getTrack();
+ private native void _setTrack(int track);
+ private native String _getChannel();
+ private native void _setChannel(String channel);
private native boolean _getMute();
private native void _setMute( boolean value );
private native void _toggleMute();
this.libvlcInstance = instance;
}
+ public int getTrack() throws VLCException {
+ return _getTrack();
+ }
+
+ public void setTrack( int track ) throws VLCException {
+ _setTrack(track);
+ }
+
+ public String getChannel() throws VLCException {
+ return _getChannel();
+ }
+
+ public void setChannel( String channel ) throws VLCException {
+ _setChannel(channel);
+ }
+
public boolean getMute() throws VLCException {
return _getMute();
}
- public void setMute(boolean value) throws VLCException {
+ public void setMute( boolean value ) throws VLCException {
_setMute( value );
}
package org.videolan.jvlc;
public interface AudioIntf {
+
+
+ /**
+ * Constant for left channel audio
+ */
+ final String LEFT_CHANNEL = "left";
+
+ /**
+ * Constant for right channel audio
+ */
+ final String RIGHT_CHANNEL = "right";
+
+ /**
+ * Constant for reverse channel audio
+ */
+ final String REVERSE_CHANNEL = "reverse";
+ /**
+ * Constant for stereo channel audio
+ */
+ final String STEREO_CHANNEL = "stereo";
+ /**
+ * Constant for dolby channel audio
+ */
+ final String DOLBY_CHANNEL = "dolby";
+
+ /**
+ * @return audio track
+ * @throws VLCException
+ */
+ int getTrack() throws VLCException;
+
+ /**
+ * @param audio track
+ * @throws VLCException
+ */
+ void setTrack(int track) throws VLCException;
+
+ /**
+ * @return channel
+ * @throws VLCException
+ */
+ String getChannel() throws VLCException;
+
+ /**
+ * @param channel
+ * @throws VLCException
+ */
+ void setChannel(String channel) throws VLCException;
+
+
/**
* @return True if input is currently muted.
* @throws VLCException
* Copyright (C) 1998-2006 the VideoLAN team
*
* Authors: Filippo Carone <filippo@carone.org>
+ * Philippe Morin <phmorin@free.fr>
*
*
* $Id $
#include "../includes/Audio.h"
#include "utils.h"
+JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Audio__1getTrack (JNIEnv *env, jobject _this)
+{
+ INIT_FUNCTION;
+ jint res = 0;
+
+ res = libvlc_audio_get_track( ( libvlc_instance_t * ) instance, exception );
+
+ CHECK_EXCEPTION_FREE;
+
+ return res;
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setTrack (JNIEnv *env, jobject _this, jint value)
+{
+ INIT_FUNCTION;
+
+ libvlc_audio_set_track( ( libvlc_instance_t * ) instance, value, exception );
+
+ CHECK_EXCEPTION_FREE;
+}
+
+JNIEXPORT jstring 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);
+
+ CHECK_EXCEPTION_FREE;
+
+ return env->NewStringUTF(res);
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setChannel (JNIEnv *env, jobject _this, jstring channel)
+{
+ INIT_FUNCTION;
+
+ const char* value = env->GetStringUTFChars( channel, 0 );
+
+ libvlc_audio_set_channel( (libvlc_instance_t *) instance, (char *) value, exception);
+
+ env->ReleaseStringUTFChars( channel, value );
+
+ CHECK_EXCEPTION_FREE;
+}
+
+
JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_Audio__1getMute (JNIEnv *env, jobject _this)
{
INIT_FUNCTION;
res = (jboolean) libvlc_audio_get_mute( ( libvlc_instance_t * ) instance, exception );
- CHECK_EXCEPTION;
+ CHECK_EXCEPTION_FREE;
return res;
INIT_FUNCTION;
libvlc_audio_set_mute( ( libvlc_instance_t * ) instance, value, exception );
-
- CHECK_EXCEPTION;
+
+ CHECK_EXCEPTION_FREE;
}
JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1toggleMute (JNIEnv *env, jobject _this)
libvlc_audio_get_mute( ( libvlc_instance_t * ) instance, exception );
- CHECK_EXCEPTION;
+ CHECK_EXCEPTION_FREE;
}
JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Audio__1getVolume (JNIEnv *env, jobject _this)
res = libvlc_audio_get_volume( ( libvlc_instance_t * ) instance, exception );
- CHECK_EXCEPTION;
+ CHECK_EXCEPTION_FREE;
return res;
}
libvlc_audio_set_volume( ( libvlc_instance_t * ) instance, volume, exception );
- CHECK_EXCEPTION;
+ CHECK_EXCEPTION_FREE;
}
-