diff options
author | Narayan Kamath <narayan@google.com> | 2014-01-16 15:48:54 +0000 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2014-01-16 15:49:59 +0000 |
commit | 6bb5cb24b458a11bd02e9bff37c03f6381e06b7c (patch) | |
tree | ec61957c8bb328444c98d3488246002a12a59860 /media | |
parent | f12fa0122000acaa4728163475adce1bb5aaf3c7 (diff) | |
parent | 28c6ec0215e8cf2dff5a571c703137b3a4d244f2 (diff) | |
download | frameworks_base-6bb5cb24b458a11bd02e9bff37c03f6381e06b7c.zip frameworks_base-6bb5cb24b458a11bd02e9bff37c03f6381e06b7c.tar.gz frameworks_base-6bb5cb24b458a11bd02e9bff37c03f6381e06b7c.tar.bz2 |
Resolved conflicts for merge of 28c6ec02 to master
Change-Id: Idf1cabf2694dfa13d928df944d346f5e051b6948
Diffstat (limited to 'media')
24 files changed, 157 insertions, 153 deletions
diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java index 0947d3e..a4891f8 100644 --- a/media/java/android/media/AudioRecord.java +++ b/media/java/android/media/AudioRecord.java @@ -107,13 +107,13 @@ public class AudioRecord * Accessed by native methods: provides access to C++ AudioRecord object */ @SuppressWarnings("unused") - private int mNativeRecorderInJavaObj; + private long mNativeRecorderInJavaObj; /** * Accessed by native methods: provides access to the callback data. */ @SuppressWarnings("unused") - private int mNativeCallbackCookie; + private long mNativeCallbackCookie; //--------------------------------------------------------- diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java index 3dd6f14..3759108 100644 --- a/media/java/android/media/AudioTrack.java +++ b/media/java/android/media/AudioTrack.java @@ -221,13 +221,13 @@ public class AudioTrack * Accessed by native methods: provides access to C++ AudioTrack object. */ @SuppressWarnings("unused") - private int mNativeTrackInJavaObj; + private long mNativeTrackInJavaObj; /** * Accessed by native methods: provides access to the JNI data (i.e. resources used by * the native AudioTrack object, but not stored in it). */ @SuppressWarnings("unused") - private int mJniData; + private long mJniData; //-------------------------------------------------------------------------- diff --git a/media/java/android/media/FaceDetector.java b/media/java/android/media/FaceDetector.java index cf900ce..61991e3 100644 --- a/media/java/android/media/FaceDetector.java +++ b/media/java/android/media/FaceDetector.java @@ -191,9 +191,9 @@ public class FaceDetector { native private void fft_get_face(Face face, int i); native private void fft_destroy(); - private int mFD; - private int mSDK; - private int mDCR; + private long mFD; + private long mSDK; + private long mDCR; private int mWidth; private int mHeight; private int mMaxFaces; diff --git a/media/java/android/media/JetPlayer.java b/media/java/android/media/JetPlayer.java index 06cda34..bd91fc5 100644 --- a/media/java/android/media/JetPlayer.java +++ b/media/java/android/media/JetPlayer.java @@ -127,7 +127,7 @@ public class JetPlayer * Accessed by native methods: provides access to C++ JetPlayer object */ @SuppressWarnings("unused") - private int mNativePlayerInJavaObj; + private long mNativePlayerInJavaObj; //-------------------------------------------- diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java index 5175830..ddf88df 100644 --- a/media/java/android/media/MediaCodec.java +++ b/media/java/android/media/MediaCodec.java @@ -644,5 +644,5 @@ final public class MediaCodec { native_init(); } - private int mNativeContext; + private long mNativeContext; } diff --git a/media/java/android/media/MediaCrypto.java b/media/java/android/media/MediaCrypto.java index 40a1326..c7c3fc2 100644 --- a/media/java/android/media/MediaCrypto.java +++ b/media/java/android/media/MediaCrypto.java @@ -88,5 +88,5 @@ public final class MediaCrypto { native_init(); } - private int mNativeContext; + private long mNativeContext; } diff --git a/media/java/android/media/MediaExtractor.java b/media/java/android/media/MediaExtractor.java index e558c07..c3e5035 100644 --- a/media/java/android/media/MediaExtractor.java +++ b/media/java/android/media/MediaExtractor.java @@ -352,5 +352,5 @@ final public class MediaExtractor { native_init(); } - private int mNativeContext; + private long mNativeContext; } diff --git a/media/java/android/media/MediaMetadataRetriever.java b/media/java/android/media/MediaMetadataRetriever.java index 9014453..db27d09 100644 --- a/media/java/android/media/MediaMetadataRetriever.java +++ b/media/java/android/media/MediaMetadataRetriever.java @@ -42,7 +42,7 @@ public class MediaMetadataRetriever // The field below is accessed by native methods @SuppressWarnings("unused") - private int mNativeContext; + private long mNativeContext; private static final int EMBEDDED_PICTURE_TYPE_ANY = 0xFFFF; diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java index 0e6e8b1..3cceb03 100644 --- a/media/java/android/media/MediaPlayer.java +++ b/media/java/android/media/MediaPlayer.java @@ -569,8 +569,8 @@ public class MediaPlayer implements SubtitleController.Listener // macro invocation in IMediaPlayer.cpp private final static String IMEDIA_PLAYER = "android.media.IMediaPlayer"; - private int mNativeContext; // accessed by native methods - private int mNativeSurfaceTexture; // accessed by native methods + private long mNativeContext; // accessed by native methods + private long mNativeSurfaceTexture; // accessed by native methods private int mListenerContext; // accessed by native methods private SurfaceHolder mSurfaceHolder; private EventHandler mEventHandler; diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java index 7b7c06c..f8a7bb6 100644 --- a/media/java/android/media/MediaRecorder.java +++ b/media/java/android/media/MediaRecorder.java @@ -81,7 +81,7 @@ public class MediaRecorder // The two fields below are accessed by native methods @SuppressWarnings("unused") - private int mNativeContext; + private long mNativeContext; @SuppressWarnings("unused") private Surface mSurface; diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java index de3041e..53835e2 100644 --- a/media/java/android/media/MediaScanner.java +++ b/media/java/android/media/MediaScanner.java @@ -301,7 +301,7 @@ public class MediaScanner // 148 and up don't seem to have been defined yet. }; - private int mNativeContext; + private long mNativeContext; private Context mContext; private String mPackageName; private IContentProvider mMediaProvider; diff --git a/media/java/android/media/RemoteDisplay.java b/media/java/android/media/RemoteDisplay.java index 7afce1a..4e937a5 100644 --- a/media/java/android/media/RemoteDisplay.java +++ b/media/java/android/media/RemoteDisplay.java @@ -38,12 +38,12 @@ public final class RemoteDisplay { private final Listener mListener; private final Handler mHandler; - private int mPtr; + private long mPtr; - private native int nativeListen(String iface); - private native void nativeDispose(int ptr); - private native void nativePause(int ptr); - private native void nativeResume(int ptr); + private native long nativeListen(String iface); + private native void nativeDispose(long ptr); + private native void nativePause(long ptr); + private native void nativeResume(long ptr); private RemoteDisplay(Listener listener, Handler handler) { mListener = listener; diff --git a/media/java/android/media/SoundPool.java b/media/java/android/media/SoundPool.java index b0c077b..f1b256e 100644 --- a/media/java/android/media/SoundPool.java +++ b/media/java/android/media/SoundPool.java @@ -442,7 +442,7 @@ public class SoundPool { private final static String TAG = "SoundPool"; private final static boolean DEBUG = false; - private int mNativeContext; // accessed by native methods + private long mNativeContext; // accessed by native methods private EventHandler mEventHandler; private SoundPool.OnLoadCompleteListener mOnLoadCompleteListener; diff --git a/media/java/android/media/ToneGenerator.java b/media/java/android/media/ToneGenerator.java index 5592105..713f147 100644 --- a/media/java/android/media/ToneGenerator.java +++ b/media/java/android/media/ToneGenerator.java @@ -887,5 +887,5 @@ public class ToneGenerator protected void finalize() { native_finalize(); } @SuppressWarnings("unused") - private int mNativeContext; // accessed by native methods + private long mNativeContext; // accessed by native methods } diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp index b8d437c..221ea57 100644 --- a/media/jni/android_media_MediaCodec.cpp +++ b/media/jni/android_media_MediaCodec.cpp @@ -328,20 +328,20 @@ using namespace android; static sp<JMediaCodec> setMediaCodec( JNIEnv *env, jobject thiz, const sp<JMediaCodec> &codec) { - sp<JMediaCodec> old = (JMediaCodec *)env->GetIntField(thiz, gFields.context); + sp<JMediaCodec> old = (JMediaCodec *)env->GetLongField(thiz, gFields.context); if (codec != NULL) { codec->incStrong(thiz); } if (old != NULL) { old->decStrong(thiz); } - env->SetIntField(thiz, gFields.context, (int)codec.get()); + env->SetLongField(thiz, gFields.context, (jlong)codec.get()); return old; } static sp<JMediaCodec> getMediaCodec(JNIEnv *env, jobject thiz) { - return (JMediaCodec *)env->GetIntField(thiz, gFields.context); + return (JMediaCodec *)env->GetLongField(thiz, gFields.context); } static void android_media_MediaCodec_release(JNIEnv *env, jobject thiz) { @@ -710,7 +710,7 @@ static jint android_media_MediaCodec_dequeueInputBuffer( status_t err = codec->dequeueInputBuffer(&index, timeoutUs); if (err == OK) { - return index; + return (jint) index; } return throwExceptionAsNecessary(env, err); @@ -732,7 +732,7 @@ static jint android_media_MediaCodec_dequeueOutputBuffer( env, bufferInfo, &index, timeoutUs); if (err == OK) { - return index; + return (jint) index; } return throwExceptionAsNecessary(env, err); @@ -885,7 +885,7 @@ static void android_media_MediaCodec_native_init(JNIEnv *env) { env, env->FindClass("android/media/MediaCodec")); CHECK(clazz.get() != NULL); - gFields.context = env->GetFieldID(clazz.get(), "mNativeContext", "I"); + gFields.context = env->GetFieldID(clazz.get(), "mNativeContext", "J"); CHECK(gFields.context != NULL); clazz.reset(env->FindClass("android/media/MediaCodec$CryptoInfo")); diff --git a/media/jni/android_media_MediaCrypto.cpp b/media/jni/android_media_MediaCrypto.cpp index d0f56ea..a6f8dcd 100644 --- a/media/jni/android_media_MediaCrypto.cpp +++ b/media/jni/android_media_MediaCrypto.cpp @@ -38,7 +38,7 @@ struct fields_t { static fields_t gFields; static sp<JCrypto> getCrypto(JNIEnv *env, jobject thiz) { - return (JCrypto *)env->GetIntField(thiz, gFields.context); + return (JCrypto *)env->GetLongField(thiz, gFields.context); } JCrypto::JCrypto( @@ -146,14 +146,14 @@ using namespace android; static sp<JCrypto> setCrypto( JNIEnv *env, jobject thiz, const sp<JCrypto> &crypto) { - sp<JCrypto> old = (JCrypto *)env->GetIntField(thiz, gFields.context); + sp<JCrypto> old = (JCrypto *)env->GetLongField(thiz, gFields.context); if (crypto != NULL) { crypto->incStrong(thiz); } if (old != NULL) { old->decStrong(thiz); } - env->SetIntField(thiz, gFields.context, (int)crypto.get()); + env->SetLongField(thiz, gFields.context, (jlong)crypto.get()); return old; } @@ -166,7 +166,7 @@ static void android_media_MediaCrypto_native_init(JNIEnv *env) { jclass clazz = env->FindClass("android/media/MediaCrypto"); CHECK(clazz != NULL); - gFields.context = env->GetFieldID(clazz, "mNativeContext", "I"); + gFields.context = env->GetFieldID(clazz, "mNativeContext", "J"); CHECK(gFields.context != NULL); } @@ -232,7 +232,7 @@ static jboolean android_media_MediaCrypto_isCryptoSchemeSupportedNative( env, "java/lang/IllegalArgumentException", NULL); - return false; + return JNI_FALSE; } jboolean isCopy; @@ -243,27 +243,27 @@ static jboolean android_media_MediaCrypto_isCryptoSchemeSupportedNative( env->ReleaseByteArrayElements(uuidObj, uuid, 0); uuid = NULL; - return result; + return result ? JNI_TRUE : JNI_FALSE; } static jboolean android_media_MediaCrypto_requiresSecureDecoderComponent( JNIEnv *env, jobject thiz, jstring mimeObj) { if (mimeObj == NULL) { jniThrowException(env, "java/lang/IllegalArgumentException", NULL); - return false; + return JNI_FALSE; } sp<JCrypto> crypto = getCrypto(env, thiz); if (crypto == NULL) { jniThrowException(env, "java/lang/IllegalArgumentException", NULL); - return false; + return JNI_FALSE; } const char *mime = env->GetStringUTFChars(mimeObj, NULL); if (mime == NULL) { - return false; + return JNI_FALSE; } bool result = crypto->requiresSecureDecoderComponent(mime); @@ -271,7 +271,7 @@ static jboolean android_media_MediaCrypto_requiresSecureDecoderComponent( env->ReleaseStringUTFChars(mimeObj, mime); mime = NULL; - return result; + return result ? JNI_TRUE : JNI_FALSE; } static JNINativeMethod gMethods[] = { diff --git a/media/jni/android_media_MediaExtractor.cpp b/media/jni/android_media_MediaExtractor.cpp index 1ac45d4..705de88 100644 --- a/media/jni/android_media_MediaExtractor.cpp +++ b/media/jni/android_media_MediaExtractor.cpp @@ -88,7 +88,7 @@ class JavaDataSourceBridge : public DataSource { env->GetByteArrayRegion(byteArrayObj, 0, size, (jbyte*) buffer); env->DeleteLocalRef(byteArrayObj); if (env->ExceptionCheck()) { - ALOGW("Exception occurred while reading %d at %lld", size, offset); + ALOGW("Exception occurred while reading %zu at %lld", size, offset); LOGW_EX(env); env->ExceptionClear(); return -1; @@ -198,7 +198,7 @@ status_t JMediaExtractor::readSampleData( void *dst = env->GetDirectBufferAddress(byteBuf); - jlong dstSize; + size_t dstSize; jbyteArray byteArray = NULL; if (dst == NULL) { @@ -219,9 +219,9 @@ status_t JMediaExtractor::readSampleData( jboolean isCopy; dst = env->GetByteArrayElements(byteArray, &isCopy); - dstSize = env->GetArrayLength(byteArray); + dstSize = (size_t) env->GetArrayLength(byteArray); } else { - dstSize = env->GetDirectBufferCapacity(byteBuf); + dstSize = (size_t) env->GetDirectBufferCapacity(byteBuf); } if (dstSize < offset) { @@ -299,7 +299,7 @@ using namespace android; static sp<JMediaExtractor> setMediaExtractor( JNIEnv *env, jobject thiz, const sp<JMediaExtractor> &extractor) { sp<JMediaExtractor> old = - (JMediaExtractor *)env->GetIntField(thiz, gFields.context); + (JMediaExtractor *)env->GetLongField(thiz, gFields.context); if (extractor != NULL) { extractor->incStrong(thiz); @@ -307,13 +307,13 @@ static sp<JMediaExtractor> setMediaExtractor( if (old != NULL) { old->decStrong(thiz); } - env->SetIntField(thiz, gFields.context, (int)extractor.get()); + env->SetLongField(thiz, gFields.context, (jlong)extractor.get()); return old; } static sp<JMediaExtractor> getMediaExtractor(JNIEnv *env, jobject thiz) { - return (JMediaExtractor *)env->GetIntField(thiz, gFields.context); + return (JMediaExtractor *)env->GetLongField(thiz, gFields.context); } static void android_media_MediaExtractor_release(JNIEnv *env, jobject thiz) { @@ -329,7 +329,7 @@ static jint android_media_MediaExtractor_getTrackCount( return -1; } - return extractor->countTracks(); + return (jint) extractor->countTracks(); } static jobject android_media_MediaExtractor_getTrackFormatNative( @@ -430,19 +430,19 @@ static jboolean android_media_MediaExtractor_advance( if (extractor == NULL) { jniThrowException(env, "java/lang/IllegalStateException", NULL); - return false; + return JNI_FALSE; } status_t err = extractor->advance(); if (err == ERROR_END_OF_STREAM) { - return false; + return JNI_FALSE; } else if (err != OK) { jniThrowException(env, "java/lang/IllegalArgumentException", NULL); - return false; + return JNI_FALSE; } - return true; + return JNI_TRUE; } static jint android_media_MediaExtractor_readSampleData( @@ -461,10 +461,10 @@ static jint android_media_MediaExtractor_readSampleData( return -1; } else if (err != OK) { jniThrowException(env, "java/lang/IllegalArgumentException", NULL); - return false; + return -1; } - return sampleSize; + return (jint) sampleSize; } static jint android_media_MediaExtractor_getSampleTrackIndex( @@ -483,10 +483,10 @@ static jint android_media_MediaExtractor_getSampleTrackIndex( return -1; } else if (err != OK) { jniThrowException(env, "java/lang/IllegalArgumentException", NULL); - return false; + return -1; } - return trackIndex; + return (jint) trackIndex; } static jlong android_media_MediaExtractor_getSampleTime( @@ -505,10 +505,10 @@ static jlong android_media_MediaExtractor_getSampleTime( return -1ll; } else if (err != OK) { jniThrowException(env, "java/lang/IllegalArgumentException", NULL); - return false; + return -1ll; } - return sampleTimeUs; + return (jlong) sampleTimeUs; } static jint android_media_MediaExtractor_getSampleFlags( @@ -517,20 +517,20 @@ static jint android_media_MediaExtractor_getSampleFlags( if (extractor == NULL) { jniThrowException(env, "java/lang/IllegalStateException", NULL); - return -1ll; + return -1; } uint32_t sampleFlags; status_t err = extractor->getSampleFlags(&sampleFlags); if (err == ERROR_END_OF_STREAM) { - return -1ll; + return -1; } else if (err != OK) { jniThrowException(env, "java/lang/IllegalArgumentException", NULL); - return false; + return -1; } - return sampleFlags; + return (jint) sampleFlags; } static jboolean android_media_MediaExtractor_getSampleCryptoInfo( @@ -539,27 +539,27 @@ static jboolean android_media_MediaExtractor_getSampleCryptoInfo( if (extractor == NULL) { jniThrowException(env, "java/lang/IllegalStateException", NULL); - return -1ll; + return JNI_FALSE; } sp<MetaData> meta; status_t err = extractor->getSampleMeta(&meta); if (err != OK) { - return false; + return JNI_FALSE; } uint32_t type; const void *data; size_t size; if (!meta->findData(kKeyEncryptedSizes, &type, &data, &size)) { - return false; + return JNI_FALSE; } size_t numSubSamples = size / sizeof(size_t); if (numSubSamples == 0) { - return false; + return JNI_FALSE; } jintArray numBytesOfEncryptedDataObj = env->NewIntArray(numSubSamples); @@ -576,7 +576,7 @@ static jboolean android_media_MediaExtractor_getSampleCryptoInfo( if (meta->findData(kKeyPlainSizes, &type, &data, &size)) { if (size != encSize) { // The two must be of the same length. - return false; + return JNI_FALSE; } numBytesOfPlainDataObj = env->NewIntArray(numSubSamples); @@ -593,7 +593,7 @@ static jboolean android_media_MediaExtractor_getSampleCryptoInfo( if (meta->findData(kKeyCryptoKey, &type, &data, &size)) { if (size != 16) { // Keys must be 16 bytes in length. - return false; + return JNI_FALSE; } keyObj = env->NewByteArray(size); @@ -608,7 +608,7 @@ static jboolean android_media_MediaExtractor_getSampleCryptoInfo( if (meta->findData(kKeyCryptoIV, &type, &data, &size)) { if (size != 16) { // IVs must be 16 bytes in length. - return false; + return JNI_FALSE; } ivObj = env->NewByteArray(size); @@ -634,14 +634,14 @@ static jboolean android_media_MediaExtractor_getSampleCryptoInfo( ivObj, mode); - return true; + return JNI_TRUE; } static void android_media_MediaExtractor_native_init(JNIEnv *env) { jclass clazz = env->FindClass("android/media/MediaExtractor"); CHECK(clazz != NULL); - gFields.context = env->GetFieldID(clazz, "mNativeContext", "I"); + gFields.context = env->GetFieldID(clazz, "mNativeContext", "J"); CHECK(gFields.context != NULL); clazz = env->FindClass("android/media/MediaCodec$CryptoInfo"); @@ -770,7 +770,7 @@ static jlong android_media_MediaExtractor_getCachedDurationUs( return -1ll; } - return cachedDurationUs; + return (jlong) cachedDurationUs; } static jboolean android_media_MediaExtractor_hasCacheReachedEOS( @@ -779,16 +779,16 @@ static jboolean android_media_MediaExtractor_hasCacheReachedEOS( if (extractor == NULL) { jniThrowException(env, "java/lang/IllegalStateException", NULL); - return true; + return JNI_TRUE; } int64_t cachedDurationUs; bool eos; if (!extractor->getCachedDuration(&cachedDurationUs, &eos)) { - return true; + return JNI_TRUE; } - return eos; + return eos ? JNI_TRUE : JNI_FALSE; } static void android_media_MediaExtractor_native_finalize( diff --git a/media/jni/android_media_MediaMetadataRetriever.cpp b/media/jni/android_media_MediaMetadataRetriever.cpp index 297dadf..fe69819 100644 --- a/media/jni/android_media_MediaMetadataRetriever.cpp +++ b/media/jni/android_media_MediaMetadataRetriever.cpp @@ -67,15 +67,15 @@ static void process_media_retriever_call(JNIEnv *env, status_t opStatus, const c static MediaMetadataRetriever* getRetriever(JNIEnv* env, jobject thiz) { // No lock is needed, since it is called internally by other methods that are protected - MediaMetadataRetriever* retriever = (MediaMetadataRetriever*) env->GetIntField(thiz, fields.context); + MediaMetadataRetriever* retriever = (MediaMetadataRetriever*) env->GetLongField(thiz, fields.context); return retriever; } -static void setRetriever(JNIEnv* env, jobject thiz, int retriever) +static void setRetriever(JNIEnv* env, jobject thiz, MediaMetadataRetriever* retriever) { // No lock is needed, since it is called internally by other methods that are protected - MediaMetadataRetriever *old = (MediaMetadataRetriever*) env->GetIntField(thiz, fields.context); - env->SetIntField(thiz, fields.context, retriever); + MediaMetadataRetriever *old = (MediaMetadataRetriever*) env->GetLongField(thiz, fields.context); + env->SetLongField(thiz, fields.context, (jlong) retriever); } static void @@ -146,10 +146,10 @@ static void android_media_MediaMetadataRetriever_setDataSourceFD(JNIEnv *env, jo int fd = jniGetFDFromFileDescriptor(env, fileDescriptor); if (offset < 0 || length < 0 || fd < 0) { if (offset < 0) { - ALOGE("negative offset (%lld)", offset); + ALOGE("negative offset (%lld)", (long long)offset); } if (length < 0) { - ALOGE("negative length (%lld)", length); + ALOGE("negative length (%lld)", (long long)length); } if (fd < 0) { ALOGE("invalid file descriptor"); @@ -359,7 +359,7 @@ static void android_media_MediaMetadataRetriever_release(JNIEnv *env, jobject th Mutex::Autolock lock(sLock); MediaMetadataRetriever* retriever = getRetriever(env, thiz); delete retriever; - setRetriever(env, thiz, 0); + setRetriever(env, thiz, (MediaMetadataRetriever*) 0); } static void android_media_MediaMetadataRetriever_native_finalize(JNIEnv *env, jobject thiz) @@ -379,7 +379,7 @@ static void android_media_MediaMetadataRetriever_native_init(JNIEnv *env) return; } - fields.context = env->GetFieldID(clazz, "mNativeContext", "I"); + fields.context = env->GetFieldID(clazz, "mNativeContext", "J"); if (fields.context == NULL) { return; } @@ -435,7 +435,7 @@ static void android_media_MediaMetadataRetriever_native_setup(JNIEnv *env, jobje jniThrowException(env, "java/lang/RuntimeException", "Out of memory"); return; } - setRetriever(env, thiz, (int)retriever); + setRetriever(env, thiz, retriever); } // JNI mapping between Java methods and native methods diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp index 5e3fb1a..9d0d5a6 100644 --- a/media/jni/android_media_MediaPlayer.cpp +++ b/media/jni/android_media_MediaPlayer.cpp @@ -133,21 +133,21 @@ void JNIMediaPlayerListener::notify(int msg, int ext1, int ext2, const Parcel *o static sp<MediaPlayer> getMediaPlayer(JNIEnv* env, jobject thiz) { Mutex::Autolock l(sLock); - MediaPlayer* const p = (MediaPlayer*)env->GetIntField(thiz, fields.context); + MediaPlayer* const p = (MediaPlayer*)env->GetLongField(thiz, fields.context); return sp<MediaPlayer>(p); } static sp<MediaPlayer> setMediaPlayer(JNIEnv* env, jobject thiz, const sp<MediaPlayer>& player) { Mutex::Autolock l(sLock); - sp<MediaPlayer> old = (MediaPlayer*)env->GetIntField(thiz, fields.context); + sp<MediaPlayer> old = (MediaPlayer*)env->GetLongField(thiz, fields.context); if (player.get()) { player->incStrong((void*)setMediaPlayer); } if (old != 0) { old->decStrong((void*)setMediaPlayer); } - env->SetIntField(thiz, fields.context, (int)player.get()); + env->SetLongField(thiz, fields.context, (jlong)player.get()); return old; } @@ -244,7 +244,7 @@ android_media_MediaPlayer_setDataSourceFD(JNIEnv *env, jobject thiz, jobject fil static sp<IGraphicBufferProducer> getVideoSurfaceTexture(JNIEnv* env, jobject thiz) { - IGraphicBufferProducer * const p = (IGraphicBufferProducer*)env->GetIntField(thiz, fields.surface_texture); + IGraphicBufferProducer * const p = (IGraphicBufferProducer*)env->GetLongField(thiz, fields.surface_texture); return sp<IGraphicBufferProducer>(p); } @@ -293,7 +293,7 @@ setVideoSurface(JNIEnv *env, jobject thiz, jobject jsurface, jboolean mediaPlaye } } - env->SetIntField(thiz, fields.surface_texture, (int)new_st.get()); + env->SetLongField(thiz, fields.surface_texture, (jlong)new_st.get()); // This will fail if the media player has not been initialized yet. This // can be the case if setDisplay() on MediaPlayer.java has been called @@ -384,7 +384,7 @@ android_media_MediaPlayer_isPlaying(JNIEnv *env, jobject thiz) sp<MediaPlayer> mp = getMediaPlayer(env, thiz); if (mp == NULL ) { jniThrowException(env, "java/lang/IllegalStateException", NULL); - return false; + return JNI_FALSE; } const jboolean is_playing = mp->isPlaying(); @@ -393,7 +393,7 @@ android_media_MediaPlayer_isPlaying(JNIEnv *env, jobject thiz) } static void -android_media_MediaPlayer_seekTo(JNIEnv *env, jobject thiz, int msec) +android_media_MediaPlayer_seekTo(JNIEnv *env, jobject thiz, jint msec) { sp<MediaPlayer> mp = getMediaPlayer(env, thiz); if (mp == NULL ) { @@ -404,7 +404,7 @@ android_media_MediaPlayer_seekTo(JNIEnv *env, jobject thiz, int msec) process_media_player_call( env, thiz, mp->seekTo(msec), NULL, NULL ); } -static int +static jint android_media_MediaPlayer_getVideoWidth(JNIEnv *env, jobject thiz) { sp<MediaPlayer> mp = getMediaPlayer(env, thiz); @@ -418,10 +418,10 @@ android_media_MediaPlayer_getVideoWidth(JNIEnv *env, jobject thiz) w = 0; } ALOGV("getVideoWidth: %d", w); - return w; + return (jint) w; } -static int +static jint android_media_MediaPlayer_getVideoHeight(JNIEnv *env, jobject thiz) { sp<MediaPlayer> mp = getMediaPlayer(env, thiz); @@ -435,11 +435,11 @@ android_media_MediaPlayer_getVideoHeight(JNIEnv *env, jobject thiz) h = 0; } ALOGV("getVideoHeight: %d", h); - return h; + return (jint) h; } -static int +static jint android_media_MediaPlayer_getCurrentPosition(JNIEnv *env, jobject thiz) { sp<MediaPlayer> mp = getMediaPlayer(env, thiz); @@ -450,10 +450,10 @@ android_media_MediaPlayer_getCurrentPosition(JNIEnv *env, jobject thiz) int msec; process_media_player_call( env, thiz, mp->getCurrentPosition(&msec), NULL, NULL ); ALOGV("getCurrentPosition: %d (msec)", msec); - return msec; + return (jint) msec; } -static int +static jint android_media_MediaPlayer_getDuration(JNIEnv *env, jobject thiz) { sp<MediaPlayer> mp = getMediaPlayer(env, thiz); @@ -464,7 +464,7 @@ android_media_MediaPlayer_getDuration(JNIEnv *env, jobject thiz) int msec; process_media_player_call( env, thiz, mp->getDuration(&msec), NULL, NULL ); ALOGV("getDuration: %d (msec)", msec); - return msec; + return (jint) msec; } static void @@ -480,7 +480,7 @@ android_media_MediaPlayer_reset(JNIEnv *env, jobject thiz) } static void -android_media_MediaPlayer_setAudioStreamType(JNIEnv *env, jobject thiz, int streamtype) +android_media_MediaPlayer_setAudioStreamType(JNIEnv *env, jobject thiz, jint streamtype) { ALOGV("setAudioStreamType: %d", streamtype); sp<MediaPlayer> mp = getMediaPlayer(env, thiz); @@ -510,21 +510,21 @@ android_media_MediaPlayer_isLooping(JNIEnv *env, jobject thiz) sp<MediaPlayer> mp = getMediaPlayer(env, thiz); if (mp == NULL ) { jniThrowException(env, "java/lang/IllegalStateException", NULL); - return false; + return JNI_FALSE; } - return mp->isLooping(); + return mp->isLooping() ? JNI_TRUE : JNI_FALSE; } static void -android_media_MediaPlayer_setVolume(JNIEnv *env, jobject thiz, float leftVolume, float rightVolume) +android_media_MediaPlayer_setVolume(JNIEnv *env, jobject thiz, jfloat leftVolume, jfloat rightVolume) { - ALOGV("setVolume: left %f right %f", leftVolume, rightVolume); + ALOGV("setVolume: left %f right %f", (float) leftVolume, (float) rightVolume); sp<MediaPlayer> mp = getMediaPlayer(env, thiz); if (mp == NULL ) { jniThrowException(env, "java/lang/IllegalStateException", NULL); return; } - process_media_player_call( env, thiz, mp->setVolume(leftVolume, rightVolume), NULL, NULL ); + process_media_player_call( env, thiz, mp->setVolume((float) leftVolume, (float) rightVolume), NULL, NULL ); } // Sends the request and reply parcels to the media player via the @@ -544,7 +544,7 @@ android_media_MediaPlayer_invoke(JNIEnv *env, jobject thiz, // Don't use process_media_player_call which use the async loop to // report errors, instead returns the status. - return media_player->invoke(*request, reply); + return (jint) media_player->invoke(*request, reply); } // Sends the new filter to the client. @@ -564,7 +564,7 @@ android_media_MediaPlayer_setMetadataFilter(JNIEnv *env, jobject thiz, jobject r return UNKNOWN_ERROR; } - return media_player->setMetadataFilter(*filter); + return (jint) media_player->setMetadataFilter(*filter); } static jboolean @@ -574,14 +574,14 @@ android_media_MediaPlayer_getMetadata(JNIEnv *env, jobject thiz, jboolean update sp<MediaPlayer> media_player = getMediaPlayer(env, thiz); if (media_player == NULL ) { jniThrowException(env, "java/lang/IllegalStateException", NULL); - return false; + return JNI_FALSE; } Parcel *metadata = parcelForJavaObject(env, reply); if (metadata == NULL ) { jniThrowException(env, "java/lang/RuntimeException", "Reply parcel is null"); - return false; + return JNI_FALSE; } metadata->freeData(); @@ -589,7 +589,11 @@ android_media_MediaPlayer_getMetadata(JNIEnv *env, jobject thiz, jboolean update // metadata. Note however that the parcel actually starts with the // return code so you should not rewind the parcel using // setDataPosition(0). - return media_player->getMetadata(update_only, apply_filter, metadata) == OK; + if (media_player->getMetadata(update_only, apply_filter, metadata) == OK) { + return JNI_TRUE; + } else { + return JNI_FALSE; + } } // This function gets some field IDs, which in turn causes class initialization. @@ -605,7 +609,7 @@ android_media_MediaPlayer_native_init(JNIEnv *env) return; } - fields.context = env->GetFieldID(clazz, "mNativeContext", "I"); + fields.context = env->GetFieldID(clazz, "mNativeContext", "J"); if (fields.context == NULL) { return; } @@ -616,7 +620,7 @@ android_media_MediaPlayer_native_init(JNIEnv *env) return; } - fields.surface_texture = env->GetFieldID(clazz, "mNativeSurfaceTexture", "I"); + fields.surface_texture = env->GetFieldID(clazz, "mNativeSurfaceTexture", "J"); if (fields.surface_texture == NULL) { return; } @@ -696,7 +700,7 @@ static jint android_media_MediaPlayer_get_audio_session_id(JNIEnv *env, jobject return 0; } - return mp->getAudioSessionId(); + return (jint) mp->getAudioSessionId(); } static void @@ -733,7 +737,7 @@ android_media_MediaPlayer_pullBatteryData(JNIEnv *env, jobject thiz, jobject jav Parcel *reply = parcelForJavaObject(env, java_reply); - return service->pullBatteryData(reply); + return (jint) service->pullBatteryData(reply); } static jint @@ -772,7 +776,7 @@ android_media_MediaPlayer_setRetransmitEndpoint(JNIEnv *env, jobject thiz, jniThrowException(env, "java/lang/IllegalStateException", NULL); } - return ret; + return (jint) ret; } static void diff --git a/media/jni/android_media_MediaProfiles.cpp b/media/jni/android_media_MediaProfiles.cpp index 3fbb8ba..48a9132 100644 --- a/media/jni/android_media_MediaProfiles.cpp +++ b/media/jni/android_media_MediaProfiles.cpp @@ -48,7 +48,7 @@ static jint android_media_MediaProfiles_native_get_num_file_formats(JNIEnv *env, jobject thiz) { ALOGV("native_get_num_file_formats"); - return sProfiles->getOutputFileFormats().size(); + return (jint) sProfiles->getOutputFileFormats().size(); } static jint @@ -119,7 +119,7 @@ static jint android_media_MediaProfiles_native_get_num_audio_encoders(JNIEnv *env, jobject thiz) { ALOGV("native_get_num_audio_encoders"); - return sProfiles->getAudioEncoders().size(); + return (jint) sProfiles->getAudioEncoders().size(); } static jobject @@ -223,18 +223,18 @@ android_media_MediaProfiles_native_has_camcorder_profile(JNIEnv *env, jobject th { ALOGV("native_has_camcorder_profile: %d %d", id, quality); if (!isCamcorderQualityKnown(quality)) { - return false; + return JNI_FALSE; } camcorder_quality q = static_cast<camcorder_quality>(quality); - return sProfiles->hasCamcorderProfile(id, q); + return sProfiles->hasCamcorderProfile(id, q) ? JNI_TRUE : JNI_FALSE; } static jint android_media_MediaProfiles_native_get_num_video_decoders(JNIEnv *env, jobject thiz) { ALOGV("native_get_num_video_decoders"); - return sProfiles->getVideoDecoders().size(); + return (jint) sProfiles->getVideoDecoders().size(); } static jint @@ -255,7 +255,7 @@ static jint android_media_MediaProfiles_native_get_num_audio_decoders(JNIEnv *env, jobject thiz) { ALOGV("native_get_num_audio_decoders"); - return sProfiles->getAudioDecoders().size(); + return (jint) sProfiles->getAudioDecoders().size(); } static jint @@ -276,7 +276,7 @@ static jint android_media_MediaProfiles_native_get_num_image_encoding_quality_levels(JNIEnv *env, jobject thiz, jint cameraId) { ALOGV("native_get_num_image_encoding_quality_levels"); - return sProfiles->getImageEncodingQualityLevels(cameraId).size(); + return (jint) sProfiles->getImageEncodingQualityLevels(cameraId).size(); } static jint @@ -284,7 +284,7 @@ android_media_MediaProfiles_native_get_image_encoding_quality_level(JNIEnv *env, { ALOGV("native_get_image_encoding_quality_level"); Vector<int> levels = sProfiles->getImageEncodingQualityLevels(cameraId); - if (index < 0 || index >= levels.size()) { + if (index < 0 || index >= (jint) levels.size()) { jniThrowException(env, "java/lang/IllegalArgumentException", "out of array boundary"); return -1; } diff --git a/media/jni/android_media_MediaRecorder.cpp b/media/jni/android_media_MediaRecorder.cpp index ac863e1..fd69cad 100644 --- a/media/jni/android_media_MediaRecorder.cpp +++ b/media/jni/android_media_MediaRecorder.cpp @@ -128,21 +128,21 @@ static bool process_media_recorder_call(JNIEnv *env, status_t opStatus, const ch static sp<MediaRecorder> getMediaRecorder(JNIEnv* env, jobject thiz) { Mutex::Autolock l(sLock); - MediaRecorder* const p = (MediaRecorder*)env->GetIntField(thiz, fields.context); + MediaRecorder* const p = (MediaRecorder*)env->GetLongField(thiz, fields.context); return sp<MediaRecorder>(p); } static sp<MediaRecorder> setMediaRecorder(JNIEnv* env, jobject thiz, const sp<MediaRecorder>& recorder) { Mutex::Autolock l(sLock); - sp<MediaRecorder> old = (MediaRecorder*)env->GetIntField(thiz, fields.context); + sp<MediaRecorder> old = (MediaRecorder*)env->GetLongField(thiz, fields.context); if (recorder.get()) { recorder->incStrong(thiz); } if (old != 0) { old->decStrong(thiz); } - env->SetIntField(thiz, fields.context, (int)recorder.get()); + env->SetLongField(thiz, fields.context, (jlong)recorder.get()); return old; } @@ -334,14 +334,14 @@ android_media_MediaRecorder_prepare(JNIEnv *env, jobject thiz) process_media_recorder_call(env, mr->prepare(), "java/io/IOException", "prepare failed."); } -static int +static jint android_media_MediaRecorder_native_getMaxAmplitude(JNIEnv *env, jobject thiz) { ALOGV("getMaxAmplitude"); sp<MediaRecorder> mr = getMediaRecorder(env, thiz); int result = 0; process_media_recorder_call(env, mr->getMaxAmplitude(&result), "java/lang/RuntimeException", "getMaxAmplitude failed."); - return result; + return (jint) result; } static jobject @@ -412,7 +412,7 @@ android_media_MediaRecorder_native_init(JNIEnv *env) return; } - fields.context = env->GetFieldID(clazz, "mNativeContext", "I"); + fields.context = env->GetFieldID(clazz, "mNativeContext", "J"); if (fields.context == NULL) { return; } diff --git a/media/jni/android_media_MediaScanner.cpp b/media/jni/android_media_MediaScanner.cpp index 4e3d14e..84028b7 100644 --- a/media/jni/android_media_MediaScanner.cpp +++ b/media/jni/android_media_MediaScanner.cpp @@ -226,12 +226,12 @@ private: static MediaScanner *getNativeScanner_l(JNIEnv* env, jobject thiz) { - return (MediaScanner *) env->GetIntField(thiz, fields.context); + return (MediaScanner *) env->GetLongField(thiz, fields.context); } static void setNativeScanner_l(JNIEnv* env, jobject thiz, MediaScanner *s) { - env->SetIntField(thiz, fields.context, (int)s); + env->SetLongField(thiz, fields.context, (jlong)s); } static void @@ -381,7 +381,7 @@ android_media_MediaScanner_native_init(JNIEnv *env) return; } - fields.context = env->GetFieldID(clazz, "mNativeContext", "I"); + fields.context = env->GetFieldID(clazz, "mNativeContext", "J"); if (fields.context == NULL) { return; } @@ -398,7 +398,7 @@ android_media_MediaScanner_native_setup(JNIEnv *env, jobject thiz) return; } - env->SetIntField(thiz, fields.context, (int)mp); + env->SetLongField(thiz, fields.context, (jlong)mp); } static void diff --git a/media/jni/soundpool/android_media_SoundPool_SoundPoolImpl.cpp b/media/jni/soundpool/android_media_SoundPool_SoundPoolImpl.cpp index 2604850..9cc55ab 100644 --- a/media/jni/soundpool/android_media_SoundPool_SoundPoolImpl.cpp +++ b/media/jni/soundpool/android_media_SoundPool_SoundPoolImpl.cpp @@ -34,11 +34,11 @@ static struct fields_t { } fields; static inline SoundPool* MusterSoundPool(JNIEnv *env, jobject thiz) { - return (SoundPool*)env->GetIntField(thiz, fields.mNativeContext); + return (SoundPool*)env->GetLongField(thiz, fields.mNativeContext); } // ---------------------------------------------------------------------------- -static int +static jint android_media_SoundPool_SoundPoolImpl_load_URL(JNIEnv *env, jobject thiz, jstring path, jint priority) { ALOGV("android_media_SoundPool_SoundPoolImpl_load_URL"); @@ -50,29 +50,29 @@ android_media_SoundPool_SoundPoolImpl_load_URL(JNIEnv *env, jobject thiz, jstrin const char* s = env->GetStringUTFChars(path, NULL); int id = ap->load(s, priority); env->ReleaseStringUTFChars(path, s); - return id; + return (jint) id; } -static int +static jint android_media_SoundPool_SoundPoolImpl_load_FD(JNIEnv *env, jobject thiz, jobject fileDescriptor, jlong offset, jlong length, jint priority) { ALOGV("android_media_SoundPool_SoundPoolImpl_load_FD"); SoundPool *ap = MusterSoundPool(env, thiz); if (ap == NULL) return 0; - return ap->load(jniGetFDFromFileDescriptor(env, fileDescriptor), + return (jint) ap->load(jniGetFDFromFileDescriptor(env, fileDescriptor), int64_t(offset), int64_t(length), int(priority)); } -static bool +static jboolean android_media_SoundPool_SoundPoolImpl_unload(JNIEnv *env, jobject thiz, jint sampleID) { ALOGV("android_media_SoundPool_SoundPoolImpl_unload\n"); SoundPool *ap = MusterSoundPool(env, thiz); - if (ap == NULL) return 0; - return ap->unload(sampleID); + if (ap == NULL) return JNI_FALSE; + return ap->unload(sampleID) ? JNI_TRUE : JNI_FALSE; } -static int +static jint android_media_SoundPool_SoundPoolImpl_play(JNIEnv *env, jobject thiz, jint sampleID, jfloat leftVolume, jfloat rightVolume, jint priority, jint loop, jfloat rate) @@ -80,7 +80,7 @@ android_media_SoundPool_SoundPoolImpl_play(JNIEnv *env, jobject thiz, jint sampl ALOGV("android_media_SoundPool_SoundPoolImpl_play\n"); SoundPool *ap = MusterSoundPool(env, thiz); if (ap == NULL) return 0; - return ap->play(sampleID, leftVolume, rightVolume, priority, loop, rate); + return (jint) ap->play(sampleID, leftVolume, rightVolume, priority, loop, rate); } static void @@ -130,22 +130,22 @@ android_media_SoundPool_SoundPoolImpl_stop(JNIEnv *env, jobject thiz, jint chann static void android_media_SoundPool_SoundPoolImpl_setVolume(JNIEnv *env, jobject thiz, jint channelID, - float leftVolume, float rightVolume) + jfloat leftVolume, jfloat rightVolume) { ALOGV("android_media_SoundPool_SoundPoolImpl_setVolume"); SoundPool *ap = MusterSoundPool(env, thiz); if (ap == NULL) return; - ap->setVolume(channelID, leftVolume, rightVolume); + ap->setVolume(channelID, (float) leftVolume, (float) rightVolume); } static void android_media_SoundPool_SoundPoolImpl_setPriority(JNIEnv *env, jobject thiz, jint channelID, - int priority) + jint priority) { ALOGV("android_media_SoundPool_SoundPoolImpl_setPriority"); SoundPool *ap = MusterSoundPool(env, thiz); if (ap == NULL) return; - ap->setPriority(channelID, priority); + ap->setPriority(channelID, (int) priority); } static void @@ -160,12 +160,12 @@ android_media_SoundPool_SoundPoolImpl_setLoop(JNIEnv *env, jobject thiz, jint ch static void android_media_SoundPool_SoundPoolImpl_setRate(JNIEnv *env, jobject thiz, jint channelID, - float rate) + jfloat rate) { ALOGV("android_media_SoundPool_SoundPoolImpl_setRate"); SoundPool *ap = MusterSoundPool(env, thiz); if (ap == NULL) return; - ap->setRate(channelID, rate); + ap->setRate(channelID, (float) rate); } static void android_media_callback(SoundPoolEvent event, SoundPool* soundPool, void* user) @@ -185,7 +185,7 @@ android_media_SoundPool_SoundPoolImpl_native_setup(JNIEnv *env, jobject thiz, jo } // save pointer to SoundPool C++ object in opaque field in Java object - env->SetIntField(thiz, fields.mNativeContext, (int)ap); + env->SetLongField(thiz, fields.mNativeContext, (jlong) ap); // set callback with weak reference jobject globalWeakRef = env->NewGlobalRef(weakRef); @@ -208,7 +208,7 @@ android_media_SoundPool_SoundPoolImpl_release(JNIEnv *env, jobject thiz) // clear callback and native context ap->setCallback(NULL, NULL); - env->SetIntField(thiz, fields.mNativeContext, 0); + env->SetLongField(thiz, fields.mNativeContext, 0); delete ap; } } @@ -299,7 +299,7 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) goto bail; } - fields.mNativeContext = env->GetFieldID(clazz, "mNativeContext", "I"); + fields.mNativeContext = env->GetFieldID(clazz, "mNativeContext", "J"); if (fields.mNativeContext == NULL) { ALOGE("Can't find SoundPoolImpl.mNativeContext"); goto bail; diff --git a/media/mca/filterfw/jni/jni_gl_environment.cpp b/media/mca/filterfw/jni/jni_gl_environment.cpp index 9abf191..6da7b7c 100644 --- a/media/mca/filterfw/jni/jni_gl_environment.cpp +++ b/media/mca/filterfw/jni/jni_gl_environment.cpp @@ -119,12 +119,12 @@ static sp<MediaRecorder> getMediaRecorder(JNIEnv* env, jobject jmediarecorder) { return NULL; } - jfieldID context = env->GetFieldID(clazz, "mNativeContext", "I"); + jfieldID context = env->GetFieldID(clazz, "mNativeContext", "J"); if (context == NULL) { return NULL; } - MediaRecorder* const p = (MediaRecorder*)env->GetIntField(jmediarecorder, context); + MediaRecorder* const p = (MediaRecorder*)env->GetLongField(jmediarecorder, context); env->DeleteLocalRef(clazz); return sp<MediaRecorder>(p); } |