]> git.sesse.net Git - vlc/blob - bindings/java/src/audio-jni.cc
fix dependancies
[vlc] / bindings / java / src / audio-jni.cc
1 /*****************************************************************************
2  * audio-jni.cc: JNI native audio functions for VLC Java Bindings
3  *****************************************************************************
4  * Copyright (C) 1998-2006 the VideoLAN team
5  *
6  * Authors: Filippo Carone <filippo@carone.org>
7  *          Philippe Morin <phmorin@free.fr>
8  *
9  *
10  * $Id $
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
25  *****************************************************************************/
26
27 /* These are a must*/
28 #include <jni.h>
29
30 #include <vlc/libvlc.h>
31
32 /* JVLC internal imports, generated by gcjh */
33 #include "../includes/Audio.h"
34 #include "utils.h"
35
36 JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Audio__1getTrack (JNIEnv *env, jobject _this)
37 {
38     INIT_FUNCTION;
39     GET_INPUT_THREAD;
40     
41     jint res = 0;
42     
43     res = libvlc_audio_get_track( input, &exception );
44  
45     libvlc_media_instance_release(input);   
46     CHECK_EXCEPTION;
47     
48     return res;
49 }
50
51 JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setTrack (JNIEnv *env, jobject _this, jint value)
52 {
53     INIT_FUNCTION;
54     GET_INPUT_THREAD;
55
56     libvlc_audio_set_track( input, value, &exception );
57
58     libvlc_media_instance_release(input);   
59     CHECK_EXCEPTION;
60 }
61
62 JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Audio__1getChannel (JNIEnv *env, jobject _this)
63 {
64     INIT_FUNCTION;
65
66     int res = libvlc_audio_get_channel( ( libvlc_instance_t * ) instance, &exception);
67
68     CHECK_EXCEPTION;
69
70     return res;
71 }
72
73 JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setChannel (JNIEnv *env, jobject _this, jint channel)
74 {
75     INIT_FUNCTION;
76
77     libvlc_audio_set_channel( (libvlc_instance_t *) instance, channel, &exception);
78
79     CHECK_EXCEPTION;
80 }
81
82
83 JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_Audio__1getMute (JNIEnv *env, jobject _this) 
84 {
85     INIT_FUNCTION;
86     jboolean res;
87
88     res = (jboolean) libvlc_audio_get_mute( ( libvlc_instance_t * ) instance, &exception );
89
90     CHECK_EXCEPTION;
91
92     return res;
93     
94 }
95
96 JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setMute (JNIEnv *env, jobject _this, jboolean value) 
97 {
98     INIT_FUNCTION;
99
100     libvlc_audio_set_mute( ( libvlc_instance_t * ) instance, value, &exception );
101   
102     CHECK_EXCEPTION;
103 }
104
105 JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1toggleMute (JNIEnv *env, jobject _this) 
106 {
107     INIT_FUNCTION;
108
109     libvlc_audio_get_mute( ( libvlc_instance_t * ) instance, &exception );
110     
111     CHECK_EXCEPTION;
112 }
113
114 JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Audio__1getVolume (JNIEnv *env, jobject _this)
115 {
116     INIT_FUNCTION;
117     jint res = 0;
118
119     res = libvlc_audio_get_volume( ( libvlc_instance_t * ) instance, &exception );
120
121     CHECK_EXCEPTION;
122
123     return res;
124 }
125
126 JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setVolume (JNIEnv *env, jobject _this, jint volume)
127 {
128     INIT_FUNCTION;
129
130     libvlc_audio_set_volume( ( libvlc_instance_t * ) instance, volume, &exception );
131
132     CHECK_EXCEPTION;
133 }