diff options
Diffstat (limited to 'media/jni/android_media_MediaCodecList.cpp')
-rw-r--r-- | media/jni/android_media_MediaCodecList.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/media/jni/android_media_MediaCodecList.cpp b/media/jni/android_media_MediaCodecList.cpp index 0638b4a..04430ec 100644 --- a/media/jni/android_media_MediaCodecList.cpp +++ b/media/jni/android_media_MediaCodecList.cpp @@ -44,6 +44,25 @@ static jstring android_media_MediaCodecList_getCodecName( return env->NewStringUTF(name); } +static jint android_media_MediaCodecList_findCodecByName( + JNIEnv *env, jobject thiz, jstring name) { + if (name == NULL) { + jniThrowException(env, "java/lang/IllegalArgumentException", NULL); + return -ENOENT; + } + + const char *nameStr = env->GetStringUTFChars(name, NULL); + + if (nameStr == NULL) { + // Out of memory exception already pending. + return -ENOENT; + } + + jint ret = MediaCodecList::getInstance()->findCodecByName(nameStr); + env->ReleaseStringUTFChars(name, nameStr); + return ret; +} + static jboolean android_media_MediaCodecList_isEncoder( JNIEnv *env, jobject thiz, jint index) { return MediaCodecList::getInstance()->isEncoder(index); @@ -180,6 +199,9 @@ static JNINativeMethod gMethods[] = { "(ILjava/lang/String;)Landroid/media/MediaCodecInfo$CodecCapabilities;", (void *)android_media_MediaCodecList_getCodecCapabilities }, + { "findCodecByName", "(Ljava/lang/String;)I", + (void *)android_media_MediaCodecList_findCodecByName }, + { "native_init", "()V", (void *)android_media_MediaCodecList_native_init }, }; |