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