]> git.sesse.net Git - vlc/blob - bindings/java/src/utils.h
Initial callback support in libvlc + example on how to use in the java bindings
[vlc] / bindings / java / src / utils.h
1 /* These are a must*/
2 #include <jni.h>
3 #include <jawt.h>
4 #include <jawt_md.h>
5
6 #include <vlc/libvlc.h>
7 #include <stdlib.h> // for free
8
9 void handle_vlc_exception( JNIEnv*, libvlc_exception_t* );
10 jlong getInstance ( JNIEnv* , jobject );
11
12 #define CHECK_EXCEPTION_FREE \
13     if ( libvlc_exception_raised( exception )) \
14     { \
15         handle_vlc_exception( env, exception ); \
16     } \
17     free( exception );
18
19 #define CHECK_EXCEPTION \
20     if ( libvlc_exception_raised( exception )) \
21     { \
22         handle_vlc_exception( env, exception ); \
23     }
24
25
26 #define INIT_FUNCTION \
27     long instance; \
28     libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t )); \
29     libvlc_exception_init( exception ); \
30     instance = getInstance( env, _this );
31
32 #define GET_INPUT_THREAD \
33     libvlc_input_t *input; \
34     input = libvlc_playlist_get_input( ( libvlc_instance_t *) instance, exception ); \
35     CHECK_EXCEPTION ;