1 /*****************************************************************************
2 * utils.cc: Utility functions for VLC Java Bindings
3 *****************************************************************************
4 * Copyright (C) 1998-2006 the VideoLAN team
6 * Authors: Filippo Carone <filippo@carone.org>
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.
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.
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 *****************************************************************************/
32 JAWT_DrawingSurfaceInfo* dsi;
34 void handle_vlc_exception( JNIEnv* env, libvlc_exception_t* exception ) {
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. */
42 env->ThrowNew(newExcCls, libvlc_exception_get_message(exception));
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);