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

Go to the source code of this file.

Data Structures

struct   FFAMediaFormat
 
 
struct   FFAMediaCodec
 

Typedefs

 

Enumerations

 
 
 

Functions

  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)
 
 
 
 
 
 
 
static int  ff_AMediaFormat_getBuffer (FFAMediaFormat *format, const char *name, void **data, size_t *size)
 
static int  ff_AMediaFormat_getString (FFAMediaFormat *format, const char *name, const char **out)
 
static int  ff_AMediaFormat_getRect (FFAMediaFormat *format, const char *name, int32_t *left, int32_t *top, int32_t *right, int32_t *bottom)
 
 
 
 
static void  ff_AMediaFormat_setString (FFAMediaFormat *format, const char *name, const char *value)
 
static void  ff_AMediaFormat_setBuffer (FFAMediaFormat *format, const char *name, void *data, size_t size)
 
static void  ff_AMediaFormat_setRect (FFAMediaFormat *format, const char *name, int32_t left, int32_t top, int32_t right, int32_t bottom)
 
static char *  ff_AMediaCodec_getName (FFAMediaCodec *codec)
 
 
FFAMediaCodecff_AMediaCodec_createDecoderByType (const char *mime_type, int ndk)
 
FFAMediaCodecff_AMediaCodec_createEncoderByType (const char *mime_type, int ndk)
 
static int  ff_AMediaCodec_configure (FFAMediaCodec *codec, const FFAMediaFormat *format, FFANativeWindow *surface, void *crypto, uint32_t flags)
 
static int  ff_AMediaCodec_start (FFAMediaCodec *codec)
 
static int  ff_AMediaCodec_stop (FFAMediaCodec *codec)
 
static int  ff_AMediaCodec_flush (FFAMediaCodec *codec)
 
static int  ff_AMediaCodec_delete (FFAMediaCodec *codec)
 
static uint8_t *  ff_AMediaCodec_getInputBuffer (FFAMediaCodec *codec, size_t idx, size_t *out_size)
 
static uint8_t *  ff_AMediaCodec_getOutputBuffer (FFAMediaCodec *codec, size_t idx, size_t *out_size)
 
static ssize_t  ff_AMediaCodec_dequeueInputBuffer (FFAMediaCodec *codec, int64_t timeoutUs)
 
static int  ff_AMediaCodec_queueInputBuffer (FFAMediaCodec *codec, size_t idx, off_t offset, size_t size, uint64_t time, uint32_t flags)
 
 
 
static int  ff_AMediaCodec_releaseOutputBuffer (FFAMediaCodec *codec, size_t idx, int render)
 
static int  ff_AMediaCodec_releaseOutputBufferAtTime (FFAMediaCodec *codec, size_t idx, int64_t timestampNs)
 
static int  ff_AMediaCodec_infoTryAgainLater (FFAMediaCodec *codec, ssize_t idx)
 
static int  ff_AMediaCodec_infoOutputBuffersChanged (FFAMediaCodec *codec, ssize_t idx)
 
static int  ff_AMediaCodec_infoOutputFormatChanged (FFAMediaCodec *codec, ssize_t idx)
 
 
 
 
 
 
 
 
  Map MediaFormat color range to AVColorRange. More...
 
  Map AVColorRange to MediaFormat color range. More...
 
  Map MediaFormat color standard to AVColorSpace. More...
 
  Map AVColorSpace to MediaFormat color standard. More...
 
  Map MediaFormat color standard to AVColorPrimaries. More...
 
  Map MediaFormat color transfer to AVColorTransferCharacteristic. More...
 
  Map AVColorTransferCharacteristic to MediaFormat color transfer. More...
 

Typedef Documentation

FFAMediaCodecCryptoInfo

Definition at line 170 of file mediacodec_wrapper.h.

Enumeration Type Documentation

FFAMediaFormatColorRange

Enumerator
COLOR_RANGE_UNSPECIFIED 
COLOR_RANGE_FULL 
COLOR_RANGE_LIMITED 

