FFmpeg
Loading...
Searching...
No Matches
amfenc.c File Reference
#include "config.h"
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_amf.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "libavutil/time.h"
#include "amfenc.h"
#include "encode.h"
#include <dlfcn.h>

Go to the source code of this file.

Macros

#define AMF_AV_FRAME_REF   L"av_frame_ref"
 
#define PTS_PROP   L"PtsProp"
 
#define FFMPEG_AMF_WRITER_ID   L"ffmpeg_amf"
 

Functions

static int amf_init_encoder (AVCodecContext *avctx)
 
int av_cold ff_amf_encode_close (AVCodecContext *avctx)
 Common encoder termination function.
 
static int amf_copy_surface (AVCodecContext *avctx, const AVFrame *frame, AMFSurface *surface)
 
static int amf_copy_buffer (AVCodecContext *avctx, AVPacket *pkt, AMFBuffer *buffer)
 
int ff_amf_encode_init (AVCodecContext *avctx)
 Common encoder initization function.
 
static AMF_RESULT amf_set_property_buffer (AMFSurface *object, const wchar_t *name, AMFBuffer *val)
 
static AMF_RESULT amf_store_attached_frame_ref (AMFEncoderContext *ctx, const AVFrame *frame, AMFSurface *surface)
 
static AMF_RESULT amf_release_attached_frame_ref (AMFEncoderContext *ctx, AMFBuffer *buffer)
 
static int amf_submit_frame (AVCodecContext *avctx, AVFrame *frame, AMFSurface **surface_resubmit)
 
static int amf_submit_frame_locked (AVCodecContext *avctx, AVFrame *frame, AMFSurface **surface_resubmit)
 
static AMF_RESULT amf_query_output (AVCodecContext *avctx, AMFBuffer **buffer)
 
int ff_amf_receive_packet (AVCodecContext *avctx, AVPacket *avpkt)
 Ecoding one frame - common function for all AMF encoders.
 

Variables

enum AVPixelFormat ff_amf_pix_fmts []
 Supported formats.
 
static int64_t next_encoder_index = 0
 
const AVCodecHWConfigInternal *const ff_amfenc_hw_configs []
 

Macro Definition Documentation

◆ AMF_AV_FRAME_REF

#define AMF_AV_FRAME_REF   L"av_frame_ref"

Definition at line 39 of file amfenc.c.

Referenced by amf_init_encoder().

◆ PTS_PROP

#define PTS_PROP   L"PtsProp"

Definition at line 40 of file amfenc.c.

Referenced by amf_init_encoder().

◆ FFMPEG_AMF_WRITER_ID

#define FFMPEG_AMF_WRITER_ID   L"ffmpeg_amf"

Definition at line 52 of file amfenc.c.

Referenced by amf_device_create(), and amf_device_uninit().

Function Documentation

◆ amf_init_encoder()

static int amf_init_encoder ( AVCodecContext * avctx)
static

Definition at line 78 of file amfenc.c.

Referenced by ff_amf_encode_init().

◆ ff_amf_encode_close()

int av_cold ff_amf_encode_close ( AVCodecContext * avctx)

Common encoder termination function.

Definition at line 140 of file amfenc.c.

Referenced by ff_amf_encode_init().

◆ amf_copy_surface()

static int amf_copy_surface ( AVCodecContext * avctx,
const AVFrame * frame,
AMFSurface * surface )
static

Definition at line 169 of file amfenc.c.

Referenced by amf_submit_frame().

◆ amf_copy_buffer()

static int amf_copy_buffer ( AVCodecContext * avctx,
AVPacket * pkt,
AMFBuffer * buffer )
static

Definition at line 193 of file amfenc.c.

Referenced by ff_amf_receive_packet().

◆ ff_amf_encode_init()

int ff_amf_encode_init ( AVCodecContext * avctx)

Common encoder initization function.

Definition at line 282 of file amfenc.c.

Referenced by amf_encode_init_av1(), amf_encode_init_h264(), and amf_encode_init_hevc().

◆ amf_set_property_buffer()

static AMF_RESULT amf_set_property_buffer ( AMFSurface * object,
const wchar_t * name,
AMFBuffer * val )
static

Definition at line 346 of file amfenc.c.

Referenced by amf_submit_frame().

◆ amf_store_attached_frame_ref()

static AMF_RESULT amf_store_attached_frame_ref ( AMFEncoderContext * ctx,
const AVFrame * frame,
AMFSurface * surface )
static

Definition at line 368 of file amfenc.c.

Referenced by amf_submit_frame().

◆ amf_release_attached_frame_ref()

static AMF_RESULT amf_release_attached_frame_ref ( AMFEncoderContext * ctx,
AMFBuffer * buffer )
static

Definition at line 380 of file amfenc.c.

Referenced by amf_query_output().

◆ amf_submit_frame()

static int amf_submit_frame ( AVCodecContext * avctx,
AVFrame * frame,
AMFSurface ** surface_resubmit )
static

Definition at line 392 of file amfenc.c.

Referenced by amf_submit_frame_locked().

◆ amf_submit_frame_locked()

static int amf_submit_frame_locked ( AVCodecContext * avctx,
AVFrame * frame,
AMFSurface ** surface_resubmit )
static

Definition at line 547 of file amfenc.c.

Referenced by ff_amf_receive_packet().

◆ amf_query_output()

static AMF_RESULT amf_query_output ( AVCodecContext * avctx,
AMFBuffer ** buffer )
static

Definition at line 562 of file amfenc.c.

Referenced by ff_amf_receive_packet().

◆ ff_amf_receive_packet()

int ff_amf_receive_packet ( AVCodecContext * avctx,
AVPacket * avpkt )

Ecoding one frame - common function for all AMF encoders.

Definition at line 579 of file amfenc.c.

Variable Documentation

◆ ff_amf_pix_fmts

enum AVPixelFormat ff_amf_pix_fmts[]
Initial value:
= {
}
#define AV_PIX_FMT_RGBAF16
Definition pixfmt.h:630
#define AV_PIX_FMT_P010
Definition pixfmt.h:608
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition pixfmt.h:96
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition pixfmt.h:265
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition pixfmt.h:99
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition pixfmt.h:102
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition pixfmt.h:100
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
Definition pixfmt.h:263
@ AV_PIX_FMT_AMF_SURFACE
HW acceleration through AMF.
Definition pixfmt.h:477
#define AV_PIX_FMT_X2BGR10
Definition pixfmt.h:620

Supported formats.

Definition at line 55 of file amfenc.c.

◆ next_encoder_index

int64_t next_encoder_index = 0
static

Definition at line 76 of file amfenc.c.

Referenced by amf_init_encoder().

◆ ff_amfenc_hw_configs

const AVCodecHWConfigInternal* const ff_amfenc_hw_configs[]
Initial value:
= {
HW_CONFIG_ENCODER_FRAMES(AMF_SURFACE, AMF),
}
#define NULL
Definition coverity.c:32
#define HW_CONFIG_ENCODER_DEVICE(format, device_type_)
Definition hwconfig.h:97
#define HW_CONFIG_ENCODER_FRAMES(format, device_type_)
Definition hwconfig.h:100
#define NONE
Definition vf_drawvg.c:262

Definition at line 714 of file amfenc.c.