am 1d78ae42
: am 24d63a83
: am bc0468e6
: am 6f17adba
: Merge "AArch64: Use long for pointers in media classes"
* commit '1d78ae42d0c5968bec0649784000063b689b2c51': 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);
|
Mutex::Autolock l(sLock);
|
||||||
AudioRecord* const ar =
|
AudioRecord* const ar =
|
||||||
(AudioRecord*)env->GetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
|
(AudioRecord*)env->GetLongField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
|
||||||
return sp<AudioRecord>(ar);
|
return sp<AudioRecord>(ar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,19 +144,19 @@ static sp<AudioRecord> setAudioRecord(JNIEnv* env, jobject thiz, const sp<AudioR
|
|||||||
{
|
{
|
||||||
Mutex::Autolock l(sLock);
|
Mutex::Autolock l(sLock);
|
||||||
sp<AudioRecord> old =
|
sp<AudioRecord> old =
|
||||||
(AudioRecord*)env->GetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
|
(AudioRecord*)env->GetLongField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
|
||||||
if (ar.get()) {
|
if (ar.get()) {
|
||||||
ar->incStrong((void*)setAudioRecord);
|
ar->incStrong((void*)setAudioRecord);
|
||||||
}
|
}
|
||||||
if (old != 0) {
|
if (old != 0) {
|
||||||
old->decStrong((void*)setAudioRecord);
|
old->decStrong((void*)setAudioRecord);
|
||||||
}
|
}
|
||||||
env->SetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj, (int)ar.get());
|
env->SetLongField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj, (jlong)ar.get());
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
static int
|
static jint
|
||||||
android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this,
|
android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this,
|
||||||
jint source, jint sampleRateInHertz, jint channelMask,
|
jint source, jint sampleRateInHertz, jint channelMask,
|
||||||
// Java channel masks map directly to the native definition
|
// 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)) {
|
if (!audio_is_input_channel(channelMask)) {
|
||||||
ALOGE("Error creating AudioRecord: channel mask %#x is not valid.", 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);
|
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)
|
if ((audioFormat != ENCODING_PCM_16BIT)
|
||||||
&& (audioFormat != ENCODING_PCM_8BIT)) {
|
&& (audioFormat != ENCODING_PCM_8BIT)) {
|
||||||
ALOGE("Error creating AudioRecord: unsupported audio format.");
|
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;
|
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) {
|
if (buffSizeInBytes == 0) {
|
||||||
ALOGE("Error creating AudioRecord: frameCount is 0.");
|
ALOGE("Error creating AudioRecord: frameCount is 0.");
|
||||||
return AUDIORECORD_ERROR_SETUP_ZEROFRAMECOUNT;
|
return (jint) AUDIORECORD_ERROR_SETUP_ZEROFRAMECOUNT;
|
||||||
}
|
}
|
||||||
int frameSize = nbChannels * bytesPerSample;
|
int frameSize = nbChannels * bytesPerSample;
|
||||||
size_t frameCount = buffSizeInBytes / frameSize;
|
size_t frameCount = buffSizeInBytes / frameSize;
|
||||||
|
|
||||||
if ((uint32_t(source) >= AUDIO_SOURCE_CNT) && (uint32_t(source) != AUDIO_SOURCE_HOTWORD)) {
|
if ((uint32_t(source) >= AUDIO_SOURCE_CNT) && (uint32_t(source) != AUDIO_SOURCE_HOTWORD)) {
|
||||||
ALOGE("Error creating AudioRecord: unknown source.");
|
ALOGE("Error creating AudioRecord: unknown source.");
|
||||||
return AUDIORECORD_ERROR_SETUP_INVALIDSOURCE;
|
return (jint) AUDIORECORD_ERROR_SETUP_INVALIDSOURCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
jclass clazz = env->GetObjectClass(thiz);
|
jclass clazz = env->GetObjectClass(thiz);
|
||||||
if (clazz == NULL) {
|
if (clazz == NULL) {
|
||||||
ALOGE("Can't find %s when setting up callback.", kClassPathName);
|
ALOGE("Can't find %s when setting up callback.", kClassPathName);
|
||||||
return AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED;
|
return (jint) AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jSession == NULL) {
|
if (jSession == NULL) {
|
||||||
ALOGE("Error creating AudioRecord: invalid session ID pointer");
|
ALOGE("Error creating AudioRecord: invalid session ID pointer");
|
||||||
return AUDIORECORD_ERROR;
|
return (jint) AUDIORECORD_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
jint* nSession = (jint *) env->GetPrimitiveArrayCritical(jSession, NULL);
|
jint* nSession = (jint *) env->GetPrimitiveArrayCritical(jSession, NULL);
|
||||||
if (nSession == NULL) {
|
if (nSession == NULL) {
|
||||||
ALOGE("Error creating AudioRecord: Error retrieving session id pointer");
|
ALOGE("Error creating AudioRecord: Error retrieving session id pointer");
|
||||||
return AUDIORECORD_ERROR;
|
return (jint) AUDIORECORD_ERROR;
|
||||||
}
|
}
|
||||||
int sessionId = nSession[0];
|
int sessionId = nSession[0];
|
||||||
env->ReleasePrimitiveArrayCritical(jSession, 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
|
// save our newly created callback information in the "nativeCallbackCookie" field
|
||||||
// of the Java object (in mNativeCallbackCookie) so we can free the memory in finalize()
|
// 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:
|
// failure:
|
||||||
native_init_failure:
|
native_init_failure:
|
||||||
env->DeleteGlobalRef(lpCallbackData->audioRecord_class);
|
env->DeleteGlobalRef(lpCallbackData->audioRecord_class);
|
||||||
env->DeleteGlobalRef(lpCallbackData->audioRecord_ref);
|
env->DeleteGlobalRef(lpCallbackData->audioRecord_ref);
|
||||||
delete lpCallbackData;
|
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)
|
android_media_AudioRecord_start(JNIEnv *env, jobject thiz, jint event, jint triggerSession)
|
||||||
{
|
{
|
||||||
sp<AudioRecord> lpRecorder = getAudioRecord(env, thiz);
|
sp<AudioRecord> lpRecorder = getAudioRecord(env, thiz);
|
||||||
if (lpRecorder == NULL ) {
|
if (lpRecorder == NULL ) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", 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));
|
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());
|
ALOGV("About to delete lpRecorder: %x\n", (int)lpRecorder.get());
|
||||||
lpRecorder->stop();
|
lpRecorder->stop();
|
||||||
|
|
||||||
audiorecord_callback_cookie *lpCookie = (audiorecord_callback_cookie *)env->GetIntField(
|
audiorecord_callback_cookie *lpCookie = (audiorecord_callback_cookie *)env->GetLongField(
|
||||||
thiz, javaAudioRecordFields.nativeCallbackCookie);
|
thiz, javaAudioRecordFields.nativeCallbackCookie);
|
||||||
|
|
||||||
// reset the native resources in the Java object so any attempt to access
|
// reset the native resources in the Java object so any attempt to access
|
||||||
// them after a call to release fails.
|
// them after a call to release fails.
|
||||||
env->SetIntField(thiz, javaAudioRecordFields.nativeCallbackCookie, 0);
|
env->SetLongField(thiz, javaAudioRecordFields.nativeCallbackCookie, 0);
|
||||||
|
|
||||||
// delete the callback information
|
// delete the callback information
|
||||||
if (lpCookie) {
|
if (lpCookie) {
|
||||||
@ -585,7 +585,7 @@ int register_android_media_AudioRecord(JNIEnv *env)
|
|||||||
// mNativeRecorderInJavaObj
|
// mNativeRecorderInJavaObj
|
||||||
javaAudioRecordFields.nativeRecorderInJavaObj =
|
javaAudioRecordFields.nativeRecorderInJavaObj =
|
||||||
env->GetFieldID(audioRecordClass,
|
env->GetFieldID(audioRecordClass,
|
||||||
JAVA_NATIVERECORDERINJAVAOBJ_FIELD_NAME, "I");
|
JAVA_NATIVERECORDERINJAVAOBJ_FIELD_NAME, "J");
|
||||||
if (javaAudioRecordFields.nativeRecorderInJavaObj == NULL) {
|
if (javaAudioRecordFields.nativeRecorderInJavaObj == NULL) {
|
||||||
ALOGE("Can't find AudioRecord.%s", JAVA_NATIVERECORDERINJAVAOBJ_FIELD_NAME);
|
ALOGE("Can't find AudioRecord.%s", JAVA_NATIVERECORDERINJAVAOBJ_FIELD_NAME);
|
||||||
return -1;
|
return -1;
|
||||||
@ -593,7 +593,7 @@ int register_android_media_AudioRecord(JNIEnv *env)
|
|||||||
// mNativeCallbackCookie
|
// mNativeCallbackCookie
|
||||||
javaAudioRecordFields.nativeCallbackCookie = env->GetFieldID(
|
javaAudioRecordFields.nativeCallbackCookie = env->GetFieldID(
|
||||||
audioRecordClass,
|
audioRecordClass,
|
||||||
JAVA_NATIVECALLBACKINFO_FIELD_NAME, "I");
|
JAVA_NATIVECALLBACKINFO_FIELD_NAME, "J");
|
||||||
if (javaAudioRecordFields.nativeCallbackCookie == NULL) {
|
if (javaAudioRecordFields.nativeCallbackCookie == NULL) {
|
||||||
ALOGE("Can't find AudioRecord.%s", JAVA_NATIVECALLBACKINFO_FIELD_NAME);
|
ALOGE("Can't find AudioRecord.%s", JAVA_NATIVECALLBACKINFO_FIELD_NAME);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -52,10 +52,10 @@ static int check_AudioSystem_Command(status_t status)
|
|||||||
return kAudioStatusError;
|
return kAudioStatusError;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static jint
|
||||||
android_media_AudioSystem_muteMicrophone(JNIEnv *env, jobject thiz, jboolean on)
|
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
|
static jboolean
|
||||||
@ -91,7 +91,7 @@ android_media_AudioSystem_isSourceActive(JNIEnv *env, jobject thiz, jint source)
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static jint
|
||||||
android_media_AudioSystem_setParameters(JNIEnv *env, jobject thiz, jstring keyValuePairs)
|
android_media_AudioSystem_setParameters(JNIEnv *env, jobject thiz, jstring keyValuePairs)
|
||||||
{
|
{
|
||||||
const jchar* c_keyValuePairs = env->GetStringCritical(keyValuePairs, 0);
|
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);
|
env->ReleaseStringCritical(keyValuePairs, c_keyValuePairs);
|
||||||
}
|
}
|
||||||
int status = check_AudioSystem_Command(AudioSystem::setParameters(0, c_keyValuePairs8));
|
int status = check_AudioSystem_Command(AudioSystem::setParameters(0, c_keyValuePairs8));
|
||||||
return status;
|
return (jint) status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static jstring
|
static jstring
|
||||||
@ -131,7 +131,7 @@ android_media_AudioSystem_error_callback(status_t err)
|
|||||||
check_AudioSystem_Command(err));
|
check_AudioSystem_Command(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static jint
|
||||||
android_media_AudioSystem_setDeviceConnectionState(JNIEnv *env, jobject thiz, jint device, jint state, jstring device_address)
|
android_media_AudioSystem_setDeviceConnectionState(JNIEnv *env, jobject thiz, jint device, jint state, jstring device_address)
|
||||||
{
|
{
|
||||||
const char *c_address = env->GetStringUTFChars(device_address, NULL);
|
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),
|
static_cast <audio_policy_dev_state_t>(state),
|
||||||
c_address));
|
c_address));
|
||||||
env->ReleaseStringUTFChars(device_address, 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)
|
android_media_AudioSystem_getDeviceConnectionState(JNIEnv *env, jobject thiz, jint device, jstring device_address)
|
||||||
{
|
{
|
||||||
const char *c_address = env->GetStringUTFChars(device_address, NULL);
|
const char *c_address = env->GetStringUTFChars(device_address, NULL);
|
||||||
int state = static_cast <int>(AudioSystem::getDeviceConnectionState(static_cast <audio_devices_t>(device),
|
int state = static_cast <int>(AudioSystem::getDeviceConnectionState(static_cast <audio_devices_t>(device),
|
||||||
c_address));
|
c_address));
|
||||||
env->ReleaseStringUTFChars(device_address, 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)
|
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)
|
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_cast <audio_policy_forced_cfg_t>(config)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static jint
|
||||||
android_media_AudioSystem_getForceUse(JNIEnv *env, jobject thiz, jint usage)
|
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)
|
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,
|
indexMin,
|
||||||
indexMax));
|
indexMax));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static jint
|
||||||
android_media_AudioSystem_setStreamVolumeIndex(JNIEnv *env,
|
android_media_AudioSystem_setStreamVolumeIndex(JNIEnv *env,
|
||||||
jobject thiz,
|
jobject thiz,
|
||||||
jint stream,
|
jint stream,
|
||||||
jint index,
|
jint index,
|
||||||
jint device)
|
jint device)
|
||||||
{
|
{
|
||||||
return check_AudioSystem_Command(
|
return (jint) check_AudioSystem_Command(
|
||||||
AudioSystem::setStreamVolumeIndex(static_cast <audio_stream_type_t>(stream),
|
AudioSystem::setStreamVolumeIndex(static_cast <audio_stream_type_t>(stream),
|
||||||
index,
|
index,
|
||||||
(audio_devices_t)device));
|
(audio_devices_t)device));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static jint
|
||||||
android_media_AudioSystem_getStreamVolumeIndex(JNIEnv *env,
|
android_media_AudioSystem_getStreamVolumeIndex(JNIEnv *env,
|
||||||
jobject thiz,
|
jobject thiz,
|
||||||
jint stream,
|
jint stream,
|
||||||
@ -205,13 +205,13 @@ android_media_AudioSystem_getStreamVolumeIndex(JNIEnv *env,
|
|||||||
!= NO_ERROR) {
|
!= NO_ERROR) {
|
||||||
index = -1;
|
index = -1;
|
||||||
}
|
}
|
||||||
return index;
|
return (jint) index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static jint
|
||||||
android_media_AudioSystem_setMasterVolume(JNIEnv *env, jobject thiz, jfloat value)
|
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
|
static jfloat
|
||||||
@ -224,10 +224,10 @@ android_media_AudioSystem_getMasterVolume(JNIEnv *env, jobject thiz)
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static jint
|
||||||
android_media_AudioSystem_setMasterMute(JNIEnv *env, jobject thiz, jboolean mute)
|
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
|
static jfloat
|
||||||
@ -275,10 +275,10 @@ android_media_AudioSystem_setLowRamDevice(JNIEnv *env, jobject clazz, jboolean i
|
|||||||
return (jint) AudioSystem::setLowRamDevice((bool) isLowRamDevice);
|
return (jint) AudioSystem::setLowRamDevice((bool) isLowRamDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static jint
|
||||||
android_media_AudioSystem_checkAudioFlinger(JNIEnv *env, jobject clazz)
|
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);
|
Mutex::Autolock l(sLock);
|
||||||
AudioTrack* const at =
|
AudioTrack* const at =
|
||||||
(AudioTrack*)env->GetIntField(thiz, javaAudioTrackFields.nativeTrackInJavaObj);
|
(AudioTrack*)env->GetLongField(thiz, javaAudioTrackFields.nativeTrackInJavaObj);
|
||||||
return sp<AudioTrack>(at);
|
return sp<AudioTrack>(at);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,19 +182,19 @@ static sp<AudioTrack> setAudioTrack(JNIEnv* env, jobject thiz, const sp<AudioTra
|
|||||||
{
|
{
|
||||||
Mutex::Autolock l(sLock);
|
Mutex::Autolock l(sLock);
|
||||||
sp<AudioTrack> old =
|
sp<AudioTrack> old =
|
||||||
(AudioTrack*)env->GetIntField(thiz, javaAudioTrackFields.nativeTrackInJavaObj);
|
(AudioTrack*)env->GetLongField(thiz, javaAudioTrackFields.nativeTrackInJavaObj);
|
||||||
if (at.get()) {
|
if (at.get()) {
|
||||||
at->incStrong((void*)setAudioTrack);
|
at->incStrong((void*)setAudioTrack);
|
||||||
}
|
}
|
||||||
if (old != 0) {
|
if (old != 0) {
|
||||||
old->decStrong((void*)setAudioTrack);
|
old->decStrong((void*)setAudioTrack);
|
||||||
}
|
}
|
||||||
env->SetIntField(thiz, javaAudioTrackFields.nativeTrackInJavaObj, (int)at.get());
|
env->SetLongField(thiz, javaAudioTrackFields.nativeTrackInJavaObj, (jlong)at.get());
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
static int
|
static jint
|
||||||
android_media_AudioTrack_native_setup(JNIEnv *env, jobject thiz, jobject weak_this,
|
android_media_AudioTrack_native_setup(JNIEnv *env, jobject thiz, jobject weak_this,
|
||||||
jint streamType, jint sampleRateInHertz, jint javaChannelMask,
|
jint streamType, jint sampleRateInHertz, jint javaChannelMask,
|
||||||
jint audioFormat, jint buffSizeInBytes, jint memoryMode, jintArray jSession)
|
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) {
|
if (AudioSystem::getOutputFrameCount(&afFrameCount, (audio_stream_type_t) streamType) != NO_ERROR) {
|
||||||
ALOGE("Error creating AudioTrack: Could not get AudioSystem frame count.");
|
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) {
|
if (AudioSystem::getOutputSamplingRate(&afSampleRate, (audio_stream_type_t) streamType) != NO_ERROR) {
|
||||||
ALOGE("Error creating AudioTrack: Could not get AudioSystem sampling rate.");
|
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
|
// 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)) {
|
if (!audio_is_output_channel(nativeChannelMask)) {
|
||||||
ALOGE("Error creating AudioTrack: invalid channel mask %#x.", javaChannelMask);
|
ALOGE("Error creating AudioTrack: invalid channel mask %#x.", javaChannelMask);
|
||||||
return AUDIOTRACK_ERROR_SETUP_INVALIDCHANNELMASK;
|
return (jint) AUDIOTRACK_ERROR_SETUP_INVALIDCHANNELMASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nbChannels = popcount(nativeChannelMask);
|
int nbChannels = popcount(nativeChannelMask);
|
||||||
@ -239,7 +239,7 @@ android_media_AudioTrack_native_setup(JNIEnv *env, jobject thiz, jobject weak_th
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ALOGE("Error creating AudioTrack: unknown stream type.");
|
ALOGE("Error creating AudioTrack: unknown stream type.");
|
||||||
return AUDIOTRACK_ERROR_SETUP_INVALIDSTREAMTYPE;
|
return (jint) AUDIOTRACK_ERROR_SETUP_INVALIDSTREAMTYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check the format.
|
// 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)) {
|
if ((audioFormat != ENCODING_PCM_16BIT) && (audioFormat != ENCODING_PCM_8BIT)) {
|
||||||
|
|
||||||
ALOGE("Error creating AudioTrack: unsupported audio format.");
|
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
|
// 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);
|
jclass clazz = env->GetObjectClass(thiz);
|
||||||
if (clazz == NULL) {
|
if (clazz == NULL) {
|
||||||
ALOGE("Can't find %s when setting up callback.", kClassPathName);
|
ALOGE("Can't find %s when setting up callback.", kClassPathName);
|
||||||
return AUDIOTRACK_ERROR_SETUP_NATIVEINITFAILED;
|
return (jint) AUDIOTRACK_ERROR_SETUP_NATIVEINITFAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jSession == NULL) {
|
if (jSession == NULL) {
|
||||||
ALOGE("Error creating AudioTrack: invalid session ID pointer");
|
ALOGE("Error creating AudioTrack: invalid session ID pointer");
|
||||||
return AUDIOTRACK_ERROR;
|
return (jint) AUDIOTRACK_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
jint* nSession = (jint *) env->GetPrimitiveArrayCritical(jSession, NULL);
|
jint* nSession = (jint *) env->GetPrimitiveArrayCritical(jSession, NULL);
|
||||||
if (nSession == NULL) {
|
if (nSession == NULL) {
|
||||||
ALOGE("Error creating AudioTrack: Error retrieving session id pointer");
|
ALOGE("Error creating AudioTrack: Error retrieving session id pointer");
|
||||||
return AUDIOTRACK_ERROR;
|
return (jint) AUDIOTRACK_ERROR;
|
||||||
}
|
}
|
||||||
int sessionId = nSession[0];
|
int sessionId = nSession[0];
|
||||||
env->ReleasePrimitiveArrayCritical(jSession, 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);
|
setAudioTrack(env, thiz, lpTrack);
|
||||||
|
|
||||||
// save the JNI resources so we can free them later
|
// save the JNI resources so we can free them later
|
||||||
//ALOGV("storing lpJniStorage: %x\n", (int)lpJniStorage);
|
//ALOGV("storing lpJniStorage: %x\n", (long)lpJniStorage);
|
||||||
env->SetIntField(thiz, javaAudioTrackFields.jniData, (int)lpJniStorage);
|
env->SetLongField(thiz, javaAudioTrackFields.jniData, (jlong)lpJniStorage);
|
||||||
|
|
||||||
return AUDIOTRACK_SUCCESS;
|
return (jint) AUDIOTRACK_SUCCESS;
|
||||||
|
|
||||||
// failures:
|
// failures:
|
||||||
native_init_failure:
|
native_init_failure:
|
||||||
@ -383,9 +383,9 @@ native_init_failure:
|
|||||||
env->DeleteGlobalRef(lpJniStorage->mCallbackData.audioTrack_class);
|
env->DeleteGlobalRef(lpJniStorage->mCallbackData.audioTrack_class);
|
||||||
env->DeleteGlobalRef(lpJniStorage->mCallbackData.audioTrack_ref);
|
env->DeleteGlobalRef(lpJniStorage->mCallbackData.audioTrack_ref);
|
||||||
delete lpJniStorage;
|
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();
|
lpTrack->stop();
|
||||||
|
|
||||||
// delete the JNI data
|
// delete the JNI data
|
||||||
AudioTrackJniStorage* pJniStorage = (AudioTrackJniStorage *)env->GetIntField(
|
AudioTrackJniStorage* pJniStorage = (AudioTrackJniStorage *)env->GetLongField(
|
||||||
thiz, javaAudioTrackFields.jniData);
|
thiz, javaAudioTrackFields.jniData);
|
||||||
// reset the native resources in the Java object so any attempt to access
|
// reset the native resources in the Java object so any attempt to access
|
||||||
// them after a call to release fails.
|
// them after a call to release fails.
|
||||||
env->SetIntField(thiz, javaAudioTrackFields.jniData, 0);
|
env->SetLongField(thiz, javaAudioTrackFields.jniData, 0);
|
||||||
|
|
||||||
if (pJniStorage) {
|
if (pJniStorage) {
|
||||||
Mutex::Autolock l(sLock);
|
Mutex::Autolock l(sLock);
|
||||||
@ -955,7 +955,7 @@ int register_android_media_AudioTrack(JNIEnv *env)
|
|||||||
// nativeTrackInJavaObj
|
// nativeTrackInJavaObj
|
||||||
javaAudioTrackFields.nativeTrackInJavaObj = env->GetFieldID(
|
javaAudioTrackFields.nativeTrackInJavaObj = env->GetFieldID(
|
||||||
audioTrackClass,
|
audioTrackClass,
|
||||||
JAVA_NATIVETRACKINJAVAOBJ_FIELD_NAME, "I");
|
JAVA_NATIVETRACKINJAVAOBJ_FIELD_NAME, "J");
|
||||||
if (javaAudioTrackFields.nativeTrackInJavaObj == NULL) {
|
if (javaAudioTrackFields.nativeTrackInJavaObj == NULL) {
|
||||||
ALOGE("Can't find AudioTrack.%s", JAVA_NATIVETRACKINJAVAOBJ_FIELD_NAME);
|
ALOGE("Can't find AudioTrack.%s", JAVA_NATIVETRACKINJAVAOBJ_FIELD_NAME);
|
||||||
return -1;
|
return -1;
|
||||||
@ -963,7 +963,7 @@ int register_android_media_AudioTrack(JNIEnv *env)
|
|||||||
// jniData;
|
// jniData;
|
||||||
javaAudioTrackFields.jniData = env->GetFieldID(
|
javaAudioTrackFields.jniData = env->GetFieldID(
|
||||||
audioTrackClass,
|
audioTrackClass,
|
||||||
JAVA_JNIDATA_FIELD_NAME, "I");
|
JAVA_JNIDATA_FIELD_NAME, "J");
|
||||||
if (javaAudioTrackFields.jniData == NULL) {
|
if (javaAudioTrackFields.jniData == NULL) {
|
||||||
ALOGE("Can't find AudioTrack.%s", JAVA_JNIDATA_FIELD_NAME);
|
ALOGE("Can't find AudioTrack.%s", JAVA_JNIDATA_FIELD_NAME);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -87,12 +87,12 @@ android_media_JetPlayer_setup(JNIEnv *env, jobject thiz, jobject weak_this,
|
|||||||
if (result==EAS_SUCCESS) {
|
if (result==EAS_SUCCESS) {
|
||||||
// save our newly created C++ JetPlayer in the "nativePlayerInJavaObj" field
|
// save our newly created C++ JetPlayer in the "nativePlayerInJavaObj" field
|
||||||
// of the Java object (in mNativePlayerInJavaObj)
|
// of the Java object (in mNativePlayerInJavaObj)
|
||||||
env->SetIntField(thiz, javaJetPlayerFields.nativePlayerInJavaObj, (int)lpJet);
|
env->SetLongField(thiz, javaJetPlayerFields.nativePlayerInJavaObj, (jlong)lpJet);
|
||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
} else {
|
} else {
|
||||||
ALOGE("android_media_JetPlayer_setup(): initialization failed with EAS error code %d", (int)result);
|
ALOGE("android_media_JetPlayer_setup(): initialization failed with EAS error code %d", (int)result);
|
||||||
delete lpJet;
|
delete lpJet;
|
||||||
env->SetIntField(weak_this, javaJetPlayerFields.nativePlayerInJavaObj, 0);
|
env->SetLongField(weak_this, javaJetPlayerFields.nativePlayerInJavaObj, 0);
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ static void
|
|||||||
android_media_JetPlayer_finalize(JNIEnv *env, jobject thiz)
|
android_media_JetPlayer_finalize(JNIEnv *env, jobject thiz)
|
||||||
{
|
{
|
||||||
ALOGV("android_media_JetPlayer_finalize(): entering.");
|
ALOGV("android_media_JetPlayer_finalize(): entering.");
|
||||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||||
if (lpJet != NULL) {
|
if (lpJet != NULL) {
|
||||||
lpJet->release();
|
lpJet->release();
|
||||||
@ -119,7 +119,7 @@ static void
|
|||||||
android_media_JetPlayer_release(JNIEnv *env, jobject thiz)
|
android_media_JetPlayer_release(JNIEnv *env, jobject thiz)
|
||||||
{
|
{
|
||||||
android_media_JetPlayer_finalize(env, 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");
|
ALOGV("android_media_JetPlayer_release() done");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ android_media_JetPlayer_release(JNIEnv *env, jobject thiz)
|
|||||||
static jboolean
|
static jboolean
|
||||||
android_media_JetPlayer_loadFromFile(JNIEnv *env, jobject thiz, jstring path)
|
android_media_JetPlayer_loadFromFile(JNIEnv *env, jobject thiz, jstring path)
|
||||||
{
|
{
|
||||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||||
if (lpJet == NULL) {
|
if (lpJet == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException",
|
jniThrowException(env, "java/lang/IllegalStateException",
|
||||||
@ -165,7 +165,7 @@ static jboolean
|
|||||||
android_media_JetPlayer_loadFromFileD(JNIEnv *env, jobject thiz,
|
android_media_JetPlayer_loadFromFileD(JNIEnv *env, jobject thiz,
|
||||||
jobject fileDescriptor, jlong offset, jlong length)
|
jobject fileDescriptor, jlong offset, jlong length)
|
||||||
{
|
{
|
||||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||||
if (lpJet == NULL) {
|
if (lpJet == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException",
|
jniThrowException(env, "java/lang/IllegalStateException",
|
||||||
@ -195,7 +195,7 @@ android_media_JetPlayer_loadFromFileD(JNIEnv *env, jobject thiz,
|
|||||||
static jboolean
|
static jboolean
|
||||||
android_media_JetPlayer_closeFile(JNIEnv *env, jobject thiz)
|
android_media_JetPlayer_closeFile(JNIEnv *env, jobject thiz)
|
||||||
{
|
{
|
||||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||||
if (lpJet == NULL) {
|
if (lpJet == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException",
|
jniThrowException(env, "java/lang/IllegalStateException",
|
||||||
@ -217,7 +217,7 @@ android_media_JetPlayer_closeFile(JNIEnv *env, jobject thiz)
|
|||||||
static jboolean
|
static jboolean
|
||||||
android_media_JetPlayer_play(JNIEnv *env, jobject thiz)
|
android_media_JetPlayer_play(JNIEnv *env, jobject thiz)
|
||||||
{
|
{
|
||||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||||
if (lpJet == NULL) {
|
if (lpJet == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException",
|
jniThrowException(env, "java/lang/IllegalStateException",
|
||||||
@ -241,7 +241,7 @@ android_media_JetPlayer_play(JNIEnv *env, jobject thiz)
|
|||||||
static jboolean
|
static jboolean
|
||||||
android_media_JetPlayer_pause(JNIEnv *env, jobject thiz)
|
android_media_JetPlayer_pause(JNIEnv *env, jobject thiz)
|
||||||
{
|
{
|
||||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||||
if (lpJet == NULL) {
|
if (lpJet == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException",
|
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,
|
jint segmentNum, jint libNum, jint repeatCount, jint transpose, jint muteFlags,
|
||||||
jbyte userID)
|
jbyte userID)
|
||||||
{
|
{
|
||||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||||
if (lpJet == NULL) {
|
if (lpJet == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException",
|
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,
|
jint segmentNum, jint libNum, jint repeatCount, jint transpose, jbooleanArray muteArray,
|
||||||
jbyte userID)
|
jbyte userID)
|
||||||
{
|
{
|
||||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||||
if (lpJet == NULL) {
|
if (lpJet == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException",
|
jniThrowException(env, "java/lang/IllegalStateException",
|
||||||
@ -344,7 +344,7 @@ static jboolean
|
|||||||
android_media_JetPlayer_setMuteFlags(JNIEnv *env, jobject thiz,
|
android_media_JetPlayer_setMuteFlags(JNIEnv *env, jobject thiz,
|
||||||
jint muteFlags /*unsigned?*/, jboolean bSync)
|
jint muteFlags /*unsigned?*/, jboolean bSync)
|
||||||
{
|
{
|
||||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||||
if (lpJet == NULL) {
|
if (lpJet == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException",
|
jniThrowException(env, "java/lang/IllegalStateException",
|
||||||
@ -369,7 +369,7 @@ static jboolean
|
|||||||
android_media_JetPlayer_setMuteArray(JNIEnv *env, jobject thiz,
|
android_media_JetPlayer_setMuteArray(JNIEnv *env, jobject thiz,
|
||||||
jbooleanArray muteArray, jboolean bSync)
|
jbooleanArray muteArray, jboolean bSync)
|
||||||
{
|
{
|
||||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||||
if (lpJet == NULL) {
|
if (lpJet == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException",
|
jniThrowException(env, "java/lang/IllegalStateException",
|
||||||
@ -415,7 +415,7 @@ static jboolean
|
|||||||
android_media_JetPlayer_setMuteFlag(JNIEnv *env, jobject thiz,
|
android_media_JetPlayer_setMuteFlag(JNIEnv *env, jobject thiz,
|
||||||
jint trackId, jboolean muteFlag, jboolean bSync)
|
jint trackId, jboolean muteFlag, jboolean bSync)
|
||||||
{
|
{
|
||||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||||
if (lpJet == NULL) {
|
if (lpJet == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException",
|
jniThrowException(env, "java/lang/IllegalStateException",
|
||||||
@ -441,7 +441,7 @@ android_media_JetPlayer_setMuteFlag(JNIEnv *env, jobject thiz,
|
|||||||
static jboolean
|
static jboolean
|
||||||
android_media_JetPlayer_triggerClip(JNIEnv *env, jobject thiz, jint clipId)
|
android_media_JetPlayer_triggerClip(JNIEnv *env, jobject thiz, jint clipId)
|
||||||
{
|
{
|
||||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||||
if (lpJet == NULL) {
|
if (lpJet == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException",
|
jniThrowException(env, "java/lang/IllegalStateException",
|
||||||
@ -466,7 +466,7 @@ android_media_JetPlayer_triggerClip(JNIEnv *env, jobject thiz, jint clipId)
|
|||||||
static jboolean
|
static jboolean
|
||||||
android_media_JetPlayer_clearQueue(JNIEnv *env, jobject thiz)
|
android_media_JetPlayer_clearQueue(JNIEnv *env, jobject thiz)
|
||||||
{
|
{
|
||||||
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
|
JetPlayer *lpJet = (JetPlayer *)env->GetLongField(
|
||||||
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
|
||||||
if (lpJet == NULL) {
|
if (lpJet == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException",
|
jniThrowException(env, "java/lang/IllegalStateException",
|
||||||
@ -533,7 +533,7 @@ int register_android_media_JetPlayer(JNIEnv *env)
|
|||||||
// Get the mNativePlayerInJavaObj variable field
|
// Get the mNativePlayerInJavaObj variable field
|
||||||
javaJetPlayerFields.nativePlayerInJavaObj = env->GetFieldID(
|
javaJetPlayerFields.nativePlayerInJavaObj = env->GetFieldID(
|
||||||
jetPlayerClass,
|
jetPlayerClass,
|
||||||
JAVA_NATIVEJETPLAYERINJAVAOBJ_FIELD_NAME, "I");
|
JAVA_NATIVEJETPLAYERINJAVAOBJ_FIELD_NAME, "J");
|
||||||
if (javaJetPlayerFields.nativePlayerInJavaObj == NULL) {
|
if (javaJetPlayerFields.nativePlayerInJavaObj == NULL) {
|
||||||
ALOGE("Can't find JetPlayer.%s", JAVA_NATIVEJETPLAYERINJAVAOBJ_FIELD_NAME);
|
ALOGE("Can't find JetPlayer.%s", JAVA_NATIVEJETPLAYERINJAVAOBJ_FIELD_NAME);
|
||||||
return -1;
|
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);
|
ScopedUtfChars iface(env, ifaceStr);
|
||||||
|
|
||||||
sp<IServiceManager> sm = defaultServiceManager();
|
sp<IServiceManager> sm = defaultServiceManager();
|
||||||
@ -155,20 +155,20 @@ static jint nativeListen(JNIEnv* env, jobject remoteDisplayObj, jstring ifaceStr
|
|||||||
}
|
}
|
||||||
|
|
||||||
NativeRemoteDisplay* wrapper = new NativeRemoteDisplay(display, client);
|
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);
|
NativeRemoteDisplay* wrapper = reinterpret_cast<NativeRemoteDisplay*>(ptr);
|
||||||
wrapper->pause();
|
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);
|
NativeRemoteDisplay* wrapper = reinterpret_cast<NativeRemoteDisplay*>(ptr);
|
||||||
wrapper->resume();
|
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);
|
NativeRemoteDisplay* wrapper = reinterpret_cast<NativeRemoteDisplay*>(ptr);
|
||||||
delete wrapper;
|
delete wrapper;
|
||||||
}
|
}
|
||||||
@ -176,13 +176,13 @@ static void nativeDispose(JNIEnv* env, jobject remoteDisplayObj, jint ptr) {
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static JNINativeMethod gMethods[] = {
|
static JNINativeMethod gMethods[] = {
|
||||||
{"nativeListen", "(Ljava/lang/String;)I",
|
{"nativeListen", "(Ljava/lang/String;)J",
|
||||||
(void*)nativeListen },
|
(void*)nativeListen },
|
||||||
{"nativeDispose", "(I)V",
|
{"nativeDispose", "(J)V",
|
||||||
(void*)nativeDispose },
|
(void*)nativeDispose },
|
||||||
{"nativePause", "(I)V",
|
{"nativePause", "(J)V",
|
||||||
(void*)nativePause },
|
(void*)nativePause },
|
||||||
{"nativeResume", "(I)V",
|
{"nativeResume", "(J)V",
|
||||||
(void*)nativeResume },
|
(void*)nativeResume },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -39,9 +39,9 @@ struct fields_t {
|
|||||||
static fields_t fields;
|
static fields_t fields;
|
||||||
|
|
||||||
static jboolean android_media_ToneGenerator_startTone(JNIEnv *env, jobject thiz, jint toneType, jint durationMs) {
|
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);
|
fields.context);
|
||||||
if (lpToneGen == NULL) {
|
if (lpToneGen == NULL) {
|
||||||
jniThrowRuntimeException(env, "Method called after release()");
|
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) {
|
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);
|
fields.context);
|
||||||
|
|
||||||
ALOGV("ToneGenerator lpToneGen: %x", (unsigned int)lpToneGen);
|
ALOGV("ToneGenerator lpToneGen: %p", lpToneGen);
|
||||||
if (lpToneGen == NULL) {
|
if (lpToneGen == NULL) {
|
||||||
jniThrowRuntimeException(env, "Method called after release()");
|
jniThrowRuntimeException(env, "Method called after release()");
|
||||||
return;
|
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) {
|
static jint android_media_ToneGenerator_getAudioSessionId(JNIEnv *env, jobject thiz) {
|
||||||
ToneGenerator *lpToneGen = (ToneGenerator *)env->GetIntField(thiz,
|
ToneGenerator *lpToneGen = (ToneGenerator *)env->GetLongField(thiz,
|
||||||
fields.context);
|
fields.context);
|
||||||
if (lpToneGen == NULL) {
|
if (lpToneGen == NULL) {
|
||||||
jniThrowRuntimeException(env, "Method called after release()");
|
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) {
|
static void android_media_ToneGenerator_release(JNIEnv *env, jobject thiz) {
|
||||||
ToneGenerator *lpToneGen = (ToneGenerator *)env->GetIntField(thiz,
|
ToneGenerator *lpToneGen = (ToneGenerator *)env->GetLongField(thiz,
|
||||||
fields.context);
|
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;
|
delete lpToneGen;
|
||||||
}
|
}
|
||||||
@ -89,11 +89,11 @@ static void android_media_ToneGenerator_native_setup(JNIEnv *env, jobject thiz,
|
|||||||
jint streamType, jint volume) {
|
jint streamType, jint volume) {
|
||||||
ToneGenerator *lpToneGen = new ToneGenerator((audio_stream_type_t) streamType, AudioSystem::linearToLog(volume), true);
|
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()) {
|
if (!lpToneGen->isInited()) {
|
||||||
ALOGE("ToneGenerator init failed");
|
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.
|
// 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,
|
static void android_media_ToneGenerator_native_finalize(JNIEnv *env,
|
||||||
jobject thiz) {
|
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);
|
fields.context);
|
||||||
|
|
||||||
if (lpToneGen != NULL) {
|
if (lpToneGen != NULL) {
|
||||||
@ -142,12 +142,12 @@ int register_android_media_ToneGenerator(JNIEnv *env) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fields.context = env->GetFieldID(clazz, "mNativeContext", "I");
|
fields.context = env->GetFieldID(clazz, "mNativeContext", "J");
|
||||||
if (fields.context == NULL) {
|
if (fields.context == NULL) {
|
||||||
ALOGE("Can't find ToneGenerator.mNativeContext");
|
ALOGE("Can't find ToneGenerator.mNativeContext");
|
||||||
return -1;
|
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,
|
return AndroidRuntime::registerNativeMethods(env,
|
||||||
"android/media/ToneGenerator", gMethods, NELEM(gMethods));
|
"android/media/ToneGenerator", gMethods, NELEM(gMethods));
|
||||||
|
@ -107,13 +107,13 @@ public class AudioRecord
|
|||||||
* Accessed by native methods: provides access to C++ AudioRecord object
|
* Accessed by native methods: provides access to C++ AudioRecord object
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private int mNativeRecorderInJavaObj;
|
private long mNativeRecorderInJavaObj;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accessed by native methods: provides access to the callback data.
|
* Accessed by native methods: provides access to the callback data.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@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.
|
* Accessed by native methods: provides access to C++ AudioTrack object.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private int mNativeTrackInJavaObj;
|
private long mNativeTrackInJavaObj;
|
||||||
/**
|
/**
|
||||||
* Accessed by native methods: provides access to the JNI data (i.e. resources used by
|
* Accessed by native methods: provides access to the JNI data (i.e. resources used by
|
||||||
* the native AudioTrack object, but not stored in it).
|
* the native AudioTrack object, but not stored in it).
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@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_get_face(Face face, int i);
|
||||||
native private void fft_destroy();
|
native private void fft_destroy();
|
||||||
|
|
||||||
private int mFD;
|
private long mFD;
|
||||||
private int mSDK;
|
private long mSDK;
|
||||||
private int mDCR;
|
private long mDCR;
|
||||||
private int mWidth;
|
private int mWidth;
|
||||||
private int mHeight;
|
private int mHeight;
|
||||||
private int mMaxFaces;
|
private int mMaxFaces;
|
||||||
|
@ -127,7 +127,7 @@ public class JetPlayer
|
|||||||
* Accessed by native methods: provides access to C++ JetPlayer object
|
* Accessed by native methods: provides access to C++ JetPlayer object
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private int mNativePlayerInJavaObj;
|
private long mNativePlayerInJavaObj;
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
|
@ -644,5 +644,5 @@ final public class MediaCodec {
|
|||||||
native_init();
|
native_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int mNativeContext;
|
private long mNativeContext;
|
||||||
}
|
}
|
||||||
|
@ -88,5 +88,5 @@ public final class MediaCrypto {
|
|||||||
native_init();
|
native_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int mNativeContext;
|
private long mNativeContext;
|
||||||
}
|
}
|
||||||
|
@ -352,5 +352,5 @@ final public class MediaExtractor {
|
|||||||
native_init();
|
native_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int mNativeContext;
|
private long mNativeContext;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class MediaMetadataRetriever
|
|||||||
|
|
||||||
// The field below is accessed by native methods
|
// The field below is accessed by native methods
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private int mNativeContext;
|
private long mNativeContext;
|
||||||
|
|
||||||
private static final int EMBEDDED_PICTURE_TYPE_ANY = 0xFFFF;
|
private static final int EMBEDDED_PICTURE_TYPE_ANY = 0xFFFF;
|
||||||
|
|
||||||
|
@ -572,8 +572,8 @@ public class MediaPlayer implements SubtitleController.Listener
|
|||||||
// macro invocation in IMediaPlayer.cpp
|
// macro invocation in IMediaPlayer.cpp
|
||||||
private final static String IMEDIA_PLAYER = "android.media.IMediaPlayer";
|
private final static String IMEDIA_PLAYER = "android.media.IMediaPlayer";
|
||||||
|
|
||||||
private int mNativeContext; // accessed by native methods
|
private long mNativeContext; // accessed by native methods
|
||||||
private int mNativeSurfaceTexture; // accessed by native methods
|
private long mNativeSurfaceTexture; // accessed by native methods
|
||||||
private int mListenerContext; // accessed by native methods
|
private int mListenerContext; // accessed by native methods
|
||||||
private SurfaceHolder mSurfaceHolder;
|
private SurfaceHolder mSurfaceHolder;
|
||||||
private EventHandler mEventHandler;
|
private EventHandler mEventHandler;
|
||||||
|
@ -81,7 +81,7 @@ public class MediaRecorder
|
|||||||
|
|
||||||
// The two fields below are accessed by native methods
|
// The two fields below are accessed by native methods
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private int mNativeContext;
|
private long mNativeContext;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private Surface mSurface;
|
private Surface mSurface;
|
||||||
|
@ -301,7 +301,7 @@ public class MediaScanner
|
|||||||
// 148 and up don't seem to have been defined yet.
|
// 148 and up don't seem to have been defined yet.
|
||||||
};
|
};
|
||||||
|
|
||||||
private int mNativeContext;
|
private long mNativeContext;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private String mPackageName;
|
private String mPackageName;
|
||||||
private IContentProvider mMediaProvider;
|
private IContentProvider mMediaProvider;
|
||||||
|
@ -38,12 +38,12 @@ public final class RemoteDisplay {
|
|||||||
private final Listener mListener;
|
private final Listener mListener;
|
||||||
private final Handler mHandler;
|
private final Handler mHandler;
|
||||||
|
|
||||||
private int mPtr;
|
private long mPtr;
|
||||||
|
|
||||||
private native int nativeListen(String iface);
|
private native long nativeListen(String iface);
|
||||||
private native void nativeDispose(int ptr);
|
private native void nativeDispose(long ptr);
|
||||||
private native void nativePause(int ptr);
|
private native void nativePause(long ptr);
|
||||||
private native void nativeResume(int ptr);
|
private native void nativeResume(long ptr);
|
||||||
|
|
||||||
private RemoteDisplay(Listener listener, Handler handler) {
|
private RemoteDisplay(Listener listener, Handler handler) {
|
||||||
mListener = listener;
|
mListener = listener;
|
||||||
|
@ -443,7 +443,7 @@ public class SoundPool {
|
|||||||
private final static String TAG = "SoundPool";
|
private final static String TAG = "SoundPool";
|
||||||
private final static boolean DEBUG = false;
|
private final static boolean DEBUG = false;
|
||||||
|
|
||||||
private int mNativeContext; // accessed by native methods
|
private long mNativeContext; // accessed by native methods
|
||||||
|
|
||||||
private EventHandler mEventHandler;
|
private EventHandler mEventHandler;
|
||||||
private SoundPool.OnLoadCompleteListener mOnLoadCompleteListener;
|
private SoundPool.OnLoadCompleteListener mOnLoadCompleteListener;
|
||||||
|
@ -887,5 +887,5 @@ public class ToneGenerator
|
|||||||
protected void finalize() { native_finalize(); }
|
protected void finalize() { native_finalize(); }
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@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(
|
static sp<JMediaCodec> setMediaCodec(
|
||||||
JNIEnv *env, jobject thiz, const sp<JMediaCodec> &codec) {
|
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) {
|
if (codec != NULL) {
|
||||||
codec->incStrong(thiz);
|
codec->incStrong(thiz);
|
||||||
}
|
}
|
||||||
if (old != NULL) {
|
if (old != NULL) {
|
||||||
old->decStrong(thiz);
|
old->decStrong(thiz);
|
||||||
}
|
}
|
||||||
env->SetIntField(thiz, gFields.context, (int)codec.get());
|
env->SetLongField(thiz, gFields.context, (jlong)codec.get());
|
||||||
|
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
static sp<JMediaCodec> getMediaCodec(JNIEnv *env, jobject thiz) {
|
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) {
|
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);
|
status_t err = codec->dequeueInputBuffer(&index, timeoutUs);
|
||||||
|
|
||||||
if (err == OK) {
|
if (err == OK) {
|
||||||
return index;
|
return (jint) index;
|
||||||
}
|
}
|
||||||
|
|
||||||
return throwExceptionAsNecessary(env, err);
|
return throwExceptionAsNecessary(env, err);
|
||||||
@ -732,7 +732,7 @@ static jint android_media_MediaCodec_dequeueOutputBuffer(
|
|||||||
env, bufferInfo, &index, timeoutUs);
|
env, bufferInfo, &index, timeoutUs);
|
||||||
|
|
||||||
if (err == OK) {
|
if (err == OK) {
|
||||||
return index;
|
return (jint) index;
|
||||||
}
|
}
|
||||||
|
|
||||||
return throwExceptionAsNecessary(env, err);
|
return throwExceptionAsNecessary(env, err);
|
||||||
@ -885,7 +885,7 @@ static void android_media_MediaCodec_native_init(JNIEnv *env) {
|
|||||||
env, env->FindClass("android/media/MediaCodec"));
|
env, env->FindClass("android/media/MediaCodec"));
|
||||||
CHECK(clazz.get() != NULL);
|
CHECK(clazz.get() != NULL);
|
||||||
|
|
||||||
gFields.context = env->GetFieldID(clazz.get(), "mNativeContext", "I");
|
gFields.context = env->GetFieldID(clazz.get(), "mNativeContext", "J");
|
||||||
CHECK(gFields.context != NULL);
|
CHECK(gFields.context != NULL);
|
||||||
|
|
||||||
clazz.reset(env->FindClass("android/media/MediaCodec$CryptoInfo"));
|
clazz.reset(env->FindClass("android/media/MediaCodec$CryptoInfo"));
|
||||||
|
@ -38,7 +38,7 @@ struct fields_t {
|
|||||||
static fields_t gFields;
|
static fields_t gFields;
|
||||||
|
|
||||||
static sp<JCrypto> getCrypto(JNIEnv *env, jobject thiz) {
|
static sp<JCrypto> getCrypto(JNIEnv *env, jobject thiz) {
|
||||||
return (JCrypto *)env->GetIntField(thiz, gFields.context);
|
return (JCrypto *)env->GetLongField(thiz, gFields.context);
|
||||||
}
|
}
|
||||||
|
|
||||||
JCrypto::JCrypto(
|
JCrypto::JCrypto(
|
||||||
@ -146,14 +146,14 @@ using namespace android;
|
|||||||
|
|
||||||
static sp<JCrypto> setCrypto(
|
static sp<JCrypto> setCrypto(
|
||||||
JNIEnv *env, jobject thiz, const sp<JCrypto> &crypto) {
|
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) {
|
if (crypto != NULL) {
|
||||||
crypto->incStrong(thiz);
|
crypto->incStrong(thiz);
|
||||||
}
|
}
|
||||||
if (old != NULL) {
|
if (old != NULL) {
|
||||||
old->decStrong(thiz);
|
old->decStrong(thiz);
|
||||||
}
|
}
|
||||||
env->SetIntField(thiz, gFields.context, (int)crypto.get());
|
env->SetLongField(thiz, gFields.context, (jlong)crypto.get());
|
||||||
|
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ static void android_media_MediaCrypto_native_init(JNIEnv *env) {
|
|||||||
jclass clazz = env->FindClass("android/media/MediaCrypto");
|
jclass clazz = env->FindClass("android/media/MediaCrypto");
|
||||||
CHECK(clazz != NULL);
|
CHECK(clazz != NULL);
|
||||||
|
|
||||||
gFields.context = env->GetFieldID(clazz, "mNativeContext", "I");
|
gFields.context = env->GetFieldID(clazz, "mNativeContext", "J");
|
||||||
CHECK(gFields.context != NULL);
|
CHECK(gFields.context != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ static jboolean android_media_MediaCrypto_isCryptoSchemeSupportedNative(
|
|||||||
env,
|
env,
|
||||||
"java/lang/IllegalArgumentException",
|
"java/lang/IllegalArgumentException",
|
||||||
NULL);
|
NULL);
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
jboolean isCopy;
|
jboolean isCopy;
|
||||||
@ -243,27 +243,27 @@ static jboolean android_media_MediaCrypto_isCryptoSchemeSupportedNative(
|
|||||||
env->ReleaseByteArrayElements(uuidObj, uuid, 0);
|
env->ReleaseByteArrayElements(uuidObj, uuid, 0);
|
||||||
uuid = NULL;
|
uuid = NULL;
|
||||||
|
|
||||||
return result;
|
return result ? JNI_TRUE : JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static jboolean android_media_MediaCrypto_requiresSecureDecoderComponent(
|
static jboolean android_media_MediaCrypto_requiresSecureDecoderComponent(
|
||||||
JNIEnv *env, jobject thiz, jstring mimeObj) {
|
JNIEnv *env, jobject thiz, jstring mimeObj) {
|
||||||
if (mimeObj == NULL) {
|
if (mimeObj == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
|
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
sp<JCrypto> crypto = getCrypto(env, thiz);
|
sp<JCrypto> crypto = getCrypto(env, thiz);
|
||||||
|
|
||||||
if (crypto == NULL) {
|
if (crypto == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
|
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *mime = env->GetStringUTFChars(mimeObj, NULL);
|
const char *mime = env->GetStringUTFChars(mimeObj, NULL);
|
||||||
|
|
||||||
if (mime == NULL) {
|
if (mime == NULL) {
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool result = crypto->requiresSecureDecoderComponent(mime);
|
bool result = crypto->requiresSecureDecoderComponent(mime);
|
||||||
@ -271,7 +271,7 @@ static jboolean android_media_MediaCrypto_requiresSecureDecoderComponent(
|
|||||||
env->ReleaseStringUTFChars(mimeObj, mime);
|
env->ReleaseStringUTFChars(mimeObj, mime);
|
||||||
mime = NULL;
|
mime = NULL;
|
||||||
|
|
||||||
return result;
|
return result ? JNI_TRUE : JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JNINativeMethod gMethods[] = {
|
static JNINativeMethod gMethods[] = {
|
||||||
|
@ -88,7 +88,7 @@ class JavaDataSourceBridge : public DataSource {
|
|||||||
env->GetByteArrayRegion(byteArrayObj, 0, size, (jbyte*) buffer);
|
env->GetByteArrayRegion(byteArrayObj, 0, size, (jbyte*) buffer);
|
||||||
env->DeleteLocalRef(byteArrayObj);
|
env->DeleteLocalRef(byteArrayObj);
|
||||||
if (env->ExceptionCheck()) {
|
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);
|
LOGW_EX(env);
|
||||||
env->ExceptionClear();
|
env->ExceptionClear();
|
||||||
return -1;
|
return -1;
|
||||||
@ -198,7 +198,7 @@ status_t JMediaExtractor::readSampleData(
|
|||||||
|
|
||||||
void *dst = env->GetDirectBufferAddress(byteBuf);
|
void *dst = env->GetDirectBufferAddress(byteBuf);
|
||||||
|
|
||||||
jlong dstSize;
|
size_t dstSize;
|
||||||
jbyteArray byteArray = NULL;
|
jbyteArray byteArray = NULL;
|
||||||
|
|
||||||
if (dst == NULL) {
|
if (dst == NULL) {
|
||||||
@ -219,9 +219,9 @@ status_t JMediaExtractor::readSampleData(
|
|||||||
jboolean isCopy;
|
jboolean isCopy;
|
||||||
dst = env->GetByteArrayElements(byteArray, &isCopy);
|
dst = env->GetByteArrayElements(byteArray, &isCopy);
|
||||||
|
|
||||||
dstSize = env->GetArrayLength(byteArray);
|
dstSize = (size_t) env->GetArrayLength(byteArray);
|
||||||
} else {
|
} else {
|
||||||
dstSize = env->GetDirectBufferCapacity(byteBuf);
|
dstSize = (size_t) env->GetDirectBufferCapacity(byteBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dstSize < offset) {
|
if (dstSize < offset) {
|
||||||
@ -299,7 +299,7 @@ using namespace android;
|
|||||||
static sp<JMediaExtractor> setMediaExtractor(
|
static sp<JMediaExtractor> setMediaExtractor(
|
||||||
JNIEnv *env, jobject thiz, const sp<JMediaExtractor> &extractor) {
|
JNIEnv *env, jobject thiz, const sp<JMediaExtractor> &extractor) {
|
||||||
sp<JMediaExtractor> old =
|
sp<JMediaExtractor> old =
|
||||||
(JMediaExtractor *)env->GetIntField(thiz, gFields.context);
|
(JMediaExtractor *)env->GetLongField(thiz, gFields.context);
|
||||||
|
|
||||||
if (extractor != NULL) {
|
if (extractor != NULL) {
|
||||||
extractor->incStrong(thiz);
|
extractor->incStrong(thiz);
|
||||||
@ -307,13 +307,13 @@ static sp<JMediaExtractor> setMediaExtractor(
|
|||||||
if (old != NULL) {
|
if (old != NULL) {
|
||||||
old->decStrong(thiz);
|
old->decStrong(thiz);
|
||||||
}
|
}
|
||||||
env->SetIntField(thiz, gFields.context, (int)extractor.get());
|
env->SetLongField(thiz, gFields.context, (jlong)extractor.get());
|
||||||
|
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
static sp<JMediaExtractor> getMediaExtractor(JNIEnv *env, jobject thiz) {
|
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) {
|
static void android_media_MediaExtractor_release(JNIEnv *env, jobject thiz) {
|
||||||
@ -329,7 +329,7 @@ static jint android_media_MediaExtractor_getTrackCount(
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return extractor->countTracks();
|
return (jint) extractor->countTracks();
|
||||||
}
|
}
|
||||||
|
|
||||||
static jobject android_media_MediaExtractor_getTrackFormatNative(
|
static jobject android_media_MediaExtractor_getTrackFormatNative(
|
||||||
@ -430,19 +430,19 @@ static jboolean android_media_MediaExtractor_advance(
|
|||||||
|
|
||||||
if (extractor == NULL) {
|
if (extractor == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t err = extractor->advance();
|
status_t err = extractor->advance();
|
||||||
|
|
||||||
if (err == ERROR_END_OF_STREAM) {
|
if (err == ERROR_END_OF_STREAM) {
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
} else if (err != OK) {
|
} else if (err != OK) {
|
||||||
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
|
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return JNI_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static jint android_media_MediaExtractor_readSampleData(
|
static jint android_media_MediaExtractor_readSampleData(
|
||||||
@ -461,10 +461,10 @@ static jint android_media_MediaExtractor_readSampleData(
|
|||||||
return -1;
|
return -1;
|
||||||
} else if (err != OK) {
|
} else if (err != OK) {
|
||||||
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
|
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sampleSize;
|
return (jint) sampleSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static jint android_media_MediaExtractor_getSampleTrackIndex(
|
static jint android_media_MediaExtractor_getSampleTrackIndex(
|
||||||
@ -483,10 +483,10 @@ static jint android_media_MediaExtractor_getSampleTrackIndex(
|
|||||||
return -1;
|
return -1;
|
||||||
} else if (err != OK) {
|
} else if (err != OK) {
|
||||||
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
|
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return trackIndex;
|
return (jint) trackIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
static jlong android_media_MediaExtractor_getSampleTime(
|
static jlong android_media_MediaExtractor_getSampleTime(
|
||||||
@ -505,10 +505,10 @@ static jlong android_media_MediaExtractor_getSampleTime(
|
|||||||
return -1ll;
|
return -1ll;
|
||||||
} else if (err != OK) {
|
} else if (err != OK) {
|
||||||
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
|
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
|
||||||
return false;
|
return -1ll;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sampleTimeUs;
|
return (jlong) sampleTimeUs;
|
||||||
}
|
}
|
||||||
|
|
||||||
static jint android_media_MediaExtractor_getSampleFlags(
|
static jint android_media_MediaExtractor_getSampleFlags(
|
||||||
@ -517,20 +517,20 @@ static jint android_media_MediaExtractor_getSampleFlags(
|
|||||||
|
|
||||||
if (extractor == NULL) {
|
if (extractor == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
||||||
return -1ll;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t sampleFlags;
|
uint32_t sampleFlags;
|
||||||
status_t err = extractor->getSampleFlags(&sampleFlags);
|
status_t err = extractor->getSampleFlags(&sampleFlags);
|
||||||
|
|
||||||
if (err == ERROR_END_OF_STREAM) {
|
if (err == ERROR_END_OF_STREAM) {
|
||||||
return -1ll;
|
return -1;
|
||||||
} else if (err != OK) {
|
} else if (err != OK) {
|
||||||
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
|
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sampleFlags;
|
return (jint) sampleFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
static jboolean android_media_MediaExtractor_getSampleCryptoInfo(
|
static jboolean android_media_MediaExtractor_getSampleCryptoInfo(
|
||||||
@ -539,27 +539,27 @@ static jboolean android_media_MediaExtractor_getSampleCryptoInfo(
|
|||||||
|
|
||||||
if (extractor == NULL) {
|
if (extractor == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
||||||
return -1ll;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
sp<MetaData> meta;
|
sp<MetaData> meta;
|
||||||
status_t err = extractor->getSampleMeta(&meta);
|
status_t err = extractor->getSampleMeta(&meta);
|
||||||
|
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t type;
|
uint32_t type;
|
||||||
const void *data;
|
const void *data;
|
||||||
size_t size;
|
size_t size;
|
||||||
if (!meta->findData(kKeyEncryptedSizes, &type, &data, &size)) {
|
if (!meta->findData(kKeyEncryptedSizes, &type, &data, &size)) {
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t numSubSamples = size / sizeof(size_t);
|
size_t numSubSamples = size / sizeof(size_t);
|
||||||
|
|
||||||
if (numSubSamples == 0) {
|
if (numSubSamples == 0) {
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
jintArray numBytesOfEncryptedDataObj = env->NewIntArray(numSubSamples);
|
jintArray numBytesOfEncryptedDataObj = env->NewIntArray(numSubSamples);
|
||||||
@ -576,7 +576,7 @@ static jboolean android_media_MediaExtractor_getSampleCryptoInfo(
|
|||||||
if (meta->findData(kKeyPlainSizes, &type, &data, &size)) {
|
if (meta->findData(kKeyPlainSizes, &type, &data, &size)) {
|
||||||
if (size != encSize) {
|
if (size != encSize) {
|
||||||
// The two must be of the same length.
|
// The two must be of the same length.
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
numBytesOfPlainDataObj = env->NewIntArray(numSubSamples);
|
numBytesOfPlainDataObj = env->NewIntArray(numSubSamples);
|
||||||
@ -593,7 +593,7 @@ static jboolean android_media_MediaExtractor_getSampleCryptoInfo(
|
|||||||
if (meta->findData(kKeyCryptoKey, &type, &data, &size)) {
|
if (meta->findData(kKeyCryptoKey, &type, &data, &size)) {
|
||||||
if (size != 16) {
|
if (size != 16) {
|
||||||
// Keys must be 16 bytes in length.
|
// Keys must be 16 bytes in length.
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyObj = env->NewByteArray(size);
|
keyObj = env->NewByteArray(size);
|
||||||
@ -608,7 +608,7 @@ static jboolean android_media_MediaExtractor_getSampleCryptoInfo(
|
|||||||
if (meta->findData(kKeyCryptoIV, &type, &data, &size)) {
|
if (meta->findData(kKeyCryptoIV, &type, &data, &size)) {
|
||||||
if (size != 16) {
|
if (size != 16) {
|
||||||
// IVs must be 16 bytes in length.
|
// IVs must be 16 bytes in length.
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ivObj = env->NewByteArray(size);
|
ivObj = env->NewByteArray(size);
|
||||||
@ -634,14 +634,14 @@ static jboolean android_media_MediaExtractor_getSampleCryptoInfo(
|
|||||||
ivObj,
|
ivObj,
|
||||||
mode);
|
mode);
|
||||||
|
|
||||||
return true;
|
return JNI_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void android_media_MediaExtractor_native_init(JNIEnv *env) {
|
static void android_media_MediaExtractor_native_init(JNIEnv *env) {
|
||||||
jclass clazz = env->FindClass("android/media/MediaExtractor");
|
jclass clazz = env->FindClass("android/media/MediaExtractor");
|
||||||
CHECK(clazz != NULL);
|
CHECK(clazz != NULL);
|
||||||
|
|
||||||
gFields.context = env->GetFieldID(clazz, "mNativeContext", "I");
|
gFields.context = env->GetFieldID(clazz, "mNativeContext", "J");
|
||||||
CHECK(gFields.context != NULL);
|
CHECK(gFields.context != NULL);
|
||||||
|
|
||||||
clazz = env->FindClass("android/media/MediaCodec$CryptoInfo");
|
clazz = env->FindClass("android/media/MediaCodec$CryptoInfo");
|
||||||
@ -770,7 +770,7 @@ static jlong android_media_MediaExtractor_getCachedDurationUs(
|
|||||||
return -1ll;
|
return -1ll;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cachedDurationUs;
|
return (jlong) cachedDurationUs;
|
||||||
}
|
}
|
||||||
|
|
||||||
static jboolean android_media_MediaExtractor_hasCacheReachedEOS(
|
static jboolean android_media_MediaExtractor_hasCacheReachedEOS(
|
||||||
@ -779,16 +779,16 @@ static jboolean android_media_MediaExtractor_hasCacheReachedEOS(
|
|||||||
|
|
||||||
if (extractor == NULL) {
|
if (extractor == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
||||||
return true;
|
return JNI_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t cachedDurationUs;
|
int64_t cachedDurationUs;
|
||||||
bool eos;
|
bool eos;
|
||||||
if (!extractor->getCachedDuration(&cachedDurationUs, &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(
|
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)
|
static MediaMetadataRetriever* getRetriever(JNIEnv* env, jobject thiz)
|
||||||
{
|
{
|
||||||
// No lock is needed, since it is called internally by other methods that are protected
|
// 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;
|
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
|
// No lock is needed, since it is called internally by other methods that are protected
|
||||||
MediaMetadataRetriever *old = (MediaMetadataRetriever*) env->GetIntField(thiz, fields.context);
|
MediaMetadataRetriever *old = (MediaMetadataRetriever*) env->GetLongField(thiz, fields.context);
|
||||||
env->SetIntField(thiz, fields.context, retriever);
|
env->SetLongField(thiz, fields.context, (jlong) retriever);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -146,10 +146,10 @@ static void android_media_MediaMetadataRetriever_setDataSourceFD(JNIEnv *env, jo
|
|||||||
int fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
|
int fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
|
||||||
if (offset < 0 || length < 0 || fd < 0) {
|
if (offset < 0 || length < 0 || fd < 0) {
|
||||||
if (offset < 0) {
|
if (offset < 0) {
|
||||||
ALOGE("negative offset (%lld)", offset);
|
ALOGE("negative offset (%lld)", (long long)offset);
|
||||||
}
|
}
|
||||||
if (length < 0) {
|
if (length < 0) {
|
||||||
ALOGE("negative length (%lld)", length);
|
ALOGE("negative length (%lld)", (long long)length);
|
||||||
}
|
}
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
ALOGE("invalid file descriptor");
|
ALOGE("invalid file descriptor");
|
||||||
@ -359,7 +359,7 @@ static void android_media_MediaMetadataRetriever_release(JNIEnv *env, jobject th
|
|||||||
Mutex::Autolock lock(sLock);
|
Mutex::Autolock lock(sLock);
|
||||||
MediaMetadataRetriever* retriever = getRetriever(env, thiz);
|
MediaMetadataRetriever* retriever = getRetriever(env, thiz);
|
||||||
delete retriever;
|
delete retriever;
|
||||||
setRetriever(env, thiz, 0);
|
setRetriever(env, thiz, (MediaMetadataRetriever*) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void android_media_MediaMetadataRetriever_native_finalize(JNIEnv *env, jobject thiz)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fields.context = env->GetFieldID(clazz, "mNativeContext", "I");
|
fields.context = env->GetFieldID(clazz, "mNativeContext", "J");
|
||||||
if (fields.context == NULL) {
|
if (fields.context == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -435,7 +435,7 @@ static void android_media_MediaMetadataRetriever_native_setup(JNIEnv *env, jobje
|
|||||||
jniThrowException(env, "java/lang/RuntimeException", "Out of memory");
|
jniThrowException(env, "java/lang/RuntimeException", "Out of memory");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setRetriever(env, thiz, (int)retriever);
|
setRetriever(env, thiz, retriever);
|
||||||
}
|
}
|
||||||
|
|
||||||
// JNI mapping between Java methods and native methods
|
// 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)
|
static sp<MediaPlayer> getMediaPlayer(JNIEnv* env, jobject thiz)
|
||||||
{
|
{
|
||||||
Mutex::Autolock l(sLock);
|
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);
|
return sp<MediaPlayer>(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static sp<MediaPlayer> setMediaPlayer(JNIEnv* env, jobject thiz, const sp<MediaPlayer>& player)
|
static sp<MediaPlayer> setMediaPlayer(JNIEnv* env, jobject thiz, const sp<MediaPlayer>& player)
|
||||||
{
|
{
|
||||||
Mutex::Autolock l(sLock);
|
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()) {
|
if (player.get()) {
|
||||||
player->incStrong((void*)setMediaPlayer);
|
player->incStrong((void*)setMediaPlayer);
|
||||||
}
|
}
|
||||||
if (old != 0) {
|
if (old != 0) {
|
||||||
old->decStrong((void*)setMediaPlayer);
|
old->decStrong((void*)setMediaPlayer);
|
||||||
}
|
}
|
||||||
env->SetIntField(thiz, fields.context, (int)player.get());
|
env->SetLongField(thiz, fields.context, (jlong)player.get());
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ android_media_MediaPlayer_setDataSourceFD(JNIEnv *env, jobject thiz, jobject fil
|
|||||||
|
|
||||||
static sp<IGraphicBufferProducer>
|
static sp<IGraphicBufferProducer>
|
||||||
getVideoSurfaceTexture(JNIEnv* env, jobject thiz) {
|
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);
|
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
|
// 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
|
// 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);
|
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
|
||||||
if (mp == NULL ) {
|
if (mp == NULL ) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
const jboolean is_playing = mp->isPlaying();
|
const jboolean is_playing = mp->isPlaying();
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ android_media_MediaPlayer_isPlaying(JNIEnv *env, jobject thiz)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
|
||||||
if (mp == NULL ) {
|
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 );
|
process_media_player_call( env, thiz, mp->seekTo(msec), NULL, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static jint
|
||||||
android_media_MediaPlayer_getVideoWidth(JNIEnv *env, jobject thiz)
|
android_media_MediaPlayer_getVideoWidth(JNIEnv *env, jobject thiz)
|
||||||
{
|
{
|
||||||
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
|
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
|
||||||
@ -418,10 +418,10 @@ android_media_MediaPlayer_getVideoWidth(JNIEnv *env, jobject thiz)
|
|||||||
w = 0;
|
w = 0;
|
||||||
}
|
}
|
||||||
ALOGV("getVideoWidth: %d", w);
|
ALOGV("getVideoWidth: %d", w);
|
||||||
return w;
|
return (jint) w;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static jint
|
||||||
android_media_MediaPlayer_getVideoHeight(JNIEnv *env, jobject thiz)
|
android_media_MediaPlayer_getVideoHeight(JNIEnv *env, jobject thiz)
|
||||||
{
|
{
|
||||||
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
|
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
|
||||||
@ -435,11 +435,11 @@ android_media_MediaPlayer_getVideoHeight(JNIEnv *env, jobject thiz)
|
|||||||
h = 0;
|
h = 0;
|
||||||
}
|
}
|
||||||
ALOGV("getVideoHeight: %d", h);
|
ALOGV("getVideoHeight: %d", h);
|
||||||
return h;
|
return (jint) h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static jint
|
||||||
android_media_MediaPlayer_getCurrentPosition(JNIEnv *env, jobject thiz)
|
android_media_MediaPlayer_getCurrentPosition(JNIEnv *env, jobject thiz)
|
||||||
{
|
{
|
||||||
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
|
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
|
||||||
@ -450,10 +450,10 @@ android_media_MediaPlayer_getCurrentPosition(JNIEnv *env, jobject thiz)
|
|||||||
int msec;
|
int msec;
|
||||||
process_media_player_call( env, thiz, mp->getCurrentPosition(&msec), NULL, NULL );
|
process_media_player_call( env, thiz, mp->getCurrentPosition(&msec), NULL, NULL );
|
||||||
ALOGV("getCurrentPosition: %d (msec)", msec);
|
ALOGV("getCurrentPosition: %d (msec)", msec);
|
||||||
return msec;
|
return (jint) msec;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static jint
|
||||||
android_media_MediaPlayer_getDuration(JNIEnv *env, jobject thiz)
|
android_media_MediaPlayer_getDuration(JNIEnv *env, jobject thiz)
|
||||||
{
|
{
|
||||||
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
|
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
|
||||||
@ -464,7 +464,7 @@ android_media_MediaPlayer_getDuration(JNIEnv *env, jobject thiz)
|
|||||||
int msec;
|
int msec;
|
||||||
process_media_player_call( env, thiz, mp->getDuration(&msec), NULL, NULL );
|
process_media_player_call( env, thiz, mp->getDuration(&msec), NULL, NULL );
|
||||||
ALOGV("getDuration: %d (msec)", msec);
|
ALOGV("getDuration: %d (msec)", msec);
|
||||||
return msec;
|
return (jint) msec;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -480,7 +480,7 @@ android_media_MediaPlayer_reset(JNIEnv *env, jobject thiz)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
ALOGV("setAudioStreamType: %d", streamtype);
|
||||||
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
|
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
|
||||||
@ -510,21 +510,21 @@ android_media_MediaPlayer_isLooping(JNIEnv *env, jobject thiz)
|
|||||||
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
|
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
|
||||||
if (mp == NULL ) {
|
if (mp == NULL ) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
return mp->isLooping();
|
return mp->isLooping() ? JNI_TRUE : JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
|
||||||
if (mp == NULL ) {
|
if (mp == NULL ) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
||||||
return;
|
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
|
// 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
|
// Don't use process_media_player_call which use the async loop to
|
||||||
// report errors, instead returns the status.
|
// 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.
|
// 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 UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return media_player->setMetadataFilter(*filter);
|
return (jint) media_player->setMetadataFilter(*filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static jboolean
|
static jboolean
|
||||||
@ -574,14 +574,14 @@ android_media_MediaPlayer_getMetadata(JNIEnv *env, jobject thiz, jboolean update
|
|||||||
sp<MediaPlayer> media_player = getMediaPlayer(env, thiz);
|
sp<MediaPlayer> media_player = getMediaPlayer(env, thiz);
|
||||||
if (media_player == NULL ) {
|
if (media_player == NULL ) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Parcel *metadata = parcelForJavaObject(env, reply);
|
Parcel *metadata = parcelForJavaObject(env, reply);
|
||||||
|
|
||||||
if (metadata == NULL ) {
|
if (metadata == NULL ) {
|
||||||
jniThrowException(env, "java/lang/RuntimeException", "Reply parcel is null");
|
jniThrowException(env, "java/lang/RuntimeException", "Reply parcel is null");
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
metadata->freeData();
|
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
|
// metadata. Note however that the parcel actually starts with the
|
||||||
// return code so you should not rewind the parcel using
|
// return code so you should not rewind the parcel using
|
||||||
// setDataPosition(0).
|
// 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.
|
// This function gets some field IDs, which in turn causes class initialization.
|
||||||
@ -605,7 +609,7 @@ android_media_MediaPlayer_native_init(JNIEnv *env)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fields.context = env->GetFieldID(clazz, "mNativeContext", "I");
|
fields.context = env->GetFieldID(clazz, "mNativeContext", "J");
|
||||||
if (fields.context == NULL) {
|
if (fields.context == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -616,7 +620,7 @@ android_media_MediaPlayer_native_init(JNIEnv *env)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fields.surface_texture = env->GetFieldID(clazz, "mNativeSurfaceTexture", "I");
|
fields.surface_texture = env->GetFieldID(clazz, "mNativeSurfaceTexture", "J");
|
||||||
if (fields.surface_texture == NULL) {
|
if (fields.surface_texture == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -696,7 +700,7 @@ static jint android_media_MediaPlayer_get_audio_session_id(JNIEnv *env, jobject
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mp->getAudioSessionId();
|
return (jint) mp->getAudioSessionId();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -733,7 +737,7 @@ android_media_MediaPlayer_pullBatteryData(JNIEnv *env, jobject thiz, jobject jav
|
|||||||
|
|
||||||
Parcel *reply = parcelForJavaObject(env, java_reply);
|
Parcel *reply = parcelForJavaObject(env, java_reply);
|
||||||
|
|
||||||
return service->pullBatteryData(reply);
|
return (jint) service->pullBatteryData(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
static jint
|
static jint
|
||||||
@ -772,7 +776,7 @@ android_media_MediaPlayer_setRetransmitEndpoint(JNIEnv *env, jobject thiz,
|
|||||||
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
jniThrowException(env, "java/lang/IllegalStateException", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return (jint) ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -48,7 +48,7 @@ static jint
|
|||||||
android_media_MediaProfiles_native_get_num_file_formats(JNIEnv *env, jobject thiz)
|
android_media_MediaProfiles_native_get_num_file_formats(JNIEnv *env, jobject thiz)
|
||||||
{
|
{
|
||||||
ALOGV("native_get_num_file_formats");
|
ALOGV("native_get_num_file_formats");
|
||||||
return sProfiles->getOutputFileFormats().size();
|
return (jint) sProfiles->getOutputFileFormats().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
static jint
|
static jint
|
||||||
@ -119,7 +119,7 @@ static jint
|
|||||||
android_media_MediaProfiles_native_get_num_audio_encoders(JNIEnv *env, jobject thiz)
|
android_media_MediaProfiles_native_get_num_audio_encoders(JNIEnv *env, jobject thiz)
|
||||||
{
|
{
|
||||||
ALOGV("native_get_num_audio_encoders");
|
ALOGV("native_get_num_audio_encoders");
|
||||||
return sProfiles->getAudioEncoders().size();
|
return (jint) sProfiles->getAudioEncoders().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
static jobject
|
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);
|
ALOGV("native_has_camcorder_profile: %d %d", id, quality);
|
||||||
if (!isCamcorderQualityKnown(quality)) {
|
if (!isCamcorderQualityKnown(quality)) {
|
||||||
return false;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
camcorder_quality q = static_cast<camcorder_quality>(quality);
|
camcorder_quality q = static_cast<camcorder_quality>(quality);
|
||||||
return sProfiles->hasCamcorderProfile(id, q);
|
return sProfiles->hasCamcorderProfile(id, q) ? JNI_TRUE : JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static jint
|
static jint
|
||||||
android_media_MediaProfiles_native_get_num_video_decoders(JNIEnv *env, jobject thiz)
|
android_media_MediaProfiles_native_get_num_video_decoders(JNIEnv *env, jobject thiz)
|
||||||
{
|
{
|
||||||
ALOGV("native_get_num_video_decoders");
|
ALOGV("native_get_num_video_decoders");
|
||||||
return sProfiles->getVideoDecoders().size();
|
return (jint) sProfiles->getVideoDecoders().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
static jint
|
static jint
|
||||||
@ -255,7 +255,7 @@ static jint
|
|||||||
android_media_MediaProfiles_native_get_num_audio_decoders(JNIEnv *env, jobject thiz)
|
android_media_MediaProfiles_native_get_num_audio_decoders(JNIEnv *env, jobject thiz)
|
||||||
{
|
{
|
||||||
ALOGV("native_get_num_audio_decoders");
|
ALOGV("native_get_num_audio_decoders");
|
||||||
return sProfiles->getAudioDecoders().size();
|
return (jint) sProfiles->getAudioDecoders().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
static jint
|
static jint
|
||||||
@ -276,7 +276,7 @@ static jint
|
|||||||
android_media_MediaProfiles_native_get_num_image_encoding_quality_levels(JNIEnv *env, jobject thiz, jint cameraId)
|
android_media_MediaProfiles_native_get_num_image_encoding_quality_levels(JNIEnv *env, jobject thiz, jint cameraId)
|
||||||
{
|
{
|
||||||
ALOGV("native_get_num_image_encoding_quality_levels");
|
ALOGV("native_get_num_image_encoding_quality_levels");
|
||||||
return sProfiles->getImageEncodingQualityLevels(cameraId).size();
|
return (jint) sProfiles->getImageEncodingQualityLevels(cameraId).size();
|
||||||
}
|
}
|
||||||
|
|
||||||
static jint
|
static jint
|
||||||
@ -284,7 +284,7 @@ android_media_MediaProfiles_native_get_image_encoding_quality_level(JNIEnv *env,
|
|||||||
{
|
{
|
||||||
ALOGV("native_get_image_encoding_quality_level");
|
ALOGV("native_get_image_encoding_quality_level");
|
||||||
Vector<int> levels = sProfiles->getImageEncodingQualityLevels(cameraId);
|
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");
|
jniThrowException(env, "java/lang/IllegalArgumentException", "out of array boundary");
|
||||||
return -1;
|
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)
|
static sp<MediaRecorder> getMediaRecorder(JNIEnv* env, jobject thiz)
|
||||||
{
|
{
|
||||||
Mutex::Autolock l(sLock);
|
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);
|
return sp<MediaRecorder>(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static sp<MediaRecorder> setMediaRecorder(JNIEnv* env, jobject thiz, const sp<MediaRecorder>& recorder)
|
static sp<MediaRecorder> setMediaRecorder(JNIEnv* env, jobject thiz, const sp<MediaRecorder>& recorder)
|
||||||
{
|
{
|
||||||
Mutex::Autolock l(sLock);
|
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()) {
|
if (recorder.get()) {
|
||||||
recorder->incStrong(thiz);
|
recorder->incStrong(thiz);
|
||||||
}
|
}
|
||||||
if (old != 0) {
|
if (old != 0) {
|
||||||
old->decStrong(thiz);
|
old->decStrong(thiz);
|
||||||
}
|
}
|
||||||
env->SetIntField(thiz, fields.context, (int)recorder.get());
|
env->SetLongField(thiz, fields.context, (jlong)recorder.get());
|
||||||
return old;
|
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.");
|
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)
|
android_media_MediaRecorder_native_getMaxAmplitude(JNIEnv *env, jobject thiz)
|
||||||
{
|
{
|
||||||
ALOGV("getMaxAmplitude");
|
ALOGV("getMaxAmplitude");
|
||||||
sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
|
sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
|
||||||
int result = 0;
|
int result = 0;
|
||||||
process_media_recorder_call(env, mr->getMaxAmplitude(&result), "java/lang/RuntimeException", "getMaxAmplitude failed.");
|
process_media_recorder_call(env, mr->getMaxAmplitude(&result), "java/lang/RuntimeException", "getMaxAmplitude failed.");
|
||||||
return result;
|
return (jint) result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -392,7 +392,7 @@ android_media_MediaRecorder_native_init(JNIEnv *env)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fields.context = env->GetFieldID(clazz, "mNativeContext", "I");
|
fields.context = env->GetFieldID(clazz, "mNativeContext", "J");
|
||||||
if (fields.context == NULL) {
|
if (fields.context == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -226,12 +226,12 @@ private:
|
|||||||
|
|
||||||
static MediaScanner *getNativeScanner_l(JNIEnv* env, jobject thiz)
|
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)
|
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
|
static void
|
||||||
@ -381,7 +381,7 @@ android_media_MediaScanner_native_init(JNIEnv *env)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fields.context = env->GetFieldID(clazz, "mNativeContext", "I");
|
fields.context = env->GetFieldID(clazz, "mNativeContext", "J");
|
||||||
if (fields.context == NULL) {
|
if (fields.context == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -398,7 +398,7 @@ android_media_MediaScanner_native_setup(JNIEnv *env, jobject thiz)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
env->SetIntField(thiz, fields.context, (int)mp);
|
env->SetLongField(thiz, fields.context, (jlong)mp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -34,11 +34,11 @@ static struct fields_t {
|
|||||||
} fields;
|
} fields;
|
||||||
|
|
||||||
static inline SoundPool* MusterSoundPool(JNIEnv *env, jobject thiz) {
|
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)
|
android_media_SoundPool_SoundPoolImpl_load_URL(JNIEnv *env, jobject thiz, jstring path, jint priority)
|
||||||
{
|
{
|
||||||
ALOGV("android_media_SoundPool_SoundPoolImpl_load_URL");
|
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);
|
const char* s = env->GetStringUTFChars(path, NULL);
|
||||||
int id = ap->load(s, priority);
|
int id = ap->load(s, priority);
|
||||||
env->ReleaseStringUTFChars(path, s);
|
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,
|
android_media_SoundPool_SoundPoolImpl_load_FD(JNIEnv *env, jobject thiz, jobject fileDescriptor,
|
||||||
jlong offset, jlong length, jint priority)
|
jlong offset, jlong length, jint priority)
|
||||||
{
|
{
|
||||||
ALOGV("android_media_SoundPool_SoundPoolImpl_load_FD");
|
ALOGV("android_media_SoundPool_SoundPoolImpl_load_FD");
|
||||||
SoundPool *ap = MusterSoundPool(env, thiz);
|
SoundPool *ap = MusterSoundPool(env, thiz);
|
||||||
if (ap == NULL) return 0;
|
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));
|
int64_t(offset), int64_t(length), int(priority));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static jboolean
|
||||||
android_media_SoundPool_SoundPoolImpl_unload(JNIEnv *env, jobject thiz, jint sampleID) {
|
android_media_SoundPool_SoundPoolImpl_unload(JNIEnv *env, jobject thiz, jint sampleID) {
|
||||||
ALOGV("android_media_SoundPool_SoundPoolImpl_unload\n");
|
ALOGV("android_media_SoundPool_SoundPoolImpl_unload\n");
|
||||||
SoundPool *ap = MusterSoundPool(env, thiz);
|
SoundPool *ap = MusterSoundPool(env, thiz);
|
||||||
if (ap == NULL) return 0;
|
if (ap == NULL) return JNI_FALSE;
|
||||||
return ap->unload(sampleID);
|
return ap->unload(sampleID) ? JNI_TRUE : JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static jint
|
||||||
android_media_SoundPool_SoundPoolImpl_play(JNIEnv *env, jobject thiz, jint sampleID,
|
android_media_SoundPool_SoundPoolImpl_play(JNIEnv *env, jobject thiz, jint sampleID,
|
||||||
jfloat leftVolume, jfloat rightVolume, jint priority, jint loop,
|
jfloat leftVolume, jfloat rightVolume, jint priority, jint loop,
|
||||||
jfloat rate)
|
jfloat rate)
|
||||||
@ -80,7 +80,7 @@ android_media_SoundPool_SoundPoolImpl_play(JNIEnv *env, jobject thiz, jint sampl
|
|||||||
ALOGV("android_media_SoundPool_SoundPoolImpl_play\n");
|
ALOGV("android_media_SoundPool_SoundPoolImpl_play\n");
|
||||||
SoundPool *ap = MusterSoundPool(env, thiz);
|
SoundPool *ap = MusterSoundPool(env, thiz);
|
||||||
if (ap == NULL) return 0;
|
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
|
static void
|
||||||
@ -130,22 +130,22 @@ android_media_SoundPool_SoundPoolImpl_stop(JNIEnv *env, jobject thiz, jint chann
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
android_media_SoundPool_SoundPoolImpl_setVolume(JNIEnv *env, jobject thiz, jint channelID,
|
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");
|
ALOGV("android_media_SoundPool_SoundPoolImpl_setVolume");
|
||||||
SoundPool *ap = MusterSoundPool(env, thiz);
|
SoundPool *ap = MusterSoundPool(env, thiz);
|
||||||
if (ap == NULL) return;
|
if (ap == NULL) return;
|
||||||
ap->setVolume(channelID, leftVolume, rightVolume);
|
ap->setVolume(channelID, (float) leftVolume, (float) rightVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
android_media_SoundPool_SoundPoolImpl_setPriority(JNIEnv *env, jobject thiz, jint channelID,
|
android_media_SoundPool_SoundPoolImpl_setPriority(JNIEnv *env, jobject thiz, jint channelID,
|
||||||
int priority)
|
jint priority)
|
||||||
{
|
{
|
||||||
ALOGV("android_media_SoundPool_SoundPoolImpl_setPriority");
|
ALOGV("android_media_SoundPool_SoundPoolImpl_setPriority");
|
||||||
SoundPool *ap = MusterSoundPool(env, thiz);
|
SoundPool *ap = MusterSoundPool(env, thiz);
|
||||||
if (ap == NULL) return;
|
if (ap == NULL) return;
|
||||||
ap->setPriority(channelID, priority);
|
ap->setPriority(channelID, (int) priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -160,12 +160,12 @@ android_media_SoundPool_SoundPoolImpl_setLoop(JNIEnv *env, jobject thiz, jint ch
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
android_media_SoundPool_SoundPoolImpl_setRate(JNIEnv *env, jobject thiz, jint channelID,
|
android_media_SoundPool_SoundPoolImpl_setRate(JNIEnv *env, jobject thiz, jint channelID,
|
||||||
float rate)
|
jfloat rate)
|
||||||
{
|
{
|
||||||
ALOGV("android_media_SoundPool_SoundPoolImpl_setRate");
|
ALOGV("android_media_SoundPool_SoundPoolImpl_setRate");
|
||||||
SoundPool *ap = MusterSoundPool(env, thiz);
|
SoundPool *ap = MusterSoundPool(env, thiz);
|
||||||
if (ap == NULL) return;
|
if (ap == NULL) return;
|
||||||
ap->setRate(channelID, rate);
|
ap->setRate(channelID, (float) rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void android_media_callback(SoundPoolEvent event, SoundPool* soundPool, void* user)
|
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
|
// 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
|
// set callback with weak reference
|
||||||
jobject globalWeakRef = env->NewGlobalRef(weakRef);
|
jobject globalWeakRef = env->NewGlobalRef(weakRef);
|
||||||
@ -208,7 +208,7 @@ android_media_SoundPool_SoundPoolImpl_release(JNIEnv *env, jobject thiz)
|
|||||||
|
|
||||||
// clear callback and native context
|
// clear callback and native context
|
||||||
ap->setCallback(NULL, NULL);
|
ap->setCallback(NULL, NULL);
|
||||||
env->SetIntField(thiz, fields.mNativeContext, 0);
|
env->SetLongField(thiz, fields.mNativeContext, 0);
|
||||||
delete ap;
|
delete ap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved)
|
|||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
fields.mNativeContext = env->GetFieldID(clazz, "mNativeContext", "I");
|
fields.mNativeContext = env->GetFieldID(clazz, "mNativeContext", "J");
|
||||||
if (fields.mNativeContext == NULL) {
|
if (fields.mNativeContext == NULL) {
|
||||||
ALOGE("Can't find SoundPoolImpl.mNativeContext");
|
ALOGE("Can't find SoundPoolImpl.mNativeContext");
|
||||||
goto bail;
|
goto bail;
|
||||||
|
@ -119,12 +119,12 @@ static sp<MediaRecorder> getMediaRecorder(JNIEnv* env, jobject jmediarecorder) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
jfieldID context = env->GetFieldID(clazz, "mNativeContext", "I");
|
jfieldID context = env->GetFieldID(clazz, "mNativeContext", "J");
|
||||||
if (context == NULL) {
|
if (context == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaRecorder* const p = (MediaRecorder*)env->GetIntField(jmediarecorder, context);
|
MediaRecorder* const p = (MediaRecorder*)env->GetLongField(jmediarecorder, context);
|
||||||
env->DeleteLocalRef(clazz);
|
env->DeleteLocalRef(clazz);
|
||||||
return sp<MediaRecorder>(p);
|
return sp<MediaRecorder>(p);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user