Definition at line 348 of file mediacodec_wrapper.h.

FFAMediaFormatColorStandard

Enumerator
COLOR_STANDARD_UNSPECIFIED 
COLOR_STANDARD_BT709 
COLOR_STANDARD_BT601_PAL 
COLOR_STANDARD_BT601_NTSC 
COLOR_STANDARD_BT2020 

Definition at line 354 of file mediacodec_wrapper.h.

FFAMediaFormatColorTransfer

Enumerator
COLOR_TRANSFER_UNSPECIFIED 
COLOR_TRANSFER_LINEAR 
COLOR_TRANSFER_SDR_VIDEO 
COLOR_TRANSFER_ST2084 
COLOR_TRANSFER_HLG 

Definition at line 362 of file mediacodec_wrapper.h.

Function Documentation

ff_AMediaCodecProfile_getProfileFromAVCodecContext()

int ff_AMediaCodecProfile_getProfileFromAVCodecContext ( AVCodecContextavctx )

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

Referenced by mediacodec_dec_get_video_codec(), and mediacodec_init().

ff_AMediaCodecList_getCodecNameByType()

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

Definition at line 470 of file mediacodec_wrapper.c.

Referenced by mediacodec_dec_get_video_codec().

ff_AMediaFormat_new()

FFAMediaFormat* ff_AMediaFormat_new ( int  ndk )

Definition at line 2401 of file mediacodec_wrapper.c.

Referenced by mediacodec_decode_init(), and mediacodec_init().

ff_AMediaFormat_delete()

static int ff_AMediaFormat_delete ( FFAMediaFormatformat )
inlinestatic

Definition at line 92 of file mediacodec_wrapper.h.

Referenced by ff_mediacodec_dec_receive(), ff_mediacodec_dec_unref(), mediacodec_decode_init(), mediacodec_init(), and mediacodec_output_format().

ff_AMediaFormat_toString()

static char* ff_AMediaFormat_toString ( FFAMediaFormatformat )
inlinestatic

ff_AMediaFormat_getInt32()

static int ff_AMediaFormat_getInt32 ( FFAMediaFormatformat,
const char *  name,
int32_tout 
)
inlinestatic

Definition at line 102 of file mediacodec_wrapper.h.

ff_AMediaFormat_getInt64()

static int ff_AMediaFormat_getInt64 ( FFAMediaFormatformat,
const char *  name,
int64_tout 
)
inlinestatic

Definition at line 107 of file mediacodec_wrapper.h.

ff_AMediaFormat_getFloat()

static int ff_AMediaFormat_getFloat ( FFAMediaFormatformat,
const char *  name,
floatout 
)
inlinestatic

Definition at line 112 of file mediacodec_wrapper.h.

ff_AMediaFormat_getBuffer()

static int ff_AMediaFormat_getBuffer ( FFAMediaFormatformat,
const char *  name,
void **  data,
size_t *  size 
)
inlinestatic

Definition at line 117 of file mediacodec_wrapper.h.

ff_AMediaFormat_getString()

static int ff_AMediaFormat_getString ( FFAMediaFormatformat,
const char *  name,
const char **  out 
)
inlinestatic

Definition at line 122 of file mediacodec_wrapper.h.

ff_AMediaFormat_getRect()

static int ff_AMediaFormat_getRect ( FFAMediaFormatformat,
const char *  name,
int32_tleft,
int32_ttop,
int32_tright,
int32_tbottom 
)
inlinestatic

Definition at line 127 of file mediacodec_wrapper.h.

Referenced by mediacodec_dec_parse_video_format().

ff_AMediaFormat_setInt32()

static void ff_AMediaFormat_setInt32 ( FFAMediaFormatformat,
const char *  name,
int32_t  value 
)
inlinestatic

Definition at line 135 of file mediacodec_wrapper.h.

Referenced by mediacodec_decode_init(), and mediacodec_init().

