[Android] [PATCH 01/24] jni: Add getInt() and reposition
Edward Wang
edward.c.wang at compdigitec.com
Wed Aug 22 23:15:01 CEST 2012
---
vlc-android/jni/libvlcjni.c | 37 +++++++++++++++++++++----------------
1 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
index 6f648f4..e032814 100644
--- a/vlc-android/jni/libvlcjni.c
+++ b/vlc-android/jni/libvlcjni.c
@@ -46,6 +46,27 @@
#define AOUT_AUDIOTRACK_JAVA 1
#define AOUT_OPENSLES 2
+static jint getInt(JNIEnv *env, jobject thiz, const char* field) {
+ jclass clazz = (*env)->GetObjectClass(env, thiz);
+ jfieldID fieldMP = (*env)->GetFieldID(env, clazz,
+ field, "I");
+ return (*env)->GetIntField(env, thiz, fieldMP);
+}
+static void setInt(JNIEnv *env, jobject item, const char* field, jint value) {
+ jclass cls;
+ jfieldID fieldId;
+
+ /* Get a reference to item's class */
+ cls = (*env)->GetObjectClass(env, item);
+
+ /* Look for the instance field s in cls */
+ fieldId = (*env)->GetFieldID(env, cls, field, "I");
+ if (fieldId == NULL)
+ return;
+
+ (*env)->SetIntField(env, item, fieldId, value);
+}
+
struct length_change_monitor {
pthread_mutex_t doneMutex;
pthread_cond_t doneCondVar;
@@ -387,22 +408,6 @@ void Java_org_videolan_vlc_LibVLC_setEventManager(JNIEnv *env, jobject thiz, job
eventManagerInstance = (*env)->NewGlobalRef(env, eventManager);
}
-void setInt(JNIEnv *env, jobject item, const char* field, int value)
-{
- jclass cls;
- jfieldID fieldId;
-
- /* Get a reference to item's class */
- cls = (*env)->GetObjectClass(env, item);
-
- /* Look for the instance field s in cls */
- fieldId = (*env)->GetFieldID(env, cls, field, "I");
- if (fieldId == NULL)
- return;
-
- (*env)->SetIntField(env, item, fieldId, value);
-}
-
void setLong(JNIEnv *env, jobject item, const char* field, long value)
{
jclass cls;
--
1.7.5.4
More information about the Android
mailing list