|
|
|
@ -68,6 +68,192 @@ static const struct FFJniField jni_amediacodeclist_mapping[] = { |
|
|
|
|
{ NULL } |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
struct JNIAMediaFormatFields { |
|
|
|
|
|
|
|
|
|
jclass clazz; |
|
|
|
|
|
|
|
|
|
jmethodID init_id; |
|
|
|
|
|
|
|
|
|
jmethodID get_integer_id; |
|
|
|
|
jmethodID get_long_id; |
|
|
|
|
jmethodID get_float_id; |
|
|
|
|
jmethodID get_bytebuffer_id; |
|
|
|
|
jmethodID get_string_id; |
|
|
|
|
|
|
|
|
|
jmethodID set_integer_id; |
|
|
|
|
jmethodID set_long_id; |
|
|
|
|
jmethodID set_float_id; |
|
|
|
|
jmethodID set_bytebuffer_id; |
|
|
|
|
jmethodID set_string_id; |
|
|
|
|
|
|
|
|
|
jmethodID to_string_id; |
|
|
|
|
|
|
|
|
|
} JNIAMediaFormatFields; |
|
|
|
|
|
|
|
|
|
static const struct FFJniField jni_amediaformat_mapping[] = { |
|
|
|
|
{ "android/media/MediaFormat", NULL, NULL, FF_JNI_CLASS, offsetof(struct JNIAMediaFormatFields, clazz), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaFormat", "<init>", "()V", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, init_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaFormat", "getInteger", "(Ljava/lang/String;)I", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, get_integer_id), 1 }, |
|
|
|
|
{ "android/media/MediaFormat", "getLong", "(Ljava/lang/String;)J", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, get_long_id), 1 }, |
|
|
|
|
{ "android/media/MediaFormat", "getFloat", "(Ljava/lang/String;)F", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, get_float_id), 1 }, |
|
|
|
|
{ "android/media/MediaFormat", "getByteBuffer", "(Ljava/lang/String;)Ljava/nio/ByteBuffer;", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, get_bytebuffer_id), 1 }, |
|
|
|
|
{ "android/media/MediaFormat", "getString", "(Ljava/lang/String;)Ljava/lang/String;", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, get_string_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaFormat", "setInteger", "(Ljava/lang/String;I)V", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, set_integer_id), 1 }, |
|
|
|
|
{ "android/media/MediaFormat", "setLong", "(Ljava/lang/String;J)V", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, set_long_id), 1 }, |
|
|
|
|
{ "android/media/MediaFormat", "setFloat", "(Ljava/lang/String;F)V", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, set_float_id), 1 }, |
|
|
|
|
{ "android/media/MediaFormat", "setByteBuffer", "(Ljava/lang/String;Ljava/nio/ByteBuffer;)V", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, set_bytebuffer_id), 1 }, |
|
|
|
|
{ "android/media/MediaFormat", "setString", "(Ljava/lang/String;Ljava/lang/String;)V", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, set_string_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaFormat", "toString", "()Ljava/lang/String;", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, to_string_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ NULL } |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static const AVClass amediaformat_class = { |
|
|
|
|
.class_name = "amediaformat", |
|
|
|
|
.item_name = av_default_item_name, |
|
|
|
|
.version = LIBAVCODEC_VERSION_INT, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
struct FFAMediaFormat { |
|
|
|
|
|
|
|
|
|
const AVClass *class; |
|
|
|
|
struct JNIAMediaFormatFields jfields; |
|
|
|
|
jobject object; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
struct JNIAMediaCodecFields { |
|
|
|
|
|
|
|
|
|
jclass mediacodec_class; |
|
|
|
|
|
|
|
|
|
jfieldID info_try_again_later_id; |
|
|
|
|
jfieldID info_output_buffers_changed_id; |
|
|
|
|
jfieldID info_output_format_changed_id; |
|
|
|
|
|
|
|
|
|
jfieldID buffer_flag_codec_config_id; |
|
|
|
|
jfieldID buffer_flag_end_of_stream_id; |
|
|
|
|
jfieldID buffer_flag_key_frame_id; |
|
|
|
|
|
|
|
|
|
jfieldID configure_flag_encode_id; |
|
|
|
|
|
|
|
|
|
jmethodID create_by_codec_name_id; |
|
|
|
|
jmethodID create_decoder_by_type_id; |
|
|
|
|
jmethodID create_encoder_by_type_id; |
|
|
|
|
|
|
|
|
|
jmethodID get_name_id; |
|
|
|
|
|
|
|
|
|
jmethodID configure_id; |
|
|
|
|
jmethodID start_id; |
|
|
|
|
jmethodID flush_id; |
|
|
|
|
jmethodID stop_id; |
|
|
|
|
jmethodID release_id; |
|
|
|
|
|
|
|
|
|
jmethodID get_output_format_id; |
|
|
|
|
|
|
|
|
|
jmethodID dequeue_input_buffer_id; |
|
|
|
|
jmethodID queue_input_buffer_id; |
|
|
|
|
jmethodID get_input_buffer_id; |
|
|
|
|
jmethodID get_input_buffers_id; |
|
|
|
|
|
|
|
|
|
jmethodID dequeue_output_buffer_id; |
|
|
|
|
jmethodID get_output_buffer_id; |
|
|
|
|
jmethodID get_output_buffers_id; |
|
|
|
|
jmethodID release_output_buffer_id; |
|
|
|
|
jmethodID release_output_buffer_at_time_id; |
|
|
|
|
|
|
|
|
|
jclass mediainfo_class; |
|
|
|
|
|
|
|
|
|
jmethodID init_id; |
|
|
|
|
|
|
|
|
|
jfieldID flags_id; |
|
|
|
|
jfieldID offset_id; |
|
|
|
|
jfieldID presentation_time_us_id; |
|
|
|
|
jfieldID size_id; |
|
|
|
|
|
|
|
|
|
} JNIAMediaCodecFields; |
|
|
|
|
|
|
|
|
|
static const struct FFJniField jni_amediacodec_mapping[] = { |
|
|
|
|
{ "android/media/MediaCodec", NULL, NULL, FF_JNI_CLASS, offsetof(struct JNIAMediaCodecFields, mediacodec_class), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "INFO_TRY_AGAIN_LATER", "I", FF_JNI_STATIC_FIELD, offsetof(struct JNIAMediaCodecFields, info_try_again_later_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "INFO_OUTPUT_BUFFERS_CHANGED", "I", FF_JNI_STATIC_FIELD, offsetof(struct JNIAMediaCodecFields, info_output_buffers_changed_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "INFO_OUTPUT_FORMAT_CHANGED", "I", FF_JNI_STATIC_FIELD, offsetof(struct JNIAMediaCodecFields, info_output_format_changed_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "BUFFER_FLAG_CODEC_CONFIG", "I", FF_JNI_STATIC_FIELD, offsetof(struct JNIAMediaCodecFields, buffer_flag_codec_config_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "BUFFER_FLAG_END_OF_STREAM", "I", FF_JNI_STATIC_FIELD, offsetof(struct JNIAMediaCodecFields, buffer_flag_end_of_stream_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "BUFFER_FLAG_KEY_FRAME", "I", FF_JNI_STATIC_FIELD, offsetof(struct JNIAMediaCodecFields, buffer_flag_key_frame_id), 0 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "CONFIGURE_FLAG_ENCODE", "I", FF_JNI_STATIC_FIELD, offsetof(struct JNIAMediaCodecFields, configure_flag_encode_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "createByCodecName", "(Ljava/lang/String;)Landroid/media/MediaCodec;", FF_JNI_STATIC_METHOD, offsetof(struct JNIAMediaCodecFields, create_by_codec_name_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "createDecoderByType", "(Ljava/lang/String;)Landroid/media/MediaCodec;", FF_JNI_STATIC_METHOD, offsetof(struct JNIAMediaCodecFields, create_decoder_by_type_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "createEncoderByType", "(Ljava/lang/String;)Landroid/media/MediaCodec;", FF_JNI_STATIC_METHOD, offsetof(struct JNIAMediaCodecFields, create_encoder_by_type_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "getName", "()Ljava/lang/String;", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, get_name_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "configure", "(Landroid/media/MediaFormat;Landroid/view/Surface;Landroid/media/MediaCrypto;I)V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, configure_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "start", "()V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, start_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "flush", "()V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, flush_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "stop", "()V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, stop_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "release", "()V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, release_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "getOutputFormat", "()Landroid/media/MediaFormat;", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, get_output_format_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "dequeueInputBuffer", "(J)I", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, dequeue_input_buffer_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "queueInputBuffer", "(IIIJI)V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, queue_input_buffer_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "getInputBuffer", "(I)Ljava/nio/ByteBuffer;", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, get_input_buffer_id), 0 }, |
|
|
|
|
{ "android/media/MediaCodec", "getInputBuffers", "()[Ljava/nio/ByteBuffer;", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, get_input_buffers_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "dequeueOutputBuffer", "(Landroid/media/MediaCodec$BufferInfo;J)I", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, dequeue_output_buffer_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "getOutputBuffer", "(I)Ljava/nio/ByteBuffer;", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, get_output_buffer_id), 0 }, |
|
|
|
|
{ "android/media/MediaCodec", "getOutputBuffers", "()[Ljava/nio/ByteBuffer;", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, get_output_buffers_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "releaseOutputBuffer", "(IZ)V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, release_output_buffer_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "releaseOutputBuffer", "(IJ)V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, release_output_buffer_at_time_id), 0 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec$BufferInfo", NULL, NULL, FF_JNI_CLASS, offsetof(struct JNIAMediaCodecFields, mediainfo_class), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec.BufferInfo", "<init>", "()V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, init_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec.BufferInfo", "flags", "I", FF_JNI_FIELD, offsetof(struct JNIAMediaCodecFields, flags_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec.BufferInfo", "offset", "I", FF_JNI_FIELD, offsetof(struct JNIAMediaCodecFields, offset_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec.BufferInfo", "presentationTimeUs", "J", FF_JNI_FIELD, offsetof(struct JNIAMediaCodecFields, presentation_time_us_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec.BufferInfo", "size", "I", FF_JNI_FIELD, offsetof(struct JNIAMediaCodecFields, size_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ NULL } |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static const AVClass amediacodec_class = { |
|
|
|
|
.class_name = "amediacodec", |
|
|
|
|
.item_name = av_default_item_name, |
|
|
|
|
.version = LIBAVCODEC_VERSION_INT, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
struct FFAMediaCodec { |
|
|
|
|
|
|
|
|
|
const AVClass *class; |
|
|
|
|
|
|
|
|
|
struct JNIAMediaCodecFields jfields; |
|
|
|
|
|
|
|
|
|
jobject object; |
|
|
|
|
|
|
|
|
|
jobject input_buffers; |
|
|
|
|
jobject output_buffers; |
|
|
|
|
|
|
|
|
|
int INFO_TRY_AGAIN_LATER; |
|
|
|
|
int INFO_OUTPUT_BUFFERS_CHANGED; |
|
|
|
|
int INFO_OUTPUT_FORMAT_CHANGED; |
|
|
|
|
|
|
|
|
|
int BUFFER_FLAG_CODEC_CONFIG; |
|
|
|
|
int BUFFER_FLAG_END_OF_STREAM; |
|
|
|
|
int BUFFER_FLAG_KEY_FRAME; |
|
|
|
|
|
|
|
|
|
int CONFIGURE_FLAG_ENCODE; |
|
|
|
|
|
|
|
|
|
int has_get_i_o_buffer; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
#define JNI_ATTACH_ENV_OR_RETURN(env, attached, log_ctx, ret) do { \ |
|
|
|
|
(env) = ff_jni_attach_env(attached, log_ctx); \
|
|
|
|
|
if (!(env)) { \
|
|
|
|
@ -257,63 +443,6 @@ done: |
|
|
|
|
return name; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
struct JNIAMediaFormatFields { |
|
|
|
|
|
|
|
|
|
jclass clazz; |
|
|
|
|
|
|
|
|
|
jmethodID init_id; |
|
|
|
|
|
|
|
|
|
jmethodID get_integer_id; |
|
|
|
|
jmethodID get_long_id; |
|
|
|
|
jmethodID get_float_id; |
|
|
|
|
jmethodID get_bytebuffer_id; |
|
|
|
|
jmethodID get_string_id; |
|
|
|
|
|
|
|
|
|
jmethodID set_integer_id; |
|
|
|
|
jmethodID set_long_id; |
|
|
|
|
jmethodID set_float_id; |
|
|
|
|
jmethodID set_bytebuffer_id; |
|
|
|
|
jmethodID set_string_id; |
|
|
|
|
|
|
|
|
|
jmethodID to_string_id; |
|
|
|
|
|
|
|
|
|
} JNIAMediaFormatFields; |
|
|
|
|
|
|
|
|
|
static const struct FFJniField jni_amediaformat_mapping[] = { |
|
|
|
|
{ "android/media/MediaFormat", NULL, NULL, FF_JNI_CLASS, offsetof(struct JNIAMediaFormatFields, clazz), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaFormat", "<init>", "()V", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, init_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaFormat", "getInteger", "(Ljava/lang/String;)I", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, get_integer_id), 1 }, |
|
|
|
|
{ "android/media/MediaFormat", "getLong", "(Ljava/lang/String;)J", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, get_long_id), 1 }, |
|
|
|
|
{ "android/media/MediaFormat", "getFloat", "(Ljava/lang/String;)F", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, get_float_id), 1 }, |
|
|
|
|
{ "android/media/MediaFormat", "getByteBuffer", "(Ljava/lang/String;)Ljava/nio/ByteBuffer;", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, get_bytebuffer_id), 1 }, |
|
|
|
|
{ "android/media/MediaFormat", "getString", "(Ljava/lang/String;)Ljava/lang/String;", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, get_string_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaFormat", "setInteger", "(Ljava/lang/String;I)V", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, set_integer_id), 1 }, |
|
|
|
|
{ "android/media/MediaFormat", "setLong", "(Ljava/lang/String;J)V", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, set_long_id), 1 }, |
|
|
|
|
{ "android/media/MediaFormat", "setFloat", "(Ljava/lang/String;F)V", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, set_float_id), 1 }, |
|
|
|
|
{ "android/media/MediaFormat", "setByteBuffer", "(Ljava/lang/String;Ljava/nio/ByteBuffer;)V", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, set_bytebuffer_id), 1 }, |
|
|
|
|
{ "android/media/MediaFormat", "setString", "(Ljava/lang/String;Ljava/lang/String;)V", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, set_string_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaFormat", "toString", "()Ljava/lang/String;", FF_JNI_METHOD, offsetof(struct JNIAMediaFormatFields, to_string_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ NULL } |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static const AVClass amediaformat_class = { |
|
|
|
|
.class_name = "amediaformat", |
|
|
|
|
.item_name = av_default_item_name, |
|
|
|
|
.version = LIBAVCODEC_VERSION_INT, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
struct FFAMediaFormat { |
|
|
|
|
|
|
|
|
|
const AVClass *class; |
|
|
|
|
struct JNIAMediaFormatFields jfields; |
|
|
|
|
jobject object; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
FFAMediaFormat *ff_AMediaFormat_new(void) |
|
|
|
|
{ |
|
|
|
|
int attached = 0; |
|
|
|
@ -830,135 +959,6 @@ fail: |
|
|
|
|
JNI_DETACH_ENV(attached, format); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
struct JNIAMediaCodecFields { |
|
|
|
|
|
|
|
|
|
jclass mediacodec_class; |
|
|
|
|
|
|
|
|
|
jfieldID info_try_again_later_id; |
|
|
|
|
jfieldID info_output_buffers_changed_id; |
|
|
|
|
jfieldID info_output_format_changed_id; |
|
|
|
|
|
|
|
|
|
jfieldID buffer_flag_codec_config_id; |
|
|
|
|
jfieldID buffer_flag_end_of_stream_id; |
|
|
|
|
jfieldID buffer_flag_key_frame_id; |
|
|
|
|
|
|
|
|
|
jfieldID configure_flag_encode_id; |
|
|
|
|
|
|
|
|
|
jmethodID create_by_codec_name_id; |
|
|
|
|
jmethodID create_decoder_by_type_id; |
|
|
|
|
jmethodID create_encoder_by_type_id; |
|
|
|
|
|
|
|
|
|
jmethodID get_name_id; |
|
|
|
|
|
|
|
|
|
jmethodID configure_id; |
|
|
|
|
jmethodID start_id; |
|
|
|
|
jmethodID flush_id; |
|
|
|
|
jmethodID stop_id; |
|
|
|
|
jmethodID release_id; |
|
|
|
|
|
|
|
|
|
jmethodID get_output_format_id; |
|
|
|
|
|
|
|
|
|
jmethodID dequeue_input_buffer_id; |
|
|
|
|
jmethodID queue_input_buffer_id; |
|
|
|
|
jmethodID get_input_buffer_id; |
|
|
|
|
jmethodID get_input_buffers_id; |
|
|
|
|
|
|
|
|
|
jmethodID dequeue_output_buffer_id; |
|
|
|
|
jmethodID get_output_buffer_id; |
|
|
|
|
jmethodID get_output_buffers_id; |
|
|
|
|
jmethodID release_output_buffer_id; |
|
|
|
|
jmethodID release_output_buffer_at_time_id; |
|
|
|
|
|
|
|
|
|
jclass mediainfo_class; |
|
|
|
|
|
|
|
|
|
jmethodID init_id; |
|
|
|
|
|
|
|
|
|
jfieldID flags_id; |
|
|
|
|
jfieldID offset_id; |
|
|
|
|
jfieldID presentation_time_us_id; |
|
|
|
|
jfieldID size_id; |
|
|
|
|
|
|
|
|
|
} JNIAMediaCodecFields; |
|
|
|
|
|
|
|
|
|
static const struct FFJniField jni_amediacodec_mapping[] = { |
|
|
|
|
{ "android/media/MediaCodec", NULL, NULL, FF_JNI_CLASS, offsetof(struct JNIAMediaCodecFields, mediacodec_class), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "INFO_TRY_AGAIN_LATER", "I", FF_JNI_STATIC_FIELD, offsetof(struct JNIAMediaCodecFields, info_try_again_later_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "INFO_OUTPUT_BUFFERS_CHANGED", "I", FF_JNI_STATIC_FIELD, offsetof(struct JNIAMediaCodecFields, info_output_buffers_changed_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "INFO_OUTPUT_FORMAT_CHANGED", "I", FF_JNI_STATIC_FIELD, offsetof(struct JNIAMediaCodecFields, info_output_format_changed_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "BUFFER_FLAG_CODEC_CONFIG", "I", FF_JNI_STATIC_FIELD, offsetof(struct JNIAMediaCodecFields, buffer_flag_codec_config_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "BUFFER_FLAG_END_OF_STREAM", "I", FF_JNI_STATIC_FIELD, offsetof(struct JNIAMediaCodecFields, buffer_flag_end_of_stream_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "BUFFER_FLAG_KEY_FRAME", "I", FF_JNI_STATIC_FIELD, offsetof(struct JNIAMediaCodecFields, buffer_flag_key_frame_id), 0 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "CONFIGURE_FLAG_ENCODE", "I", FF_JNI_STATIC_FIELD, offsetof(struct JNIAMediaCodecFields, configure_flag_encode_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "createByCodecName", "(Ljava/lang/String;)Landroid/media/MediaCodec;", FF_JNI_STATIC_METHOD, offsetof(struct JNIAMediaCodecFields, create_by_codec_name_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "createDecoderByType", "(Ljava/lang/String;)Landroid/media/MediaCodec;", FF_JNI_STATIC_METHOD, offsetof(struct JNIAMediaCodecFields, create_decoder_by_type_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "createEncoderByType", "(Ljava/lang/String;)Landroid/media/MediaCodec;", FF_JNI_STATIC_METHOD, offsetof(struct JNIAMediaCodecFields, create_encoder_by_type_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "getName", "()Ljava/lang/String;", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, get_name_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "configure", "(Landroid/media/MediaFormat;Landroid/view/Surface;Landroid/media/MediaCrypto;I)V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, configure_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "start", "()V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, start_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "flush", "()V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, flush_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "stop", "()V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, stop_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "release", "()V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, release_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "getOutputFormat", "()Landroid/media/MediaFormat;", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, get_output_format_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "dequeueInputBuffer", "(J)I", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, dequeue_input_buffer_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "queueInputBuffer", "(IIIJI)V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, queue_input_buffer_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "getInputBuffer", "(I)Ljava/nio/ByteBuffer;", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, get_input_buffer_id), 0 }, |
|
|
|
|
{ "android/media/MediaCodec", "getInputBuffers", "()[Ljava/nio/ByteBuffer;", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, get_input_buffers_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec", "dequeueOutputBuffer", "(Landroid/media/MediaCodec$BufferInfo;J)I", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, dequeue_output_buffer_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "getOutputBuffer", "(I)Ljava/nio/ByteBuffer;", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, get_output_buffer_id), 0 }, |
|
|
|
|
{ "android/media/MediaCodec", "getOutputBuffers", "()[Ljava/nio/ByteBuffer;", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, get_output_buffers_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "releaseOutputBuffer", "(IZ)V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, release_output_buffer_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec", "releaseOutputBuffer", "(IJ)V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, release_output_buffer_at_time_id), 0 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec$BufferInfo", NULL, NULL, FF_JNI_CLASS, offsetof(struct JNIAMediaCodecFields, mediainfo_class), 1 }, |
|
|
|
|
|
|
|
|
|
{ "android/media/MediaCodec.BufferInfo", "<init>", "()V", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecFields, init_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec.BufferInfo", "flags", "I", FF_JNI_FIELD, offsetof(struct JNIAMediaCodecFields, flags_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec.BufferInfo", "offset", "I", FF_JNI_FIELD, offsetof(struct JNIAMediaCodecFields, offset_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec.BufferInfo", "presentationTimeUs", "J", FF_JNI_FIELD, offsetof(struct JNIAMediaCodecFields, presentation_time_us_id), 1 }, |
|
|
|
|
{ "android/media/MediaCodec.BufferInfo", "size", "I", FF_JNI_FIELD, offsetof(struct JNIAMediaCodecFields, size_id), 1 }, |
|
|
|
|
|
|
|
|
|
{ NULL } |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static const AVClass amediacodec_class = { |
|
|
|
|
.class_name = "amediacodec", |
|
|
|
|
.item_name = av_default_item_name, |
|
|
|
|
.version = LIBAVCODEC_VERSION_INT, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
struct FFAMediaCodec { |
|
|
|
|
|
|
|
|
|
const AVClass *class; |
|
|
|
|
|
|
|
|
|
struct JNIAMediaCodecFields jfields; |
|
|
|
|
|
|
|
|
|
jobject object; |
|
|
|
|
|
|
|
|
|
jobject input_buffers; |
|
|
|
|
jobject output_buffers; |
|
|
|
|
|
|
|
|
|
int INFO_TRY_AGAIN_LATER; |
|
|
|
|
int INFO_OUTPUT_BUFFERS_CHANGED; |
|
|
|
|
int INFO_OUTPUT_FORMAT_CHANGED; |
|
|
|
|
|
|
|
|
|
int BUFFER_FLAG_CODEC_CONFIG; |
|
|
|
|
int BUFFER_FLAG_END_OF_STREAM; |
|
|
|
|
int BUFFER_FLAG_KEY_FRAME; |
|
|
|
|
|
|
|
|
|
int CONFIGURE_FLAG_ENCODE; |
|
|
|
|
|
|
|
|
|
int has_get_i_o_buffer; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static int codec_init_static_fields(FFAMediaCodec *codec) |
|
|
|
|
{ |
|
|
|
|
int ret = 0; |
|
|
|
|