70 {
"android/media/MediaCodecList",
"findDecoderForFormat",
"(Landroid/media/MediaFormat;)Ljava/lang/String;",
FF_JNI_METHOD, offsetof(
struct JNIAMediaCodecListFields, find_decoder_for_format_id), 0 },
77 {
"android/media/MediaCodecInfo",
"getCapabilitiesForType",
"(Ljava/lang/String;)Landroid/media/MediaCodecInfo$CodecCapabilities;",
FF_JNI_METHOD, offsetof(
struct JNIAMediaCodecListFields, get_codec_capabilities_id), 1 },
83 {
"android/media/MediaCodecInfo$CodecCapabilities",
"profileLevels",
"[Landroid/media/MediaCodecInfo$CodecProfileLevel;",
FF_JNI_FIELD, offsetof(
struct JNIAMediaCodecListFields, profile_levels_id), 1 },
130 {
"android/media/MediaFormat",
"getByteBuffer",
"(Ljava/lang/String;)Ljava/nio/ByteBuffer;",
FF_JNI_METHOD, offsetof(
struct JNIAMediaFormatFields, get_bytebuffer_id), 1 },
136 {
"android/media/MediaFormat",
"setByteBuffer",
"(Ljava/lang/String;Ljava/nio/ByteBuffer;)V",
FF_JNI_METHOD, offsetof(
struct JNIAMediaFormatFields, set_bytebuffer_id), 1 },
226 {
"android/media/MediaCodec",
"configure",
"(Landroid/media/MediaFormat;Landroid/view/Surface;Landroid/media/MediaCrypto;I)V",
FF_JNI_METHOD, offsetof(
struct JNIAMediaCodecFields, configure_id), 1 },
232 {
"android/media/MediaCodec",
"getOutputFormat",
"()Landroid/media/MediaFormat;",
FF_JNI_METHOD, offsetof(
struct JNIAMediaCodecFields, get_output_format_id), 1 },
239 {
"android/media/MediaCodec",
"dequeueOutputBuffer",
"(Landroid/media/MediaCodec$BufferInfo;J)I",
FF_JNI_METHOD, offsetof(
struct JNIAMediaCodecFields, dequeue_output_buffer_id), 1 },
286 #define JNI_ATTACH_ENV_OR_RETURN(env, attached, log_ctx, ret) do { \
287 (env) = ff_jni_attach_env(attached, log_ctx); \
293 #define JNI_ATTACH_ENV_OR_RETURN_VOID(env, attached, log_ctx) do { \
294 (env) = ff_jni_attach_env(attached, log_ctx); \
300 #define JNI_DETACH_ENV(attached, log_ctx) do { \
302 ff_jni_detach_env(log_ctx); \
322 jfieldID field_id = 0;
377 char *supported_type =
NULL;
385 jobject codec =
NULL;
386 jobject codec_name =
NULL;
390 jobjectArray types =
NULL;
392 jobject capabilities =
NULL;
393 jobject profile_level =
NULL;
394 jobjectArray profile_levels =
NULL;
398 if ((ret =
ff_jni_init_jfields(env, &jfields, jni_amediacodeclist_mapping, 0, log_ctx)) < 0) {
402 if ((ret =
ff_jni_init_jfields(env, &mediaformat_jfields, jni_amediaformat_mapping, 0, log_ctx)) < 0) {
411 for(i = 0; i < codec_count; i++) {
426 is_encoder = (*env)->CallBooleanMethod(env, info, jfields.
is_encoder_id);
431 if (is_encoder != encoder) {
435 type_count = (*env)->GetArrayLength(env, types);
436 for (j = 0; j < type_count; j++) {
440 type = (*env)->GetObjectArrayElement(env, types, j);
446 if (!supported_type) {
451 codec_name = (*env)->CallObjectMethod(env, info, jfields.
get_name_id);
461 if (strstr(name,
"OMX.google")) {
471 profile_levels = (*env)->GetObjectField(env, capabilities, jfields.
profile_levels_id);
476 profile_count = (*env)->GetArrayLength(env, profile_levels);
477 for (k = 0; k < profile_count; k++) {
478 int supported_profile = 0;
485 profile_level = (*env)->GetObjectArrayElement(env, profile_levels, k);
490 supported_profile = (*env)->GetIntField(env, profile_level, jfields.
profile_id);
495 found_codec = profile == supported_profile;
498 (*env)->DeleteLocalRef(env, profile_level);
499 profile_level =
NULL;
509 if (profile_levels) {
510 (*env)->DeleteLocalRef(env, profile_levels);
511 profile_levels =
NULL;
515 (*env)->DeleteLocalRef(env, capabilities);
520 (*env)->DeleteLocalRef(env, type);
535 (*env)->DeleteLocalRef(env, info);
540 (*env)->DeleteLocalRef(env, types);
551 (*env)->DeleteLocalRef(env, format);
555 (*env)->DeleteLocalRef(env, codec);
559 (*env)->DeleteLocalRef(env, codec_name);
563 (*env)->DeleteLocalRef(env, info);
567 (*env)->DeleteLocalRef(env, type);
571 (*env)->DeleteLocalRef(env, types);
575 (*env)->DeleteLocalRef(env, capabilities);
579 (*env)->DeleteLocalRef(env, profile_level);
582 if (profile_levels) {
583 (*env)->DeleteLocalRef(env, profile_levels);
627 format->
object = (*env)->NewGlobalRef(env, format->
object);
667 format->
object = (*env)->NewGlobalRef(env,
object);
698 (*env)->DeleteGlobalRef(env, format->
object);
716 jstring description =
NULL;
731 (*env)->DeleteLocalRef(env, description);
766 (*env)->DeleteLocalRef(env, key);
801 (*env)->DeleteLocalRef(env, key);
836 (*env)->DeleteLocalRef(env, key);
851 jobject result =
NULL;
869 *data = (*env)->GetDirectBufferAddress(env, result);
870 *size = (*env)->GetDirectBufferCapacity(env, result);
872 if (*data && *size) {
880 memcpy(*data, src, *size);
886 (*env)->DeleteLocalRef(env, key);
890 (*env)->DeleteLocalRef(env, result);
905 jstring result =
NULL;
932 (*env)->DeleteLocalRef(env, key);
936 (*env)->DeleteLocalRef(env, result);
966 (*env)->DeleteLocalRef(env, key);
994 (*env)->DeleteLocalRef(env, key);
1022 (*env)->DeleteLocalRef(env, key);
1033 jstring
string =
NULL;
1056 (*env)->DeleteLocalRef(env, key);
1060 (*env)->DeleteLocalRef(env,
string);
1083 if (!data || !size) {
1092 memcpy(buffer_data, data, size);
1094 buffer = (*env)->NewDirectByteBuffer(env, buffer_data, size);
1106 (*env)->DeleteLocalRef(env, key);
1110 (*env)->DeleteLocalRef(env, buffer);
1177 jstring codec_name =
NULL;
1205 codec->
object = (*env)->NewGlobalRef(env, codec->
object);
1225 (*env)->DeleteLocalRef(env, codec_name);
1240 jstring mime_type =
NULL;
1268 codec->
object = (*env)->NewGlobalRef(env, codec->
object);
1288 (*env)->DeleteLocalRef(env, mime_type);
1303 jstring mime_type =
NULL;
1331 codec->
object = (*env)->NewGlobalRef(env, codec->
object);
1351 (*env)->DeleteLocalRef(env, mime_type);
1379 (*env)->DeleteGlobalRef(env, codec->
object);
1582 jobject mediainfo =
NULL;
1623 (*env)->DeleteLocalRef(env, mediainfo);
1659 buffer = (*env)->GetObjectArrayElement(env, codec->
input_buffers, idx);
1665 ret = (*env)->GetDirectBufferAddress(env, buffer);
1666 *out_size = (*env)->GetDirectBufferCapacity(env, buffer);
1669 (*env)->DeleteLocalRef(env, buffer);
1705 buffer = (*env)->GetObjectArrayElement(env, codec->
output_buffers, idx);
1711 ret = (*env)->GetDirectBufferAddress(env, buffer);
1712 *out_size = (*env)->GetDirectBufferCapacity(env, buffer);
1715 (*env)->DeleteLocalRef(env, buffer);
1729 jobject mediaformat =
NULL;
1741 (*env)->DeleteLocalRef(env, mediaformat);
#define FF_PROFILE_H264_MAIN
JNIEnv * ff_jni_attach_env(int *attached, void *log_ctx)
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)
#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 LIBAVCODEC_VERSION_INT
#define FF_PROFILE_H264_EXTENDED
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
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
#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.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...