ff_AMediaFormat_setInt64()

static void ff_AMediaFormat_setInt64 ( FFAMediaFormatformat,
const char *  name,
int64_t  value 
)
inlinestatic

Definition at line 140 of file mediacodec_wrapper.h.

ff_AMediaFormat_setFloat()

static void ff_AMediaFormat_setFloat ( FFAMediaFormatformat,
const char *  name,
float  value 
)
inlinestatic

Definition at line 145 of file mediacodec_wrapper.h.

ff_AMediaFormat_setString()

static void ff_AMediaFormat_setString ( FFAMediaFormatformat,
const char *  name,
const char *  value 
)
inlinestatic

Definition at line 150 of file mediacodec_wrapper.h.

Referenced by mediacodec_decode_init(), and mediacodec_init().

ff_AMediaFormat_setBuffer()

static void ff_AMediaFormat_setBuffer ( FFAMediaFormatformat,
const char *  name,
void *  data,
size_t  size 
)
inlinestatic

Definition at line 155 of file mediacodec_wrapper.h.

ff_AMediaFormat_setRect()

static void ff_AMediaFormat_setRect ( FFAMediaFormatformat,
const char *  name,
int32_t  left,
int32_t  top,
int32_t  right,
int32_t  bottom 
)
inlinestatic

Definition at line 160 of file mediacodec_wrapper.h.

ff_AMediaCodec_getName()

static char* ff_AMediaCodec_getName ( FFAMediaCodeccodec )
inlinestatic

ff_AMediaCodec_createCodecByName()

FFAMediaCodec* ff_AMediaCodec_createCodecByName ( const char *  name,
int  ndk 
)

Definition at line 2408 of file mediacodec_wrapper.c.

Referenced by mediacodec_dec_get_video_codec(), and mediacodec_init().

ff_AMediaCodec_createDecoderByType()

FFAMediaCodec* ff_AMediaCodec_createDecoderByType ( const char *  mime_type,
int  ndk 
)

ff_AMediaCodec_createEncoderByType()

FFAMediaCodec* ff_AMediaCodec_createEncoderByType ( const char *  mime_type,
int  ndk 
)

Definition at line 2422 of file mediacodec_wrapper.c.

Referenced by mediacodec_init().

ff_AMediaCodec_configure()

static int ff_AMediaCodec_configure ( FFAMediaCodeccodec,
const FFAMediaFormatformat,
FFANativeWindowsurface,
void *  crypto,
uint32_t  flags 
)
inlinestatic

Definition at line 233 of file mediacodec_wrapper.h.

Referenced by ff_mediacodec_dec_init(), and mediacodec_init().

ff_AMediaCodec_start()

static int ff_AMediaCodec_start ( FFAMediaCodeccodec )
inlinestatic

Definition at line 241 of file mediacodec_wrapper.h.

Referenced by ff_mediacodec_dec_init(), and mediacodec_init().

ff_AMediaCodec_stop()

static int ff_AMediaCodec_stop ( FFAMediaCodeccodec )
inlinestatic

Definition at line 246 of file mediacodec_wrapper.h.

Referenced by ff_mediacodec_dec_close(), and mediacodec_close().

ff_AMediaCodec_flush()

static int ff_AMediaCodec_flush ( FFAMediaCodeccodec )
inlinestatic

ff_AMediaCodec_delete()

static int ff_AMediaCodec_delete ( FFAMediaCodeccodec )
inlinestatic

Definition at line 256 of file mediacodec_wrapper.h.

Referenced by ff_mediacodec_dec_unref(), and mediacodec_close().

ff_AMediaCodec_getInputBuffer()

static uint8_t* ff_AMediaCodec_getInputBuffer ( FFAMediaCodeccodec,
size_t  idx,
size_t *  out_size 
)
inlinestatic

Definition at line 261 of file mediacodec_wrapper.h.

Referenced by ff_mediacodec_dec_send(), and mediacodec_send().

