aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2018-04-26 11:50:55 -0700
committerAman Gupta <aman@tmm1.net>2018-05-18 19:16:34 -0700
commit6f55a36be9a218755af59b11a63b214300ef4be8 (patch)
tree7775110bbf098a326e82406ae2cd1c2a1576b4ee /libavcodec
parent33042d632d12e3b69801057780742f8c3d13de55 (diff)
downloadffmpeg-6f55a36be9a218755af59b11a63b214300ef4be8.tar.gz
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> (cherry picked from commit fe0a6bcbda0f51d0613dbbd42a7635c22530ce95)
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mediacodec_wrapper.c15
-rw-r--r--libavcodec/mediacodec_wrapper.h2
2 files changed, 17 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;
+}
diff --git a/libavcodec/mediacodec_wrapper.h b/libavcodec/mediacodec_wrapper.h
index 1b4f3a9492..f0de16d669 100644
--- a/libavcodec/mediacodec_wrapper.h
+++ b/libavcodec/mediacodec_wrapper.h
@@ -124,4 +124,6 @@ int ff_AMediaCodec_getConfigureFlagEncode(FFAMediaCodec *codec);
int ff_AMediaCodec_cleanOutputBuffers(FFAMediaCodec *codec);
+int ff_Build_SDK_INT(AVCodecContext *avctx);
+
#endif /* AVCODEC_MEDIACODEC_WRAPPER_H */