FFmpeg
|
#include <jni.h>
#include "libavutil/avassert.h"
#include "libavutil/mem.h"
#include "libavutil/avstring.h"
#include "avcodec.h"
#include "ffjni.h"
#include "version.h"
#include "mediacodec_wrapper.h"
Go to the source code of this file.
Data Structures | |
struct | JNIAMediaCodecListFields |
struct | JNIAMediaFormatFields |
struct | FFAMediaFormat |
struct | JNIAMediaCodecFields |
struct | FFAMediaCodec |
Macros | |
#define | JNI_GET_ENV_OR_RETURN(env, log_ctx, ret) |
#define | JNI_GET_ENV_OR_RETURN_VOID(env, log_ctx) |
#define | CREATE_CODEC_BY_NAME 0 |
#define | CREATE_DECODER_BY_TYPE 1 |
#define | CREATE_ENCODER_BY_TYPE 2 |
#define | DECLARE_FF_AMEDIACODEC_CREATE_FUNC(name, method) |
Variables | |
static const struct FFJniField | jni_amediacodeclist_mapping [] |
static const struct FFJniField | jni_amediaformat_mapping [] |
static const AVClass | amediaformat_class |
static const struct FFJniField | jni_amediacodec_mapping [] |
static const AVClass | amediacodec_class |
#define JNI_GET_ENV_OR_RETURN | ( | env, | |
log_ctx, | |||
ret | |||
) |
Definition at line 299 of file mediacodec_wrapper.c.
#define JNI_GET_ENV_OR_RETURN_VOID | ( | env, | |
log_ctx | |||
) |
Definition at line 306 of file mediacodec_wrapper.c.
#define CREATE_CODEC_BY_NAME 0 |
Definition at line 1175 of file mediacodec_wrapper.c.
#define CREATE_DECODER_BY_TYPE 1 |
Definition at line 1176 of file mediacodec_wrapper.c.
#define CREATE_ENCODER_BY_TYPE 2 |
Definition at line 1177 of file mediacodec_wrapper.c.
#define DECLARE_FF_AMEDIACODEC_CREATE_FUNC | ( | name, | |
method | |||
) |
Definition at line 1279 of file mediacodec_wrapper.c.
int ff_AMediaCodecProfile_getProfileFromAVCodecContext | ( | AVCodecContext * | avctx | ) |
The following API around MediaCodec and MediaFormat is based on the NDK one provided by Google since Android 5.0.
Differences from the NDK API:
Buffers returned by ff_AMediaFormat_toString and ff_AMediaFormat_getString are newly allocated buffer and must be freed by the user after use.
The MediaCrypto API is not implemented.
ff_AMediaCodec_infoTryAgainLater, ff_AMediaCodec_infoOutputBuffersChanged, ff_AMediaCodec_infoOutputFormatChanged, ff_AMediaCodec_cleanOutputBuffers ff_AMediaCodec_getName and ff_AMediaCodec_getBufferFlagEndOfStream are not part of the original NDK API and are convenience functions to hide JNI implementation.
The API around MediaCodecList is not part of the NDK (and is lacking as we still need to retrieve the codec name to work around faulty decoders and encoders).
For documentation, please refers to NdkMediaCodec.h NdkMediaFormat.h and http://developer.android.com/reference/android/media/MediaCodec.html.
Definition at line 313 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_init().
char* ff_AMediaCodecList_getCodecNameByType | ( | const char * | mime, |
int | profile, | ||
int | encoder, | ||
void * | log_ctx | ||
) |
Definition at line 382 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_init().
FFAMediaFormat* ff_AMediaFormat_new | ( | void | ) |
Definition at line 612 of file mediacodec_wrapper.c.
Referenced by mediacodec_decode_init().
|
static |
Definition at line 657 of file mediacodec_wrapper.c.
Referenced by ff_AMediaCodec_getOutputFormat().
int ff_AMediaFormat_delete | ( | FFAMediaFormat * | format | ) |
Definition at line 692 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_receive(), ff_mediacodec_dec_unref(), and mediacodec_decode_init().
char* ff_AMediaFormat_toString | ( | FFAMediaFormat * | format | ) |
Definition at line 714 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_init(), ff_mediacodec_dec_receive(), and mediacodec_dec_parse_format().
int ff_AMediaFormat_getInt32 | ( | FFAMediaFormat * | format, |
const char * | name, | ||
int32_t * | out | ||
) |
Definition at line 739 of file mediacodec_wrapper.c.
int ff_AMediaFormat_getInt64 | ( | FFAMediaFormat * | format, |
const char * | name, | ||
int64_t * | out | ||
) |
Definition at line 778 of file mediacodec_wrapper.c.
int ff_AMediaFormat_getFloat | ( | FFAMediaFormat * | format, |
const char * | name, | ||
float * | out | ||
) |
Definition at line 817 of file mediacodec_wrapper.c.
int ff_AMediaFormat_getBuffer | ( | FFAMediaFormat * | format, |
const char * | name, | ||
void ** | data, | ||
size_t * | size | ||
) |
Definition at line 856 of file mediacodec_wrapper.c.
int ff_AMediaFormat_getString | ( | FFAMediaFormat * | format, |
const char * | name, | ||
const char ** | out | ||
) |
Definition at line 914 of file mediacodec_wrapper.c.
void ff_AMediaFormat_setInt32 | ( | FFAMediaFormat * | format, |
const char * | name, | ||
int32_t | value | ||
) |
Definition at line 964 of file mediacodec_wrapper.c.
Referenced by mediacodec_decode_init().
void ff_AMediaFormat_setInt64 | ( | FFAMediaFormat * | format, |
const char * | name, | ||
int64_t | value | ||
) |
Definition at line 989 of file mediacodec_wrapper.c.
void ff_AMediaFormat_setFloat | ( | FFAMediaFormat * | format, |
const char * | name, | ||
float | value | ||
) |
Definition at line 1014 of file mediacodec_wrapper.c.
void ff_AMediaFormat_setString | ( | FFAMediaFormat * | format, |
const char * | name, | ||
const char * | value | ||
) |
Definition at line 1039 of file mediacodec_wrapper.c.
Referenced by mediacodec_decode_init().
void ff_AMediaFormat_setBuffer | ( | FFAMediaFormat * | format, |
const char * | name, | ||
void * | data, | ||
size_t | size | ||
) |
Definition at line 1074 of file mediacodec_wrapper.c.
|
static |
Definition at line 1121 of file mediacodec_wrapper.c.
Referenced by codec_create().
|
inlinestatic |
Definition at line 1179 of file mediacodec_wrapper.c.
int ff_AMediaCodec_delete | ( | FFAMediaCodec * | codec | ) |
Definition at line 1289 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_unref().
char* ff_AMediaCodec_getName | ( | FFAMediaCodec * | codec | ) |
Definition at line 1325 of file mediacodec_wrapper.c.
int ff_AMediaCodec_configure | ( | FFAMediaCodec * | codec, |
const FFAMediaFormat * | format, | ||
void * | surface, | ||
void * | crypto, | ||
uint32_t | flags | ||
) |
Definition at line 1348 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_init().
int ff_AMediaCodec_start | ( | FFAMediaCodec * | codec | ) |
Definition at line 1365 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_init().
int ff_AMediaCodec_stop | ( | FFAMediaCodec * | codec | ) |
Definition at line 1382 of file mediacodec_wrapper.c.
int ff_AMediaCodec_flush | ( | FFAMediaCodec * | codec | ) |
Definition at line 1399 of file mediacodec_wrapper.c.
Referenced by mediacodec_dec_flush_codec().
int ff_AMediaCodec_releaseOutputBuffer | ( | FFAMediaCodec * | codec, |
size_t | idx, | ||
int | render | ||
) |
Definition at line 1416 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_receive(), mediacodec_buffer_release(), mediacodec_wrap_hw_buffer(), and mediacodec_wrap_sw_buffer().
int ff_AMediaCodec_releaseOutputBufferAtTime | ( | FFAMediaCodec * | codec, |
size_t | idx, | ||
int64_t | timestampNs | ||
) |
Definition at line 1433 of file mediacodec_wrapper.c.
ssize_t ff_AMediaCodec_dequeueInputBuffer | ( | FFAMediaCodec * | codec, |
int64_t | timeoutUs | ||
) |
Definition at line 1450 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_send(), and mediacodec_receive_frame().
int ff_AMediaCodec_queueInputBuffer | ( | FFAMediaCodec * | codec, |
size_t | idx, | ||
off_t | offset, | ||
size_t | size, | ||
uint64_t | time, | ||
uint32_t | flags | ||
) |
Definition at line 1467 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_send().
ssize_t ff_AMediaCodec_dequeueOutputBuffer | ( | FFAMediaCodec * | codec, |
FFAMediaCodecBufferInfo * | info, | ||
int64_t | timeoutUs | ||
) |
Definition at line 1484 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_receive().
uint8_t* ff_AMediaCodec_getInputBuffer | ( | FFAMediaCodec * | codec, |
size_t | idx, | ||
size_t * | out_size | ||
) |
Definition at line 1519 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_send().
uint8_t* ff_AMediaCodec_getOutputBuffer | ( | FFAMediaCodec * | codec, |
size_t | idx, | ||
size_t * | out_size | ||
) |
Definition at line 1567 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_receive().
FFAMediaFormat* ff_AMediaCodec_getOutputFormat | ( | FFAMediaCodec * | codec | ) |
Definition at line 1615 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_init(), and ff_mediacodec_dec_receive().
int ff_AMediaCodec_infoTryAgainLater | ( | FFAMediaCodec * | codec, |
ssize_t | idx | ||
) |
Definition at line 1638 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_receive(), and ff_mediacodec_dec_send().
int ff_AMediaCodec_infoOutputBuffersChanged | ( | FFAMediaCodec * | codec, |
ssize_t | idx | ||
) |
Definition at line 1643 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_receive().
int ff_AMediaCodec_infoOutputFormatChanged | ( | FFAMediaCodec * | codec, |
ssize_t | idx | ||
) |
Definition at line 1648 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_receive().
int ff_AMediaCodec_getBufferFlagCodecConfig | ( | FFAMediaCodec * | codec | ) |
Definition at line 1653 of file mediacodec_wrapper.c.
int ff_AMediaCodec_getBufferFlagEndOfStream | ( | FFAMediaCodec * | codec | ) |
Definition at line 1658 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_receive(), and ff_mediacodec_dec_send().
int ff_AMediaCodec_getBufferFlagKeyFrame | ( | FFAMediaCodec * | codec | ) |
Definition at line 1663 of file mediacodec_wrapper.c.
int ff_AMediaCodec_getConfigureFlagEncode | ( | FFAMediaCodec * | codec | ) |
Definition at line 1668 of file mediacodec_wrapper.c.
int ff_AMediaCodec_cleanOutputBuffers | ( | FFAMediaCodec * | codec | ) |
Definition at line 1673 of file mediacodec_wrapper.c.
Referenced by ff_mediacodec_dec_receive().
int ff_Build_SDK_INT | ( | AVCodecContext * | avctx | ) |
Definition at line 1696 of file mediacodec_wrapper.c.
Referenced by mediacodec_decode_init().
|
static |
Definition at line 71 of file mediacodec_wrapper.c.
Referenced by ff_AMediaCodecList_getCodecNameByType(), and ff_AMediaCodecProfile_getProfileFromAVCodecContext().
|
static |
Definition at line 132 of file mediacodec_wrapper.c.
Referenced by ff_AMediaCodecList_getCodecNameByType(), ff_AMediaFormat_delete(), ff_AMediaFormat_new(), and ff_AMediaFormat_newFromObject().
|
static |
Definition at line 156 of file mediacodec_wrapper.c.
Referenced by ff_AMediaFormat_new(), and ff_AMediaFormat_newFromObject().
|
static |
Definition at line 219 of file mediacodec_wrapper.c.
Referenced by codec_create(), and ff_AMediaCodec_delete().
|
static |
Definition at line 268 of file mediacodec_wrapper.c.
Referenced by codec_create().