ff_AMediaCodec_getOutputBuffer()

static uint8_t* ff_AMediaCodec_getOutputBuffer ( FFAMediaCodeccodec,
size_t  idx,
size_t *  out_size 
)
inlinestatic

Definition at line 266 of file mediacodec_wrapper.h.

Referenced by ff_mediacodec_dec_receive(), and mediacodec_receive().

ff_AMediaCodec_dequeueInputBuffer()

static ssize_t ff_AMediaCodec_dequeueInputBuffer ( FFAMediaCodeccodec,
int64_t  timeoutUs 
)
inlinestatic

ff_AMediaCodec_queueInputBuffer()

static int ff_AMediaCodec_queueInputBuffer ( FFAMediaCodeccodec,
size_t  idx,
off_t  offset,
size_t  size,
uint64_t  time,
uint32_t  flags 
)
inlinestatic

Definition at line 276 of file mediacodec_wrapper.h.

Referenced by ff_mediacodec_dec_send(), and mediacodec_send().

ff_AMediaCodec_dequeueOutputBuffer()

static ssize_t ff_AMediaCodec_dequeueOutputBuffer ( FFAMediaCodeccodec,
int64_t  timeoutUs 
)
inlinestatic

Definition at line 281 of file mediacodec_wrapper.h.

Referenced by ff_mediacodec_dec_receive(), and mediacodec_receive().

ff_AMediaCodec_getOutputFormat()

static FFAMediaFormat* ff_AMediaCodec_getOutputFormat ( FFAMediaCodeccodec )
inlinestatic

ff_AMediaCodec_releaseOutputBuffer()

static int ff_AMediaCodec_releaseOutputBuffer ( FFAMediaCodeccodec,
size_t  idx,
int  render 
)
inlinestatic

ff_AMediaCodec_releaseOutputBufferAtTime()

static int ff_AMediaCodec_releaseOutputBufferAtTime ( FFAMediaCodeccodec,
size_t  idx,
int64_t  timestampNs 
)
inlinestatic

Definition at line 296 of file mediacodec_wrapper.h.

ff_AMediaCodec_infoTryAgainLater()

static int ff_AMediaCodec_infoTryAgainLater ( FFAMediaCodeccodec,
ssize_t  idx 
)
inlinestatic

ff_AMediaCodec_infoOutputBuffersChanged()

static int ff_AMediaCodec_infoOutputBuffersChanged ( FFAMediaCodeccodec,
ssize_t  idx 
)
inlinestatic

Definition at line 306 of file mediacodec_wrapper.h.

Referenced by ff_mediacodec_dec_receive(), and mediacodec_receive().

ff_AMediaCodec_infoOutputFormatChanged()

static int ff_AMediaCodec_infoOutputFormatChanged ( FFAMediaCodeccodec,
ssize_t  idx 
)
inlinestatic

Definition at line 311 of file mediacodec_wrapper.h.

Referenced by ff_mediacodec_dec_receive(), and mediacodec_receive().

ff_AMediaCodec_getBufferFlagCodecConfig()

static int ff_AMediaCodec_getBufferFlagCodecConfig ( FFAMediaCodeccodec )
inlinestatic

Definition at line 316 of file mediacodec_wrapper.h.

Referenced by mediacodec_receive().

ff_AMediaCodec_getBufferFlagEndOfStream()

static int ff_AMediaCodec_getBufferFlagEndOfStream ( FFAMediaCodeccodec )
inlinestatic

ff_AMediaCodec_getBufferFlagKeyFrame()

static int ff_AMediaCodec_getBufferFlagKeyFrame ( FFAMediaCodeccodec )
inlinestatic

Definition at line 326 of file mediacodec_wrapper.h.

Referenced by mediacodec_receive().

ff_AMediaCodec_getConfigureFlagEncode()

static int ff_AMediaCodec_getConfigureFlagEncode ( FFAMediaCodeccodec )
inlinestatic

