FFmpeg
Data Structures | Typedefs | Functions
mediacodec_wrapper.h File Reference
#include <stdint.h>
#include <sys/types.h>
#include "avcodec.h"

Go to the source code of this file.

Data Structures

struct  FFAMediaCodecBufferInfo
 

Typedefs

typedef struct FFAMediaCodecCryptoInfo FFAMediaCodecCryptoInfo
 

Functions

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. More...
 
char * ff_AMediaCodecList_getCodecNameByType (const char *mime, int profile, int encoder, void *log_ctx)
 
FFAMediaFormatff_AMediaFormat_new (void)
 
int ff_AMediaFormat_delete (FFAMediaFormat *format)
 
char * ff_AMediaFormat_toString (FFAMediaFormat *format)
 
int ff_AMediaFormat_getInt32 (FFAMediaFormat *format, const char *name, int32_t *out)
 
int ff_AMediaFormat_getInt64 (FFAMediaFormat *format, const char *name, int64_t *out)
 
int ff_AMediaFormat_getFloat (FFAMediaFormat *format, const char *name, float *out)
 
int ff_AMediaFormat_getBuffer (FFAMediaFormat *format, const char *name, void **data, size_t *size)
 
int ff_AMediaFormat_getString (FFAMediaFormat *format, const char *name, const char **out)
 
void ff_AMediaFormat_setInt32 (FFAMediaFormat *format, const char *name, int32_t value)
 
void ff_AMediaFormat_setInt64 (FFAMediaFormat *format, const char *name, int64_t value)
 
void ff_AMediaFormat_setFloat (FFAMediaFormat *format, const char *name, float value)
 
void ff_AMediaFormat_setString (FFAMediaFormat *format, const char *name, const char *value)
 
void ff_AMediaFormat_setBuffer (FFAMediaFormat *format, const char *name, void *data, size_t size)
 
char * ff_AMediaCodec_getName (FFAMediaCodec *codec)
 
FFAMediaCodecff_AMediaCodec_createCodecByName (const char *name)
 
FFAMediaCodecff_AMediaCodec_createDecoderByType (const char *mime_type)
 
FFAMediaCodecff_AMediaCodec_createEncoderByType (const char *mime_type)
 
int ff_AMediaCodec_configure (FFAMediaCodec *codec, const FFAMediaFormat *format, void *surface, void *crypto, uint32_t flags)
 
int ff_AMediaCodec_start (FFAMediaCodec *codec)
 
int ff_AMediaCodec_stop (FFAMediaCodec *codec)
 
int ff_AMediaCodec_flush (FFAMediaCodec *codec)
 
int ff_AMediaCodec_delete (FFAMediaCodec *codec)
 
uint8_tff_AMediaCodec_getInputBuffer (FFAMediaCodec *codec, size_t idx, size_t *out_size)
 
uint8_tff_AMediaCodec_getOutputBuffer (FFAMediaCodec *codec, size_t idx, size_t *out_size)
 
ssize_t ff_AMediaCodec_dequeueInputBuffer (FFAMediaCodec *codec, int64_t timeoutUs)
 
int ff_AMediaCodec_queueInputBuffer (FFAMediaCodec *codec, size_t idx, off_t offset, size_t size, uint64_t time, uint32_t flags)
 
ssize_t ff_AMediaCodec_dequeueOutputBuffer (FFAMediaCodec *codec, FFAMediaCodecBufferInfo *info, int64_t timeoutUs)
 
FFAMediaFormatff_AMediaCodec_getOutputFormat (FFAMediaCodec *codec)
 
int ff_AMediaCodec_releaseOutputBuffer (FFAMediaCodec *codec, size_t idx, int render)
 
int ff_AMediaCodec_releaseOutputBufferAtTime (FFAMediaCodec *codec, size_t idx, int64_t timestampNs)
 
int ff_AMediaCodec_infoTryAgainLater (FFAMediaCodec *codec, ssize_t idx)
 
int ff_AMediaCodec_infoOutputBuffersChanged (FFAMediaCodec *codec, ssize_t idx)
 
int ff_AMediaCodec_infoOutputFormatChanged (FFAMediaCodec *codec, ssize_t indx)
 
int ff_AMediaCodec_getBufferFlagCodecConfig (FFAMediaCodec *codec)
 
int ff_AMediaCodec_getBufferFlagEndOfStream (FFAMediaCodec *codec)
 
int ff_AMediaCodec_getBufferFlagKeyFrame (FFAMediaCodec *codec)
 
int ff_AMediaCodec_getConfigureFlagEncode (FFAMediaCodec *codec)
 
int ff_AMediaCodec_cleanOutputBuffers (FFAMediaCodec *codec)
 
int ff_Build_SDK_INT (AVCodecContext *avctx)
 

Typedef Documentation

◆ FFAMediaCodecCryptoInfo

Definition at line 83 of file mediacodec_wrapper.h.

Function Documentation

◆ ff_AMediaCodecProfile_getProfileFromAVCodecContext()

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 315 of file mediacodec_wrapper.c.

