diff options
author | Ashok Bhat <ashok.bhat@arm.com> | 2013-12-17 14:10:25 +0000 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2014-01-07 12:44:38 +0000 |
commit | b348c3fd87bff8641bb0c2fc475742f1847a4784 (patch) | |
tree | eac099f5d982e312a8ac8ce35a1d28e200585d0d /media | |
parent | cf1aa551eed7be4310a386b9b9e458e46847207a (diff) | |
download | frameworks_base-b348c3fd87bff8641bb0c2fc475742f1847a4784.zip frameworks_base-b348c3fd87bff8641bb0c2fc475742f1847a4784.tar.gz frameworks_base-b348c3fd87bff8641bb0c2fc475742f1847a4784.tar.bz2 |
AArch64: Use long for pointers in AmrInputStream
For storing pointers, long is used in AmrInputStream
class, as native pointers can be 64-bit.
Change-Id: I78fff3eb54fc7101746b0d693cbc4e923c2bad08
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AmrInputStream.java | 12 | ||||
-rw-r--r-- | media/jni/android_media_AmrInputStream.cpp | 28 |
2 files changed, 20 insertions, 20 deletions
diff --git a/media/java/android/media/AmrInputStream.java b/media/java/android/media/AmrInputStream.java index 8b7eee2..e2115e4 100644 --- a/media/java/android/media/AmrInputStream.java +++ b/media/java/android/media/AmrInputStream.java @@ -41,7 +41,7 @@ public final class AmrInputStream extends InputStream private InputStream mInputStream; // native handle - private int mGae; + private long mGae; // result amr stream private final byte[] mBuf = new byte[SAMPLES_PER_FRAME * 2]; @@ -130,11 +130,11 @@ public final class AmrInputStream extends InputStream // // AudioRecord JNI interface // - private static native int GsmAmrEncoderNew(); - private static native void GsmAmrEncoderInitialize(int gae); - private static native int GsmAmrEncoderEncode(int gae, + private static native long GsmAmrEncoderNew(); + private static native void GsmAmrEncoderInitialize(long gae); + private static native int GsmAmrEncoderEncode(long gae, byte[] pcm, int pcmOffset, byte[] amr, int amrOffset) throws IOException; - private static native void GsmAmrEncoderCleanup(int gae); - private static native void GsmAmrEncoderDelete(int gae); + private static native void GsmAmrEncoderCleanup(long gae); + private static native void GsmAmrEncoderDelete(long gae); } diff --git a/media/jni/android_media_AmrInputStream.cpp b/media/jni/android_media_AmrInputStream.cpp index b5220fe..3df6530 100644 --- a/media/jni/android_media_AmrInputStream.cpp +++ b/media/jni/android_media_AmrInputStream.cpp @@ -49,17 +49,17 @@ struct GsmAmrEncoderState { int32_t mLastModeUsed; }; -static jint android_media_AmrInputStream_GsmAmrEncoderNew +static jlong android_media_AmrInputStream_GsmAmrEncoderNew (JNIEnv *env, jclass clazz) { GsmAmrEncoderState* gae = new GsmAmrEncoderState(); if (gae == NULL) { jniThrowRuntimeException(env, "Out of memory"); } - return (jint)gae; + return (jlong)gae; } static void android_media_AmrInputStream_GsmAmrEncoderInitialize - (JNIEnv *env, jclass clazz, jint gae) { + (JNIEnv *env, jclass clazz, jlong gae) { GsmAmrEncoderState *state = (GsmAmrEncoderState *) gae; int32_t nResult = AMREncodeInit(&state->mEncState, &state->mSidState, false); if (nResult != OK) { @@ -70,7 +70,7 @@ static void android_media_AmrInputStream_GsmAmrEncoderInitialize static jint android_media_AmrInputStream_GsmAmrEncoderEncode (JNIEnv *env, jclass clazz, - jint gae, jbyteArray pcm, jint pcmOffset, jbyteArray amr, jint amrOffset) { + jlong gae, jbyteArray pcm, jint pcmOffset, jbyteArray amr, jint amrOffset) { jbyte inBuf[BYTES_PER_FRAME]; jbyte outBuf[MAX_OUTPUT_BUFFER_SIZE]; @@ -86,7 +86,7 @@ static jint android_media_AmrInputStream_GsmAmrEncoderEncode if (length < 0) { jniThrowExceptionFmt(env, "java/io/IOException", "Failed to encode a frame with error code: %d", length); - return -1; + return (jint)-1; } // The 1st byte of PV AMR frames are WMF (Wireless Multimedia Forum) @@ -101,30 +101,30 @@ static jint android_media_AmrInputStream_GsmAmrEncoderEncode env->SetByteArrayRegion(amr, amrOffset, length, outBuf); - return length; + return (jint)length; } static void android_media_AmrInputStream_GsmAmrEncoderCleanup - (JNIEnv *env, jclass clazz, jint gae) { - GsmAmrEncoderState *state = (GsmAmrEncoderState *)gae; + (JNIEnv *env, jclass clazz, jlong gae) { + GsmAmrEncoderState *state = (GsmAmrEncoderState *) gae; AMREncodeExit(&state->mEncState, &state->mSidState); state->mEncState = NULL; state->mSidState = NULL; } static void android_media_AmrInputStream_GsmAmrEncoderDelete - (JNIEnv *env, jclass clazz, jint gae) { + (JNIEnv *env, jclass clazz, jlong gae) { delete (GsmAmrEncoderState*)gae; } // ---------------------------------------------------------------------------- static JNINativeMethod gMethods[] = { - {"GsmAmrEncoderNew", "()I", (void*)android_media_AmrInputStream_GsmAmrEncoderNew}, - {"GsmAmrEncoderInitialize", "(I)V", (void*)android_media_AmrInputStream_GsmAmrEncoderInitialize}, - {"GsmAmrEncoderEncode", "(I[BI[BI)I", (void*)android_media_AmrInputStream_GsmAmrEncoderEncode}, - {"GsmAmrEncoderCleanup", "(I)V", (void*)android_media_AmrInputStream_GsmAmrEncoderCleanup}, - {"GsmAmrEncoderDelete", "(I)V", (void*)android_media_AmrInputStream_GsmAmrEncoderDelete}, + {"GsmAmrEncoderNew", "()J", (void*)android_media_AmrInputStream_GsmAmrEncoderNew}, + {"GsmAmrEncoderInitialize", "(J)V", (void*)android_media_AmrInputStream_GsmAmrEncoderInitialize}, + {"GsmAmrEncoderEncode", "(J[BI[BI)I", (void*)android_media_AmrInputStream_GsmAmrEncoderEncode}, + {"GsmAmrEncoderCleanup", "(J)V", (void*)android_media_AmrInputStream_GsmAmrEncoderCleanup}, + {"GsmAmrEncoderDelete", "(J)V", (void*)android_media_AmrInputStream_GsmAmrEncoderDelete}, }; |