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>
This commit is contained in:
Aman Gupta 2018-04-26 11:50:55 -07:00
parent 7074a7ccd9
commit fe0a6bcbda
2 changed files with 17 additions and 0 deletions

View File

@ -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;
}

View File

@ -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 */