am 5d6332e3
: Merge "AArch64: Use long for pointers in MediaDrm and MediaMuxer"
* commit '5d6332e3744e37ced079e5360f1fa3e0e5681d57': AArch64: Use long for pointers in MediaDrm and MediaMuxer
This commit is contained in:
@ -100,7 +100,7 @@ public final class MediaDrm {
|
|||||||
private EventHandler mEventHandler;
|
private EventHandler mEventHandler;
|
||||||
private OnEventListener mOnEventListener;
|
private OnEventListener mOnEventListener;
|
||||||
|
|
||||||
private int mNativeContext;
|
private long mNativeContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query if the given scheme identified by its UUID is supported on
|
* Query if the given scheme identified by its UUID is supported on
|
||||||
|
@ -65,7 +65,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
final public class MediaMuxer {
|
final public class MediaMuxer {
|
||||||
|
|
||||||
private int mNativeContext;
|
private long mNativeContext;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("media_jni");
|
System.loadLibrary("media_jni");
|
||||||
@ -84,16 +84,16 @@ final public class MediaMuxer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// All the native functions are listed here.
|
// All the native functions are listed here.
|
||||||
private static native int nativeSetup(FileDescriptor fd, int format);
|
private static native long nativeSetup(FileDescriptor fd, int format);
|
||||||
private static native void nativeRelease(int nativeObject);
|
private static native void nativeRelease(long nativeObject);
|
||||||
private static native void nativeStart(int nativeObject);
|
private static native void nativeStart(long nativeObject);
|
||||||
private static native void nativeStop(int nativeObject);
|
private static native void nativeStop(long nativeObject);
|
||||||
private static native int nativeAddTrack(int nativeObject, String[] keys,
|
private static native int nativeAddTrack(long nativeObject, String[] keys,
|
||||||
Object[] values);
|
Object[] values);
|
||||||
private static native void nativeSetOrientationHint(int nativeObject,
|
private static native void nativeSetOrientationHint(long nativeObject,
|
||||||
int degrees);
|
int degrees);
|
||||||
private static native void nativeSetLocation(int nativeObject, int latitude, int longitude);
|
private static native void nativeSetLocation(long nativeObject, int latitude, int longitude);
|
||||||
private static native void nativeWriteSampleData(int nativeObject,
|
private static native void nativeWriteSampleData(long nativeObject,
|
||||||
int trackIndex, ByteBuffer byteBuf,
|
int trackIndex, ByteBuffer byteBuf,
|
||||||
int offset, int size, long presentationTimeUs, int flags);
|
int offset, int size, long presentationTimeUs, int flags);
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ final public class MediaMuxer {
|
|||||||
private final CloseGuard mCloseGuard = CloseGuard.get();
|
private final CloseGuard mCloseGuard = CloseGuard.get();
|
||||||
private int mLastTrackIndex = -1;
|
private int mLastTrackIndex = -1;
|
||||||
|
|
||||||
private int mNativeObject;
|
private long mNativeObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -267,7 +267,7 @@ static bool throwExceptionAsNecessary(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static sp<IDrm> GetDrm(JNIEnv *env, jobject thiz) {
|
static sp<IDrm> GetDrm(JNIEnv *env, jobject thiz) {
|
||||||
JDrm *jdrm = (JDrm *)env->GetIntField(thiz, gFields.context);
|
JDrm *jdrm = (JDrm *)env->GetLongField(thiz, gFields.context);
|
||||||
return jdrm ? jdrm->getDrm() : NULL;
|
return jdrm ? jdrm->getDrm() : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,7 +484,7 @@ using namespace android;
|
|||||||
|
|
||||||
static sp<JDrm> setDrm(
|
static sp<JDrm> setDrm(
|
||||||
JNIEnv *env, jobject thiz, const sp<JDrm> &drm) {
|
JNIEnv *env, jobject thiz, const sp<JDrm> &drm) {
|
||||||
sp<JDrm> old = (JDrm *)env->GetIntField(thiz, gFields.context);
|
sp<JDrm> old = (JDrm *)env->GetLongField(thiz, gFields.context);
|
||||||
if (drm != NULL) {
|
if (drm != NULL) {
|
||||||
drm->incStrong(thiz);
|
drm->incStrong(thiz);
|
||||||
}
|
}
|
||||||
@ -520,7 +520,7 @@ static void android_media_MediaDrm_release(JNIEnv *env, jobject thiz) {
|
|||||||
static void android_media_MediaDrm_native_init(JNIEnv *env) {
|
static void android_media_MediaDrm_native_init(JNIEnv *env) {
|
||||||
jclass clazz;
|
jclass clazz;
|
||||||
FIND_CLASS(clazz, "android/media/MediaDrm");
|
FIND_CLASS(clazz, "android/media/MediaDrm");
|
||||||
GET_FIELD_ID(gFields.context, clazz, "mNativeContext", "I");
|
GET_FIELD_ID(gFields.context, clazz, "mNativeContext", "J");
|
||||||
GET_STATIC_METHOD_ID(gFields.post_event, clazz, "postEventFromNative",
|
GET_STATIC_METHOD_ID(gFields.post_event, clazz, "postEventFromNative",
|
||||||
"(Ljava/lang/Object;IILjava/lang/Object;)V");
|
"(Ljava/lang/Object;IILjava/lang/Object;)V");
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ static fields_t gFields;
|
|||||||
using namespace android;
|
using namespace android;
|
||||||
|
|
||||||
static jint android_media_MediaMuxer_addTrack(
|
static jint android_media_MediaMuxer_addTrack(
|
||||||
JNIEnv *env, jclass clazz, jint nativeObject, jobjectArray keys,
|
JNIEnv *env, jclass clazz, jlong nativeObject, jobjectArray keys,
|
||||||
jobjectArray values) {
|
jobjectArray values) {
|
||||||
sp<MediaMuxer> muxer(reinterpret_cast<MediaMuxer *>(nativeObject));
|
sp<MediaMuxer> muxer(reinterpret_cast<MediaMuxer *>(nativeObject));
|
||||||
if (muxer == NULL) {
|
if (muxer == NULL) {
|
||||||
@ -72,7 +72,7 @@ static jint android_media_MediaMuxer_addTrack(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void android_media_MediaMuxer_writeSampleData(
|
static void android_media_MediaMuxer_writeSampleData(
|
||||||
JNIEnv *env, jclass clazz, jint nativeObject, jint trackIndex,
|
JNIEnv *env, jclass clazz, jlong nativeObject, jint trackIndex,
|
||||||
jobject byteBuf, jint offset, jint size, jlong timeUs, jint flags) {
|
jobject byteBuf, jint offset, jint size, jlong timeUs, jint flags) {
|
||||||
sp<MediaMuxer> muxer(reinterpret_cast<MediaMuxer *>(nativeObject));
|
sp<MediaMuxer> muxer(reinterpret_cast<MediaMuxer *>(nativeObject));
|
||||||
if (muxer == NULL) {
|
if (muxer == NULL) {
|
||||||
@ -147,7 +147,7 @@ static jint android_media_MediaMuxer_native_setup(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void android_media_MediaMuxer_setOrientationHint(
|
static void android_media_MediaMuxer_setOrientationHint(
|
||||||
JNIEnv *env, jclass clazz, jint nativeObject, jint degrees) {
|
JNIEnv *env, jclass clazz, jlong nativeObject, jint degrees) {
|
||||||
sp<MediaMuxer> muxer(reinterpret_cast<MediaMuxer *>(nativeObject));
|
sp<MediaMuxer> muxer(reinterpret_cast<MediaMuxer *>(nativeObject));
|
||||||
if (muxer == NULL) {
|
if (muxer == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException",
|
jniThrowException(env, "java/lang/IllegalStateException",
|
||||||
@ -177,7 +177,7 @@ static void android_media_MediaMuxer_setLocation(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void android_media_MediaMuxer_start(JNIEnv *env, jclass clazz,
|
static void android_media_MediaMuxer_start(JNIEnv *env, jclass clazz,
|
||||||
jint nativeObject) {
|
jlong nativeObject) {
|
||||||
sp<MediaMuxer> muxer(reinterpret_cast<MediaMuxer *>(nativeObject));
|
sp<MediaMuxer> muxer(reinterpret_cast<MediaMuxer *>(nativeObject));
|
||||||
if (muxer == NULL) {
|
if (muxer == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException",
|
jniThrowException(env, "java/lang/IllegalStateException",
|
||||||
@ -195,7 +195,7 @@ static void android_media_MediaMuxer_start(JNIEnv *env, jclass clazz,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void android_media_MediaMuxer_stop(JNIEnv *env, jclass clazz,
|
static void android_media_MediaMuxer_stop(JNIEnv *env, jclass clazz,
|
||||||
jint nativeObject) {
|
jlong nativeObject) {
|
||||||
sp<MediaMuxer> muxer(reinterpret_cast<MediaMuxer *>(nativeObject));
|
sp<MediaMuxer> muxer(reinterpret_cast<MediaMuxer *>(nativeObject));
|
||||||
if (muxer == NULL) {
|
if (muxer == NULL) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException",
|
jniThrowException(env, "java/lang/IllegalStateException",
|
||||||
@ -213,7 +213,7 @@ static void android_media_MediaMuxer_stop(JNIEnv *env, jclass clazz,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void android_media_MediaMuxer_native_release(
|
static void android_media_MediaMuxer_native_release(
|
||||||
JNIEnv *env, jclass clazz, jint nativeObject) {
|
JNIEnv *env, jclass clazz, jlong nativeObject) {
|
||||||
sp<MediaMuxer> muxer(reinterpret_cast<MediaMuxer *>(nativeObject));
|
sp<MediaMuxer> muxer(reinterpret_cast<MediaMuxer *>(nativeObject));
|
||||||
if (muxer != NULL) {
|
if (muxer != NULL) {
|
||||||
muxer->decStrong(clazz);
|
muxer->decStrong(clazz);
|
||||||
@ -222,26 +222,26 @@ static void android_media_MediaMuxer_native_release(
|
|||||||
|
|
||||||
static JNINativeMethod gMethods[] = {
|
static JNINativeMethod gMethods[] = {
|
||||||
|
|
||||||
{ "nativeAddTrack", "(I[Ljava/lang/String;[Ljava/lang/Object;)I",
|
{ "nativeAddTrack", "(J[Ljava/lang/String;[Ljava/lang/Object;)I",
|
||||||
(void *)android_media_MediaMuxer_addTrack },
|
(void *)android_media_MediaMuxer_addTrack },
|
||||||
|
|
||||||
{ "nativeSetOrientationHint", "(II)V",
|
{ "nativeSetOrientationHint", "(JI)V",
|
||||||
(void *)android_media_MediaMuxer_setOrientationHint},
|
(void *)android_media_MediaMuxer_setOrientationHint},
|
||||||
|
|
||||||
{ "nativeSetLocation", "(III)V",
|
{ "nativeSetLocation", "(JII)V",
|
||||||
(void *)android_media_MediaMuxer_setLocation},
|
(void *)android_media_MediaMuxer_setLocation},
|
||||||
|
|
||||||
{ "nativeStart", "(I)V", (void *)android_media_MediaMuxer_start},
|
{ "nativeStart", "(J)V", (void *)android_media_MediaMuxer_start},
|
||||||
|
|
||||||
{ "nativeWriteSampleData", "(IILjava/nio/ByteBuffer;IIJI)V",
|
{ "nativeWriteSampleData", "(JILjava/nio/ByteBuffer;IIJI)V",
|
||||||
(void *)android_media_MediaMuxer_writeSampleData },
|
(void *)android_media_MediaMuxer_writeSampleData },
|
||||||
|
|
||||||
{ "nativeStop", "(I)V", (void *)android_media_MediaMuxer_stop},
|
{ "nativeStop", "(J)V", (void *)android_media_MediaMuxer_stop},
|
||||||
|
|
||||||
{ "nativeSetup", "(Ljava/io/FileDescriptor;I)I",
|
{ "nativeSetup", "(Ljava/io/FileDescriptor;I)J",
|
||||||
(void *)android_media_MediaMuxer_native_setup },
|
(void *)android_media_MediaMuxer_native_setup },
|
||||||
|
|
||||||
{ "nativeRelease", "(I)V",
|
{ "nativeRelease", "(J)V",
|
||||||
(void *)android_media_MediaMuxer_native_release },
|
(void *)android_media_MediaMuxer_native_release },
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -255,7 +255,7 @@ int register_android_media_MediaMuxer(JNIEnv *env) {
|
|||||||
jclass clazz = env->FindClass("android/media/MediaMuxer");
|
jclass clazz = env->FindClass("android/media/MediaMuxer");
|
||||||
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);
|
||||||
|
|
||||||
jclass byteBufClass = env->FindClass("java/nio/ByteBuffer");
|
jclass byteBufClass = env->FindClass("java/nio/ByteBuffer");
|
||||||
|
Reference in New Issue
Block a user