Lines Matching defs:env

41 static sp<JCrypto> getCrypto(JNIEnv *env, jobject thiz) {
42 return (JCrypto *)env->GetLongField(thiz, gFields.context);
46 JNIEnv *env, jobject thiz,
48 mObject = env->NewWeakGlobalRef(thiz);
56 JNIEnv *env = AndroidRuntime::getJNIEnv();
58 env->DeleteWeakGlobalRef(mObject);
122 sp<ICrypto> JCrypto::GetCrypto(JNIEnv *env, jobject obj) {
123 jclass clazz = env->FindClass("android/media/MediaCrypto");
126 if (!env->IsInstanceOf(obj, clazz)) {
130 sp<JCrypto> jcrypto = getCrypto(env, obj);
140 static Vector<uint8_t> JByteArrayToVector(JNIEnv *env, jbyteArray const &byteArray) {
142 size_t length = env->GetArrayLength(byteArray);
144 env->GetByteArrayRegion(byteArray, 0, length, (jbyte *)vector.editArray());
153 JNIEnv *env, jobject thiz, const sp<JCrypto> &crypto) {
154 sp<JCrypto> old = (JCrypto *)env->GetLongField(thiz, gFields.context);
161 env->SetLongField(thiz, gFields.context, (jlong)crypto.get());
166 static void android_media_MediaCrypto_release(JNIEnv *env, jobject thiz) {
167 setCrypto(env, thiz, NULL);
170 static void android_media_MediaCrypto_native_init(JNIEnv *env) {
171 jclass clazz = env->FindClass("android/media/MediaCrypto");
174 gFields.context = env->GetFieldID(clazz, "mNativeContext", "J");
179 JNIEnv *env, jobject thiz,
181 jsize uuidLength = env->GetArrayLength(uuidObj);
185 env,
192 jbyte *uuid = env->GetByteArrayElements(uuidObj, &isCopy);
198 initDataLength = env->GetArrayLength(initDataObj);
199 initData = env->GetByteArrayElements(initDataObj, &isCopy);
203 env, thiz, (const uint8_t *)uuid, initData, initDataLength);
208 env->ReleaseByteArrayElements(initDataObj, initData, 0);
212 env->ReleaseByteArrayElements(uuidObj, uuid, 0);
217 env,
223 setCrypto(env,thiz, crypto);
227 JNIEnv *env, jobject thiz) {
228 android_media_MediaCrypto_release(env, thiz);
232 JNIEnv *env, jobject /* thiz */, jbyteArray uuidObj) {
233 jsize uuidLength = env->GetArrayLength(uuidObj);
237 env,
244 jbyte *uuid = env->GetByteArrayElements(uuidObj, &isCopy);
248 env->ReleaseByteArrayElements(uuidObj, uuid, 0);
255 JNIEnv *env, jobject thiz, jstring mimeObj) {
257 jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
261 sp<JCrypto> crypto = getCrypto(env, thiz);
264 jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
268 const char *mime = env->GetStringUTFChars(mimeObj, NULL);
276 env->ReleaseStringUTFChars(mimeObj, mime);
283 JNIEnv *env, jobject thiz, jbyteArray jsessionId) {
285 jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
289 sp<ICrypto> crypto = JCrypto::GetCrypto(env, thiz);
292 jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
296 Vector<uint8_t> sessionId(JByteArrayToVector(env, jsessionId));
311 jniThrowException(env, "android/media/MediaCryptoException", msg.string());
335 int register_android_media_Crypto(JNIEnv *env) {
336 return AndroidRuntime::registerNativeMethods(env,