39#include <AMF/components/PreAnalysis.h>
41#define AMF_AV_FRAME_REF L"av_frame_ref"
42#define PTS_PROP L"PtsProp"
54#define FFMPEG_AMF_WRITER_ID L"ffmpeg_amf"
94 if(!
ctx->pts_property_name)
99 if(!
ctx->av_frame_property_name)
135 ctx->submitted_frame = 0;
136 ctx->encoded_frame = 0;
147 ctx->encoder->pVtbl->Terminate(
ctx->encoder);
148 ctx->encoder->pVtbl->Release(
ctx->encoder);
155 if (
ctx->output_list) {
173 if (!encoder || !out_max)
177#if AMF_VERSION_ATLEAST(1, 5, 3)
178 const AMFPropertyInfo *prop_info =
NULL;
181 if (runtime_version >= AMF_MAKE_FULL_VERSION(1, 5, 3, 0)) {
182 res = encoder->pVtbl->GetPropertyInfo(encoder, AMF_PA_LOOKAHEAD_BUFFER_DEPTH, &prop_info);
183 if (res == AMF_OK && prop_info && prop_info->type == AMF_VARIANT_INT64) {
184 *out_max = prop_info->maxValue.int64Value;
201 ctx->pa_lookahead_buffer_depth > hw_max) {
203 "pa_lookahead_buffer_depth %d exceeds supported maximum %lld, clamping\n",
204 ctx->pa_lookahead_buffer_depth, (
long long)hw_max);
205 ctx->pa_lookahead_buffer_depth = (int)hw_max;
208 AMF_ASSIGN_PROPERTY_INT64(res,
ctx->encoder, AMF_PA_LOOKAHEAD_BUFFER_DEPTH,
ctx->pa_lookahead_buffer_depth);
222 AMFVariantStruct var = { 0 };
225 res =
ctx->encoder->pVtbl->GetProperty(
ctx->encoder, AMF_PA_LOOKAHEAD_BUFFER_DEPTH, &var);
226 if (res == AMF_OK && var.int64Value >=
ctx->hwsurfaces_in_queue_max) {
228 "async_depth (%d) too small for lookahead (%lld), increasing to (%lld)\n",
229 ctx->hwsurfaces_in_queue_max, (
long long)var.int64Value, (
long long)(var.int64Value + 1));
230 ctx->hwsurfaces_in_queue_max = (int)(var.int64Value + 1);
234 ctx->hwsurfaces_in_queue_max > hw_max + 1) {
236 "async_depth %d exceeds supported range, clamping to %lld\n",
237 ctx->hwsurfaces_in_queue_max, (
long long)(hw_max + 1));
238 ctx->hwsurfaces_in_queue_max = (int)(hw_max + 1);
246 uint8_t *dst_data[4] = {0};
247 int dst_linesize[4] = {0};
251 planes = (int)surface->pVtbl->GetPlanesCount(surface);
255 plane = surface->pVtbl->GetPlaneAt(surface,
i);
256 dst_data[
i] = plane->pVtbl->GetNative(plane);
257 dst_linesize[
i] = plane->pVtbl->GetHPitch(plane);
270 AMFVariantStruct var = {0};
283 buffer->pVtbl->GetProperty(
buffer, AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE, &var);
284 pkt->flags |=
AV_PKT_FLAG_KEY * (var.int64Value == AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_IDR);
285 pict_type = var.int64Value == AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_IDR ?
AV_PICTURE_TYPE_I :
291 if ((
buffer->pVtbl->GetProperty(
buffer, AMF_VIDEO_ENCODER_STATISTIC_AVERAGE_QP, &var)) == AMF_OK) {
292 average_qp =
FFMAX((
int)var.int64Value, -1);
296 buffer->pVtbl->GetProperty(
buffer, AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE, &var);
297 pkt->flags |=
AV_PKT_FLAG_KEY * (var.int64Value == AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE_IDR);
298 pict_type = var.int64Value == AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE_IDR ?
AV_PICTURE_TYPE_I :
299 var.int64Value == AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE_I ?
AV_PICTURE_TYPE_I :
300 var.int64Value == AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE_P ?
AV_PICTURE_TYPE_P : 0;
303 if ((
buffer->pVtbl->GetProperty(
buffer, AMF_VIDEO_ENCODER_HEVC_STATISTIC_AVERAGE_QP, &var)) == AMF_OK) {
304 average_qp =
FFMAX((
int)var.int64Value, -1);
308 buffer->pVtbl->GetProperty(
buffer, AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE, &var);
309 pkt->flags |=
AV_PKT_FLAG_KEY * (var.int64Value == AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_KEY);
310 pict_type = var.int64Value == AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_KEY ?
AV_PICTURE_TYPE_I :
311 var.int64Value == AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_INTRA_ONLY ?
AV_PICTURE_TYPE_I :
312 var.int64Value == AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_INTER ?
AV_PICTURE_TYPE_P : 0;
315 if ((
buffer->pVtbl->GetProperty(
buffer, AMF_VIDEO_ENCODER_AV1_STATISTIC_AVERAGE_Q_INDEX, &var)) == AMF_OK) {
316 average_qp =
FFMAX((
int)var.int64Value, -1);
317 if (average_qp >= 0) {
318 average_qp = (average_qp > 244) ? (average_qp <= 249 ? 62 : 63) : (average_qp + 3) >> 2;
326 if (
ctx->qp_stats && average_qp >= 0) {
332 pkt->pts = var.int64Value;
338 if ((
ctx->max_b_frames > 0 || ((
ctx->pa_adaptive_mini_gop == 1) ?
true :
false)) &&
ctx->dts_delay == 0) {
343 "timestamp_list is empty while max_b_frames = %d\n", avctx->
max_b_frames);
348 ctx->dts_delay = timestamp_last - timestamp;
350 pkt->dts = timestamp -
ctx->dts_delay;
364 if (!
ctx->timestamp_list) {
368 if (!
ctx->output_list)
373 ctx->hwsurfaces_in_queue = 0;
413 AMFVariantStruct var;
414 res = AMFVariantInit(&var);
416 AMFGuid guid_AMFInterface = IID_AMFInterface();
417 AMFInterface *amf_interface;
418 res =
val->pVtbl->QueryInterface(
val, &guid_AMFInterface, (
void**)&amf_interface);
421 res = AMFVariantAssignInterface(&var, amf_interface);
422 amf_interface->pVtbl->Release(amf_interface);
425 res =
object->pVtbl->SetProperty(
object,
name, var);
427 AMFVariantClear(&var);
434 AMF_RESULT res = AMF_FAIL;
439 AMF_ASSIGN_PROPERTY_INT64(res, surface,
ctx->av_frame_property_name,
data);
446 AMFVariantStruct var = {0};
447 AMF_RESULT res =
buffer->pVtbl->GetProperty(
buffer,
ctx->av_frame_property_name, &var);
448 if(res == AMF_OK && var.int64Value){
468 switch (
frame->format) {
472 static const GUID AMFTextureArrayIndexGUID = { 0x28115527, 0xe7c3, 0x4b66, { 0x99, 0xd3, 0x4f, 0x2a, 0xe6, 0xb4, 0x7f, 0xaf } };
473 ID3D11Texture2D *texture = (ID3D11Texture2D*)
frame->data[0];
477 texture->lpVtbl->SetPrivateData(texture, &AMFTextureArrayIndexGUID,
sizeof(
index), &
index);
478 res = amf_device_ctx->
context->pVtbl->CreateSurfaceFromDX11Native(amf_device_ctx->
context, texture, &surface,
NULL);
487 IDirect3DSurface9 *texture = (IDirect3DSurface9 *)
frame->data[3];
488 res = amf_device_ctx->
context->pVtbl->CreateSurfaceFromDX9Native(amf_device_ctx->
context, texture, &surface,
NULL);
496 surface = (AMFSurface*)
frame->data[0];
497 surface->pVtbl->Acquire(surface);
503 res = amf_device_ctx->
context->pVtbl->AllocSurface(amf_device_ctx->
context, AMF_MEMORY_HOST,
ctx->format, avctx->
width, avctx->
height, &surface);
511 ctx->hwsurfaces_in_queue++;
513 surface->pVtbl->SetCrop(surface, 0, 0,
frame->width,
frame->height);
517 AMFBuffer * hdrmeta_buffer =
NULL;
518 res = amf_device_ctx->
context->pVtbl->AllocBuffer(amf_device_ctx->
context, AMF_MEMORY_HOST,
sizeof(AMFHDRMetadata), &hdrmeta_buffer);
520 AMFHDRMetadata * hdrmeta = (AMFHDRMetadata*)hdrmeta_buffer->pVtbl->GetNative(hdrmeta_buffer);
524 AMF_ASSIGN_PROPERTY_INTERFACE(res,
ctx->encoder, AMF_VIDEO_ENCODER_INPUT_HDR_METADATA, hdrmeta_buffer);
break;
526 AMF_ASSIGN_PROPERTY_INTERFACE(res,
ctx->encoder, AMF_VIDEO_ENCODER_HEVC_INPUT_HDR_METADATA, hdrmeta_buffer);
break;
528 AMF_ASSIGN_PROPERTY_INTERFACE(res,
ctx->encoder, AMF_VIDEO_ENCODER_AV1_INPUT_HDR_METADATA, hdrmeta_buffer);
break;
533 hdrmeta_buffer->pVtbl->Release(hdrmeta_buffer);
536 surface->pVtbl->SetPts(surface,
frame->pts);
538 AMF_ASSIGN_PROPERTY_INT64(res, surface,
ctx->pts_property_name,
frame->pts);
543 AMF_ASSIGN_PROPERTY_BOOL(res, surface, AMF_VIDEO_ENCODER_STATISTICS_FEEDBACK, 1);
545 AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_INSERT_AUD, !!
ctx->aud);
546 switch (
frame->pict_type) {
548 if (
ctx->forced_idr) {
549 AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_INSERT_SPS, 1);
550 AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_INSERT_PPS, 1);
551 AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_PICTURE_TYPE_IDR);
553 AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_PICTURE_TYPE_I);
557 AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_PICTURE_TYPE_P);
560 AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_PICTURE_TYPE_B);
566 AMF_ASSIGN_PROPERTY_BOOL(res, surface, AMF_VIDEO_ENCODER_HEVC_STATISTICS_FEEDBACK, 1);
568 AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_HEVC_INSERT_AUD, !!
ctx->aud);
569 switch (
frame->pict_type) {
571 if (
ctx->forced_idr) {
572 AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_HEVC_INSERT_HEADER, 1);
573 AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_HEVC_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_IDR);
575 AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_HEVC_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_I);
579 AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_HEVC_FORCE_PICTURE_TYPE, AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_P);
585 AMF_ASSIGN_PROPERTY_BOOL(res, surface, AMF_VIDEO_ENCODER_AV1_STATISTICS_FEEDBACK, 1);
588 if (
ctx->forced_idr) {
589 AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_AV1_FORCE_INSERT_SEQUENCE_HEADER, 1);
590 AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE, AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_KEY);
592 AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE, AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_INTRA_ONLY);
600 res =
ctx->encoder->pVtbl->SubmitInput(
ctx->encoder, (AMFData*)surface);
601 if (res == AMF_INPUT_FULL) {
603 *surface_resubmit = surface;
605 surface->pVtbl->Release(surface);
607 ctx->submitted_frame++;
611 if(
ctx->submitted_frame <=
ctx->encoded_frame + output_delay)
624 if (amf_device_ctx->
lock)
627 if (amf_device_ctx->
unlock)
636 AMF_RESULT
ret =
ctx->encoder->pVtbl->QueryOutput(
ctx->encoder, &
data);
639 AMFGuid guid = IID_AMFBuffer();
643 ctx->hwsurfaces_in_queue--;
644 ctx->encoded_frame++;
652 AMFSurface *surface =
NULL;
655 AMF_RESULT res_query;
679 if(
ctx->submitted_frame <=
ctx->encoded_frame + output_delay)
685 if (!
frame->buf[0]) {
687 if(!
ctx->delayed_drain) {
688 res =
ctx->encoder->pVtbl->Drain(
ctx->encoder);
689 if (res == AMF_INPUT_FULL) {
690 ctx->delayed_drain = 1;
720 if (
ctx->delayed_drain) {
721 res =
ctx->encoder->pVtbl->Drain(
ctx->encoder);
722 if (res != AMF_INPUT_FULL) {
723 ctx->delayed_drain = 0;
727 av_log(avctx,
AV_LOG_WARNING,
"Data acquired but delayed drain submission got AMF_INPUT_FULL- should not happen\n");
730 }
else if (
ctx->delayed_drain || (
ctx->eof && res_query != AMF_EOF) || (
ctx->hwsurfaces_in_queue >=
ctx->hwsurfaces_in_queue_max) || surface) {
734 if (!
ctx->query_timeout_supported || avpkt->
data || avpkt->
buf) {
738 }
while (block_and_wait);
740 if (res_query == AMF_EOF) {
748 res =
ctx->encoder->pVtbl->SubmitInput(
ctx->encoder, (AMFData*)surface);
749 if (res != AMF_INPUT_FULL)
752 if (!
ctx->query_timeout_supported)
763 }
while(res == AMF_INPUT_FULL);
765 surface->pVtbl->Release(surface);
766 if (res == AMF_INPUT_FULL) {
767 av_log(avctx,
AV_LOG_WARNING,
"Data acquired but delayed SubmitInput returned AMF_INPUT_FULL- should not happen\n");
773 ctx->submitted_frame++;
static double val(void *priv, double ch)
static int amf_submit_frame_locked(AVCodecContext *avctx, AVFrame *frame, AMFSurface **surface_resubmit)
int ff_amf_encode_init(AVCodecContext *avctx)
Common encoder initization function.
static AMF_RESULT amf_query_output(AVCodecContext *avctx, AMFBuffer **buffer)
void ff_amf_clamp_lookahead_depth(AVCodecContext *avctx, AMFEncoderContext *ctx)
Clamp pa_lookahead_buffer_depth to the AMF-reported maximum and assign it to the encoder.
const AVCodecHWConfigInternal *const ff_amfenc_hw_configs[]
static AMF_RESULT amf_release_attached_frame_ref(AMFEncoderContext *ctx, AMFBuffer *buffer)
static AMF_RESULT amf_set_property_buffer(AMFSurface *object, const wchar_t *name, AMFBuffer *val)
static int amf_copy_buffer(AVCodecContext *avctx, AVPacket *pkt, AMFBuffer *buffer)
int av_cold ff_amf_encode_close(AVCodecContext *avctx)
Common encoder termination function.
static int amf_submit_frame(AVCodecContext *avctx, AVFrame *frame, AMFSurface **surface_resubmit)
void ff_amf_fit_async_depth(AVCodecContext *avctx, AMFEncoderContext *ctx)
Size async_depth (hwsurfaces_in_queue_max) around the lookahead window: widen it to hold the lookahea...
static int amf_copy_surface(AVCodecContext *avctx, const AVFrame *frame, AMFSurface *surface)
static int amf_init_encoder(AVCodecContext *avctx)
static int64_t next_encoder_index
int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
Ecoding one frame - common function for all AMF encoders.
enum AVPixelFormat ff_amf_pix_fmts[]
Supported formats.
static AMF_RESULT amf_store_attached_frame_ref(AMFEncoderContext *ctx, const AVFrame *frame, AMFSurface *surface)
int ff_amf_get_lookahead_depth_max(AVCodecContext *avctx, AMFComponent *encoder, amf_uint64 runtime_version, amf_int64 *out_max)
Query the maximum PA lookahead buffer depth (AMF_PA_LOOKAHEAD_BUFFER_DEPTH).
#define MAX_LOOKAHEAD_DEPTH
#define AMF_RETURN_IF_FALSE(avctx, exp, ret_value,...)
Error handling helper.
static AVFormatContext * ctx
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define i(width, name, range_min, range_max)
static enum AVPixelFormat pix_fmt
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
int ff_encode_get_frame(AVCodecContext *avctx, AVFrame *frame)
Called by encoders to get the next frame for encoding.
int ff_encode_add_stats_side_data(AVPacket *pkt, int quality, const int64_t error[], int error_count, enum AVPictureType pict_type)
#define AV_CODEC_FLAG_LOW_DELAY
Force low delay.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
#define AVERROR_ENCODER_NOT_FOUND
Encoder not found.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
#define AVERROR_EOF
End of file.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
AVFifo * av_fifo_alloc2(size_t nb_elems, size_t elem_size, unsigned int flags)
Allocate and initialize an AVFifo with a given element size.
void av_fifo_freep2(AVFifo **f)
Free an AVFifo and reset pointer to NULL.
#define AV_FIFO_FLAG_AUTO_GROW
Automatically resize the FIFO on writes, so that the data fits.
size_t av_fifo_can_read(const AVFifo *f)
int av_fifo_peek(const AVFifo *f, void *buf, size_t nb_elems, size_t offset)
Read data from a FIFO without modifying FIFO state.
int av_fifo_write(AVFifo *f, const void *buf, size_t nb_elems)
Write data into a FIFO.
int av_fifo_read(AVFifo *f, void *buf, size_t nb_elems)
Read data from a FIFO.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
static void av_image_copy2(uint8_t *const dst_data[4], const int dst_linesizes[4], uint8_t *const src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Wrapper around av_image_copy() to workaround the limitation that the conversion from uint8_t * const ...
@ AV_PICTURE_TYPE_I
Intra.
@ AV_PICTURE_TYPE_P
Predicted.
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static AVBufferRef * hw_device_ctx
#define HW_CONFIG_ENCODER_DEVICE(format, device_type_)
#define HW_CONFIG_ENCODER_FRAMES(format, device_type_)
int av_hwdevice_ctx_create(AVBufferRef **pdevice_ref, enum AVHWDeviceType type, const char *device, AVDictionary *opts, int flags)
Open a device of the specified type and create an AVHWDeviceContext for it.
int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ref_ptr, enum AVHWDeviceType type, AVBufferRef *src_ref, int flags)
Create a new device of the specified type from an existing device.
enum AMF_SURFACE_FORMAT av_av_to_amf_format(enum AVPixelFormat fmt)
int av_amf_extract_hdr_metadata(const AVFrame *frame, AMFHDRMetadata *hdrmeta)
An API-specific header for AV_HWDEVICE_TYPE_D3D11VA.
An API-specific header for AV_HWDEVICE_TYPE_DXVA2.
static const struct @257111027162314367033347246032313251342043035002 planes[]
Memory handling functions.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
#define AV_PIX_FMT_RGBAF16
AVPixelFormat
Pixel format.
@ 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...
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
@ AV_PIX_FMT_DXVA2_VLD
HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer.
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
@ AV_PIX_FMT_D3D11
Hardware surfaces for Direct3D11.
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
@ AV_PIX_FMT_AMF_SURFACE
HW acceleration through AMF.
#define AV_PIX_FMT_X2BGR10
@ AVCOL_TRC_SMPTE2084
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
#define FF_ARRAY_ELEMS(a)
This struct is allocated as AVHWDeviceContext.hwctx.
void(* lock)(void *lock_ctx)
void(* unlock)(void *lock_ctx)
int64_t version
version of AMF runtime
uint8_t * data
The data buffer.
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames.
int max_b_frames
maximum number of B-frames between non-B-frames Note: The output will be delayed by max_b_frames+1 re...
const struct AVCodec * codec
int flags
AV_CODEC_FLAG_*.
AVBufferRef * hw_device_ctx
A reference to the AVHWDeviceContext describing the device which will be used by a hardware encoder/d...
This structure describes decoded (raw) audio or video data.
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
enum AVHWDeviceType type
This field identifies the underlying API used for hardware access.
This struct describes a set or pool of "hardware" frames (i.e.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
AVBufferRef * device_ref
A reference to the parent AVHWDeviceContext.
This structure stores compressed data.
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
static int frame_ref(AVFrame *dst, const AVFrame *src, const int plane_copy[4])
int av_usleep(unsigned usec)
Sleep for a period of time.