summaryrefslogtreecommitdiff
path: root/libavcodec/mediacodec_wrapper.c
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2018-04-26 11:50:55 -0700
committerAman Gupta <aman@tmm1.net>2018-05-04 11:51:45 -0700
commitfe0a6bcbda0f51d0613dbbd42a7635c22530ce95 (patch)
treedb6cbf3f2e07522e6bad76e7b35687caf79a902c /libavcodec/mediacodec_wrapper.c
parent7074a7ccd9a4d4e445252780fd182aa0b3778b79 (diff)
avcodec/mediacodec_wrapper: add helper to fetch SDK_INT
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com> Signed-off-by: Aman Gupta <aman@tmm1.net>
Diffstat (limited to 'libavcodec/mediacodec_wrapper.c')
-rw-r--r--libavcodec/mediacodec_wrapper.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 9bf96e9383..c47c2c9a41 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -1687,3 +1687,18 @@ int ff_AMediaCodec_cleanOutputBuffers(FFAMediaCodec *codec)
fail:
return ret;
}
+
+int ff_Build_SDK_INT(AVCodecContext *avctx)
+{
+ int ret = -1;
+ JNIEnv *env = NULL;
+ jclass versionClass;
+ jfieldID sdkIntFieldID;
+ JNI_GET_ENV_OR_RETURN(env, avctx, -1);
+
+ versionClass = (*env)->FindClass(env, "android/os/Build$VERSION");
+ sdkIntFieldID = (*env)->GetStaticFieldID(env, versionClass, "SDK_INT", "I");
+ ret = (*env)->GetStaticIntField(env, versionClass, sdkIntFieldID);
+ (*env)->DeleteLocalRef(env, versionClass);
+ return ret;
+}