Lines Matching refs:env
122 JNIEnv *env, jobject thiz, in JMediaCodec() argument
126 jclass clazz = env->GetObjectClass(thiz); in JMediaCodec()
129 mClass = (jclass)env->NewGlobalRef(clazz); in JMediaCodec()
130 mObject = env->NewWeakGlobalRef(thiz); in JMediaCodec()
132 cacheJavaObjects(env); in JMediaCodec()
150 void JMediaCodec::cacheJavaObjects(JNIEnv *env) { in cacheJavaObjects() argument
151 jclass clazz = (jclass)env->FindClass("java/nio/ByteBuffer"); in cacheJavaObjects()
152 mByteBufferClass = (jclass)env->NewGlobalRef(clazz); in cacheJavaObjects()
156 env, env->FindClass("java/nio/ByteOrder")); in cacheJavaObjects()
159 jmethodID nativeOrderID = env->GetStaticMethodID( in cacheJavaObjects()
164 env->CallStaticObjectMethod(byteOrderClass.get(), nativeOrderID); in cacheJavaObjects()
165 mNativeByteOrderObj = env->NewGlobalRef(nativeByteOrderObj); in cacheJavaObjects()
167 env->DeleteLocalRef(nativeByteOrderObj); in cacheJavaObjects()
170 mByteBufferOrderMethodID = env->GetMethodID( in cacheJavaObjects()
176 mByteBufferAsReadOnlyBufferMethodID = env->GetMethodID( in cacheJavaObjects()
180 mByteBufferPositionMethodID = env->GetMethodID( in cacheJavaObjects()
184 mByteBufferLimitMethodID = env->GetMethodID( in cacheJavaObjects()
227 JNIEnv *env = AndroidRuntime::getJNIEnv(); in ~JMediaCodec() local
229 env->DeleteWeakGlobalRef(mObject); in ~JMediaCodec()
231 env->DeleteGlobalRef(mClass); in ~JMediaCodec()
233 deleteJavaObjects(env); in ~JMediaCodec()
236 void JMediaCodec::deleteJavaObjects(JNIEnv *env) { in deleteJavaObjects() argument
237 env->DeleteGlobalRef(mByteBufferClass); in deleteJavaObjects()
239 env->DeleteGlobalRef(mNativeByteOrderObj); in deleteJavaObjects()
361 JNIEnv *env, jobject bufferInfo, size_t *index, int64_t timeoutUs) { in dequeueOutputBuffer() argument
373 env, env->FindClass("android/media/MediaCodec$BufferInfo")); in dequeueOutputBuffer()
375 jmethodID method = env->GetMethodID(clazz.get(), "set", "(IIJI)V"); in dequeueOutputBuffer()
376 env->CallVoidMethod(bufferInfo, method, (jint)offset, (jint)size, timeUs, flags); in dequeueOutputBuffer()
395 status_t JMediaCodec::getFormat(JNIEnv *env, bool input, jobject *format) const { in getFormat() argument
403 return ConvertMessageToMap(env, msg, format); in getFormat()
406 status_t JMediaCodec::getOutputFormat(JNIEnv *env, size_t index, jobject *format) const { in getOutputFormat() argument
413 return ConvertMessageToMap(env, msg, format); in getOutputFormat()
417 JNIEnv *env, bool input, jobjectArray *bufArray) const { in getBuffers() argument
429 *bufArray = (jobjectArray)env->NewObjectArray( in getBuffers()
440 env, !input /* readOnly */, true /* clearBuffer */, buffer, &byteBuffer); in getBuffers()
445 env->SetObjectArrayElement( in getBuffers()
448 env->DeleteLocalRef(byteBuffer); in getBuffers()
459 JNIEnv *env, bool readOnly, bool clearBuffer, const sp<T> &buffer, in createByteBufferFromABuffer() argument
475 env->NewDirectByteBuffer(buffer->base(), buffer->capacity()); in createByteBufferFromABuffer()
477 jobject readOnlyBuffer = env->CallObjectMethod( in createByteBufferFromABuffer()
479 env->DeleteLocalRef(byteBuffer); in createByteBufferFromABuffer()
485 jobject me = env->CallObjectMethod( in createByteBufferFromABuffer()
487 env->DeleteLocalRef(me); in createByteBufferFromABuffer()
488 me = env->CallObjectMethod( in createByteBufferFromABuffer()
491 env->DeleteLocalRef(me); in createByteBufferFromABuffer()
492 me = env->CallObjectMethod( in createByteBufferFromABuffer()
495 env->DeleteLocalRef(me); in createByteBufferFromABuffer()
503 JNIEnv *env, bool input, size_t index, jobject *buf) const { in getBuffer() argument
516 env, !input /* readOnly */, input /* clearBuffer */, buffer, buf); in getBuffer()
520 JNIEnv *env, bool input, size_t index, jobject *buf) const { in getImage() argument
552 env, !input /* readOnly */, input /* clearBuffer */, buffer, &byteBuffer); in getImage()
559 env, true /* readOnly */, true /* clearBuffer */, imageData, &infoBuffer); in getImage()
561 env->DeleteLocalRef(byteBuffer); in getImage()
570 env, env->FindClass("android/graphics/Rect")); in getImage()
573 jmethodID rectConstructID = env->GetMethodID( in getImage()
576 cropRect = env->NewObject( in getImage()
581 env, env->FindClass("android/media/MediaCodec$MediaImage")); in getImage()
584 jmethodID imageConstructID = env->GetMethodID(imageClazz.get(), "<init>", in getImage()
587 *buf = env->NewObject(imageClazz.get(), imageConstructID, in getImage()
594 if (env->ExceptionCheck()) { in getImage()
595 env->ExceptionDescribe(); in getImage()
596 env->ExceptionClear(); in getImage()
601 env->DeleteLocalRef(cropRect); in getImage()
605 env->DeleteLocalRef(byteBuffer); in getImage()
608 env->DeleteLocalRef(infoBuffer); in getImage()
614 status_t JMediaCodec::getName(JNIEnv *env, jstring *nameStr) const { in getName() argument
623 *nameStr = env->NewStringUTF(name.c_str()); in getName()
645 JNIEnv *env, status_t err, int32_t actionCode, const char *msg = NULL) { in createCodecException() argument
647 env, env->FindClass("android/media/MediaCodec$CodecException")); in createCodecException()
650 const jmethodID ctor = env->GetMethodID(clazz.get(), "<init>", "(IILjava/lang/String;)V"); in createCodecException()
654 env, env->NewStringUTF(msg != NULL ? msg : String8::format("Error %#x", err))); in createCodecException()
681 return (jthrowable)env->NewObject(clazz.get(), ctor, err, actionCode, msgObj.get()); in createCodecException()
688 JNIEnv *env = AndroidRuntime::getJNIEnv(); in handleCallback() local
710 env, env->FindClass("android/media/MediaCodec$BufferInfo")); in handleCallback()
711 jmethodID ctor = env->GetMethodID(clazz.get(), "<init>", "()V"); in handleCallback()
712 jmethodID method = env->GetMethodID(clazz.get(), "set", "(IIJI)V"); in handleCallback()
714 obj = env->NewObject(clazz.get(), ctor); in handleCallback()
717 if (env->ExceptionCheck()) { in handleCallback()
719 env->ExceptionClear(); in handleCallback()
721 jniThrowException(env, "java/lang/IllegalStateException", NULL); in handleCallback()
725 env->CallVoidMethod(obj, method, (jint)offset, (jint)size, timeUs, flags); in handleCallback()
736 obj = (jobject)createCodecException(env, err, actionCode); in handleCallback()
739 if (env->ExceptionCheck()) { in handleCallback()
741 env->ExceptionClear(); in handleCallback()
743 jniThrowException(env, "java/lang/IllegalStateException", NULL); in handleCallback()
755 if (OK != ConvertMessageToMap(env, format, &obj)) { in handleCallback()
756 jniThrowException(env, "java/lang/IllegalStateException", NULL); in handleCallback()
767 env->CallVoidMethod( in handleCallback()
775 env->DeleteLocalRef(obj); in handleCallback()
781 JNIEnv *env = AndroidRuntime::getJNIEnv(); in handleFrameRenderedNotification() local
786 status_t err = ConvertMessageToMap(env, data, &obj); in handleFrameRenderedNotification()
788 jniThrowException(env, "java/lang/IllegalStateException", NULL); in handleFrameRenderedNotification()
792 env->CallVoidMethod( in handleFrameRenderedNotification()
796 env->DeleteLocalRef(obj); in handleFrameRenderedNotification()
823 JNIEnv *env, jobject thiz, const sp<JMediaCodec> &codec) { in setMediaCodec() argument
824 sp<JMediaCodec> old = (JMediaCodec *)env->GetLongField(thiz, gFields.context); in setMediaCodec()
837 env->SetLongField(thiz, gFields.context, (jlong)codec.get()); in setMediaCodec()
842 static sp<JMediaCodec> getMediaCodec(JNIEnv *env, jobject thiz) { in getMediaCodec() argument
843 return (JMediaCodec *)env->GetLongField(thiz, gFields.context); in getMediaCodec()
846 static void android_media_MediaCodec_release(JNIEnv *env, jobject thiz) { in android_media_MediaCodec_release() argument
847 setMediaCodec(env, thiz, NULL); in android_media_MediaCodec_release()
850 static void throwCodecException(JNIEnv *env, status_t err, int32_t actionCode, const char *msg) { in throwCodecException() argument
851 jthrowable exception = createCodecException(env, err, actionCode, msg); in throwCodecException()
852 env->Throw(exception); in throwCodecException()
855 static void throwCryptoException(JNIEnv *env, status_t err, const char *msg) { in throwCryptoException() argument
857 env, env->FindClass("android/media/MediaCodec$CryptoException")); in throwCryptoException()
861 env->GetMethodID(clazz.get(), "<init>", "(ILjava/lang/String;)V"); in throwCryptoException()
896 jstring msgObj = env->NewStringUTF(msg != NULL ? msg : defaultMsg); in throwCryptoException()
899 (jthrowable)env->NewObject(clazz.get(), constructID, err, msgObj); in throwCryptoException()
901 env->Throw(exception); in throwCryptoException()
905 JNIEnv *env, status_t err, int32_t actionCode = ACTION_CODE_FATAL, in throwExceptionAsNecessary() argument
921 jniThrowException(env, "java/lang/IllegalStateException", msg); in throwExceptionAsNecessary()
925 jniThrowException(env, "java/lang/IllegalArgumentException", msg); in throwExceptionAsNecessary()
930 throwCryptoException(env, err, msg); in throwExceptionAsNecessary()
933 throwCodecException(env, err, actionCode, msg); in throwExceptionAsNecessary()
939 JNIEnv *env, in android_media_MediaCodec_native_enableOnFrameRenderedListener() argument
942 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_native_enableOnFrameRenderedListener()
945 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_native_enableOnFrameRenderedListener()
951 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_native_enableOnFrameRenderedListener()
955 JNIEnv *env, in android_media_MediaCodec_native_setCallback() argument
958 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_native_setCallback()
961 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_native_setCallback()
967 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_native_setCallback()
971 JNIEnv *env, in android_media_MediaCodec_native_configure() argument
978 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_native_configure()
981 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_native_configure()
986 status_t err = ConvertKeyValueArraysToMessage(env, keys, values, &format); in android_media_MediaCodec_native_configure()
989 jniThrowException(env, "java/lang/IllegalArgumentException", NULL); in android_media_MediaCodec_native_configure()
995 sp<Surface> surface(android_view_Surface_getSurface(env, jsurface)); in android_media_MediaCodec_native_configure()
1000 env, in android_media_MediaCodec_native_configure()
1009 crypto = JCrypto::GetCrypto(env, jcrypto); in android_media_MediaCodec_native_configure()
1014 descrambler = JDescrambler::GetDescrambler(env, descramblerBinderObj); in android_media_MediaCodec_native_configure()
1019 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_native_configure()
1023 JNIEnv *env, in android_media_MediaCodec_native_setSurface() argument
1026 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_native_setSurface()
1029 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_native_setSurface()
1035 sp<Surface> surface(android_view_Surface_getSurface(env, jsurface)); in android_media_MediaCodec_native_setSurface()
1040 env, in android_media_MediaCodec_native_setSurface()
1048 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_native_setSurface()
1052 JNIEnv* env, jobject object) { in android_media_MediaCodec_getPersistentInputSurface() argument
1055 jobject lock = env->GetObjectField( in android_media_MediaCodec_getPersistentInputSurface()
1057 if (env->MonitorEnter(lock) == JNI_OK) { in android_media_MediaCodec_getPersistentInputSurface()
1059 env->GetLongField(object, in android_media_MediaCodec_getPersistentInputSurface()
1061 env->MonitorExit(lock); in android_media_MediaCodec_getPersistentInputSurface()
1063 env->DeleteLocalRef(lock); in android_media_MediaCodec_getPersistentInputSurface()
1069 JNIEnv* env, jclass /* clazz */) { in android_media_MediaCodec_createPersistentInputSurface() argument
1084 jobject object = env->NewObject( in android_media_MediaCodec_createPersistentInputSurface()
1089 if (env->ExceptionCheck()) { in android_media_MediaCodec_createPersistentInputSurface()
1091 env->ExceptionClear(); in android_media_MediaCodec_createPersistentInputSurface()
1096 jobject lock = env->GetObjectField( in android_media_MediaCodec_createPersistentInputSurface()
1098 if (env->MonitorEnter(lock) == JNI_OK) { in android_media_MediaCodec_createPersistentInputSurface()
1099 env->CallVoidMethod( in android_media_MediaCodec_createPersistentInputSurface()
1103 env->SetLongField( in android_media_MediaCodec_createPersistentInputSurface()
1107 env->MonitorExit(lock); in android_media_MediaCodec_createPersistentInputSurface()
1109 env->DeleteLocalRef(object); in android_media_MediaCodec_createPersistentInputSurface()
1112 env->DeleteLocalRef(lock); in android_media_MediaCodec_createPersistentInputSurface()
1123 JNIEnv* env, jclass /* clazz */, jobject object) { in android_media_MediaCodec_releasePersistentInputSurface() argument
1126 jobject lock = env->GetObjectField( in android_media_MediaCodec_releasePersistentInputSurface()
1128 if (env->MonitorEnter(lock) == JNI_OK) { in android_media_MediaCodec_releasePersistentInputSurface()
1130 env->GetLongField( in android_media_MediaCodec_releasePersistentInputSurface()
1132 env->SetLongField( in android_media_MediaCodec_releasePersistentInputSurface()
1136 env->MonitorExit(lock); in android_media_MediaCodec_releasePersistentInputSurface()
1138 env->DeleteLocalRef(lock); in android_media_MediaCodec_releasePersistentInputSurface()
1147 JNIEnv* env, jobject thiz, jobject object) { in android_media_MediaCodec_setInputSurface() argument
1150 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_setInputSurface()
1152 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_setInputSurface()
1157 android_media_MediaCodec_getPersistentInputSurface(env, object); in android_media_MediaCodec_setInputSurface()
1161 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_setInputSurface()
1165 static jobject android_media_MediaCodec_createInputSurface(JNIEnv* env, in android_media_MediaCodec_createInputSurface() argument
1169 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_createInputSurface()
1171 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_createInputSurface()
1179 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_createInputSurface()
1184 return android_view_Surface_createFromIGraphicBufferProducer(env, in android_media_MediaCodec_createInputSurface()
1188 static void android_media_MediaCodec_start(JNIEnv *env, jobject thiz) { in android_media_MediaCodec_start() argument
1191 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_start()
1194 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_start()
1200 throwExceptionAsNecessary(env, err, ACTION_CODE_FATAL, "start failed"); in android_media_MediaCodec_start()
1203 static void android_media_MediaCodec_stop(JNIEnv *env, jobject thiz) { in android_media_MediaCodec_stop() argument
1206 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_stop()
1209 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_stop()
1215 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_stop()
1218 static void android_media_MediaCodec_reset(JNIEnv *env, jobject thiz) { in android_media_MediaCodec_reset() argument
1221 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_reset()
1224 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_reset()
1237 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_reset()
1240 static void android_media_MediaCodec_flush(JNIEnv *env, jobject thiz) { in android_media_MediaCodec_flush() argument
1243 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_flush()
1246 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_flush()
1252 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_flush()
1256 JNIEnv *env, in android_media_MediaCodec_queueInputBuffer() argument
1265 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_queueInputBuffer()
1268 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_queueInputBuffer()
1278 env, err, ACTION_CODE_FATAL, errorDetailMsg.empty() ? NULL : errorDetailMsg.c_str()); in android_media_MediaCodec_queueInputBuffer()
1282 JNIEnv *env, in android_media_MediaCodec_queueSecureInputBuffer() argument
1291 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_queueSecureInputBuffer()
1294 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_queueSecureInputBuffer()
1299 env->GetIntField(cryptoInfoObj, gFields.cryptoInfoNumSubSamplesID); in android_media_MediaCodec_queueSecureInputBuffer()
1302 (jintArray)env->GetObjectField( in android_media_MediaCodec_queueSecureInputBuffer()
1306 (jintArray)env->GetObjectField( in android_media_MediaCodec_queueSecureInputBuffer()
1310 (jbyteArray)env->GetObjectField(cryptoInfoObj, gFields.cryptoInfoKeyID); in android_media_MediaCodec_queueSecureInputBuffer()
1313 (jbyteArray)env->GetObjectField(cryptoInfoObj, gFields.cryptoInfoIVID); in android_media_MediaCodec_queueSecureInputBuffer()
1315 jint jmode = env->GetIntField(cryptoInfoObj, gFields.cryptoInfoModeID); in android_media_MediaCodec_queueSecureInputBuffer()
1324 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_queueSecureInputBuffer()
1328 jobject patternObj = env->GetObjectField(cryptoInfoObj, gFields.cryptoInfoPatternID); in android_media_MediaCodec_queueSecureInputBuffer()
1335 pattern.mEncryptBlocks = env->GetIntField(patternObj, gFields.patternEncryptBlocksID); in android_media_MediaCodec_queueSecureInputBuffer()
1336 pattern.mSkipBlocks = env->GetIntField(patternObj, gFields.patternSkipBlocksID); in android_media_MediaCodec_queueSecureInputBuffer()
1351 && env->GetArrayLength(numBytesOfEncryptedDataObj) < numSubSamples) { in android_media_MediaCodec_queueSecureInputBuffer()
1354 && env->GetArrayLength(numBytesOfClearDataObj) < numSubSamples) { in android_media_MediaCodec_queueSecureInputBuffer()
1366 : env->GetIntArrayElements(numBytesOfClearDataObj, &isCopy); in android_media_MediaCodec_queueSecureInputBuffer()
1371 : env->GetIntArrayElements(numBytesOfEncryptedDataObj, &isCopy); in android_media_MediaCodec_queueSecureInputBuffer()
1385 env->ReleaseIntArrayElements( in android_media_MediaCodec_queueSecureInputBuffer()
1391 env->ReleaseIntArrayElements( in android_media_MediaCodec_queueSecureInputBuffer()
1398 if (env->GetArrayLength(keyObj) != 16) { in android_media_MediaCodec_queueSecureInputBuffer()
1402 key = env->GetByteArrayElements(keyObj, &isCopy); in android_media_MediaCodec_queueSecureInputBuffer()
1407 if (env->GetArrayLength(ivObj) != 16) { in android_media_MediaCodec_queueSecureInputBuffer()
1411 iv = env->GetByteArrayElements(ivObj, &isCopy); in android_media_MediaCodec_queueSecureInputBuffer()
1430 env->ReleaseByteArrayElements(ivObj, iv, 0); in android_media_MediaCodec_queueSecureInputBuffer()
1435 env->ReleaseByteArrayElements(keyObj, key, 0); in android_media_MediaCodec_queueSecureInputBuffer()
1443 env, err, ACTION_CODE_FATAL, errorDetailMsg.empty() ? NULL : errorDetailMsg.c_str()); in android_media_MediaCodec_queueSecureInputBuffer()
1447 JNIEnv *env, jobject thiz, jlong timeoutUs) { in android_media_MediaCodec_dequeueInputBuffer() argument
1450 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_dequeueInputBuffer()
1453 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_dequeueInputBuffer()
1464 return throwExceptionAsNecessary(env, err); in android_media_MediaCodec_dequeueInputBuffer()
1468 JNIEnv *env, jobject thiz, jobject bufferInfo, jlong timeoutUs) { in android_media_MediaCodec_dequeueOutputBuffer() argument
1471 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_dequeueOutputBuffer()
1474 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_dequeueOutputBuffer()
1480 env, bufferInfo, &index, timeoutUs); in android_media_MediaCodec_dequeueOutputBuffer()
1486 return throwExceptionAsNecessary(env, err); in android_media_MediaCodec_dequeueOutputBuffer()
1490 JNIEnv *env, jobject thiz, in android_media_MediaCodec_releaseOutputBuffer() argument
1494 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_releaseOutputBuffer()
1497 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_releaseOutputBuffer()
1503 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_releaseOutputBuffer()
1506 static void android_media_MediaCodec_signalEndOfInputStream(JNIEnv* env, in android_media_MediaCodec_signalEndOfInputStream() argument
1510 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_signalEndOfInputStream()
1512 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_signalEndOfInputStream()
1518 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_signalEndOfInputStream()
1522 JNIEnv *env, jobject thiz, jboolean input) { in android_media_MediaCodec_getFormatNative() argument
1525 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_getFormatNative()
1528 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_getFormatNative()
1533 status_t err = codec->getFormat(env, input, &format); in android_media_MediaCodec_getFormatNative()
1539 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_getFormatNative()
1545 JNIEnv *env, jobject thiz, jint index) { in android_media_MediaCodec_getOutputFormatForIndexNative() argument
1548 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_getOutputFormatForIndexNative()
1551 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_getOutputFormatForIndexNative()
1556 status_t err = codec->getOutputFormat(env, index, &format); in android_media_MediaCodec_getOutputFormatForIndexNative()
1562 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_getOutputFormatForIndexNative()
1568 JNIEnv *env, jobject thiz, jboolean input) { in android_media_MediaCodec_getBuffers() argument
1571 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_getBuffers()
1574 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_getBuffers()
1579 status_t err = codec->getBuffers(env, input, &buffers); in android_media_MediaCodec_getBuffers()
1587 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_getBuffers()
1594 JNIEnv *env, jobject thiz, jboolean input, jint index) { in android_media_MediaCodec_getBuffer() argument
1597 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_getBuffer()
1600 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_getBuffer()
1605 status_t err = codec->getBuffer(env, input, index, &buffer); in android_media_MediaCodec_getBuffer()
1613 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_getBuffer()
1620 JNIEnv *env, jobject thiz, jboolean input, jint index) { in android_media_MediaCodec_getImage() argument
1623 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_getImage()
1626 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_getImage()
1631 status_t err = codec->getImage(env, input, index, &image); in android_media_MediaCodec_getImage()
1639 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_getImage()
1646 JNIEnv *env, jobject thiz) { in android_media_MediaCodec_getName() argument
1649 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_getName()
1652 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_getName()
1657 status_t err = codec->getName(env, &name); in android_media_MediaCodec_getName()
1663 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_getName()
1669 android_media_MediaCodec_native_getMetrics(JNIEnv *env, jobject thiz) in android_media_MediaCodec_native_getMetrics() argument
1673 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_native_getMetrics()
1675 jniThrowException(env, "java/lang/IllegalStateException", NULL); in android_media_MediaCodec_native_getMetrics()
1682 status_t err = codec->getMetrics(env, item); in android_media_MediaCodec_native_getMetrics()
1688 jobject mybundle = MediaMetricsJNI::writeMetricsToBundle(env, item, NULL); in android_media_MediaCodec_native_getMetrics()
1698 JNIEnv *env, jobject thiz, jobjectArray keys, jobjectArray vals) { in android_media_MediaCodec_setParameters() argument
1701 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_setParameters()
1704 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_setParameters()
1709 status_t err = ConvertKeyValueArraysToMessage(env, keys, vals, ¶ms); in android_media_MediaCodec_setParameters()
1715 throwExceptionAsNecessary(env, err); in android_media_MediaCodec_setParameters()
1719 JNIEnv *env, jobject thiz, jint mode) { in android_media_MediaCodec_setVideoScalingMode() argument
1720 sp<JMediaCodec> codec = getMediaCodec(env, thiz); in android_media_MediaCodec_setVideoScalingMode()
1723 throwExceptionAsNecessary(env, INVALID_OPERATION); in android_media_MediaCodec_setVideoScalingMode()
1729 jniThrowException(env, "java/lang/IllegalArgumentException", NULL); in android_media_MediaCodec_setVideoScalingMode()
1736 static void android_media_MediaCodec_native_init(JNIEnv *env) { in android_media_MediaCodec_native_init() argument
1738 env, env->FindClass("android/media/MediaCodec")); in android_media_MediaCodec_native_init()
1741 gFields.context = env->GetFieldID(clazz.get(), "mNativeContext", "J"); in android_media_MediaCodec_native_init()
1745 env->GetMethodID( in android_media_MediaCodec_native_init()
1751 field = env->GetStaticFieldID(clazz.get(), "CRYPTO_MODE_UNENCRYPTED", "I"); in android_media_MediaCodec_native_init()
1754 env->GetStaticIntField(clazz.get(), field); in android_media_MediaCodec_native_init()
1756 field = env->GetStaticFieldID(clazz.get(), "CRYPTO_MODE_AES_CTR", "I"); in android_media_MediaCodec_native_init()
1759 env->GetStaticIntField(clazz.get(), field); in android_media_MediaCodec_native_init()
1761 field = env->GetStaticFieldID(clazz.get(), "CRYPTO_MODE_AES_CBC", "I"); in android_media_MediaCodec_native_init()
1764 env->GetStaticIntField(clazz.get(), field); in android_media_MediaCodec_native_init()
1766 clazz.reset(env->FindClass("android/media/MediaCodec$CryptoInfo")); in android_media_MediaCodec_native_init()
1770 env->GetFieldID(clazz.get(), "numSubSamples", "I"); in android_media_MediaCodec_native_init()
1774 env->GetFieldID(clazz.get(), "numBytesOfClearData", "[I"); in android_media_MediaCodec_native_init()
1778 env->GetFieldID(clazz.get(), "numBytesOfEncryptedData", "[I"); in android_media_MediaCodec_native_init()
1781 gFields.cryptoInfoKeyID = env->GetFieldID(clazz.get(), "key", "[B"); in android_media_MediaCodec_native_init()
1784 gFields.cryptoInfoIVID = env->GetFieldID(clazz.get(), "iv", "[B"); in android_media_MediaCodec_native_init()
1787 gFields.cryptoInfoModeID = env->GetFieldID(clazz.get(), "mode", "I"); in android_media_MediaCodec_native_init()
1790 gFields.cryptoInfoPatternID = env->GetFieldID(clazz.get(), "pattern", in android_media_MediaCodec_native_init()
1794 clazz.reset(env->FindClass("android/media/MediaCodec$CryptoInfo$Pattern")); in android_media_MediaCodec_native_init()
1797 gFields.patternEncryptBlocksID = env->GetFieldID(clazz.get(), "mEncryptBlocks", "I"); in android_media_MediaCodec_native_init()
1800 gFields.patternSkipBlocksID = env->GetFieldID(clazz.get(), "mSkipBlocks", "I"); in android_media_MediaCodec_native_init()
1803 clazz.reset(env->FindClass("android/media/MediaCodec$CryptoException")); in android_media_MediaCodec_native_init()
1806 field = env->GetStaticFieldID(clazz.get(), "ERROR_NO_KEY", "I"); in android_media_MediaCodec_native_init()
1809 env->GetStaticIntField(clazz.get(), field); in android_media_MediaCodec_native_init()
1811 field = env->GetStaticFieldID(clazz.get(), "ERROR_KEY_EXPIRED", "I"); in android_media_MediaCodec_native_init()
1814 env->GetStaticIntField(clazz.get(), field); in android_media_MediaCodec_native_init()
1816 field = env->GetStaticFieldID(clazz.get(), "ERROR_RESOURCE_BUSY", "I"); in android_media_MediaCodec_native_init()
1819 env->GetStaticIntField(clazz.get(), field); in android_media_MediaCodec_native_init()
1821 field = env->GetStaticFieldID(clazz.get(), "ERROR_INSUFFICIENT_OUTPUT_PROTECTION", "I"); in android_media_MediaCodec_native_init()
1824 env->GetStaticIntField(clazz.get(), field); in android_media_MediaCodec_native_init()
1826 field = env->GetStaticFieldID(clazz.get(), "ERROR_SESSION_NOT_OPENED", "I"); in android_media_MediaCodec_native_init()
1829 env->GetStaticIntField(clazz.get(), field); in android_media_MediaCodec_native_init()
1831 field = env->GetStaticFieldID(clazz.get(), "ERROR_UNSUPPORTED_OPERATION", "I"); in android_media_MediaCodec_native_init()
1834 env->GetStaticIntField(clazz.get(), field); in android_media_MediaCodec_native_init()
1836 clazz.reset(env->FindClass("android/media/MediaCodec$CodecException")); in android_media_MediaCodec_native_init()
1838 field = env->GetStaticFieldID(clazz.get(), "ACTION_TRANSIENT", "I"); in android_media_MediaCodec_native_init()
1841 env->GetStaticIntField(clazz.get(), field); in android_media_MediaCodec_native_init()
1843 field = env->GetStaticFieldID(clazz.get(), "ACTION_RECOVERABLE", "I"); in android_media_MediaCodec_native_init()
1846 env->GetStaticIntField(clazz.get(), field); in android_media_MediaCodec_native_init()
1848 field = env->GetStaticFieldID(clazz.get(), "ERROR_INSUFFICIENT_RESOURCE", "I"); in android_media_MediaCodec_native_init()
1851 env->GetStaticIntField(clazz.get(), field); in android_media_MediaCodec_native_init()
1853 field = env->GetStaticFieldID(clazz.get(), "ERROR_RECLAIMED", "I"); in android_media_MediaCodec_native_init()
1856 env->GetStaticIntField(clazz.get(), field); in android_media_MediaCodec_native_init()
1858 clazz.reset(env->FindClass("android/view/Surface")); in android_media_MediaCodec_native_init()
1861 field = env->GetFieldID(clazz.get(), "mLock", "Ljava/lang/Object;"); in android_media_MediaCodec_native_init()
1865 jmethodID method = env->GetMethodID(clazz.get(), "setNativeObjectLocked", "(J)V"); in android_media_MediaCodec_native_init()
1869 clazz.reset(env->FindClass("android/media/MediaCodec$PersistentSurface")); in android_media_MediaCodec_native_init()
1871 gPersistentSurfaceClassInfo.clazz = (jclass)env->NewGlobalRef(clazz.get()); in android_media_MediaCodec_native_init()
1873 method = env->GetMethodID(clazz.get(), "<init>", "()V"); in android_media_MediaCodec_native_init()
1877 field = env->GetFieldID(clazz.get(), "mPersistentObject", "J"); in android_media_MediaCodec_native_init()
1883 JNIEnv *env, jobject thiz, in android_media_MediaCodec_native_setup() argument
1886 jniThrowException(env, "java/lang/NullPointerException", NULL); in android_media_MediaCodec_native_setup()
1890 const char *tmp = env->GetStringUTFChars(name, NULL); in android_media_MediaCodec_native_setup()
1896 sp<JMediaCodec> codec = new JMediaCodec(env, thiz, tmp, nameIsType, encoder); in android_media_MediaCodec_native_setup()
1901 jniThrowException(env, "java/lang/IllegalArgumentException", in android_media_MediaCodec_native_setup()
1903 env->ReleaseStringUTFChars(name, tmp); in android_media_MediaCodec_native_setup()
1906 throwCodecException(env, err, ACTION_CODE_TRANSIENT, in android_media_MediaCodec_native_setup()
1908 env->ReleaseStringUTFChars(name, tmp); in android_media_MediaCodec_native_setup()
1912 jniThrowException(env, "java/io/IOException", in android_media_MediaCodec_native_setup()
1914 env->ReleaseStringUTFChars(name, tmp); in android_media_MediaCodec_native_setup()
1918 env->ReleaseStringUTFChars(name, tmp); in android_media_MediaCodec_native_setup()
1922 setMediaCodec(env,thiz, codec); in android_media_MediaCodec_native_setup()
1926 JNIEnv *env, jobject thiz) { in android_media_MediaCodec_native_finalize() argument
1927 android_media_MediaCodec_release(env, thiz); in android_media_MediaCodec_native_finalize()
2023 int register_android_media_MediaCodec(JNIEnv *env) { in register_android_media_MediaCodec() argument
2024 return AndroidRuntime::registerNativeMethods(env, in register_android_media_MediaCodec()