Merge "AArch64: Use long for pointers in VideoEditor classes"
diff --git a/media/java/android/media/videoeditor/MediaArtistNativeHelper.java b/media/java/android/media/videoeditor/MediaArtistNativeHelper.java
index f4fccbe..2b0b3e2 100644
--- a/media/java/android/media/videoeditor/MediaArtistNativeHelper.java
+++ b/media/java/android/media/videoeditor/MediaArtistNativeHelper.java
@@ -118,7 +118,7 @@
     private boolean mErrorFlagSet = false;
 
     @SuppressWarnings("unused")
-    private int mManualEditContext;
+    private long mManualEditContext;
 
     /* Listeners */
 
diff --git a/media/jni/mediaeditor/VideoEditorClasses.cpp b/media/jni/mediaeditor/VideoEditorClasses.cpp
index d8099dd..d29fad3 100644
--- a/media/jni/mediaeditor/VideoEditorClasses.cpp
+++ b/media/jni/mediaeditor/VideoEditorClasses.cpp
@@ -609,7 +609,7 @@
 
 VIDEOEDIT_JAVA_DEFINE_FIELDS(Engine)
 {
-    VIDEOEDIT_JAVA_FIELD_INIT("mManualEditContext", "I")
+    VIDEOEDIT_JAVA_FIELD_INIT("mManualEditContext", "J")
 };
 
 VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(Engine, MANUAL_EDIT_ENGINE_CLASS_NAME)
@@ -3096,7 +3096,7 @@
     if (*pResult)
     {
         // Retrieve the context pointer.
-        pContext = (void *)pEnv->GetIntField(object, fieldIds.context);
+        pContext = (void *)pEnv->GetLongField(object, fieldIds.context);
     }
 
     // Return the context pointer.
@@ -3132,15 +3132,15 @@
     {
         // Set the context field.
         VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
-                        "The context value from JAVA before setting is = 0x%x",
-                        pEnv->GetIntField(object, fieldIds.context));
+                        "The context value from JAVA before setting is = %p",
+                        (void *)pEnv->GetLongField(object, fieldIds.context));
 
-        pEnv->SetIntField(object, fieldIds.context, (int)pContext);
-        M4OSA_TRACE1_1("The context value in JNI is = 0x%x",pContext);
+        pEnv->SetLongField(object, fieldIds.context, (jlong)pContext);
+        M4OSA_TRACE1_1("The context value in JNI is = %p",pContext);
 
         VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
-                         "The context value from JAVA after setting is = 0x%x",
-                         pEnv->GetIntField(object, fieldIds.context));
+                         "The context value from JAVA after setting is = %p",
+                         (void *)pEnv->GetLongField(object, fieldIds.context));
     }
 }
 
diff --git a/media/jni/mediaeditor/VideoEditorMain.cpp b/media/jni/mediaeditor/VideoEditorMain.cpp
index c1ad516..058012b 100644
--- a/media/jni/mediaeditor/VideoEditorMain.cpp
+++ b/media/jni/mediaeditor/VideoEditorMain.cpp
@@ -170,7 +170,7 @@
 static void videoEditor_release(
                 JNIEnv*                             pEnv,
                 jobject                             thiz);