Referenced by ff_mediacodec_dec_init().

◆ ff_AMediaCodecList_getCodecNameByType()

char* ff_AMediaCodecList_getCodecNameByType ( const char *  mime,
int  profile,
int  encoder,
void *  log_ctx 
)

Definition at line 384 of file mediacodec_wrapper.c.

Referenced by ff_mediacodec_dec_init().

◆ ff_AMediaFormat_new()

FFAMediaFormat* ff_AMediaFormat_new ( void  )

Definition at line 626 of file mediacodec_wrapper.c.

Referenced by mediacodec_decode_init().

◆ ff_AMediaFormat_delete()

int ff_AMediaFormat_delete ( FFAMediaFormat format)

◆ ff_AMediaFormat_toString()

char* ff_AMediaFormat_toString ( FFAMediaFormat format)

◆ ff_AMediaFormat_getInt32()

int ff_AMediaFormat_getInt32 ( FFAMediaFormat format,
const char *  name,
int32_t out 
)

Definition at line 753 of file mediacodec_wrapper.c.

◆ ff_AMediaFormat_getInt64()

int ff_AMediaFormat_getInt64 ( FFAMediaFormat format,
const char *  name,
int64_t *  out 
)

Definition at line 792 of file mediacodec_wrapper.c.

◆ ff_AMediaFormat_getFloat()

int ff_AMediaFormat_getFloat ( FFAMediaFormat format,
const char *  name,
float *  out 
)

Definition at line 831 of file mediacodec_wrapper.c.

◆ ff_AMediaFormat_getBuffer()

int ff_AMediaFormat_getBuffer ( FFAMediaFormat format,
const char *  name,
void **  data,
size_t *  size 
)

Definition at line 870 of file mediacodec_wrapper.c.

◆ ff_AMediaFormat_getString()

int ff_AMediaFormat_getString ( FFAMediaFormat format,
const char *  name,
const char **  out 
)

Definition at line 928 of file mediacodec_wrapper.c.

◆ ff_AMediaFormat_setInt32()

void ff_AMediaFormat_setInt32 ( FFAMediaFormat format,
const char *  name,
int32_t  value 
)

Definition at line 978 of file mediacodec_wrapper.c.

Referenced by mediacodec_decode_init().

◆ ff_AMediaFormat_setInt64()

void ff_AMediaFormat_setInt64 ( FFAMediaFormat format,
const char *  name,
int64_t  value 
)

Definition at line 1003 of file mediacodec_wrapper.c.

◆ ff_AMediaFormat_setFloat()

void ff_AMediaFormat_setFloat ( FFAMediaFormat format,
const char *  name,
float  value 
)

Definition at line 1028 of file mediacodec_wrapper.c.

◆ ff_AMediaFormat_setString()

void ff_AMediaFormat_setString ( FFAMediaFormat format,
const char *  name,
const char *  value 
)

Definition at line 1053 of file mediacodec_wrapper.c.

Referenced by mediacodec_decode_init().

◆ ff_AMediaFormat_setBuffer()

void ff_AMediaFormat_setBuffer ( FFAMediaFormat format,
const char *  name,
void *  data,
size_t  size 
)

Definition at line 1088 of file mediacodec_wrapper.c.

◆ ff_AMediaCodec_getName()

char* ff_AMediaCodec_getName ( FFAMediaCodec codec)

Definition at line 1339 of file mediacodec_wrapper.c.

◆ ff_AMediaCodec_createCodecByName()

FFAMediaCodec* ff_AMediaCodec_createCodecByName ( const char *  name)

Referenced by ff_mediacodec_dec_init().

◆ ff_AMediaCodec_createDecoderByType()

FFAMediaCodec* ff_AMediaCodec_createDecoderByType ( const char *  mime_type)

◆ ff_AMediaCodec_createEncoderByType()

FFAMediaCodec* ff_AMediaCodec_createEncoderByType ( const char *  mime_type)

◆ ff_AMediaCodec_configure()

int ff_AMediaCodec_configure ( FFAMediaCodec codec,
const FFAMediaFormat format,
void *  surface,
void *  crypto,
uint32_t  flags 
)

Definition at line 1362 of file mediacodec_wrapper.c.

Referenced by ff_mediacodec_dec_init().

◆ ff_AMediaCodec_start()

int ff_AMediaCodec_start ( FFAMediaCodec codec)

Definition at line 1379 of file mediacodec_wrapper.c.

Referenced by ff_mediacodec_dec_init().

◆ ff_AMediaCodec_stop()

int ff_AMediaCodec_stop ( FFAMediaCodec codec)

Definition at line 1396 of file mediacodec_wrapper.c.

◆ ff_AMediaCodec_flush()

int ff_AMediaCodec_flush ( FFAMediaCodec codec)

Definition at line 1413 of file mediacodec_wrapper.c.

Referenced by mediacodec_dec_flush_codec().

◆ ff_AMediaCodec_delete()

int ff_AMediaCodec_delete ( FFAMediaCodec codec)

Definition at line 1303 of file mediacodec_wrapper.c.