Definition at line 331 of file mediacodec_wrapper.h.

Referenced by mediacodec_init().

ff_AMediaCodec_cleanOutputBuffers()

static int ff_AMediaCodec_cleanOutputBuffers ( FFAMediaCodeccodec )
inlinestatic

Definition at line 336 of file mediacodec_wrapper.h.

Referenced by ff_mediacodec_dec_receive(), and mediacodec_receive().

ff_AMediaCodec_signalEndOfInputStream()

static int ff_AMediaCodec_signalEndOfInputStream ( FFAMediaCodeccodec )
inlinestatic

Definition at line 341 of file mediacodec_wrapper.h.

Referenced by mediacodec_send().

ff_Build_SDK_INT()

int ff_Build_SDK_INT ( AVCodecContextavctx )

Definition at line 2429 of file mediacodec_wrapper.c.

Referenced by mediacodec_decode_init().

ff_AMediaFormatColorRange_to_AVColorRange()

enum AVColorRange ff_AMediaFormatColorRange_to_AVColorRange ( int  color_range )

Map MediaFormat color range to AVColorRange.

return AVCOL_RANGE_UNSPECIFIED when failed.

Definition at line 2500 of file mediacodec_wrapper.c.

Referenced by mediacodec_dec_parse_video_format().

ff_AMediaFormatColorRange_from_AVColorRange()

int ff_AMediaFormatColorRange_from_AVColorRange ( enum AVColorRange  color_range )

Map AVColorRange to MediaFormat color range.

return COLOR_RANGE_UNSPECIFIED when failed.

Definition at line 2509 of file mediacodec_wrapper.c.

Referenced by mediacodec_init().

ff_AMediaFormatColorStandard_to_AVColorSpace()

enum AVColorSpace ff_AMediaFormatColorStandard_to_AVColorSpace ( int  color_standard )

Map MediaFormat color standard to AVColorSpace.

return AVCOL_SPC_UNSPECIFIED when failed.

Definition at line 2517 of file mediacodec_wrapper.c.

Referenced by mediacodec_dec_parse_video_format().

ff_AMediaFormatColorStandard_from_AVColorSpace()

int ff_AMediaFormatColorStandard_from_AVColorSpace ( enum AVColorSpace  color_space )

Map AVColorSpace to MediaFormat color standard.

return COLOR_STANDARD_UNSPECIFIED when failed.

Definition at line 2526 of file mediacodec_wrapper.c.

Referenced by mediacodec_init().

ff_AMediaFormatColorStandard_to_AVColorPrimaries()

enum AVColorPrimaries ff_AMediaFormatColorStandard_to_AVColorPrimaries ( int  color_standard )

Map MediaFormat color standard to AVColorPrimaries.

return AVCOL_PRI_UNSPECIFIED when failed.

Definition at line 2535 of file mediacodec_wrapper.c.

Referenced by mediacodec_dec_parse_video_format().

ff_AMediaFormatColorTransfer_to_AVColorTransfer()

enum AVColorTransferCharacteristic ff_AMediaFormatColorTransfer_to_AVColorTransfer ( int  color_transfer )

Map MediaFormat color transfer to AVColorTransferCharacteristic.

return AVCOL_TRC_UNSPECIFIED when failed.

Definition at line 2545 of file mediacodec_wrapper.c.

Referenced by mediacodec_dec_parse_video_format().

ff_AMediaFormatColorTransfer_from_AVColorTransfer()

int ff_AMediaFormatColorTransfer_from_AVColorTransfer ( enum AVColorTransferCharacteristic  color_transfer )

Map AVColorTransferCharacteristic to MediaFormat color transfer.

return COLOR_TRANSFER_UNSPECIFIED when failed.

Definition at line 2554 of file mediacodec_wrapper.c.

Referenced by mediacodec_init().


Generated on Fri Aug 22 2025 13:59:55 for FFmpeg by   doxygen 1.8.17

AltStyle によって変換されたページ (->オリジナル) /