42         (*java_vm)->DetachCurrentThread(
java_vm);
 
   72     ret = (*java_vm)->GetEnv(
java_vm, (
void **)&env, JNI_VERSION_1_6);
 
   75         if ((*java_vm)->AttachCurrentThread(
java_vm, &env, 
NULL) != 0) {
 
   76             av_log(log_ctx, 
AV_LOG_ERROR, 
"Failed to attach the JNI environment to the current thread\n");
 
   88         av_log(log_ctx, 
AV_LOG_ERROR, 
"Failed to get the JNI environment attached to this thread\n");
 
  100     const char *utf_chars = 
NULL;
 
  108     utf_chars = (*env)->GetStringUTFChars(env, 
string, &
copy);
 
  109     if ((*env)->ExceptionCheck(env)) {
 
  110         (*env)->ExceptionClear(env);
 
  117     (*env)->ReleaseStringUTFChars(env, 
string, utf_chars);
 
  118     if ((*env)->ExceptionCheck(env)) {
 
  119         (*env)->ExceptionClear(env);
 
  131     ret = (*env)->NewStringUTF(env, utf_chars);
 
  132     if ((*env)->ExceptionCheck(env)) {
 
  133         (*env)->ExceptionClear(env);
 
  150     jclass class_class = 
NULL;
 
  151     jmethodID get_name_id = 
NULL;
 
  153     jclass exception_class = 
NULL;
 
  154     jmethodID get_message_id = 
NULL;
 
  156     jstring 
string = 
NULL;
 
  160     exception_class = (*env)->GetObjectClass(env, exception);
 
  161     if ((*env)->ExceptionCheck(env)) {
 
  162         (*env)->ExceptionClear(env);
 
  168     class_class = (*env)->GetObjectClass(env, exception_class);
 
  169     if ((*env)->ExceptionCheck(env)) {
 
  170         (*env)->ExceptionClear(env);
 
  176     get_name_id = (*env)->GetMethodID(env, class_class, 
"getName", 
"()Ljava/lang/String;");
 
  177     if ((*env)->ExceptionCheck(env)) {
 
  178         (*env)->ExceptionClear(env);
 
  184     string = (*env)->CallObjectMethod(env, exception_class, get_name_id);
 
  185     if ((*env)->ExceptionCheck(env)) {
 
  186         (*env)->ExceptionClear(env);
 
  194         (*env)->DeleteLocalRef(env, 
string);
 
  198     get_message_id = (*env)->GetMethodID(env, exception_class, 
"getMessage", 
"()Ljava/lang/String;");
 
  199     if ((*env)->ExceptionCheck(env)) {
 
  200         (*env)->ExceptionClear(env);
 
  201         av_log(log_ctx, 
AV_LOG_ERROR, 
"Could not find method java/lang/Throwable.getMessage()\n");
 
  206     string = (*env)->CallObjectMethod(env, exception, get_message_id);
 
  207     if ((*env)->ExceptionCheck(env)) {
 
  208         (*env)->ExceptionClear(env);
 
  216         (*env)->DeleteLocalRef(env, 
string);
 
  238         (*env)->DeleteLocalRef(env, class_class);
 
  241     if (exception_class) {
 
  242         (*env)->DeleteLocalRef(env, exception_class);
 
  246         (*env)->DeleteLocalRef(env, 
string);
 
  256     jthrowable exception;
 
  260     if (!(*(env))->ExceptionCheck((env))) {
 
  265         (*(env))->ExceptionClear((env));
 
  269     exception = (*env)->ExceptionOccurred(env);
 
  270     (*(env))->ExceptionClear((env));
 
  273         (*env)->DeleteLocalRef(env, exception);
 
  277     (*env)->DeleteLocalRef(env, exception);
 
  288     jclass last_clazz = 
NULL;
 
  290     for (
i = 0; jfields_mapping[
i].
name; 
i++) {
 
  299             clazz = (*env)->FindClass(env, jfields_mapping[
i].
name);
 
  304             last_clazz = *(jclass*)((
uint8_t*)jfields + jfields_mapping[
i].
offset) =
 
  305                     global ? (*env)->NewGlobalRef(env, clazz) : clazz;
 
  308                 (*env)->DeleteLocalRef(env, clazz);
 
  320                 jfieldID field_id = (*env)->GetFieldID(env, last_clazz, jfields_mapping[
i].method, jfields_mapping[
i].
signature);
 
  325                 *(jfieldID*)((
uint8_t*)jfields + jfields_mapping[
i].
offset) = field_id;
 
  329                 jfieldID field_id = (*env)->GetStaticFieldID(env, last_clazz, jfields_mapping[
i].method, jfields_mapping[
i].
signature);
 
  334                 *(jfieldID*)((
uint8_t*)jfields + jfields_mapping[
i].
offset) = field_id;
 
  338                 jmethodID method_id = (*env)->GetMethodID(env, last_clazz, jfields_mapping[
i].method, jfields_mapping[
i].
signature);
 
  343                 *(jmethodID*)((
uint8_t*)jfields + jfields_mapping[
i].
offset) = method_id;
 
  347                 jmethodID method_id = (*env)->GetStaticMethodID(env, last_clazz, jfields_mapping[
i].method, jfields_mapping[
i].
signature);
 
  352                 *(jmethodID*)((
uint8_t*)jfields + jfields_mapping[
i].
offset) = method_id;
 
  378     for (
i = 0; jfields_mapping[
i].
name; 
i++) {
 
  383             jclass clazz = *(jclass*)((
uint8_t*)jfields + jfields_mapping[
i].
offset);
 
  388                 (*env)->DeleteGlobalRef(env, clazz);
 
  390                 (*env)->DeleteLocalRef(env, clazz);