Referenced by ff_mediacodec_dec_unref().

◆ ff_AMediaCodec_getInputBuffer()

uint8_t* ff_AMediaCodec_getInputBuffer ( FFAMediaCodec codec,
size_t  idx,
size_t *  out_size 
)

Definition at line 1533 of file mediacodec_wrapper.c.

Referenced by ff_mediacodec_dec_send().

◆ ff_AMediaCodec_getOutputBuffer()

uint8_t* ff_AMediaCodec_getOutputBuffer ( FFAMediaCodec codec,
size_t  idx,
size_t *  out_size 
)

Definition at line 1581 of file mediacodec_wrapper.c.

Referenced by ff_mediacodec_dec_receive().

◆ ff_AMediaCodec_dequeueInputBuffer()

ssize_t ff_AMediaCodec_dequeueInputBuffer ( FFAMediaCodec codec,
int64_t  timeoutUs 
)

Definition at line 1464 of file mediacodec_wrapper.c.

Referenced by ff_mediacodec_dec_send(), and mediacodec_receive_frame().

◆ ff_AMediaCodec_queueInputBuffer()

int ff_AMediaCodec_queueInputBuffer ( FFAMediaCodec codec,
size_t  idx,
off_t  offset,
size_t  size,
uint64_t  time,
uint32_t  flags 
)

Definition at line 1481 of file mediacodec_wrapper.c.

Referenced by ff_mediacodec_dec_send().

◆ ff_AMediaCodec_dequeueOutputBuffer()

ssize_t ff_AMediaCodec_dequeueOutputBuffer ( FFAMediaCodec codec,
FFAMediaCodecBufferInfo info,
int64_t  timeoutUs 
)

Definition at line 1498 of file mediacodec_wrapper.c.

Referenced by ff_mediacodec_dec_receive().

◆ ff_AMediaCodec_getOutputFormat()

FFAMediaFormat* ff_AMediaCodec_getOutputFormat ( FFAMediaCodec codec)

Definition at line 1629 of file mediacodec_wrapper.c.

Referenced by ff_mediacodec_dec_init(), and ff_mediacodec_dec_receive().

◆ ff_AMediaCodec_releaseOutputBuffer()

int ff_AMediaCodec_releaseOutputBuffer ( FFAMediaCodec codec,
size_t  idx,
int  render 
)

◆ ff_AMediaCodec_releaseOutputBufferAtTime()

int ff_AMediaCodec_releaseOutputBufferAtTime ( FFAMediaCodec codec,
size_t  idx,
int64_t  timestampNs 
)

Definition at line 1447 of file mediacodec_wrapper.c.

◆ ff_AMediaCodec_infoTryAgainLater()

int ff_AMediaCodec_infoTryAgainLater ( FFAMediaCodec codec,
ssize_t  idx 
)

Definition at line 1652 of file mediacodec_wrapper.c.

Referenced by ff_mediacodec_dec_receive(), and ff_mediacodec_dec_send().

◆ ff_AMediaCodec_infoOutputBuffersChanged()

int ff_AMediaCodec_infoOutputBuffersChanged ( FFAMediaCodec codec,
ssize_t  idx 
)

Definition at line 1657 of file mediacodec_wrapper.c.

Referenced by ff_mediacodec_dec_receive().

◆ ff_AMediaCodec_infoOutputFormatChanged()

int ff_AMediaCodec_infoOutputFormatChanged ( FFAMediaCodec codec,
ssize_t  indx 
)

Definition at line 1662 of file mediacodec_wrapper.c.

Referenced by ff_mediacodec_dec_receive().

◆ ff_AMediaCodec_getBufferFlagCodecConfig()

int ff_AMediaCodec_getBufferFlagCodecConfig ( FFAMediaCodec codec)

Definition at line 1667 of file mediacodec_wrapper.c.

◆ ff_AMediaCodec_getBufferFlagEndOfStream()

int ff_AMediaCodec_getBufferFlagEndOfStream ( FFAMediaCodec codec)

Definition at line 1672 of file mediacodec_wrapper.c.

Referenced by ff_mediacodec_dec_receive(), and ff_mediacodec_dec_send().

◆ ff_AMediaCodec_getBufferFlagKeyFrame()

int ff_AMediaCodec_getBufferFlagKeyFrame ( FFAMediaCodec codec)

Definition at line 1677 of file mediacodec_wrapper.c.

◆ ff_AMediaCodec_getConfigureFlagEncode()

int ff_AMediaCodec_getConfigureFlagEncode ( FFAMediaCodec codec)

Definition at line 1682 of file mediacodec_wrapper.c.

◆ ff_AMediaCodec_cleanOutputBuffers()

int ff_AMediaCodec_cleanOutputBuffers ( FFAMediaCodec codec)

Definition at line 1687 of file mediacodec_wrapper.c.

Referenced by ff_mediacodec_dec_receive().

◆ ff_Build_SDK_INT()

int ff_Build_SDK_INT ( AVCodecContext avctx)

Definition at line 1710 of file mediacodec_wrapper.c.

Referenced by mediacodec_decode_init().