55     ret = (*java_vm)->GetEnv(
java_vm, (
void **)&env, JNI_VERSION_1_6);
 
   58         if ((*java_vm)->AttachCurrentThread(
java_vm, &env, 
NULL) != 0) {
 
   59             av_log(log_ctx, 
AV_LOG_ERROR, 
"Failed to attach the JNI environment to the current thread\n");
 
   71         av_log(log_ctx, 
AV_LOG_ERROR, 
"Failed to get the JNI environment attached to this thread");
 
   85     return (*java_vm)->DetachCurrentThread(
java_vm);
 
   91     const char *utf_chars = 
NULL;
 
   99     utf_chars = (*env)->GetStringUTFChars(env, 
string, ©);
 
  100     if ((*env)->ExceptionCheck(env)) {
 
  101         (*env)->ExceptionClear(env);
 
  108     (*env)->ReleaseStringUTFChars(env, 
string, utf_chars);
 
  109     if ((*env)->ExceptionCheck(env)) {
 
  110         (*env)->ExceptionClear(env);
 
  122     ret = (*env)->NewStringUTF(env, utf_chars);
 
  123     if ((*env)->ExceptionCheck(env)) {
 
  124         (*env)->ExceptionClear(env);
 
  141     jclass class_class = 
NULL;
 
  142     jmethodID get_name_id = 
NULL;
 
  144     jclass exception_class = 
NULL;
 
  145     jmethodID get_message_id = 
NULL;
 
  147     jstring 
string = 
NULL;
 
  151     exception_class = (*env)->GetObjectClass(env, exception);
 
  152     if ((*env)->ExceptionCheck(env)) {
 
  153         (*env)->ExceptionClear(env);
 
  159     class_class = (*env)->GetObjectClass(env, exception_class);
 
  160     if ((*env)->ExceptionCheck(env)) {
 
  161         (*env)->ExceptionClear(env);
 
  167     get_name_id = (*env)->GetMethodID(env, class_class, 
"getName", 
"()Ljava/lang/String;");
 
  168     if ((*env)->ExceptionCheck(env)) {
 
  169         (*env)->ExceptionClear(env);
 
  175     string = (*env)->CallObjectMethod(env, exception_class, get_name_id);
 
  176     if ((*env)->ExceptionCheck(env)) {
 
  177         (*env)->ExceptionClear(env);
 
  185         (*env)->DeleteLocalRef(env, 
string);
 
  189     get_message_id = (*env)->GetMethodID(env, exception_class, 
"getMessage", 
"()Ljava/lang/String;");
 
  190     if ((*env)->ExceptionCheck(env)) {
 
  191         (*env)->ExceptionClear(env);
 
  192         av_log(log_ctx, 
AV_LOG_ERROR, 
"Could not find method java/lang/Throwable.getMessage()\n");
 
  197     string = (*env)->CallObjectMethod(env, exception, get_message_id);
 
  198     if ((*env)->ExceptionCheck(env)) {
 
  199         (*env)->ExceptionClear(env);
 
  207         (*env)->DeleteLocalRef(env, 
string);
 
  211     if (name && message) {
 
  213     } 
else if (name && !message) {
 
  215     } 
else if (!name && message) {
 
  229         (*env)->DeleteLocalRef(env, class_class);
 
  232     if (exception_class) {
 
  233         (*env)->DeleteLocalRef(env, exception_class);
 
  237         (*env)->DeleteLocalRef(env, 
string);
 
  247     jthrowable exception;
 
  251     if (!(*(env))->ExceptionCheck((env))) {
 
  256         (*(env))->ExceptionClear((env));
 
  260     exception = (*env)->ExceptionOccurred(env);
 
  261     (*(env))->ExceptionClear((env));
 
  264         (*env)->DeleteLocalRef(env, exception);
 
  268     (*env)->DeleteLocalRef(env, exception);
 
  279     jclass last_clazz = 
NULL;
 
  281     for (i = 0; jfields_mapping[i].
name; i++) {
 
  282         int mandatory = jfields_mapping[i].
mandatory;
 
  290             clazz = (*env)->FindClass(env, jfields_mapping[i].
name);
 
  295             last_clazz = *(jclass*)((
uint8_t*)jfields + jfields_mapping[i].
offset) =
 
  296                     global ? (*env)->NewGlobalRef(env, clazz) : clazz;
 
  306                 jfieldID field_id = (*env)->GetFieldID(env, last_clazz, jfields_mapping[i].method, jfields_mapping[i].
signature);
 
  311                 *(jfieldID*)((
uint8_t*)jfields + jfields_mapping[i].
offset) = field_id;
 
  315                 jfieldID field_id = (*env)->GetStaticFieldID(env, last_clazz, jfields_mapping[i].method, jfields_mapping[i].
signature);
 
  320                 *(jfieldID*)((
uint8_t*)jfields + jfields_mapping[i].
offset) = field_id;
 
  324                 jmethodID method_id = (*env)->GetMethodID(env, last_clazz, jfields_mapping[i].method, jfields_mapping[i].
signature);
 
  329                 *(jmethodID*)((
uint8_t*)jfields + jfields_mapping[i].
offset) = method_id;
 
  333                 jmethodID method_id = (*env)->GetStaticMethodID(env, last_clazz, jfields_mapping[i].method, jfields_mapping[i].
signature);
 
  338                 *(jmethodID*)((
uint8_t*)jfields + jfields_mapping[i].
offset) = method_id;
 
  362     for (i = 0; jfields_mapping[i].
name; i++) {
 
  367             jclass clazz = *(jclass*)((
uint8_t*)jfields + jfields_mapping[i].
offset);
 
  372                 (*env)->DeleteGlobalRef(env, clazz);
 
  374                 (*env)->DeleteLocalRef(env, clazz);
 
JNIEnv * ff_jni_attach_env(int *attached, void *log_ctx)
void av_bprintf(AVBPrint *buf, const char *fmt,...)
int ff_jni_reset_jfields(JNIEnv *env, void *jfields, const struct FFJniField *jfields_mapping, int global, void *log_ctx)
#define AV_LOG_WARNING
Something somehow does not look correct. 
jstring ff_jni_utf_chars_to_jstring(JNIEnv *env, const char *utf_chars, void *log_ctx)
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer. 
static const char signature[]
static void copy(LZOContext *c, int cnt)
Copies bytes from input to output buffer with checking. 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered. 
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
void * av_jni_get_java_vm(void *log_ctx)
char * ff_jni_jstring_to_utf_chars(JNIEnv *env, jstring string, void *log_ctx)
int ff_jni_init_jfields(JNIEnv *env, void *jfields, const struct FFJniField *jfields_mapping, int global, void *log_ctx)
int ff_jni_exception_check(JNIEnv *env, int log, void *log_ctx)
#define AV_BPRINT_SIZE_AUTOMATIC
char * av_strdup(const char *s)
Duplicate the string s. 
int ff_jni_detach_env(void *log_ctx)
int ff_jni_exception_get_summary(JNIEnv *env, jthrowable exception, char **error, void *log_ctx)
static pthread_mutex_t lock
static av_always_inline int pthread_mutex_unlock(pthread_mutex_t *mutex)
static av_always_inline int pthread_mutex_lock(pthread_mutex_t *mutex)
#define AVERROR_EXTERNAL
Generic error in an external library.