]> git.sesse.net Git - vlc/blob - bindings/java/src/utils.cc
fix dependancies
[vlc] / bindings / java / src / utils.cc
1 /*****************************************************************************
2  * utils.cc: Utility 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 /* These are a must*/
27 #include <jni.h>
28
29 #include "utils.h"
30
31 JAWT awt;
32 JAWT_DrawingSurfaceInfo* dsi;
33
34 void handle_vlc_exception( JNIEnv* env, libvlc_exception_t* exception ) {
35   jclass newExcCls;
36
37   // raise a Java exception
38   newExcCls = env->FindClass("org/videolan/jvlc/VLCException");
39   if (newExcCls == 0) { /* Unable to find the new exception class, give up. */
40       return;
41   }
42   env->ThrowNew(newExcCls, libvlc_exception_get_message(exception));
43         
44 }
45
46 jlong getInstance (JNIEnv *env, jobject _this) {
47     /* get the id field of object */
48     jclass    cls   = env->GetObjectClass(_this);
49     jmethodID mid   = env->GetMethodID(cls, "getInstance", "()J");
50     jlong     field = env->CallLongMethod(_this, mid);
51     return field;
52 }