FFmpeg
Data Structures | Macros | Functions | Variables
mediacodecdec.c File Reference
#include "config_components.h"
#include <stdint.h>
#include <string.h>
#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/opt.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/pixfmt.h"
#include "libavutil/internal.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "decode.h"
#include "h264_parse.h"
#include "h264_ps.h"
#include "hevc_parse.h"
#include "hwconfig.h"
#include "internal.h"
#include "mediacodec_wrapper.h"
#include "mediacodecdec_common.h"

Go to the source code of this file.

Data Structures

struct  MediaCodecH264DecContext
 

Macros

#define OFFSET(x)   offsetof(MediaCodecH264DecContext, x)
 
#define VD   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
 
#define DECLARE_MEDIACODEC_VCLASS(short_name)
 
#define DECLARE_MEDIACODEC_VDEC(short_name, full_name, codec_id, bsf)
 

Functions

static av_cold int mediacodec_decode_close (AVCodecContext *avctx)
 
static av_cold int mediacodec_decode_init (AVCodecContext *avctx)
 
static int mediacodec_receive_frame (AVCodecContext *avctx, AVFrame *frame)
 
static void mediacodec_decode_flush (AVCodecContext *avctx)
 

Variables

static const AVCodecHWConfigInternal *const mediacodec_hw_configs []
 
static const AVOption ff_mediacodec_vdec_options []
 

Macro Definition Documentation

◆ OFFSET

#define OFFSET (   x)    offsetof(MediaCodecH264DecContext, x)

Definition at line 517 of file mediacodecdec.c.

◆ VD

Definition at line 518 of file mediacodecdec.c.

◆ DECLARE_MEDIACODEC_VCLASS

#define DECLARE_MEDIACODEC_VCLASS (   short_name)
Value:
static const AVClass ff_##short_name##_mediacodec_dec_class = { \
.class_name = #short_name "_mediacodec", \
.item_name = av_default_item_name, \
.version = LIBAVUTIL_VERSION_INT, \
};

Definition at line 525 of file mediacodecdec.c.

◆ DECLARE_MEDIACODEC_VDEC

#define DECLARE_MEDIACODEC_VDEC (   short_name,
  full_name,
  codec_id,
  bsf 
)
Value:
const FFCodec ff_ ## short_name ## _mediacodec_decoder = { \
.p.name = #short_name "_mediacodec", \
.p.long_name = NULL_IF_CONFIG_SMALL(full_name " Android MediaCodec decoder"), \
.p.type = AVMEDIA_TYPE_VIDEO, \
.p.id = codec_id, \
.p.priv_class = &ff_##short_name##_mediacodec_dec_class, \
.priv_data_size = sizeof(MediaCodecH264DecContext), \
.caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, \
.bsfs = bsf, \
.hw_configs = mediacodec_hw_configs, \
.p.wrapper_name = "mediacodec", \
}; \

Definition at line 533 of file mediacodecdec.c.

Function Documentation

◆ mediacodec_decode_close()

static av_cold int mediacodec_decode_close ( AVCodecContext avctx)
static

Definition at line 59 of file mediacodecdec.c.

Referenced by mediacodec_decode_init().

◆ mediacodec_decode_init()

static av_cold int mediacodec_decode_init ( AVCodecContext avctx)
static

Definition at line 303 of file mediacodecdec.c.

◆ mediacodec_receive_frame()

static int mediacodec_receive_frame ( AVCodecContext avctx,
AVFrame frame 
)
static

Definition at line 421 of file mediacodecdec.c.

◆ mediacodec_decode_flush()

static void mediacodec_decode_flush ( AVCodecContext avctx)
static

Definition at line 495 of file mediacodecdec.c.

Variable Documentation

◆ mediacodec_hw_configs

const AVCodecHWConfigInternal* const mediacodec_hw_configs[]
static
Initial value:

Definition at line 504 of file mediacodecdec.c.

◆ ff_mediacodec_vdec_options

const AVOption ff_mediacodec_vdec_options[]
static
Initial value:
= {
{ "delay_flush", "Delay flush until hw output buffers are returned to the decoder",
OFFSET(delay_flush), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VD },
{ NULL }
}

Definition at line 519 of file mediacodecdec.c.

mediacodec_receive_frame
static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Definition: mediacodecdec.c:421
AV_CODEC_CAP_HARDWARE
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
Definition: codec.h:162
mediacodec_decode_init
static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
Definition: mediacodecdec.c:303
AV_HWDEVICE_TYPE_MEDIACODEC
@ AV_HWDEVICE_TYPE_MEDIACODEC
Definition: hwcontext.h:38
FFCodec
Definition: codec_internal.h:112
init
static int init
Definition: av_tx.c:47
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:116
OFFSET
#define OFFSET(x)
Definition: mediacodecdec.c:517
codec_id
enum AVCodecID codec_id
Definition: vaapi_decode.c:371
AV_PIX_FMT_MEDIACODEC
@ AV_PIX_FMT_MEDIACODEC
hardware decoding through MediaCodec
Definition: pixfmt.h:285
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
NULL
#define NULL
Definition: coverity.c:32
AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX
@ AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX
The codec supports this format via the hw_device_ctx interface.
Definition: codec.h:318
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:116
VD
#define VD
Definition: mediacodecdec.c:518
MediaCodecH264DecContext
Definition: mediacodecdec.c:46
DECLARE_MEDIACODEC_VCLASS
#define DECLARE_MEDIACODEC_VCLASS(short_name)
Definition: mediacodecdec.c:525
AVCodecHWConfigInternal
Definition: hwconfig.h:29
mediacodec_decode_flush
static void mediacodec_decode_flush(AVCodecContext *avctx)
Definition: mediacodecdec.c:495
AV_CODEC_HW_CONFIG_METHOD_AD_HOC
@ AV_CODEC_HW_CONFIG_METHOD_AD_HOC
The codec supports this format by some ad-hoc method.
Definition: codec.h:347
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:203
FF_CODEC_CAP_SETS_PKT_DTS
#define FF_CODEC_CAP_SETS_PKT_DTS
Decoders marked with FF_CODEC_CAP_SETS_PKT_DTS want to set AVFrame.pkt_dts manually.
Definition: codec_internal.h:46
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:71
FF_CODEC_RECEIVE_FRAME_CB
#define FF_CODEC_RECEIVE_FRAME_CB(func)
Definition: codec_internal.h:260
AV_CODEC_CAP_DELAY
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: codec.h:82
ff_mediacodec_vdec_options
static const AVOption ff_mediacodec_vdec_options[]
Definition: mediacodecdec.c:519
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:244
AV_CODEC_CAP_AVOID_PROBING
#define AV_CODEC_CAP_AVOID_PROBING
Decoder is not a preferred choice for probing.
Definition: codec.h:144
mediacodec_hw_configs
static const AVCodecHWConfigInternal *const mediacodec_hw_configs[]
Definition: mediacodecdec.c:504
mediacodec_decode_close
static av_cold int mediacodec_decode_close(AVCodecContext *avctx)
Definition: mediacodecdec.c:59