74 {
"android/media/MediaCodecList",
"findDecoderForFormat",
"(Landroid/media/MediaFormat;)Ljava/lang/String;",
FF_JNI_METHOD, offsetof(
struct JNIAMediaCodecListFields, find_decoder_for_format_id), 0 },
81 {
"android/media/MediaCodecInfo",
"getCapabilitiesForType",
"(Ljava/lang/String;)Landroid/media/MediaCodecInfo$CodecCapabilities;",
FF_JNI_METHOD, offsetof(
struct JNIAMediaCodecListFields, get_codec_capabilities_id), 1 },
87 {
"android/media/MediaCodecInfo$CodecCapabilities",
"profileLevels",
"[Landroid/media/MediaCodecInfo$CodecProfileLevel;",
FF_JNI_FIELD, offsetof(
struct JNIAMediaCodecListFields, profile_levels_id), 1 },
138 {
"android/media/MediaFormat",
"getByteBuffer",
"(Ljava/lang/String;)Ljava/nio/ByteBuffer;",
FF_JNI_METHOD, offsetof(
struct JNIAMediaFormatFields, get_bytebuffer_id), 1 },
144 {
"android/media/MediaFormat",
"setByteBuffer",
"(Ljava/lang/String;Ljava/nio/ByteBuffer;)V",
FF_JNI_METHOD, offsetof(
struct JNIAMediaFormatFields, set_bytebuffer_id), 1 },
234 {
"android/media/MediaCodec",
"configure",
"(Landroid/media/MediaFormat;Landroid/view/Surface;Landroid/media/MediaCrypto;I)V",
FF_JNI_METHOD, offsetof(
struct JNIAMediaCodecFields, configure_id), 1 },
240 {
"android/media/MediaCodec",
"getOutputFormat",
"()Landroid/media/MediaFormat;",
FF_JNI_METHOD, offsetof(
struct JNIAMediaCodecFields, get_output_format_id), 1 },
247 {
"android/media/MediaCodec",
"dequeueOutputBuffer",
"(Landroid/media/MediaCodec$BufferInfo;J)I",
FF_JNI_METHOD, offsetof(
struct JNIAMediaCodecFields, dequeue_output_buffer_id), 1 },
294 #define JNI_GET_ENV_OR_RETURN(env, log_ctx, ret) do { \
295 (env) = ff_jni_get_env(log_ctx); \
301 #define JNI_GET_ENV_OR_RETURN_VOID(env, log_ctx) do { \
302 (env) = ff_jni_get_env(log_ctx); \
314 jfieldID field_id = 0;
384 char *supported_type =
NULL;
391 jobject codec =
NULL;
392 jobject codec_name =
NULL;
396 jobjectArray types =
NULL;
398 jobject capabilities =
NULL;
399 jobject profile_level =
NULL;
400 jobjectArray profile_levels =
NULL;
404 if ((ret =
ff_jni_init_jfields(env, &jfields, jni_amediacodeclist_mapping, 0, log_ctx)) < 0) {
408 if ((ret =
ff_jni_init_jfields(env, &mediaformat_jfields, jni_amediaformat_mapping, 0, log_ctx)) < 0) {
417 for(i = 0; i < codec_count; i++) {
432 is_encoder = (*env)->CallBooleanMethod(env, info, jfields.
is_encoder_id);
437 if (is_encoder != encoder) {
441 type_count = (*env)->GetArrayLength(env, types);
442 for (j = 0; j < type_count; j++) {
446 type = (*env)->GetObjectArrayElement(env, types, j);
452 if (!supported_type) {
457 codec_name = (*env)->CallObjectMethod(env, info, jfields.
get_name_id);
467 if (strstr(name,
"OMX.google")) {
477 profile_levels = (*env)->GetObjectField(env, capabilities, jfields.
profile_levels_id);
482 profile_count = (*env)->GetArrayLength(env, profile_levels);
483 if (!profile_count) {
486 for (k = 0; k < profile_count; k++) {
487 int supported_profile = 0;
494 profile_level = (*env)->GetObjectArrayElement(env, profile_levels, k);
499 supported_profile = (*env)->GetIntField(env, profile_level, jfields.
profile_id);
504 found_codec = profile == supported_profile;
507 (*env)->DeleteLocalRef(env, profile_level);
508 profile_level =
NULL;
518 if (profile_levels) {
519 (*env)->DeleteLocalRef(env, profile_levels);
520 profile_levels =
NULL;
524 (*env)->DeleteLocalRef(env, capabilities);
529 (*env)->DeleteLocalRef(env, type);
544 (*env)->DeleteLocalRef(env, info);
549 (*env)->DeleteLocalRef(env, types);
560 (*env)->DeleteLocalRef(env, format);
564 (*env)->DeleteLocalRef(env, codec);
568 (*env)->DeleteLocalRef(env, codec_name);
572 (*env)->DeleteLocalRef(env, info);
576 (*env)->DeleteLocalRef(env, type);
580 (*env)->DeleteLocalRef(env, types);
584 (*env)->DeleteLocalRef(env, capabilities);
588 (*env)->DeleteLocalRef(env, profile_level);
591 if (profile_levels) {
592 (*env)->DeleteLocalRef(env, profile_levels);
611 jobject
object =
NULL;
634 format->
object = (*env)->NewGlobalRef(env,
object);
641 (*env)->DeleteLocalRef(env,
object);
673 format->
object = (*env)->NewGlobalRef(env,
object);
699 (*env)->DeleteGlobalRef(env, format->
object);
714 jstring description =
NULL;
728 (*env)->DeleteLocalRef(env, description);
760 (*env)->DeleteLocalRef(env, key);
792 (*env)->DeleteLocalRef(env, key);
824 (*env)->DeleteLocalRef(env, key);
836 jobject result =
NULL;
854 *data = (*env)->GetDirectBufferAddress(env, result);
855 *size = (*env)->GetDirectBufferCapacity(env, result);
857 if (*data && *size) {
865 memcpy(*data, src, *size);
871 (*env)->DeleteLocalRef(env, key);
875 (*env)->DeleteLocalRef(env, result);
887 jstring result =
NULL;
914 (*env)->DeleteLocalRef(env, key);
918 (*env)->DeleteLocalRef(env, result);
945 (*env)->DeleteLocalRef(env, key);
970 (*env)->DeleteLocalRef(env, key);
995 (*env)->DeleteLocalRef(env, key);
1003 jstring
string =
NULL;
1026 (*env)->DeleteLocalRef(env, key);
1030 (*env)->DeleteLocalRef(env,
string);
1050 if (!data || !size) {
1059 memcpy(buffer_data, data, size);
1061 buffer = (*env)->NewDirectByteBuffer(env, buffer_data, size);
1073 (*env)->DeleteLocalRef(env, key);
1077 (*env)->DeleteLocalRef(env, buffer);
1140 jstring codec_name =
NULL;
1141 jobject
object =
NULL;
1169 codec->
object = (*env)->NewGlobalRef(env,
object);
1185 (*env)->DeleteLocalRef(env, codec_name);
1189 (*env)->DeleteLocalRef(env,
object);
1205 jstring mime_type =
NULL;
1206 jobject
object =
NULL;
1234 codec->
object = (*env)->NewGlobalRef(env,
object);
1250 (*env)->DeleteLocalRef(env, mime_type);
1254 (*env)->DeleteLocalRef(env,
object);
1270 jstring mime_type =
NULL;
1271 jobject
object =
NULL;
1299 codec->
object = (*env)->NewGlobalRef(env,
object);
1315 (*env)->DeleteLocalRef(env, mime_type);
1319 (*env)->DeleteLocalRef(env,
object);
1347 (*env)->DeleteGlobalRef(env, codec->
object);
1517 jobject mediainfo =
NULL;
1558 (*env)->DeleteLocalRef(env, mediainfo);
1570 jobject input_buffers =
NULL;
1586 codec->
input_buffers = (*env)->NewGlobalRef(env, input_buffers);
1592 buffer = (*env)->GetObjectArrayElement(env, codec->
input_buffers, idx);
1598 ret = (*env)->GetDirectBufferAddress(env, buffer);
1599 *out_size = (*env)->GetDirectBufferCapacity(env, buffer);
1602 (*env)->DeleteLocalRef(env, buffer);
1605 if (input_buffers) {
1606 (*env)->DeleteLocalRef(env, input_buffers);
1618 jobject output_buffers =
NULL;
1634 codec->
output_buffers = (*env)->NewGlobalRef(env, output_buffers);
1640 buffer = (*env)->GetObjectArrayElement(env, codec->
output_buffers, idx);
1646 ret = (*env)->GetDirectBufferAddress(env, buffer);
1647 *out_size = (*env)->GetDirectBufferCapacity(env, buffer);
1650 (*env)->DeleteLocalRef(env, buffer);
1653 if (output_buffers) {
1654 (*env)->DeleteLocalRef(env, output_buffers);
1665 jobject mediaformat =
NULL;
1677 (*env)->DeleteLocalRef(env, mediaformat);
#define FF_PROFILE_H264_MAIN
ptrdiff_t const GLvoid * data
int ff_jni_reset_jfields(JNIEnv *env, void *jfields, const struct FFJniField *jfields_mapping, int global, void *log_ctx)
Memory handling functions.
jstring ff_jni_utf_chars_to_jstring(JNIEnv *env, const char *utf_chars, void *log_ctx)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
#define FF_PROFILE_H264_HIGH_444_PREDICTIVE
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define FF_PROFILE_H264_BASELINE
#define FF_PROFILE_HEVC_MAIN
#define LIBAVCODEC_VERSION_INT
#define FF_PROFILE_H264_EXTENDED
#define FF_PROFILE_HEVC_MAIN_10
Libavcodec version macros.
#define FF_PROFILE_H264_HIGH_422
#define FF_PROFILE_H264_HIGH
simple assert() macros that are a bit more flexible than ISO C assert().
static const uint8_t offset[127][2]
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
char * ff_jni_jstring_to_utf_chars(JNIEnv *env, jstring string, void *log_ctx)
GLsizei GLboolean const GLfloat * value
#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE
int ff_jni_init_jfields(JNIEnv *env, void *jfields, const struct FFJniField *jfields_mapping, int global, void *log_ctx)
int ff_jni_exception_check(JNIEnv *env, int log, void *log_ctx)
Libavcodec external API header.
#define FF_PROFILE_H264_HIGH_422_INTRA
main external API structure.
#define FF_PROFILE_H264_HIGH_10_INTRA
static const char * format
Describe the class of an AVClass context structure.
#define FF_PROFILE_H264_HIGH_444
JNIEnv * ff_jni_get_env(void *log_ctx)
#define FF_PROFILE_H264_HIGH_444_INTRA
#define FF_PROFILE_H264_CONSTRAINED_BASELINE
#define FF_PROFILE_H264_HIGH_10
#define AVERROR_EXTERNAL
Generic error in an external library.