-static int videoEditor_getPixels(
+static jint videoEditor_getPixels(
                                  JNIEnv*                  env,
                                  jobject                  thiz,
                                  jstring                  path,
@@ -178,7 +178,7 @@
                                  M4OSA_UInt32             width,
                                  M4OSA_UInt32             height,
                                  M4OSA_UInt32             timeMS);
-static int videoEditor_getPixelsList(
+static jint videoEditor_getPixelsList(
                                      JNIEnv*                  env,
                                      jobject                  thiz,
                                      jstring                  path,
@@ -209,7 +209,7 @@
                 jobject                 object,
                 jobject                 audioSettingObject);
 
-static int videoEditor_stopPreview(JNIEnv*  pEnv,
+static jint videoEditor_stopPreview(JNIEnv*  pEnv,
                               jobject  thiz);
 
 static jobject
@@ -218,7 +218,7 @@
                 jobject                             thiz,
                 jstring                             file);
 
-static int videoEditor_renderPreviewFrame(JNIEnv* pEnv,
+static jint videoEditor_renderPreviewFrame(JNIEnv* pEnv,
                                     jobject thiz,
                                     jobject    mSurface,
                                     jlong fromMs,
@@ -231,7 +231,7 @@
 static void jniPreviewProgressCallback(void* cookie, M4OSA_UInt32 msgType,
                                         void *argc);
 
-static int videoEditor_renderMediaItemPreviewFrame(JNIEnv* pEnv,
+static jint videoEditor_renderMediaItemPreviewFrame(JNIEnv* pEnv,
                                                     jobject thiz,
                                                     jobject mSurface,
                                                     jstring filePath,
@@ -241,7 +241,7 @@
                                                     jint surfaceHeight,
                                                     jlong fromMs);
 
-static int videoEditor_generateAudioWaveFormSync ( JNIEnv*     pEnv,
+static jint videoEditor_generateAudioWaveFormSync ( JNIEnv*     pEnv,
                                                   jobject     thiz,
                                                   jstring     pcmfilePath,
                                                   jstring     outGraphfilePath,
@@ -258,7 +258,7 @@
                                     M4OSA_Char* infilePath,
                                     M4OSA_Char* pcmfilePath );
 
-static int
+static jint
 videoEditor_generateClip(
                 JNIEnv*                             pEnv,
                 jobject                             thiz,
@@ -572,7 +572,7 @@
 
     return result;
 }
-static int videoEditor_stopPreview(JNIEnv*  pEnv,
+static jint videoEditor_stopPreview(JNIEnv*  pEnv,
                               jobject  thiz)
 {
     ManualEditContext* pContext = M4OSA_NULL;
@@ -594,7 +594,7 @@
         pContext->mOverlayFileName = NULL;
     }
 
-    return lastProgressTimeMs;
+    return (jint)lastProgressTimeMs;
 }
 
 static void videoEditor_clearSurface(JNIEnv* pEnv,
@@ -654,7 +654,7 @@
 
   }
 
-static int videoEditor_renderPreviewFrame(JNIEnv* pEnv,
+static jint videoEditor_renderPreviewFrame(JNIEnv* pEnv,
                                     jobject thiz,
                                     jobject    mSurface,
                                     jlong fromMs,
@@ -976,10 +976,10 @@
         free(yuvPlane);
     }
 
-    return tnTimeMs;
+    return (jint)tnTimeMs;
 }
 
-static int videoEditor_renderMediaItemPreviewFrame(JNIEnv* pEnv,
+static jint videoEditor_renderMediaItemPreviewFrame(JNIEnv* pEnv,
                                                     jobject thiz,
                                                     jobject mSurface,
                                                     jstring filePath,
@@ -1033,7 +1033,7 @@
     /* get thumbnail*/
     result = ThumbnailOpen(&tnContext,(const M4OSA_Char*)pString, M4OSA_TRUE);
     if (result != M4NO_ERROR || tnContext  == M4OSA_NULL) {
-        return timeMs;
+        return (jint)timeMs;
     }
 
     framesizeYuv = ((frameWidth)*(frameHeight)*1.5);
@@ -1046,7 +1046,7 @@
         ThumbnailClose(tnContext);
         pMessage = videoEditJava_getErrorName(M4ERR_ALLOC);
         jniThrowException(pEnv, "java/lang/RuntimeException", pMessage);
-        return timeMs;
+        return (jint)timeMs;
     }
 
     result = ThumbnailGetPixels16(tnContext, (M4OSA_Int16 *)pixelArray,
@@ -1055,7 +1055,7 @@
     if (result != M4NO_ERROR) {
         free(pixelArray);
         ThumbnailClose(tnContext);
-        return fromMs;
+        return (jint)fromMs;
     }
 
 #ifdef DUMPTOFILESYSTEM
@@ -1131,10 +1131,10 @@
         pEnv->ReleaseStringUTFChars(filePath, pString);
     }
 
-    return timeMs;
+    return (jint)timeMs;
 }
 
-int videoEditor_generateAudioRawFile(   JNIEnv*     pEnv,
+jint videoEditor_generateAudioRawFile(  JNIEnv*     pEnv,
                                         jobject     thiz,
                                         jstring     infilePath,
                                         jstring     pcmfilePath)
@@ -1178,7 +1178,7 @@
         pEnv->ReleaseStringUTFChars(pcmfilePath, pStringOutPCMFilePath);
     }
 
-    return result;
+    return (jint)result;
 }
 
 M4OSA_ERR videoEditor_generateAudio(JNIEnv* pEnv,ManualEditContext* pContext,
@@ -2182,7 +2182,7 @@
     return object;
 
 }
-static int videoEditor_getPixels(
+static jint videoEditor_getPixels(
                     JNIEnv*                     env,
                     jobject                     thiz,
                     jstring                     path,
@@ -2234,10 +2234,10 @@
         env->ReleaseStringUTFChars(path, pString);
     }
 
-    return timeMS;
+    return (jint)timeMS;
 }
 
-static int videoEditor_getPixelsList(
+static jint videoEditor_getPixelsList(
                 JNIEnv*                 env,
                 jobject                 thiz,
                 jstring                 path,
@@ -2257,7 +2257,7 @@
     const char *pString = env->GetStringUTFChars(path, NULL);
     if (pString == M4OSA_NULL) {
         jniThrowException(env, "java/lang/RuntimeException", "Input string null");
-        return M4ERR_ALLOC;
+        return (jint)M4ERR_ALLOC;
     }
 
     err = ThumbnailOpen(&mContext,(const M4OSA_Char*)pString, M4OSA_FALSE);
@@ -2266,7 +2266,7 @@
         if (pString != NULL) {
             env->ReleaseStringUTFChars(path, pString);
         }
-        return err;
+        return (jint)err;
     }
 
     jlong duration = (endTime - startTime);
@@ -2307,7 +2307,7 @@
                 "ThumbnailGetPixels32 failed");
     }
 
-    return err;
+    return (jint)err;
 }
 
 static M4OSA_ERR
@@ -2892,7 +2892,7 @@
 }
 /*+ PROGRESS CB */
 
-static int
+static jint
 videoEditor_generateClip(
                 JNIEnv*                             pEnv,
                 jobject                             thiz,
@@ -2934,7 +2934,7 @@
     }
 
     ALOGV("videoEditor_generateClip END 0x%x", (unsigned int) result);
-    return result;
+    return (jint)result;
 }
 
 static void
@@ -3556,7 +3556,7 @@
     return err;
 }
 
-static int videoEditor_generateAudioWaveFormSync (JNIEnv*  pEnv, jobject thiz,
+static jint videoEditor_generateAudioWaveFormSync (JNIEnv*  pEnv, jobject thiz,
                                                   jstring pcmfilePath,
                                                   jstring outGraphfilePath,
                                                   jint frameDuration, jint channels,
@@ -3619,7 +3619,7 @@
     VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR",
         "videoEditor_generateAudioWaveFormSync pContext->bSkipState ");
 
-    return result;
+    return (jint)result;
 }
 
 /******** End Audio Graph *******/