Home | History | Annotate | Download | only in jni

Lines Matching defs:env

40 static sp<JCrypto> getCrypto(JNIEnv *env, jobject thiz) {
41 return (JCrypto *)env->GetLongField(thiz, gFields.context);
45 JNIEnv *env, jobject thiz,
47 mObject = env->NewWeakGlobalRef(thiz);
55 JNIEnv *env = AndroidRuntime::getJNIEnv();
57 env->DeleteWeakGlobalRef(mObject);
126 sp<ICrypto> JCrypto::GetCrypto(JNIEnv *env, jobject obj) {
127 jclass clazz = env->FindClass("android/media/MediaCrypto");
130 if (!env->IsInstanceOf(obj, clazz)) {
134 sp<JCrypto> jcrypto = getCrypto(env, obj);
144 static Vector<uint8_t> JByteArrayToVector(JNIEnv *env, jbyteArray const &byteArray) {
146 size_t length = env->GetArrayLength(byteArray);
148 env->GetByteArrayRegion(byteArray, 0, length, (jbyte *)vector.editArray());
157 JNIEnv *env, jobject thiz, const sp<JCrypto> &crypto) {
158 sp<JCrypto> old = (JCrypto *)env->GetLongField(thiz, gFields.context);
165 env->SetLongField(thiz, gFields.context, (jlong)crypto.get());
170 static void android_media_MediaCrypto_release(JNIEnv *env, jobject thiz) {
171 setCrypto(env, thiz, NULL);
174 static void android_media_MediaCrypto_native_init(JNIEnv *env) {
175 jclass clazz = env->FindClass("android/media/MediaCrypto");
178 gFields.context = env->GetFieldID(clazz, "mNativeContext", "J");
183 JNIEnv *env, jobject thiz,
185 jsize uuidLength = env->GetArrayLength(uuidObj);
189 env,
196 jbyte *uuid = env->GetByteArrayElements(uuidObj, &isCopy);
202 initDataLength = env->GetArrayLength(initDataObj);
203 initData = env->GetByteArrayElements(initDataObj, &isCopy);
207 env, thiz, (const uint8_t *)uuid, initData, initDataLength);
212 env->ReleaseByteArrayElements(initDataObj, initData, 0);
216 env->ReleaseByteArrayElements(uuidObj, uuid, 0);
221 env,
227 setCrypto(env,thiz, crypto);
231 JNIEnv *env, jobject thiz) {
232 android_media_MediaCrypto_release(env, thiz);
236 JNIEnv *env, jobject /* thiz */, jbyteArray uuidObj) {
237 jsize uuidLength = env->GetArrayLength(uuidObj);
241 env,
248 jbyte *uuid = env->GetByteArrayElements(uuidObj, &isCopy);
252 env->ReleaseByteArrayElements(uuidObj, uuid, 0);
259 JNIEnv *env, jobject thiz, jstring mimeObj) {
261 jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
265 sp<JCrypto> crypto = getCrypto(env, thiz);
268 jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
272 const char *mime = env->GetStringUTFChars(mimeObj, NULL);
280 env->ReleaseStringUTFChars(mimeObj, mime);
287 JNIEnv *env, jobject thiz, jbyteArray jsessionId) {
289 jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
293 sp<ICrypto> crypto = JCrypto::GetCrypto(env, thiz);
296 jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
300 Vector<uint8_t> sessionId(JByteArrayToVector(env, jsessionId));
315 jniThrowException(env, "android/media/MediaCryptoException", msg.string());
339 int register_android_media_Crypto(JNIEnv *env) {
340 return AndroidRuntime::registerNativeMethods(env,