44         (*java_vm)->DetachCurrentThread(
java_vm);
 
   74     ret = (*java_vm)->GetEnv(
java_vm, (
void **)&env, JNI_VERSION_1_6);
 
   77         if ((*java_vm)->AttachCurrentThread(
java_vm, &env, 
NULL) != 0) {
 
   78             av_log(log_ctx, 
AV_LOG_ERROR, 
"Failed to attach the JNI environment to the current thread\n");
 
   90         av_log(log_ctx, 
AV_LOG_ERROR, 
"Failed to get the JNI environment attached to this thread\n");
 
  102     const char *utf_chars = 
NULL;
 
  110     utf_chars = (*env)->GetStringUTFChars(env, 
string, &
copy);
 
  111     if ((*env)->ExceptionCheck(env)) {
 
  112         (*env)->ExceptionClear(env);
 
  119     (*env)->ReleaseStringUTFChars(env, 
string, utf_chars);
 
  120     if ((*env)->ExceptionCheck(env)) {
 
  121         (*env)->ExceptionClear(env);
 
  133     ret = (*env)->NewStringUTF(env, utf_chars);
 
  134     if ((*env)->ExceptionCheck(env)) {
 
  135         (*env)->ExceptionClear(env);
 
  152     jclass class_class = 
NULL;
 
  153     jmethodID get_name_id = 
NULL;
 
  155     jclass exception_class = 
NULL;
 
  156     jmethodID get_message_id = 
NULL;
 
  158     jstring 
string = 
NULL;
 
  162     exception_class = (*env)->GetObjectClass(env, exception);
 
  163     if ((*env)->ExceptionCheck(env)) {
 
  164         (*env)->ExceptionClear(env);
 
  170     class_class = (*env)->GetObjectClass(env, exception_class);
 
  171     if ((*env)->ExceptionCheck(env)) {
 
  172         (*env)->ExceptionClear(env);
 
  178     get_name_id = (*env)->GetMethodID(env, class_class, 
"getName", 
"()Ljava/lang/String;");
 
  179     if ((*env)->ExceptionCheck(env)) {
 
  180         (*env)->ExceptionClear(env);
 
  186     string = (*env)->CallObjectMethod(env, exception_class, get_name_id);
 
  187     if ((*env)->ExceptionCheck(env)) {
 
  188         (*env)->ExceptionClear(env);
 
  196         (*env)->DeleteLocalRef(env, 
string);
 
  200     get_message_id = (*env)->GetMethodID(env, exception_class, 
"getMessage", 
"()Ljava/lang/String;");
 
  201     if ((*env)->ExceptionCheck(env)) {
 
  202         (*env)->ExceptionClear(env);
 
  203         av_log(log_ctx, 
AV_LOG_ERROR, 
"Could not find method java/lang/Throwable.getMessage()\n");
 
  208     string = (*env)->CallObjectMethod(env, exception, get_message_id);
 
  209     if ((*env)->ExceptionCheck(env)) {
 
  210         (*env)->ExceptionClear(env);
 
  218         (*env)->DeleteLocalRef(env, 
string);
 
  240         (*env)->DeleteLocalRef(env, class_class);
 
  243     if (exception_class) {
 
  244         (*env)->DeleteLocalRef(env, exception_class);
 
  248         (*env)->DeleteLocalRef(env, 
string);
 
  258     jthrowable exception;
 
  262     if (!(*(env))->ExceptionCheck((env))) {
 
  267         (*(env))->ExceptionClear((env));
 
  271     exception = (*env)->ExceptionOccurred(env);
 
  272     (*(env))->ExceptionClear((env));
 
  275         (*env)->DeleteLocalRef(env, exception);
 
  279     (*env)->DeleteLocalRef(env, exception);
 
  290     jclass last_clazz = 
NULL;
 
  292     for (
i = 0; jfields_mapping[
i].
name; 
i++) {
 
  301             clazz = (*env)->FindClass(env, jfields_mapping[
i].
name);
 
  306             last_clazz = *(jclass*)((uint8_t*)jfields + jfields_mapping[
i].
offset) =
 
  307                     global ? (*env)->NewGlobalRef(env, clazz) : clazz;
 
  310                 (*env)->DeleteLocalRef(env, clazz);
 
  322                 jfieldID field_id = (*env)->GetFieldID(env, last_clazz, jfields_mapping[
i].method, jfields_mapping[
i].
signature);
 
  327                 *(jfieldID*)((uint8_t*)jfields + jfields_mapping[
i].
offset) = field_id;
 
  331                 jfieldID field_id = (*env)->GetStaticFieldID(env, last_clazz, jfields_mapping[
i].method, jfields_mapping[
i].
signature);
 
  336                 *(jfieldID*)((uint8_t*)jfields + jfields_mapping[
i].
offset) = field_id;
 
  340                 jmethodID method_id = (*env)->GetMethodID(env, last_clazz, jfields_mapping[
i].method, jfields_mapping[
i].
signature);
 
  345                 *(jmethodID*)((uint8_t*)jfields + jfields_mapping[
i].
offset) = method_id;
 
  349                 jmethodID method_id = (*env)->GetStaticMethodID(env, last_clazz, jfields_mapping[
i].method, jfields_mapping[
i].
signature);
 
  354                 *(jmethodID*)((uint8_t*)jfields + jfields_mapping[
i].
offset) = method_id;
 
  380     for (
i = 0; jfields_mapping[
i].
name; 
i++) {
 
  385             jclass clazz = *(jclass*)((uint8_t*)jfields + jfields_mapping[
i].
offset);
 
  390                 (*env)->DeleteGlobalRef(env, clazz);
 
  392                 (*env)->DeleteLocalRef(env, clazz);
 
  395             *(jclass*)((uint8_t*)jfields + jfields_mapping[
i].
offset) = 
NULL;
 
  399             *(jfieldID*)((uint8_t*)jfields + jfields_mapping[
i].
offset) = 
NULL;
 
  403             *(jfieldID*)((uint8_t*)jfields + jfields_mapping[
i].
offset) = 
NULL;
 
  407             *(jmethodID*)((uint8_t*)jfields + jfields_mapping[
i].
offset) = 
NULL;
 
  411             *(jmethodID*)((uint8_t*)jfields + jfields_mapping[
i].
offset) = 
NULL;