Browse Source

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>
tags/n4.1
Aman Gupta 7 years ago
parent
commit
fe0a6bcbda
2 changed files with 17 additions and 0 deletions
  1. +15
    -0
      libavcodec/mediacodec_wrapper.c
  2. +2
    -0
      libavcodec/mediacodec_wrapper.h

+ 15
- 0
libavcodec/mediacodec_wrapper.c 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;
}

+ 2
- 0
libavcodec/mediacodec_wrapper.h 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 */

Loading…
Cancel
Save