FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
amfenc.c File Reference
#include "config.h"
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/hwcontext.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "libavutil/time.h"
#include "amfenc.h"
#include "internal.h"
#include <dlfcn.h>

Go to the source code of this file.

Data Structures

struct  FormatMap
 

Macros

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

Functions

static int is_hwaccel_pix_fmt (enum AVPixelFormat pix_fmt)
 
static enum AMF_SURFACE_FORMAT amf_av_to_amf_format (enum AVPixelFormat fmt)
 
static void AMF_CDECL_CALL AMFTraceWriter_Write (AMFTraceWriter *pThis, const wchar_t *scope, const wchar_t *message)
 
static void AMF_CDECL_CALL AMFTraceWriter_Flush (AMFTraceWriter *pThis)
 
static int amf_load_library (AVCodecContext *avctx)
 
static int amf_init_context (AVCodecContext *avctx)
 
static int amf_init_encoder (AVCodecContext *avctx)
 
int av_cold ff_amf_encode_close (AVCodecContext *avctx)
 Common encoder termination function. More...
 
static int amf_copy_surface (AVCodecContext *avctx, const AVFrame *frame, AMFSurface *surface)
 
static int timestamp_queue_enqueue (AVCodecContext *avctx, int64_t timestamp)
 
static int amf_copy_buffer (AVCodecContext *avctx, AVPacket *pkt, AMFBuffer *buffer)
 
int ff_amf_encode_init (AVCodecContext *avctx)
 Common encoder initization function. More...
 
int ff_amf_send_frame (AVCodecContext *avctx, const AVFrame *frame)
 Ecoding one frame - common function for all AMF encoders. More...
 
int ff_amf_receive_packet (AVCodecContext *avctx, AVPacket *avpkt)
 

Variables

enum AVPixelFormat ff_amf_pix_fmts []
 Supported formats. More...
 
static const FormatMap format_map []
 
static AMFTraceWriterVtbl tracer_vtbl
 

Macro Definition Documentation

#define FFMPEG_AMF_WRITER_ID   L"ffmpeg_amf"

Definition at line 44 of file amfenc.c.

Referenced by amf_init_context(), and ff_amf_encode_close().

#define PTS_PROP   L"PtsProp"

Definition at line 46 of file amfenc.c.

Referenced by amf_copy_buffer(), and ff_amf_send_frame().

Function Documentation

static int is_hwaccel_pix_fmt ( enum AVPixelFormat  pix_fmt)
static

Definition at line 75 of file amfenc.c.

Referenced by amf_copy_surface().

static enum AMF_SURFACE_FORMAT amf_av_to_amf_format ( enum AVPixelFormat  fmt)
static

Definition at line 82 of file amfenc.c.

Referenced by amf_init_context(), and amf_init_encoder().

static void AMF_CDECL_CALL AMFTraceWriter_Write ( AMFTraceWriter *  pThis,
const wchar_t *  scope,
const wchar_t *  message 
)
static

Definition at line 93 of file amfenc.c.

static void AMF_CDECL_CALL AMFTraceWriter_Flush ( AMFTraceWriter *  pThis)
static

Definition at line 100 of file amfenc.c.

static int amf_load_library ( AVCodecContext avctx)
static

Definition at line 110 of file amfenc.c.

Referenced by ff_amf_encode_init().

static int amf_init_context ( AVCodecContext avctx)
static

Definition at line 155 of file amfenc.c.

Referenced by ff_amf_encode_init().

static int amf_init_encoder ( AVCodecContext avctx)
static

Definition at line 232 of file amfenc.c.

Referenced by ff_amf_encode_init().

int av_cold ff_amf_encode_close ( AVCodecContext avctx)

Common encoder termination function.

Definition at line 259 of file amfenc.c.

Referenced by ff_amf_encode_init().

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

Definition at line 300 of file amfenc.c.

Referenced by ff_amf_send_frame().

static int timestamp_queue_enqueue ( AVCodecContext avctx,
int64_t  timestamp 
)
inlinestatic

Definition at line 346 of file amfenc.c.

Referenced by ff_amf_receive_packet(), and ff_amf_send_frame().

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

Definition at line 358 of file amfenc.c.

Referenced by ff_amf_receive_packet().

int ff_amf_encode_init ( AVCodecContext avctx)

Common encoder initization function.

Definition at line 418 of file amfenc.c.

Referenced by amf_encode_init_h264(), and amf_encode_init_hevc().

int ff_amf_send_frame ( AVCodecContext avctx,
const AVFrame frame 
)

Ecoding one frame - common function for all AMF encoders.

Definition at line 447 of file amfenc.c.

int ff_amf_receive_packet ( AVCodecContext avctx,
AVPacket avpkt 
)

Definition at line 539 of file amfenc.c.

Variable Documentation

enum AVPixelFormat ff_amf_pix_fmts[]
Initial value:
= {
}
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:85
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:62

Supported formats.

Definition at line 48 of file amfenc.c.

const FormatMap format_map[]
static
Initial value:
=
{
{ AV_PIX_FMT_NONE, AMF_SURFACE_UNKNOWN },
{ AV_PIX_FMT_NV12, AMF_SURFACE_NV12 },
{ AV_PIX_FMT_BGR0, AMF_SURFACE_BGRA },
{ AV_PIX_FMT_RGB0, AMF_SURFACE_RGBA },
{ AV_PIX_FMT_GRAY8, AMF_SURFACE_GRAY8 },
{ AV_PIX_FMT_YUV420P, AMF_SURFACE_YUV420P },
{ AV_PIX_FMT_YUYV422, AMF_SURFACE_YUY2 },
{ AV_PIX_FMT_D3D11, AMF_SURFACE_NV12 },
}
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
Definition: pixfmt.h:234
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:85
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:63
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:236
Hardware surfaces for Direct3D11.
Definition: pixfmt.h:309
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:62
Y , 8bpp.
Definition: pixfmt.h:70

Definition at line 62 of file amfenc.c.

AMFTraceWriterVtbl tracer_vtbl
static
Initial value:
=
{
}
static void AMF_CDECL_CALL AMFTraceWriter_Write(AMFTraceWriter *pThis, const wchar_t *scope, const wchar_t *message)
Definition: amfenc.c:93
static void AMF_CDECL_CALL AMFTraceWriter_Flush(AMFTraceWriter *pThis)
Definition: amfenc.c:100

Definition at line 104 of file amfenc.c.

Referenced by amf_init_context().