Home | History | Annotate | Download | only in jni

Lines Matching refs:env

68         JNIEnv *env, jobject thiz,
72 jclass clazz = env->GetObjectClass(thiz);
75 mClass = (jclass)env->NewGlobalRef(clazz);
76 mObject = env->NewWeakGlobalRef(thiz);
103 JNIEnv *env = AndroidRuntime::getJNIEnv();
105 env->DeleteWeakGlobalRef(mObject);
107 env->DeleteGlobalRef(mClass);
174 JNIEnv *env, jobject bufferInfo, size_t *index, int64_t timeoutUs) {
184 jclass clazz = env->FindClass("android/media/MediaCodec$BufferInfo");
186 jmethodID method = env->GetMethodID(clazz, "set", "(IIJI)V");
187 env->CallVoidMethod(bufferInfo, method, offset, size, timeUs, flags);
202 status_t JMediaCodec::getOutputFormat(JNIEnv *env, jobject *format) const {
209 return ConvertMessageToMap(env, msg, format);
213 JNIEnv *env, bool input, jobjectArray *bufArray) const {
225 jclass byteBufferClass = env->FindClass("java/nio/ByteBuffer");
228 jmethodID orderID = env->GetMethodID(
235 jclass byteOrderClass = env->FindClass("java/nio/ByteOrder");
238 jmethodID nativeOrderID = env->GetStaticMethodID(
243 env->CallStaticObjectMethod(byteOrderClass, nativeOrderID);
246 *bufArray = (jobjectArray)env->NewObjectArray(
249 env->DeleteLocalRef(nativeByteOrderObj);
262 env->NewDirectByteBuffer(
266 env->DeleteLocalRef(nativeByteOrderObj);
269 jobject me = env->CallObjectMethod(
271 env->DeleteLocalRef(me);
274 env->SetObjectArrayElement(
277 env->DeleteLocalRef(byteBuffer);
281 env->DeleteLocalRef(nativeByteOrderObj);
287 status_t JMediaCodec::getName(JNIEnv *env, jstring *nameStr) const {
296 *nameStr = env->NewStringUTF(name.c_str());
314 JNIEnv *env, jobject thiz, const sp<JMediaCodec> &codec) {
315 sp<JMediaCodec> old = (JMediaCodec *)env->GetIntField(thiz, gFields.context);
322 env->SetIntField(thiz, gFields.context, (int)codec.get());
327 static sp<JMediaCodec> getMediaCodec(JNIEnv *env, jobject thiz) {
328 return (JMediaCodec *)env->GetIntField(thiz, gFields.context);
331 static void android_media_MediaCodec_release(JNIEnv *env, jobject thiz) {
332 setMediaCodec(env, thiz, NULL);
335 static void throwCryptoException(JNIEnv *env, status_t err, const char *msg) {
336 jclass clazz = env->FindClass("android/media/MediaCodec$CryptoException");
340 env->GetMethodID(clazz, "<init>", "(ILjava/lang/String;)V");
343 jstring msgObj = env->NewStringUTF(msg != NULL ? msg : "Unknown Error");
346 (jthrowable)env->NewObject(clazz, constructID, err, msgObj);
348 env->Throw(exception);
352 JNIEnv *env, status_t err, const char *msg = NULL) {
356 throwCryptoException(env, err, msg);
375 jniThrowException(env, "java/lang/IllegalStateException", msg);
384 JNIEnv *env,
390 sp<JMediaCodec> codec = getMediaCodec(env, thiz);
393 jniThrowException(env, "java/lang/IllegalStateException", NULL);
398 status_t err = ConvertKeyValueArraysToMessage(env, keys, values, &format);
401 jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
407 sp<Surface> surface(android_view_Surface_getSurface(env, jsurface));
412 env,
421 crypto = JCrypto::GetCrypto(env, jcrypto);
426 throwExceptionAsNecessary(env, err);
429 static jobject android_media_MediaCodec_createInputSurface(JNIEnv* env,
433 sp<JMediaCodec> codec = getMediaCodec(env, thiz);
435 jniThrowException(env, "java/lang/IllegalStateException", NULL);
443 throwExceptionAsNecessary(env, err);
448 return android_view_Surface_createFromIGraphicBufferProducer(env,
452 static void android_media_MediaCodec_start(JNIEnv *env, jobject thiz) {
455 sp<JMediaCodec> codec = getMediaCodec(env, thiz);
458 jniThrowException(env, "java/lang/IllegalStateException", "no codec found");
464 throwExceptionAsNecessary(env, err, "start failed");
467 static void android_media_MediaCodec_stop(JNIEnv *env, jobject thiz) {
470 sp<JMediaCodec> codec = getMediaCodec(env, thiz);
473 jniThrowException(env, "java/lang/IllegalStateException", NULL);
479 throwExceptionAsNecessary(env, err);
482 static void android_media_MediaCodec_flush(JNIEnv *env, jobject thiz) {
485 sp<JMediaCodec> codec = getMediaCodec(env, thiz);
488 jniThrowException(env, "java/lang/IllegalStateException", NULL);
494 throwExceptionAsNecessary(env, err);
498 JNIEnv *env,
507 sp<JMediaCodec> codec = getMediaCodec(env, thiz);
510 jniThrowException(env, "java/lang/IllegalStateException", NULL);
520 env, err, errorDetailMsg.empty() ? NULL : errorDetailMsg.c_str());
524 JNIEnv *env,
533 sp<JMediaCodec> codec = getMediaCodec(env, thiz);
536 jniThrowException(env, "java/lang/IllegalStateException", NULL);
541 env->GetIntField(cryptoInfoObj, gFields.cryptoInfoNumSubSamplesID);
544 (jintArray)env->GetObjectField(
548 (jintArray)env->GetObjectField(
552 (jbyteArray)env->GetObjectField(cryptoInfoObj, gFields.cryptoInfoKeyID);
555 (jbyteArray)env->GetObjectField(cryptoInfoObj, gFields.cryptoInfoIVID);
557 jint mode = env->GetIntField(cryptoInfoObj, gFields.cryptoInfoModeID);
571 && env->GetArrayLength(numBytesOfEncryptedDataObj) < numSubSamples) {
574 && env->GetArrayLength(numBytesOfClearDataObj) < numSubSamples) {
582 : env->GetIntArrayElements(numBytesOfClearDataObj, &isCopy);
587 : env->GetIntArrayElements(numBytesOfEncryptedDataObj, &isCopy);
601 env->ReleaseIntArrayElements(
607 env->ReleaseIntArrayElements(
614 if (env->GetArrayLength(keyObj) != 16) {
618 key = env->GetByteArrayElements(keyObj, &isCopy);
623 if (env->GetArrayLength(ivObj) != 16) {
627 iv = env->GetByteArrayElements(ivObj, &isCopy);
645 env->ReleaseByteArrayElements(ivObj, iv, 0);
650 env->ReleaseByteArrayElements(keyObj, key, 0);
658 env, err, errorDetailMsg.empty() ? NULL : errorDetailMsg.c_str());
662 JNIEnv *env, jobject thiz, jlong timeoutUs) {
665 sp<JMediaCodec> codec = getMediaCodec(env, thiz);
668 jniThrowException(env, "java/lang/IllegalStateException", NULL);
679 return throwExceptionAsNecessary(env, err);
683 JNIEnv *env, jobject thiz, jobject bufferInfo, jlong timeoutUs) {
686 sp<JMediaCodec> codec = getMediaCodec(env, thiz);
689 jniThrowException(env, "java/lang/IllegalStateException", NULL);
695 env, bufferInfo, &index, timeoutUs);
701 return throwExceptionAsNecessary(env, err);
705 JNIEnv *env, jobject thiz, jint index, jboolean render) {
708 sp<JMediaCodec> codec = getMediaCodec(env, thiz);
711 jniThrowException(env, "java/lang/IllegalStateException", NULL);
717 throwExceptionAsNecessary(env, err);
720 static void android_media_MediaCodec_signalEndOfInputStream(JNIEnv* env,
724 sp<JMediaCodec> codec = getMediaCodec(env, thiz);
726 jniThrowException(env, "java/lang/IllegalStateException", NULL);
732 throwExceptionAsNecessary(env, err);
736 JNIEnv *env, jobject thiz) {
739 sp<JMediaCodec> codec = getMediaCodec(env, thiz);
742 jniThrowException(env, "java/lang/IllegalStateException", NULL);
747 status_t err = codec->getOutputFormat(env, &format);
753 throwExceptionAsNecessary(env, err);
759 JNIEnv *env, jobject thiz, jboolean input) {
762 sp<JMediaCodec> codec = getMediaCodec(env, thiz);
765 jniThrowException(env, "java/lang/IllegalStateException", NULL);
770 status_t err = codec->getBuffers(env, input, &buffers);
778 throwExceptionAsNecessary(env, err);
785 JNIEnv *env, jobject thiz) {
788 sp<JMediaCodec> codec = getMediaCodec(env, thiz);
791 jniThrowException(env, "java/lang/IllegalStateException", NULL);
796 status_t err = codec->getName(env, &name);
802 throwExceptionAsNecessary(env, err);
808 JNIEnv *env, jobject thiz, jint mode) {
809 sp<JMediaCodec> codec = getMediaCodec(env, thiz);
812 jniThrowException(env, "java/lang/IllegalStateException", NULL);
818 jniThrowException(env, "java/lang/InvalidArgumentException", NULL);
825 static void android_media_MediaCodec_native_init(JNIEnv *env) {
826 jclass clazz = env->FindClass("android/media/MediaCodec");
829 gFields.context = env->GetFieldID(clazz, "mNativeContext", "I");
832 clazz = env->FindClass("android/media/MediaCodec$CryptoInfo");
836 env->GetFieldID(clazz, "numSubSamples", "I");
840 env->GetFieldID(clazz, "numBytesOfClearData", "[I");
844 env->GetFieldID(clazz, "numBytesOfEncryptedData", "[I");
847 gFields.cryptoInfoKeyID = env->GetFieldID(clazz, "key", "[B");
850 gFields.cryptoInfoIVID = env->GetFieldID(clazz, "iv", "[B");
853 gFields.cryptoInfoModeID = env->GetFieldID(clazz, "mode", "I");
858 JNIEnv *env, jobject thiz,
861 jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
865 const char *tmp = env->GetStringUTFChars(name, NULL);
871 sp<JMediaCodec> codec = new JMediaCodec(env, thiz, tmp, nameIsType, encoder);
875 env->ReleaseStringUTFChars(name, tmp);
880 env,
886 setMediaCodec(env,thiz, codec);
890 JNIEnv *env, jobject thiz) {
891 android_media_MediaCodec_release(env, thiz);
948 int register_android_media_MediaCodec(JNIEnv *env) {
949 return AndroidRuntime::registerNativeMethods(env,