Merge "AArch64: Use long for pointers in media classes"
This commit is contained in:
@ -136,7 +136,7 @@ static sp<AudioRecord> getAudioRecord(JNIEnv* env, jobject thiz)
|
||||
{
|
||||
Mutex::Autolock l(sLock);
|
||||
AudioRecord* const ar =
|
||||
(AudioRecord*)env->GetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
|
||||
(AudioRecord*)env->GetLongField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
|
||||
return sp<AudioRecord>(ar);
|
||||
}
|
||||
|
||||
@ -144,19 +144,19 @@ static sp<AudioRecord> setAudioRecord(JNIEnv* env, jobject thiz, const sp<AudioR
|
||||
{
|
||||
Mutex::Autolock l(sLock);
|
||||
sp<AudioRecord> old =
|
||||
(AudioRecord*)env->GetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
|
||||
(AudioRecord*)env->GetLongField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
|
||||
if (ar.get()) {
|
||||
ar->incStrong((void*)setAudioRecord);
|
||||
}
|
||||
if (old != 0) {
|
||||
old->decStrong((void*)setAudioRecord);
|
||||
}
|
||||
env->SetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj, (int)ar.get());
|
||||
env->SetLongField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj, (jlong)ar.get());
|
||||
return old;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
static int
|
||||
static jint
|
||||
android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this,
|
||||
jint source, jint sampleRateInHertz, jint channelMask,
|
||||
// Java channel masks map directly to the native definition
|
||||
@ -168,7 +168,7 @@ android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this,
|
||||
|
||||
if (!audio_is_input_channel(channelMask)) {
|
||||
ALOGE("Error creating AudioRecord: channel mask %#x is not valid.", channelMask);
|
||||
return AUDIORECORD_ERROR_SETUP_INVALIDCHANNELMASK;
|
||||
return (jint) AUDIORECORD_ERROR_SETUP_INVALIDCHANNELMASK;
|
||||
}
|
||||
uint32_t nbChannels = popcount(channelMask);
|
||||
|
||||
@ -176,7 +176,7 @@ android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this,
|
||||
if ((audioFormat != ENCODING_PCM_16BIT)
|
||||
&& (audioFormat != ENCODING_PCM_8BIT)) {
|
||||
ALOGE("Error creating AudioRecord: unsupported audio format.");
|
||||
return AUDIORECORD_ERROR_SETUP_INVALIDFORMAT;
|
||||
return (jint) AUDIORECORD_ERROR_SETUP_INVALIDFORMAT;
|
||||
}
|
||||
|
||||
int bytesPerSample = audioFormat == ENCODING_PCM_16BIT ? 2 : 1;
|
||||
@ -185,31 +185,31 @@ android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this,
|
||||
|
||||
if (buffSizeInBytes == 0) {
|
||||
ALOGE("Error creating AudioRecord: frameCount is 0.");
|
||||
return AUDIORECORD_ERROR_SETUP_ZEROFRAMECOUNT;
|
||||
return (jint) AUDIORECORD_ERROR_SETUP_ZEROFRAMECOUNT;
|
||||
}
|
||||
int frameSize = nbChannels * bytesPerSample;
|
||||
size_t frameCount = buffSizeInBytes / frameSize;
|
||||
|
||||
if ((uint32_t(source) >= AUDIO_SOURCE_CNT) && (uint32_t(source) != AUDIO_SOURCE_HOTWORD)) {
|
||||
ALOGE("Error creating AudioRecord: unknown source.");
|
||||
return AUDIORECORD_ERROR_SETUP_INVALIDSOURCE;
|
||||
return (jint) AUDIORECORD_ERROR_SETUP_INVALIDSOURCE;
|
||||
}
|
||||
|
||||
jclass clazz = env->GetObjectClass(thiz);
|
||||
if (clazz == NULL) {
|
||||
ALOGE("Can't find %s when setting up callback.", kClassPathName);
|
||||
return AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED;
|
||||
return (jint) AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED;
|
||||
}
|
||||
|
||||
if (jSession == NULL) {
|
||||
ALOGE("Error creating AudioRecord: invalid session ID pointer");
|
||||
return AUDIORECORD_ERROR;
|
||||
return (jint) AUDIORECORD_ERROR;
|
||||
}
|
||||
|
||||
jint* nSession = (jint *) env->GetPrimitiveArrayCritical(jSession, NULL);
|
||||
if (nSession == NULL) {
|
||||
ALOGE("Error creating AudioRecord: Error retrieving session id pointer");
|
||||
return AUDIORECORD_ERROR;
|
||||
return (jint) AUDIORECORD_ERROR;
|
||||
}
|
||||
int sessionId = nSession[0];
|
||||
env->ReleasePrimitiveArrayCritical(jSession, nSession, 0);
|
||||
@ -262,33 +262,33 @@ android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this,
|
||||
|
||||
// save our newly created callback information in the "nativeCallbackCookie" field
|
||||
// of the Java object (in mNativeCallbackCookie) so we can free the memory in finalize()
|
||||
env->SetIntField(thiz, javaAudioRecordFields.nativeCallbackCookie, (int)lpCallbackData);
|
||||
env->SetLongField(thiz, javaAudioRecordFields.nativeCallbackCookie, (jlong)lpCallbackData);
|
||||
|
||||
return AUDIORECORD_SUCCESS;
|
||||
return (jint) AUDIORECORD_SUCCESS;
|
||||
|
||||
// failure:
|
||||
native_init_failure:
|
||||
env->DeleteGlobalRef(lpCallbackData->audioRecord_class);
|
||||
env->DeleteGlobalRef(lpCallbackData->audioRecord_ref);
|
||||
delete lpCallbackData;
|
||||
env->SetIntField(thiz, javaAudioRecordFields.nativeCallbackCookie, 0);
|
||||
env->SetLongField(thiz, javaAudioRecordFields.nativeCallbackCookie, 0);
|
||||
|
||||
return AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED;
|
||||
return (jint) AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
static int
|
||||
static jint
|
||||
android_media_AudioRecord_start(JNIEnv *env, jobject thiz, jint event, jint triggerSession)
|
||||
{
|
||||
sp<AudioRecord> lpRecorder = getAudioRecord(env, thiz);
|
||||
if (lpRecorder == NULL ) {
|
||||
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
||||
return AUDIORECORD_ERROR;
|
||||
return (jint) AUDIORECORD_ERROR;
|
||||
}
|
||||
|
||||
return android_media_translateRecorderErrorCode(
|
||||
return (jint) android_media_translateRecorderErrorCode(
|
||||
lpRecorder->start((AudioSystem::sync_event_t)event, triggerSession));
|
||||
}
|
||||
|
||||
@ -319,12 +319,12 @@ static void android_media_AudioRecord_release(JNIEnv *env, jobject thiz) {
|
||||
ALOGV("About to delete lpRecorder: %x\n", (int)lpRecorder.get());
|
||||
lpRecorder->stop();
|
||||
|
||||
audiorecord_callback_cookie *lpCookie = (audiorecord_callback_cookie *)env->GetIntField(
|
||||
audiorecord_callback_cookie *lpCookie = (audiorecord_callback_cookie *)env->GetLongField(
|
||||
thiz, javaAudioRecordFields.nativeCallbackCookie);
|
||||
|
||||
// reset the native resources in the Java object so any attempt to access
|
||||
// them after a call to release fails.
|
||||
env->SetIntField(thiz, javaAudioRecordFields.nativeCallbackCookie, 0);
|
||||
env->SetLongField(thiz, javaAudioRecordFields.nativeCallbackCookie, 0);
|
||||
|
||||
// delete the callback information
|
||||
if (lpCookie) {
|
||||
@ -585,7 +585,7 @@ int register_android_media_AudioRecord(JNIEnv *env)
|
||||
// mNativeRecorderInJavaObj
|
||||
javaAudioRecordFields.nativeRecorderInJavaObj =
|
||||
env->GetFieldID(audioRecordClass,
|
||||
JAVA_NATIVERECORDERINJAVAOBJ_FIELD_NAME, "I");
|
||||
JAVA_NATIVERECORDERINJAVAOBJ_FIELD_NAME, "J");
|
||||
if (javaAudioRecordFields.nativeRecorderInJavaObj == NULL) {
|
||||
ALOGE("Can't find AudioRecord.%s", JAVA_NATIVERECORDERINJAVAOBJ_FIELD_NAME);
|
||||
return -1;
|
||||
@ -593,7 +593,7 @@ int register_android_media_AudioRecord(JNIEnv *env)
|
||||
// mNativeCallbackCookie
|
||||
javaAudioRecordFields.nativeCallbackCookie = env->GetFieldID(
|
||||
audioRecordClass,
|
||||
JAVA_NATIVECALLBACKINFO_FIELD_NAME, "I");
|
||||
JAVA_NATIVECALLBACKINFO_FIELD_NAME, "J");
|
||||
if (javaAudioRecordFields.nativeCallbackCookie == NULL) {
|
||||
ALOGE("Can't find AudioRecord.%s", JAVA_NATIVECALLBACKINFO_FIELD_NAME);
|
||||
return -1;
|
||||
|
@ -52,10 +52,10 @@ static int check_AudioSystem_Command(status_t status)
|
||||
return kAudioStatusError;
|
||||
}
|
||||
|
||||
static int
|
||||
static jint
|
||||
android_media_AudioSystem_muteMicrophone(JNIEnv *env, jobject thiz, jboolean on)
|
||||
{
|
||||
return check_AudioSystem_Command(AudioSystem::muteMicrophone(on));
|
||||
return (jint) check_AudioSystem_Command(AudioSystem::muteMicrophone(on));
|
||||
}
|
||||
|
||||
static jboolean
|
||||
@ -91,7 +91,7 @@ android_media_AudioSystem_isSourceActive(JNIEnv *env, jobject thiz, jint source)
|
||||
return state;
|
||||
}
|
||||
|
||||
static int
|
||||
static jint
|
||||
android_media_AudioSystem_setParameters(JNIEnv *env, jobject thiz, jstring keyValuePairs)
|
||||
{
|
||||
const jchar* c_keyValuePairs = env->GetStringCritical(keyValuePairs, 0);
|
||||
@ -101,7 +101,7 @@ android_media_AudioSystem_setParameters(JNIEnv *env, jobject thiz, jstring keyVa
|
||||
env->ReleaseStringCritical(keyValuePairs, c_keyValuePairs);
|
||||
}
|
||||
int status = check_AudioSystem_Command(AudioSystem::setParameters(0, c_keyValuePairs8));
|
||||
return status;
|
||||
return (jint) status;
|
||||
}
|
||||
|
||||
static jstring
|
||||
@ -131,7 +131,7 @@ android_media_AudioSystem_error_callback(status_t err)
|
||||
check_AudioSystem_Command(err));
|
||||
}
|
||||
|
||||
static int
|
||||
static jint
|
||||
android_media_AudioSystem_setDeviceConnectionState(JNIEnv *env, jobject thiz, jint device, jint state, jstring device_address)
|
||||
{
|
||||
const char *c_address = env->GetStringUTFChars(device_address, NULL);
|
||||
@ -139,60 +139,60 @@ android_media_AudioSystem_setDeviceConnectionState(JNIEnv *env, jobject thiz, ji
|
||||
static_cast <audio_policy_dev_state_t>(state),
|
||||
c_address));
|
||||
env->ReleaseStringUTFChars(device_address, c_address);
|
||||
return status;
|
||||
return (jint) status;
|
||||
}
|
||||
|
||||
static int
|
||||
static jint
|
||||
android_media_AudioSystem_getDeviceConnectionState(JNIEnv *env, jobject thiz, jint device, jstring device_address)
|
||||
{
|
||||
const char *c_address = env->GetStringUTFChars(device_address, NULL);
|
||||
int state = static_cast <int>(AudioSystem::getDeviceConnectionState(static_cast <audio_devices_t>(device),
|
||||
c_address));
|
||||
env->ReleaseStringUTFChars(device_address, c_address);
|
||||
return state;
|
||||
return (jint) state;
|
||||
}
|
||||
|
||||
static int
|
||||
static jint
|
||||
android_media_AudioSystem_setPhoneState(JNIEnv *env, jobject thiz, jint state)
|
||||
{
|
||||
return check_AudioSystem_Command(AudioSystem::setPhoneState((audio_mode_t) state));
|
||||
return (jint) check_AudioSystem_Command(AudioSystem::setPhoneState((audio_mode_t) state));
|
||||
}
|
||||
|
||||
static int
|
||||
static jint
|
||||
android_media_AudioSystem_setForceUse(JNIEnv *env, jobject thiz, jint usage, jint config)
|
||||
{
|
||||
return check_AudioSystem_Command(AudioSystem::setForceUse(static_cast <audio_policy_force_use_t>(usage),
|
||||
return (jint) check_AudioSystem_Command(AudioSystem::setForceUse(static_cast <audio_policy_force_use_t>(usage),
|
||||
static_cast <audio_policy_forced_cfg_t>(config)));
|
||||
}
|
||||
|
||||
static int
|
||||
static jint
|
||||
android_media_AudioSystem_getForceUse(JNIEnv *env, jobject thiz, jint usage)
|
||||
{
|
||||
return static_cast <int>(AudioSystem::getForceUse(static_cast <audio_policy_force_use_t>(usage)));
|
||||
return static_cast <jint>(AudioSystem::getForceUse(static_cast <audio_policy_force_use_t>(usage)));
|
||||
}
|
||||
|
||||
static int
|
||||
static jint
|
||||
android_media_AudioSystem_initStreamVolume(JNIEnv *env, jobject thiz, jint stream, jint indexMin, jint indexMax)
|
||||
{
|
||||
return check_AudioSystem_Command(AudioSystem::initStreamVolume(static_cast <audio_stream_type_t>(stream),
|
||||
return (jint) check_AudioSystem_Command(AudioSystem::initStreamVolume(static_cast <audio_stream_type_t>(stream),
|
||||
indexMin,
|
||||
indexMax));
|
||||
}
|
||||
|
||||
static int
|
||||
static jint
|
||||
android_media_AudioSystem_setStreamVolumeIndex(JNIEnv *env,
|
||||
jobject thiz,
|
||||
jint stream,
|
||||
jint index,
|
||||
jint device)
|
||||
{
|
||||
return check_AudioSystem_Command(
|
||||
return (jint) check_AudioSystem_Command(
|
||||
AudioSystem::setStreamVolumeIndex(static_cast <audio_stream_type_t>(stream),
|
||||
index,
|
||||
(audio_devices_t)device));
|
||||
}
|
||||
|
||||
static int
|
||||
static jint
|
||||
android_media_AudioSystem_getStreamVolumeIndex(JNIEnv *env,
|
||||
jobject thiz,
|
||||
jint stream,
|
||||
@ -205,13 +205,13 @@ android_media_AudioSystem_getStreamVolumeIndex(JNIEnv *env,
|
||||
!= NO_ERROR) {
|
||||
index = -1;
|
||||
}
|
||||
return index;
|
||||
return (jint) index;
|
||||
}
|
||||
|
||||
static int
|
||||
static jint
|
||||
android_media_AudioSystem_setMasterVolume(JNIEnv *env, jobject thiz, jfloat value)
|
||||
{
|
||||
return check_AudioSystem_Command(AudioSystem::setMasterVolume(value));
|
||||
return (jint) check_AudioSystem_Command(AudioSystem::setMasterVolume(value));
|
||||
}
|
||||
|
||||
static jfloat
|
||||
@ -224,10 +224,10 @@ android_media_AudioSystem_getMasterVolume(JNIEnv *env, jobject thiz)
|
||||
return value;
|
||||
}
|
||||
|
||||
static int
|
||||
static jint
|
||||
android_media_AudioSystem_setMasterMute(JNIEnv *env, jobject thiz, jboolean mute)
|
||||
{
|
||||
return check_AudioSystem_Command(AudioSystem::setMasterMute(mute));
|
||||
return (jint) check_AudioSystem_Command(AudioSystem::setMasterMute(mute));
|
||||
}
|
||||
|
||||
static jfloat
|
||||
@ -275,10 +275,10 @@ android_media_AudioSystem_setLowRamDevice(JNIEnv *env, jobject clazz, jboolean i
|
||||
return (jint) AudioSystem::setLowRamDevice((bool) isLowRamDevice);
|
||||
}
|
||||
|
||||
static int
|
||||
static jint
|
||||
android_media_AudioSystem_checkAudioFlinger(JNIEnv *env, jobject clazz)
|
||||
{
|
||||
return check_AudioSystem_Command(AudioSystem::checkAudioFlinger());
|
||||
return (jint) check_AudioSystem_Command(AudioSystem::checkAudioFlinger());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -174,7 +174,7 @@ static sp<AudioTrack> getAudioTrack(JNIEnv* env, jobject thiz)
|
||||
{
|
||||
Mutex::Autolock l(sLock);
|
||||
AudioTrack* const at =
|
||||
(AudioTrack*)env->GetIntField(thiz, javaAudioTrackFields.nativeTrackInJavaObj);
|
||||
(AudioTrack*)env->GetLongField(thiz, javaAudioTrackFields.nativeTrackInJavaObj);
|
||||
return sp<AudioTrack>(at);
|
||||
}
|
||||
|
||||
@ -182,19 +182,19 @@ static sp<AudioTrack> setAudioTrack(JNIEnv* env, jobject thiz, const sp<AudioTra
|
||||
{
|
||||
Mutex::Autolock l(sLock);
|
||||
sp<AudioTrack> old =
|
||||
(AudioTrack*)env->GetIntField(thiz, javaAudioTrackFields.nativeTrackInJavaObj);
|
||||
(AudioTrack*)env->GetLongField(thiz, javaAudioTrackFields.nativeTrackInJavaObj);
|
||||
if (at.get()) {
|
||||
at->incStrong((void*)setAudioTrack);
|
||||
}
|
||||
if (old != 0) {
|
||||
old->decStrong((void*)setAudioTrack);
|
||||
}
|
||||
env->SetIntField(thiz, javaAudioTrackFields.nativeTrackInJavaObj, (int)at.get());
|
||||
env->SetLongField(thiz, javaAudioTrackFields.nativeTrackInJavaObj, (jlong)at.get());
|
||||
return old;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
static int
|
||||
static jint
|
||||
android_media_AudioTrack_native_setup(JNIEnv *env, jobject thiz, jobject weak_this,
|
||||
jint streamType, jint sampleRateInHertz, jint javaChannelMask,
|
||||
jint audioFormat, jint buffSizeInBytes, jint memoryMode, jintArray jSession)
|
||||
@ -206,11 +206,11 @@ android_media_AudioTrack_native_setup(JNIEnv *env, jobject thiz, jobject weak_th
|
||||
|
||||
if (AudioSystem::getOutputFrameCount(&afFrameCount, (audio_stream_type_t) streamType) != NO_ERROR) {
|
||||
ALOGE("Error creating AudioTrack: Could not get AudioSystem frame count.");
|
||||
return AUDIOTRACK_ERROR_SETUP_AUDIOSYSTEM;
|
||||
return (jint) AUDIOTRACK_ERROR_SETUP_AUDIOSYSTEM;
|
||||
}
|
||||
if (AudioSystem::getOutputSamplingRate(&afSampleRate, (audio_stream_type_t) streamType) != NO_ERROR) {
|
||||
ALOGE("Error creating AudioTrack: Could not get AudioSystem sampling rate.");
|
||||
return AUDIOTRACK_ERROR_SETUP_AUDIOSYSTEM;
|
||||
return (jint) AUDIOTRACK_ERROR_SETUP_AUDIOSYSTEM;
|
||||
}
|
||||
|
||||
// Java channel masks don't map directly to the native definition, but it's a simple shift
|
||||
@ -219,7 +219,7 @@ android_media_AudioTrack_native_setup(JNIEnv *env, jobject thiz, jobject weak_th
|
||||
|
||||
if (!audio_is_output_channel(nativeChannelMask)) {
|
||||
ALOGE("Error creating AudioTrack: invalid channel mask %#x.", javaChannelMask);
|
||||
return AUDIOTRACK_ERROR_SETUP_INVALIDCHANNELMASK;
|
||||
return (jint) AUDIOTRACK_ERROR_SETUP_INVALIDCHANNELMASK;
|
||||
}
|
||||
|
||||
int nbChannels = popcount(nativeChannelMask);
|
||||
@ -239,7 +239,7 @@ android_media_AudioTrack_native_setup(JNIEnv *env, jobject thiz, jobject weak_th
|
||||
break;
|
||||
default:
|
||||
ALOGE("Error creating AudioTrack: unknown stream type.");
|
||||
return AUDIOTRACK_ERROR_SETUP_INVALIDSTREAMTYPE;
|
||||
return (jint) AUDIOTRACK_ERROR_SETUP_INVALIDSTREAMTYPE;
|
||||
}
|
||||
|
||||
// check the format.
|
||||
@ -247,7 +247,7 @@ android_media_AudioTrack_native_setup(JNIEnv *env, jobject thiz, jobject weak_th
|
||||
if ((audioFormat != ENCODING_PCM_16BIT) && (audioFormat != ENCODING_PCM_8BIT)) {
|
||||
|
||||
ALOGE("Error creating AudioTrack: unsupported audio format.");
|
||||
return AUDIOTRACK_ERROR_SETUP_INVALIDFORMAT;
|
||||
return (jint) AUDIOTRACK_ERROR_SETUP_INVALIDFORMAT;
|
||||
}
|
||||
|
||||
// for the moment 8bitPCM in MODE_STATIC is not supported natively in the AudioTrack C++ class
|
||||
@ -272,18 +272,18 @@ android_media_AudioTrack_native_setup(JNIEnv *env, jobject thiz, jobject weak_th
|
||||
jclass clazz = env->GetObjectClass(thiz);
|
||||
if (clazz == NULL) {
|
||||
ALOGE("Can't find %s when setting up callback.", kClassPathName);
|
||||
return AUDIOTRACK_ERROR_SETUP_NATIVEINITFAILED;
|
||||
return (jint) AUDIOTRACK_ERROR_SETUP_NATIVEINITFAILED;
|
||||
}
|
||||
|
||||
if (jSession == NULL) {
|
||||
ALOGE("Error creating AudioTrack: invalid session ID pointer");
|
||||
return AUDIOTRACK_ERROR;
|
||||
return (jint) AUDIOTRACK_ERROR;
|
||||
}
|
||||
|
||||
jint* nSession = (jint *) env->GetPrimitiveArrayCritical(jSession, NULL);
|
||||
if (nSession == NULL) {
|
||||
ALOGE("Error creating AudioTrack: Error retrieving session id pointer");
|
||||
return AUDIOTRACK_ERROR;
|
||||
return (jint) AUDIOTRACK_ERROR;
|
||||
}
|
||||
int sessionId = nSession[0];
|
||||
env->ReleasePrimitiveArrayCritical(jSession, nSession, 0);
|
||||
@ -370,10 +370,10 @@ android_media_AudioTrack_native_setup(JNIEnv *env, jobject thiz, jobject weak_th
|
||||
setAudioTrack(env, thiz, lpTrack);
|
||||
|
||||
// save the JNI resources so we can free them later
|
||||
//ALOGV("storing lpJniStorage: %x\n", (int)lpJniStorage);
|
||||
env->SetIntField(thiz, javaAudioTrackFields.jniData, (int)lpJniStorage);
|
||||
//ALOGV("storing lpJniStorage: %x\n", (long)lpJniStorage);
|
||||
env->SetLongField(thiz, javaAudioTrackFields.jniData, (jlong)lpJniStorage);
|
||||
|
||||
return AUDIOTRACK_SUCCESS;
|
||||
return (jint) AUDIOTRACK_SUCCESS;
|
||||
|
||||
// failures:
|
||||
native_init_failure:
|
||||
@ -383,9 +383,9 @@ native_init_failure:
|
||||
env->DeleteGlobalRef(lpJniStorage->mCallbackData.audioTrack_class);
|
||||
env->DeleteGlobalRef(lpJniStorage->mCallbackData.audioTrack_ref);
|
||||
delete lpJniStorage;
|
||||
env->SetIntField(thiz, javaAudioTrackFields.jniData, 0);
|
||||
env->SetLongField(thiz, javaAudioTrackFields.jniData, 0);
|
||||
|
||||
return AUDIOTRACK_ERROR_SETUP_NATIVEINITFAILED;
|
||||
return (jint) AUDIOTRACK_ERROR_SETUP_NATIVEINITFAILED;
|
||||
}
|
||||
|
||||
|
||||
@ -474,11 +474,11 @@ static void android_media_AudioTrack_native_release(JNIEnv *env, jobject thiz)
|
||||
lpTrack->stop();
|
||||
|
||||
// delete the JNI data
|
||||
AudioTrackJniStorage* pJniStorage = (AudioTrackJniStorage *)env->GetIntField(
|
||||
AudioTrackJniStorage* pJniStorage = (AudioTrackJniStorage *)env->GetLongField(
|
||||
thiz, javaAudioTrackFields.jniData);
|
||||
// reset the native resources in the Java object so any attempt to access
|
||||
// them after a call to release fails.
|
||||
env->SetIntField(thiz, javaAudioTrackFields.jniData, 0);
|
||||
env->SetLongField(thiz, javaAudioTrackFields.jniData, 0);
|
||||
|
||||
if (pJniStorage) {
|
||||
Mutex::Autolock l(sLock);
|
||||
@ -955,7 +955,7 @@ int register_android_media_AudioTrack(JNIEnv *env)
|
||||
// nativeTrackInJavaObj
|
||||
javaAudioTrackFields.nativeTrackInJavaObj = env->GetFieldID(
|
||||
audioTrackClass,
|
||||
JAVA_NATIVETRACKINJAVAOBJ_FIELD_NAME, "I");
|
||||
JAVA_NATIVETRACKINJAVAOBJ_FIELD_NAME, "J");
|
||||
if (javaAudioTrackFields.nativeTrackInJavaObj == NULL) {
|
||||
ALOGE("Can't find AudioTrack.%s", JAVA_NATIVETRACKINJAVAOBJ_FIELD_NAME);
|
||||
return -1;
|
||||
@ -963,7 +963,7 @@ int register_android_media_AudioTrack(JNIEnv *env)
|
||||
// jniData;
|
||||
javaAudioTrackFields.jniData = env->GetFieldID(
|
||||
audioTrackClass,
|
||||
JAVA_JNIDATA_FIELD_NAME, "I");
|
||||
JAVA_JNIDATA_FIELD_NAME, "J");
|
||||
if (javaAudioTrackFields.jniData == NULL) {
|
||||
ALOGE("Can't find AudioTrack.%s", JAVA_JNIDATA_FIELD_NAME);
|
||||
return -1;
|
||||
|
@ -87,12 +87,12 @@ android_media_JetPlayer_setup(JNIEnv *env, jobject thiz, jobject weak_this,
|
||||
if (result==EAS_SUCCESS) {
|
||||
// save our newly created C++ JetPlayer in the "nativePlayerInJavaObj" field
|
||||
// of the Java object (in mNativePlayerInJavaObj)
|
||||
env->SetIntField(thiz, javaJetPlayerFields.nativePlayerInJavaObj, (int)lpJet);
|
||||
env->SetLongField(thiz, javaJetPlayerFields.nativePlayerInJavaObj, (jlong)lpJet);
|
||||
return JNI_TRUE;
|
||||
} else {
|
||||
ALOGE("android_media_JetPlayer_setup(): initialization failed with EAS error code %d", (int)result);
|
||||
delete lpJet;
|
||||
env->SetIntField(weak_this, javaJetPlayerFields.nativePlayerInJavaObj, 0);
|
||||
env->SetLongField(weak_this, javaJetPlayerFields.nativePlayerInJavaObj, 0);
|
||||
return JNI_FALSE;
|
||||
}
|
||||
}
|
||||
@ -103,7 +103,7 @@ static void
|
||||
android_media_JetPlayer_finalize(JNIEnv *env, jobject thiz)
|
||||
{
|
||||
ALOGV("android_media_JetPlayer_finalize(): entering.");
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||
if (lpJet != NULL) {
|
||||
lpJet->release();
|
||||
@ -119,7 +119,7 @@ static void
|
||||
android_media_JetPlayer_release(JNIEnv *env, jobject thiz)
|
||||
{
|
||||
android_media_JetPlayer_finalize(env, thiz);
|
||||
env->SetIntField(thiz, javaJetPlayerFields.nativePlayerInJavaObj, 0);
|
||||
env->SetLongField(thiz, javaJetPlayerFields.nativePlayerInJavaObj, 0);
|
||||
ALOGV("android_media_JetPlayer_release() done");
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ android_media_JetPlayer_release(JNIEnv *env, jobject thiz)
|
||||
static jboolean
|
||||
android_media_JetPlayer_loadFromFile(JNIEnv *env, jobject thiz, jstring path)
|
||||
{
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||
if (lpJet == NULL) {
|
||||
jniThrowException(env, "java/lang/IllegalStateException",
|
||||
@ -165,7 +165,7 @@ static jboolean
|
||||
android_media_JetPlayer_loadFromFileD(JNIEnv *env, jobject thiz,
|
||||
jobject fileDescriptor, jlong offset, jlong length)
|
||||
{
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||
if (lpJet == NULL) {
|
||||
jniThrowException(env, "java/lang/IllegalStateException",
|
||||
@ -195,7 +195,7 @@ android_media_JetPlayer_loadFromFileD(JNIEnv *env, jobject thiz,
|
||||
static jboolean
|
||||
android_media_JetPlayer_closeFile(JNIEnv *env, jobject thiz)
|
||||
{
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||
if (lpJet == NULL) {
|
||||
jniThrowException(env, "java/lang/IllegalStateException",
|
||||
@ -217,7 +217,7 @@ android_media_JetPlayer_closeFile(JNIEnv *env, jobject thiz)
|
||||
static jboolean
|
||||
android_media_JetPlayer_play(JNIEnv *env, jobject thiz)
|
||||
{
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||
if (lpJet == NULL) {
|
||||
jniThrowException(env, "java/lang/IllegalStateException",
|
||||
@ -241,7 +241,7 @@ android_media_JetPlayer_play(JNIEnv *env, jobject thiz)
|
||||
static jboolean
|
||||
android_media_JetPlayer_pause(JNIEnv *env, jobject thiz)
|
||||
{
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||
if (lpJet == NULL) {
|
||||
jniThrowException(env, "java/lang/IllegalStateException",
|
||||
@ -271,7 +271,7 @@ android_media_JetPlayer_queueSegment(JNIEnv *env, jobject thiz,
|
||||
jint segmentNum, jint libNum, jint repeatCount, jint transpose, jint muteFlags,
|
||||
jbyte userID)
|
||||
{
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||
if (lpJet == NULL) {
|
||||
jniThrowException(env, "java/lang/IllegalStateException",
|
||||
@ -298,7 +298,7 @@ android_media_JetPlayer_queueSegmentMuteArray(JNIEnv *env, jobject thiz,
|
||||
jint segmentNum, jint libNum, jint repeatCount, jint transpose, jbooleanArray muteArray,
|
||||
jbyte userID)
|
||||
{
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||
if (lpJet == NULL) {
|
||||
jniThrowException(env, "java/lang/IllegalStateException",
|
||||
@ -344,7 +344,7 @@ static jboolean
|
||||
android_media_JetPlayer_setMuteFlags(JNIEnv *env, jobject thiz,
|
||||
jint muteFlags /*unsigned?*/, jboolean bSync)
|
||||
{
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||
if (lpJet == NULL) {
|
||||
jniThrowException(env, "java/lang/IllegalStateException",
|
||||
@ -369,7 +369,7 @@ static jboolean
|
||||
android_media_JetPlayer_setMuteArray(JNIEnv *env, jobject thiz,
|
||||
jbooleanArray muteArray, jboolean bSync)
|
||||
{
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||
if (lpJet == NULL) {
|
||||
jniThrowException(env, "java/lang/IllegalStateException",
|
||||
@ -415,7 +415,7 @@ static jboolean
|
||||
android_media_JetPlayer_setMuteFlag(JNIEnv *env, jobject thiz,
|
||||
jint trackId, jboolean muteFlag, jboolean bSync)
|
||||
{
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||
if (lpJet == NULL) {
|
||||
jniThrowException(env, "java/lang/IllegalStateException",
|
||||
@ -441,7 +441,7 @@ android_media_JetPlayer_setMuteFlag(JNIEnv *env, jobject thiz,
|
||||
static jboolean
|
||||
android_media_JetPlayer_triggerClip(JNIEnv *env, jobject thiz, jint clipId)
|
||||
{
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||
if (lpJet == NULL) {
|
||||
jniThrowException(env, "java/lang/IllegalStateException",
|
||||
@ -466,7 +466,7 @@ android_media_JetPlayer_triggerClip(JNIEnv *env, jobject thiz, jint clipId)
|
||||
static jboolean
|
||||
android_media_JetPlayer_clearQueue(JNIEnv *env, jobject thiz)
|
||||
{
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
||||
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||
if (lpJet == NULL) {
|
||||
jniThrowException(env, "java/lang/IllegalStateException",
|
||||
@ -533,7 +533,7 @@ int register_android_media_JetPlayer(JNIEnv *env)
|
||||
// Get the mNativePlayerInJavaObj variable field
|
||||
javaJetPlayerFields.nativePlayerInJavaObj = env->GetFieldID(
|
||||
jetPlayerClass,
|
||||
JAVA_NATIVEJETPLAYERINJAVAOBJ_FIELD_NAME, "I");
|
||||
JAVA_NATIVEJETPLAYERINJAVAOBJ_FIELD_NAME, "J");
|
||||
if (javaJetPlayerFields.nativePlayerInJavaObj == NULL) {
|
||||
ALOGE("Can't find JetPlayer.%s", JAVA_NATIVEJETPLAYERINJAVAOBJ_FIELD_NAME);
|
||||
return -1;
|
||||
|
@ -134,7 +134,7 @@ private:
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static jint nativeListen(JNIEnv* env, jobject remoteDisplayObj, jstring ifaceStr) {
|
||||
static jlong nativeListen(JNIEnv* env, jobject remoteDisplayObj, jstring ifaceStr) {
|
||||
ScopedUtfChars iface(env, ifaceStr);
|
||||
|
||||
sp<IServiceManager> sm = defaultServiceManager();
|
||||
@ -155,20 +155,20 @@ static jint nativeListen(JNIEnv* env, jobject remoteDisplayObj, jstring ifaceStr
|
||||
}
|
||||
|
||||
NativeRemoteDisplay* wrapper = new NativeRemoteDisplay(display, client);
|
||||
return reinterpret_cast<jint>(wrapper);
|
||||
return reinterpret_cast<jlong>(wrapper);
|
||||
}
|
||||
|
||||
static void nativePause(JNIEnv* env, jobject remoteDisplayObj, jint ptr) {
|
||||
static void nativePause(JNIEnv* env, jobject remoteDisplayObj, jlong ptr) {
|
||||
NativeRemoteDisplay* wrapper = reinterpret_cast<NativeRemoteDisplay*>(ptr);
|
||||
wrapper->pause();
|
||||
}
|
||||
|
||||
static void nativeResume(JNIEnv* env, jobject remoteDisplayObj, jint ptr) {
|
||||
static void nativeResume(JNIEnv* env, jobject remoteDisplayObj, jlong ptr) {
|
||||
NativeRemoteDisplay* wrapper = reinterpret_cast<NativeRemoteDisplay*>(ptr);
|
||||
wrapper->resume();
|
||||
}
|
||||
|
||||
static void nativeDispose(JNIEnv* env, jobject remoteDisplayObj, jint ptr) {
|
||||
static void nativeDispose(JNIEnv* env, jobject remoteDisplayObj, jlong ptr) {
|
||||
NativeRemoteDisplay* wrapper = reinterpret_cast<NativeRemoteDisplay*>(ptr);
|
||||
delete wrapper;
|
||||
}
|
||||
@ -176,13 +176,13 @@ static void nativeDispose(JNIEnv* env, jobject remoteDisplayObj, jint ptr) {
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static JNINativeMethod gMethods[] = {
|
||||
{"nativeListen", "(Ljava/lang/String;)I",
|
||||
{"nativeListen", "(Ljava/lang/String;)J",
|
||||
(void*)nativeListen },
|
||||
{"nativeDispose", "(I)V",
|
||||
{"nativeDispose", "(J)V",
|
||||
(void*)nativeDispose },
|
||||
{"nativePause", "(I)V",
|
||||
{"nativePause", "(J)V",
|
||||
(void*)nativePause },
|
||||
{"nativeResume", "(I)V",
|
||||
{"nativeResume", "(J)V",
|
||||
(void*)nativeResume },
|
||||
};
|
||||
|
||||
|
@ -39,9 +39,9 @@ struct fields_t {
|
||||
static fields_t fields;
|
||||
|
||||
static jboolean android_media_ToneGenerator_startTone(JNIEnv *env, jobject thiz, jint toneType, jint durationMs) {
|
||||
ALOGV("android_media_ToneGenerator_startTone: %x", (int)thiz);
|
||||
ALOGV("android_media_ToneGenerator_startTone: %p", thiz);
|
||||
|
||||
ToneGenerator *lpToneGen = (ToneGenerator *)env->GetIntField(thiz,
|
||||
ToneGenerator *lpToneGen = (ToneGenerator *)env->GetLongField(thiz,
|
||||
fields.context);
|
||||
if (lpToneGen == NULL) {
|
||||
jniThrowRuntimeException(env, "Method called after release()");
|
||||
@ -52,12 +52,12 @@ static jboolean android_media_ToneGenerator_startTone(JNIEnv *env, jobject thiz,
|
||||
}
|
||||
|
||||
static void android_media_ToneGenerator_stopTone(JNIEnv *env, jobject thiz) {
|
||||
ALOGV("android_media_ToneGenerator_stopTone: %x", (int)thiz);
|
||||
ALOGV("android_media_ToneGenerator_stopTone: %p", thiz);
|
||||
|
||||
ToneGenerator *lpToneGen = (ToneGenerator *)env->GetIntField(thiz,
|
||||
ToneGenerator *lpToneGen = (ToneGenerator *)env->GetLongField(thiz,
|
||||
fields.context);
|
||||
|
||||
ALOGV("ToneGenerator lpToneGen: %x", (unsigned int)lpToneGen);
|
||||
ALOGV("ToneGenerator lpToneGen: %p", lpToneGen);
|
||||
if (lpToneGen == NULL) {
|
||||
jniThrowRuntimeException(env, "Method called after release()");
|
||||
return;
|
||||
@ -66,7 +66,7 @@ static void android_media_ToneGenerator_stopTone(JNIEnv *env, jobject thiz) {
|
||||
}
|
||||
|
||||
static jint android_media_ToneGenerator_getAudioSessionId(JNIEnv *env, jobject thiz) {
|
||||
ToneGenerator *lpToneGen = (ToneGenerator *)env->GetIntField(thiz,
|
||||
ToneGenerator *lpToneGen = (ToneGenerator *)env->GetLongField(thiz,
|
||||
fields.context);
|
||||
if (lpToneGen == NULL) {
|
||||
jniThrowRuntimeException(env, "Method called after release()");
|
||||
@ -76,11 +76,11 @@ static jint android_media_ToneGenerator_getAudioSessionId(JNIEnv *env, jobject t
|
||||
}
|
||||
|
||||
static void android_media_ToneGenerator_release(JNIEnv *env, jobject thiz) {
|
||||
ToneGenerator *lpToneGen = (ToneGenerator *)env->GetIntField(thiz,
|
||||
ToneGenerator *lpToneGen = (ToneGenerator *)env->GetLongField(thiz,
|
||||
fields.context);
|
||||
ALOGV("android_media_ToneGenerator_release lpToneGen: %x", (int)lpToneGen);
|
||||
ALOGV("android_media_ToneGenerator_release lpToneGen: %p", lpToneGen);
|
||||
|
||||
env->SetIntField(thiz, fields.context, 0);
|
||||
env->SetLongField(thiz, fields.context, 0);
|
||||
|
||||
delete lpToneGen;
|
||||
}
|
||||
@ -89,11 +89,11 @@ static void android_media_ToneGenerator_native_setup(JNIEnv *env, jobject thiz,
|
||||
jint streamType, jint volume) {
|
||||
ToneGenerator *lpToneGen = new ToneGenerator((audio_stream_type_t) streamType, AudioSystem::linearToLog(volume), true);
|
||||
|
||||
env->SetIntField(thiz, fields.context, 0);
|
||||
env->SetLongField(thiz, fields.context, 0);
|
||||
|
||||
ALOGV("android_media_ToneGenerator_native_setup jobject: %x", (int)thiz);
|
||||
ALOGV("android_media_ToneGenerator_native_setup jobject: %p", thiz);
|
||||
|
||||
ALOGV("ToneGenerator lpToneGen: %x", (unsigned int)lpToneGen);
|
||||
ALOGV("ToneGenerator lpToneGen: %p", lpToneGen);
|
||||
|
||||
if (!lpToneGen->isInited()) {
|
||||
ALOGE("ToneGenerator init failed");
|
||||
@ -103,16 +103,16 @@ static void android_media_ToneGenerator_native_setup(JNIEnv *env, jobject thiz,
|
||||
}
|
||||
|
||||
// Stow our new C++ ToneGenerator in an opaque field in the Java object.
|
||||
env->SetIntField(thiz, fields.context, (int)lpToneGen);
|
||||
env->SetLongField(thiz, fields.context, (jlong)lpToneGen);
|
||||
|
||||
ALOGV("ToneGenerator fields.context: %x", env->GetIntField(thiz, fields.context));
|
||||
ALOGV("ToneGenerator fields.context: %p", (void*) env->GetLongField(thiz, fields.context));
|
||||
}
|
||||
|
||||
static void android_media_ToneGenerator_native_finalize(JNIEnv *env,
|
||||
jobject thiz) {
|
||||
ALOGV("android_media_ToneGenerator_native_finalize jobject: %x", (int)thiz);
|
||||
ALOGV("android_media_ToneGenerator_native_finalize jobject: %p", thiz);
|
||||
|
||||
ToneGenerator *lpToneGen = (ToneGenerator *)env->GetIntField(thiz,
|
||||
ToneGenerator *lpToneGen = (ToneGenerator *)env->GetLongField(thiz,
|
||||
fields.context);
|
||||
|
||||
if (lpToneGen != NULL) {
|
||||
@ -142,12 +142,12 @@ int register_android_media_ToneGenerator(JNIEnv *env) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
fields.context = env->GetFieldID(clazz, "mNativeContext", "I");
|
||||
fields.context = env->GetFieldID(clazz, "mNativeContext", "J");
|
||||
if (fields.context == NULL) {
|
||||
ALOGE("Can't find ToneGenerator.mNativeContext");
|
||||
return -1;
|
||||
}
|
||||
ALOGV("register_android_media_ToneGenerator ToneGenerator fields.context: %x", (unsigned int)fields.context);
|
||||
ALOGV("register_android_media_ToneGenerator ToneGenerator fields.context: %p", fields.context);
|
||||
|
||||
return AndroidRuntime::registerNativeMethods(env,
|
||||
"android/media/ToneGenerator", gMethods, NELEM(gMethods));
|
||||
|
@ -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;
|
||||
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -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;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
||||
//--------------------------------------------
|
||||
|
@ -644,5 +644,5 @@ final public class MediaCodec {
|
||||
native_init();
|
||||
}
|
||||
|
||||
private int mNativeContext;
|
||||
private long mNativeContext;
|
||||
}
|
||||
|
@ -88,5 +88,5 @@ public final class MediaCrypto {
|
||||
native_init();
|
||||
}
|
||||
|
||||
private int mNativeContext;
|
||||
private long mNativeContext;
|
||||
}
|
||||
|
@ -352,5 +352,5 @@ final public class MediaExtractor {
|
||||
native_init();
|
||||
}
|
||||
|
||||
private int mNativeContext;
|
||||
private long mNativeContext;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -572,8 +572,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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -443,7 +443,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;
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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"));
|
||||
|
@ -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[] = {
|
||||
|
@ -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(
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 void
|
||||
@ -392,7 +392,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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user