1
0

avcodec/avcodec: Add FFHWAccel, hide internals of AVHWAccel

This commit is the AVHWAccel analogue of commit
20f9727018: It moves the private fields
of AVHWAccel to a new struct FFHWAccel extending AVHWAccel
in an internal header (namely hwaccel_internal.h).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2023-08-01 19:44:22 +02:00
parent c48cc9c6e9
commit e35dfe864d
55 changed files with 691 additions and 630 deletions

2
configure vendored
View File

@ -4102,7 +4102,7 @@ CODEC_LIST="
"
PARSER_LIST=$(find_things_extern parser AVCodecParser libavcodec/parsers.c)
BSF_LIST=$(find_things_extern bsf FFBitStreamFilter libavcodec/bitstream_filters.c)
HWACCEL_LIST=$(find_things_extern hwaccel AVHWAccel libavcodec/hwaccels.h)
HWACCEL_LIST=$(find_things_extern hwaccel FFHWAccel libavcodec/hwaccels.h)
PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
AVCODEC_COMPONENTS_LIST="

View File

@ -33,6 +33,7 @@
#include "bytestream.h"
#include "codec_internal.h"
#include "decode.h"
#include "hwaccel_internal.h"
#include "internal.h"
#include "hwconfig.h"
#include "profiles.h"
@ -1233,9 +1234,9 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
}
}
if (avctx->hwaccel && avctx->hwaccel->decode_params) {
ret = avctx->hwaccel->decode_params(avctx, unit->type, unit->data,
unit->data_size);
if (FF_HW_HAS_CB(avctx, decode_params)) {
ret = FF_HW_CALL(avctx, decode_params, unit->type,
unit->data, unit->data_size);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "HW accel decode params fail.\n");
s->raw_seq = NULL;
@ -1305,8 +1306,7 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
s->cur_frame.temporal_id = header->temporal_id;
if (avctx->hwaccel && s->cur_frame.f->buf[0]) {
ret = avctx->hwaccel->start_frame(avctx, unit->data,
unit->data_size);
ret = FF_HW_CALL(avctx, start_frame, unit->data, unit->data_size);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "HW accel start frame fail.\n");
goto end;
@ -1332,9 +1332,8 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
goto end;
if (avctx->hwaccel && s->cur_frame.f->buf[0]) {
ret = avctx->hwaccel->decode_slice(avctx,
raw_tile_group->tile_data.data,
raw_tile_group->tile_data.data_size);
ret = FF_HW_CALL(avctx, decode_slice, raw_tile_group->tile_data.data,
raw_tile_group->tile_data.data_size);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR,
"HW accel decode slice fail.\n");
@ -1396,7 +1395,7 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
if (raw_tile_group && (s->tile_num == raw_tile_group->tg_end + 1)) {
int show_frame = s->raw_frame_header->show_frame;
if (avctx->hwaccel && s->cur_frame.f->buf[0]) {
ret = avctx->hwaccel->end_frame(avctx);
ret = FF_HW_SIMPLE_CALL(avctx, end_frame);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "HW accel end frame fail.\n");
goto end;
@ -1492,8 +1491,8 @@ static void av1_decode_flush(AVCodecContext *avctx)
ff_cbs_fragment_reset(&s->current_obu);
ff_cbs_flush(s->cbc);
if (avctx->hwaccel && avctx->hwaccel->flush)
avctx->hwaccel->flush(avctx);
if (FF_HW_HAS_CB(avctx, flush))
FF_HW_SIMPLE_CALL(avctx, flush);
}
#define OFFSET(x) offsetof(AV1DecContext, x)

View File

@ -2144,139 +2144,6 @@ typedef struct AVHWAccel {
* see AV_HWACCEL_CODEC_CAP_*
*/
int capabilities;
/*****************************************************************
* No fields below this line are part of the public API. They
* may not be used outside of libavcodec and can be changed and
* removed at will.
* New public fields should be added right above.
*****************************************************************
*/
/**
* Allocate a custom buffer
*/
int (*alloc_frame)(AVCodecContext *avctx, AVFrame *frame);
/**
* Called at the beginning of each frame or field picture.
*
* Meaningful frame information (codec specific) is guaranteed to
* be parsed at this point. This function is mandatory.
*
* Note that buf can be NULL along with buf_size set to 0.
* Otherwise, this means the whole frame is available at this point.
*
* @param avctx the codec context
* @param buf the frame data buffer base
* @param buf_size the size of the frame in bytes
* @return zero if successful, a negative value otherwise
*/
int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
/**
* Callback for parameter data (SPS/PPS/VPS etc).
*
* Useful for hardware decoders which keep persistent state about the
* video parameters, and need to receive any changes to update that state.
*
* @param avctx the codec context
* @param type the nal unit type
* @param buf the nal unit data buffer
* @param buf_size the size of the nal unit in bytes
* @return zero if successful, a negative value otherwise
*/
int (*decode_params)(AVCodecContext *avctx, int type, const uint8_t *buf, uint32_t buf_size);
/**
* Callback for each slice.
*
* Meaningful slice information (codec specific) is guaranteed to
* be parsed at this point. This function is mandatory.
*
* @param avctx the codec context
* @param buf the slice data buffer base
* @param buf_size the size of the slice in bytes
* @return zero if successful, a negative value otherwise
*/
int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
/**
* Called at the end of each frame or field picture.
*
* The whole picture is parsed at this point and can now be sent
* to the hardware accelerator. This function is mandatory.
*
* @param avctx the codec context
* @return zero if successful, a negative value otherwise
*/
int (*end_frame)(AVCodecContext *avctx);
/**
* Size of per-frame hardware accelerator private data.
*
* Private data is allocated with av_mallocz() before
* AVCodecContext.get_buffer() and deallocated after
* AVCodecContext.release_buffer().
*/
int frame_priv_data_size;
/**
* Initialize the hwaccel private data.
*
* This will be called from ff_get_format(), after hwaccel and
* hwaccel_context are set and the hwaccel private data in AVCodecInternal
* is allocated.
*/
int (*init)(AVCodecContext *avctx);
/**
* Uninitialize the hwaccel private data.
*
* This will be called from get_format() or avcodec_close(), after hwaccel
* and hwaccel_context are already uninitialized.
*/
int (*uninit)(AVCodecContext *avctx);
/**
* Size of the private data to allocate in
* AVCodecInternal.hwaccel_priv_data.
*/
int priv_data_size;
/**
* Internal hwaccel capabilities.
*/
int caps_internal;
/**
* Fill the given hw_frames context with current codec parameters. Called
* from get_format. Refer to avcodec_get_hw_frames_parameters() for
* details.
*
* This CAN be called before AVHWAccel.init is called, and you must assume
* that avctx->hwaccel_priv_data is invalid.
*/
int (*frame_params)(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx);
/**
* Copy necessary context variables from a previous thread context to the current one.
* For thread-safe hwaccels only.
*/
int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
/**
* Callback to free the hwaccel-specific frame data.
*
* @param hwctx a pointer to an AVHWDeviceContext.
* @param data the per-frame hardware accelerator private data to be freed.
*/
void (*free_frame_priv)(void *hwctx, uint8_t *data);
/**
* Callback to flush the hwaccel state.
*/
void (*flush)(AVCodecContext *avctx);
} AVHWAccel;
/**

View File

@ -46,6 +46,7 @@
#include "bsf.h"
#include "codec_internal.h"
#include "decode.h"
#include "hwaccel_internal.h"
#include "hwconfig.h"
#include "internal.h"
#include "packet_internal.h"
@ -1159,7 +1160,7 @@ int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
{
AVBufferRef *frames_ref = NULL;
const AVCodecHWConfigInternal *hw_config;
const AVHWAccel *hwa;
const FFHWAccel *hwa;
int i, ret;
for (i = 0;; i++) {
@ -1211,14 +1212,14 @@ int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
}
static int hwaccel_init(AVCodecContext *avctx,
const AVHWAccel *hwaccel)
const FFHWAccel *hwaccel)
{
int err;
if (hwaccel->capabilities & AV_HWACCEL_CODEC_CAP_EXPERIMENTAL &&
if (hwaccel->p.capabilities & AV_HWACCEL_CODEC_CAP_EXPERIMENTAL &&
avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
av_log(avctx, AV_LOG_WARNING, "Ignoring experimental hwaccel: %s\n",
hwaccel->name);
hwaccel->p.name);
return AVERROR_PATCHWELCOME;
}
@ -1229,13 +1230,13 @@ static int hwaccel_init(AVCodecContext *avctx,
return AVERROR(ENOMEM);
}
avctx->hwaccel = hwaccel;
avctx->hwaccel = &hwaccel->p;
if (hwaccel->init) {
err = hwaccel->init(avctx);
if (err < 0) {
av_log(avctx, AV_LOG_ERROR, "Failed setup for format %s: "
"hwaccel initialisation returned error.\n",
av_get_pix_fmt_name(hwaccel->pix_fmt));
av_get_pix_fmt_name(hwaccel->p.pix_fmt));
av_freep(&avctx->internal->hwaccel_priv_data);
avctx->hwaccel = NULL;
return err;
@ -1247,8 +1248,8 @@ static int hwaccel_init(AVCodecContext *avctx,
void ff_hwaccel_uninit(AVCodecContext *avctx)
{
if (avctx->hwaccel && avctx->hwaccel->uninit)
avctx->hwaccel->uninit(avctx);
if (FF_HW_HAS_CB(avctx, uninit))
FF_HW_SIMPLE_CALL(avctx, uninit);
av_freep(&avctx->internal->hwaccel_priv_data);
@ -1569,7 +1570,7 @@ int ff_attach_decode_data(AVFrame *frame)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
{
const AVHWAccel *hwaccel = avctx->hwaccel;
const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel);
int override_dimensions = 1;
int ret;
@ -1791,7 +1792,7 @@ int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)
int ff_hwaccel_frame_priv_alloc(AVCodecContext *avctx, void **hwaccel_picture_private,
AVBufferRef **hwaccel_priv_buf)
{
const AVHWAccel *hwaccel = avctx->hwaccel;
const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel);
AVBufferRef *ref;
AVHWFramesContext *frames_ctx;
uint8_t *data;

View File

@ -27,6 +27,7 @@
#include "dxva2_internal.h"
#include "av1dec.h"
#include "hwaccel_internal.h"
#define MAX_TILES 256
@ -457,11 +458,11 @@ static int dxva2_av1_uninit(AVCodecContext *avctx)
}
#if CONFIG_AV1_DXVA2_HWACCEL
const AVHWAccel ff_av1_dxva2_hwaccel = {
.name = "av1_dxva2",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_AV1,
.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
const FFHWAccel ff_av1_dxva2_hwaccel = {
.p.name = "av1_dxva2",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_AV1,
.p.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
.init = ff_dxva2_decode_init,
.uninit = dxva2_av1_uninit,
.start_frame = dxva2_av1_start_frame,
@ -474,11 +475,11 @@ const AVHWAccel ff_av1_dxva2_hwaccel = {
#endif
#if CONFIG_AV1_D3D11VA_HWACCEL
const AVHWAccel ff_av1_d3d11va_hwaccel = {
.name = "av1_d3d11va",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_AV1,
.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
const FFHWAccel ff_av1_d3d11va_hwaccel = {
.p.name = "av1_d3d11va",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_AV1,
.p.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
.init = ff_dxva2_decode_init,
.uninit = dxva2_av1_uninit,
.start_frame = dxva2_av1_start_frame,
@ -491,11 +492,11 @@ const AVHWAccel ff_av1_d3d11va_hwaccel = {
#endif
#if CONFIG_AV1_D3D11VA2_HWACCEL
const AVHWAccel ff_av1_d3d11va2_hwaccel = {
.name = "av1_d3d11va2",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_AV1,
.pix_fmt = AV_PIX_FMT_D3D11,
const FFHWAccel ff_av1_d3d11va2_hwaccel = {
.p.name = "av1_d3d11va2",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_AV1,
.p.pix_fmt = AV_PIX_FMT_D3D11,
.init = ff_dxva2_decode_init,
.uninit = dxva2_av1_uninit,
.start_frame = dxva2_av1_start_frame,

View File

@ -28,6 +28,7 @@
#include "h264dec.h"
#include "h264data.h"
#include "h264_ps.h"
#include "hwaccel_internal.h"
#include "mpegutils.h"
struct dxva2_picture_context {
@ -516,11 +517,11 @@ static int dxva2_h264_end_frame(AVCodecContext *avctx)
}
#if CONFIG_H264_DXVA2_HWACCEL
const AVHWAccel ff_h264_dxva2_hwaccel = {
.name = "h264_dxva2",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_H264,
.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
const FFHWAccel ff_h264_dxva2_hwaccel = {
.p.name = "h264_dxva2",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_H264,
.p.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_h264_start_frame,
@ -533,11 +534,11 @@ const AVHWAccel ff_h264_dxva2_hwaccel = {
#endif
#if CONFIG_H264_D3D11VA_HWACCEL
const AVHWAccel ff_h264_d3d11va_hwaccel = {
.name = "h264_d3d11va",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_H264,
.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
const FFHWAccel ff_h264_d3d11va_hwaccel = {
.p.name = "h264_d3d11va",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_H264,
.p.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_h264_start_frame,
@ -550,11 +551,11 @@ const AVHWAccel ff_h264_d3d11va_hwaccel = {
#endif
#if CONFIG_H264_D3D11VA2_HWACCEL
const AVHWAccel ff_h264_d3d11va2_hwaccel = {
.name = "h264_d3d11va2",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_H264,
.pix_fmt = AV_PIX_FMT_D3D11,
const FFHWAccel ff_h264_d3d11va2_hwaccel = {
.p.name = "h264_d3d11va2",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_H264,
.p.pix_fmt = AV_PIX_FMT_D3D11,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_h264_start_frame,

View File

@ -27,6 +27,7 @@
#include "dxva2_internal.h"
#include "hevc_data.h"
#include "hevcdec.h"
#include "hwaccel_internal.h"
#define MAX_SLICES 256
@ -420,11 +421,11 @@ static int dxva2_hevc_end_frame(AVCodecContext *avctx)
}
#if CONFIG_HEVC_DXVA2_HWACCEL
const AVHWAccel ff_hevc_dxva2_hwaccel = {
.name = "hevc_dxva2",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_HEVC,
.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
const FFHWAccel ff_hevc_dxva2_hwaccel = {
.p.name = "hevc_dxva2",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_HEVC,
.p.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_hevc_start_frame,
@ -437,11 +438,11 @@ const AVHWAccel ff_hevc_dxva2_hwaccel = {
#endif
#if CONFIG_HEVC_D3D11VA_HWACCEL
const AVHWAccel ff_hevc_d3d11va_hwaccel = {
.name = "hevc_d3d11va",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_HEVC,
.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
const FFHWAccel ff_hevc_d3d11va_hwaccel = {
.p.name = "hevc_d3d11va",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_HEVC,
.p.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_hevc_start_frame,
@ -454,11 +455,11 @@ const AVHWAccel ff_hevc_d3d11va_hwaccel = {
#endif
#if CONFIG_HEVC_D3D11VA2_HWACCEL
const AVHWAccel ff_hevc_d3d11va2_hwaccel = {
.name = "hevc_d3d11va2",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_HEVC,
.pix_fmt = AV_PIX_FMT_D3D11,
const FFHWAccel ff_hevc_d3d11va2_hwaccel = {
.p.name = "hevc_d3d11va2",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_HEVC,
.p.pix_fmt = AV_PIX_FMT_D3D11,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_hevc_start_frame,

View File

@ -25,6 +25,7 @@
#include "libavutil/log.h"
#include "dxva2_internal.h"
#include "hwaccel_internal.h"
#include "mpegutils.h"
#include "mpegvideodec.h"
@ -316,11 +317,11 @@ static int dxva2_mpeg2_end_frame(AVCodecContext *avctx)
}
#if CONFIG_MPEG2_DXVA2_HWACCEL
const AVHWAccel ff_mpeg2_dxva2_hwaccel = {
.name = "mpeg2_dxva2",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_MPEG2VIDEO,
.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
const FFHWAccel ff_mpeg2_dxva2_hwaccel = {
.p.name = "mpeg2_dxva2",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_MPEG2VIDEO,
.p.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_mpeg2_start_frame,
@ -333,11 +334,11 @@ const AVHWAccel ff_mpeg2_dxva2_hwaccel = {
#endif
#if CONFIG_MPEG2_D3D11VA_HWACCEL
const AVHWAccel ff_mpeg2_d3d11va_hwaccel = {
.name = "mpeg2_d3d11va",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_MPEG2VIDEO,
.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
const FFHWAccel ff_mpeg2_d3d11va_hwaccel = {
.p.name = "mpeg2_d3d11va",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_MPEG2VIDEO,
.p.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_mpeg2_start_frame,
@ -350,11 +351,11 @@ const AVHWAccel ff_mpeg2_d3d11va_hwaccel = {
#endif
#if CONFIG_MPEG2_D3D11VA2_HWACCEL
const AVHWAccel ff_mpeg2_d3d11va2_hwaccel = {
.name = "mpeg2_d3d11va2",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_MPEG2VIDEO,
.pix_fmt = AV_PIX_FMT_D3D11,
const FFHWAccel ff_mpeg2_d3d11va2_hwaccel = {
.p.name = "mpeg2_d3d11va2",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_MPEG2VIDEO,
.p.pix_fmt = AV_PIX_FMT_D3D11,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_mpeg2_start_frame,

View File

@ -23,6 +23,7 @@
#include "config_components.h"
#include "dxva2_internal.h"
#include "hwaccel_internal.h"
#include "mpegutils.h"
#include "mpegvideodec.h"
#include "vc1.h"
@ -376,11 +377,11 @@ static int dxva2_vc1_end_frame(AVCodecContext *avctx)
}
#if CONFIG_WMV3_DXVA2_HWACCEL
const AVHWAccel ff_wmv3_dxva2_hwaccel = {
.name = "wmv3_dxva2",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_WMV3,
.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
const FFHWAccel ff_wmv3_dxva2_hwaccel = {
.p.name = "wmv3_dxva2",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_WMV3,
.p.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_vc1_start_frame,
@ -393,11 +394,11 @@ const AVHWAccel ff_wmv3_dxva2_hwaccel = {
#endif
#if CONFIG_VC1_DXVA2_HWACCEL
const AVHWAccel ff_vc1_dxva2_hwaccel = {
.name = "vc1_dxva2",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_VC1,
.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
const FFHWAccel ff_vc1_dxva2_hwaccel = {
.p.name = "vc1_dxva2",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_VC1,
.p.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_vc1_start_frame,
@ -410,11 +411,11 @@ const AVHWAccel ff_vc1_dxva2_hwaccel = {
#endif
#if CONFIG_WMV3_D3D11VA_HWACCEL
const AVHWAccel ff_wmv3_d3d11va_hwaccel = {
.name = "wmv3_d3d11va",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_WMV3,
.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
const FFHWAccel ff_wmv3_d3d11va_hwaccel = {
.p.name = "wmv3_d3d11va",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_WMV3,
.p.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_vc1_start_frame,
@ -427,11 +428,11 @@ const AVHWAccel ff_wmv3_d3d11va_hwaccel = {
#endif
#if CONFIG_WMV3_D3D11VA2_HWACCEL
const AVHWAccel ff_wmv3_d3d11va2_hwaccel = {
.name = "wmv3_d3d11va2",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_WMV3,
.pix_fmt = AV_PIX_FMT_D3D11,
const FFHWAccel ff_wmv3_d3d11va2_hwaccel = {
.p.name = "wmv3_d3d11va2",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_WMV3,
.p.pix_fmt = AV_PIX_FMT_D3D11,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_vc1_start_frame,
@ -444,11 +445,11 @@ const AVHWAccel ff_wmv3_d3d11va2_hwaccel = {
#endif
#if CONFIG_VC1_D3D11VA_HWACCEL
const AVHWAccel ff_vc1_d3d11va_hwaccel = {
.name = "vc1_d3d11va",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_VC1,
.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
const FFHWAccel ff_vc1_d3d11va_hwaccel = {
.p.name = "vc1_d3d11va",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_VC1,
.p.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_vc1_start_frame,
@ -461,11 +462,11 @@ const AVHWAccel ff_vc1_d3d11va_hwaccel = {
#endif
#if CONFIG_VC1_D3D11VA2_HWACCEL
const AVHWAccel ff_vc1_d3d11va2_hwaccel = {
.name = "vc1_d3d11va2",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_VC1,
.pix_fmt = AV_PIX_FMT_D3D11,
const FFHWAccel ff_vc1_d3d11va2_hwaccel = {
.p.name = "vc1_d3d11va2",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_VC1,
.p.pix_fmt = AV_PIX_FMT_D3D11,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_vc1_start_frame,

View File

@ -26,6 +26,7 @@
#include "libavutil/pixdesc.h"
#include "dxva2_internal.h"
#include "hwaccel_internal.h"
#include "vp9shared.h"
struct vp9_dxva2_picture_context {
@ -307,11 +308,11 @@ static int dxva2_vp9_end_frame(AVCodecContext *avctx)
}
#if CONFIG_VP9_DXVA2_HWACCEL
const AVHWAccel ff_vp9_dxva2_hwaccel = {
.name = "vp9_dxva2",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_VP9,
.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
const FFHWAccel ff_vp9_dxva2_hwaccel = {
.p.name = "vp9_dxva2",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_VP9,
.p.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_vp9_start_frame,
@ -324,11 +325,11 @@ const AVHWAccel ff_vp9_dxva2_hwaccel = {
#endif
#if CONFIG_VP9_D3D11VA_HWACCEL
const AVHWAccel ff_vp9_d3d11va_hwaccel = {
.name = "vp9_d3d11va",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_VP9,
.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
const FFHWAccel ff_vp9_d3d11va_hwaccel = {
.p.name = "vp9_d3d11va",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_VP9,
.p.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_vp9_start_frame,
@ -341,11 +342,11 @@ const AVHWAccel ff_vp9_d3d11va_hwaccel = {
#endif
#if CONFIG_VP9_D3D11VA2_HWACCEL
const AVHWAccel ff_vp9_d3d11va2_hwaccel = {
.name = "vp9_d3d11va2",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_VP9,
.pix_fmt = AV_PIX_FMT_D3D11,
const FFHWAccel ff_vp9_d3d11va2_hwaccel = {
.p.name = "vp9_d3d11va2",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_VP9,
.p.pix_fmt = AV_PIX_FMT_D3D11,
.init = ff_dxva2_decode_init,
.uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_vp9_start_frame,

View File

@ -36,6 +36,7 @@
#include "flvdec.h"
#include "h263.h"
#include "h263dec.h"
#include "hwaccel_internal.h"
#include "hwconfig.h"
#include "mpeg_er.h"
#include "mpeg4video.h"
@ -190,7 +191,7 @@ static int decode_slice(MpegEncContext *s)
if (s->avctx->hwaccel) {
const uint8_t *start = s->gb.buffer + get_bits_count(&s->gb) / 8;
ret = s->avctx->hwaccel->decode_slice(s->avctx, start, s->gb.buffer_end - start);
ret = FF_HW_CALL(s->avctx, decode_slice, start, s->gb.buffer_end - start);
// ensure we exit decode loop
s->mb_y = s->mb_height;
return ret;
@ -568,8 +569,8 @@ retry:
ff_thread_finish_setup(avctx);
if (avctx->hwaccel) {
ret = avctx->hwaccel->start_frame(avctx, s->gb.buffer,
s->gb.buffer_end - s->gb.buffer);
ret = FF_HW_CALL(avctx, start_frame,
s->gb.buffer, s->gb.buffer_end - s->gb.buffer);
if (ret < 0 )
return ret;
}
@ -624,7 +625,7 @@ frame_end:
ff_er_frame_end(&s->er);
if (avctx->hwaccel) {
ret = avctx->hwaccel->end_frame(avctx);
ret = FF_HW_SIMPLE_CALL(avctx, end_frame);
if (ret < 0)
return ret;
}

View File

@ -29,6 +29,7 @@
#include "error_resilience.h"
#include "avcodec.h"
#include "h264dec.h"
#include "hwaccel_internal.h"
#include "mpegutils.h"
#include "thread.h"
#include "threadframe.h"
@ -233,7 +234,7 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup)
}
if (avctx->hwaccel) {
err = avctx->hwaccel->end_frame(avctx);
err = FF_HW_SIMPLE_CALL(avctx, end_frame);
if (err < 0)
av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");

View File

@ -45,6 +45,7 @@
#include "h264data.h"
#include "h264_ps.h"
#include "golomb.h"
#include "hwaccel_internal.h"
#include "hwconfig.h"
#include "mpegutils.h"
#include "profiles.h"
@ -485,8 +486,8 @@ static void h264_decode_flush(AVCodecContext *avctx)
ff_h264_free_tables(h);
h->context_initialized = 0;
if (avctx->hwaccel && avctx->hwaccel->flush)
avctx->hwaccel->flush(avctx);
if (FF_HW_HAS_CB(avctx, flush))
FF_HW_SIMPLE_CALL(avctx, flush);
}
static int get_last_needed_nal(H264Context *h)
@ -652,14 +653,14 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
}
if (h->avctx->hwaccel &&
(ret = h->avctx->hwaccel->start_frame(h->avctx, buf, buf_size)) < 0)
(ret = FF_HW_CALL(h->avctx, start_frame, buf, buf_size)) < 0)
goto end;
}
max_slice_ctx = avctx->hwaccel ? 1 : h->nb_slice_ctx;
if (h->nb_slice_ctx_queued == max_slice_ctx) {
if (h->avctx->hwaccel) {
ret = avctx->hwaccel->decode_slice(avctx, nal->raw_data, nal->raw_size);
ret = FF_HW_CALL(avctx, decode_slice, nal->raw_data, nal->raw_size);
h->nb_slice_ctx_queued = 0;
} else
ret = ff_h264_execute_decode_slices(h);
@ -686,11 +687,9 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
break;
case H264_NAL_SPS: {
GetBitContext tmp_gb = nal->gb;
if (avctx->hwaccel && avctx->hwaccel->decode_params) {
ret = avctx->hwaccel->decode_params(avctx,
nal->type,
nal->raw_data,
nal->raw_size);
if (FF_HW_HAS_CB(avctx, decode_params)) {
ret = FF_HW_CALL(avctx, decode_params,
nal->type, nal->raw_data, nal->raw_size);
if (ret < 0)
goto end;
}
@ -705,11 +704,9 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
break;
}
case H264_NAL_PPS:
if (avctx->hwaccel && avctx->hwaccel->decode_params) {
ret = avctx->hwaccel->decode_params(avctx,
nal->type,
nal->raw_data,
nal->raw_size);
if (FF_HW_HAS_CB(avctx, decode_params)) {
ret = FF_HW_CALL(avctx, decode_params,
nal->type, nal->raw_data, nal->raw_size);
if (ret < 0)
goto end;
}

View File

@ -46,6 +46,7 @@
#include "hevc_data.h"
#include "hevc_parse.h"
#include "hevcdec.h"
#include "hwaccel_internal.h"
#include "hwconfig.h"
#include "internal.h"
#include "profiles.h"
@ -2948,11 +2949,9 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
switch (s->nal_unit_type) {
case HEVC_NAL_VPS:
if (s->avctx->hwaccel && s->avctx->hwaccel->decode_params) {
ret = s->avctx->hwaccel->decode_params(s->avctx,
nal->type,
nal->raw_data,
nal->raw_size);
if (FF_HW_HAS_CB(s->avctx, decode_params)) {
ret = FF_HW_CALL(s->avctx, decode_params,
nal->type, nal->raw_data, nal->raw_size);
if (ret < 0)
goto fail;
}
@ -2961,11 +2960,9 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
goto fail;
break;
case HEVC_NAL_SPS:
if (s->avctx->hwaccel && s->avctx->hwaccel->decode_params) {
ret = s->avctx->hwaccel->decode_params(s->avctx,
nal->type,
nal->raw_data,
nal->raw_size);
if (FF_HW_HAS_CB(s->avctx, decode_params)) {
ret = FF_HW_CALL(s->avctx, decode_params,
nal->type, nal->raw_data, nal->raw_size);
if (ret < 0)
goto fail;
}
@ -2975,11 +2972,9 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
goto fail;
break;
case HEVC_NAL_PPS:
if (s->avctx->hwaccel && s->avctx->hwaccel->decode_params) {
ret = s->avctx->hwaccel->decode_params(s->avctx,
nal->type,
nal->raw_data,
nal->raw_size);
if (FF_HW_HAS_CB(s->avctx, decode_params)) {
ret = FF_HW_CALL(s->avctx, decode_params,
nal->type, nal->raw_data, nal->raw_size);
if (ret < 0)
goto fail;
}
@ -2989,11 +2984,9 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
break;
case HEVC_NAL_SEI_PREFIX:
case HEVC_NAL_SEI_SUFFIX:
if (s->avctx->hwaccel && s->avctx->hwaccel->decode_params) {
ret = s->avctx->hwaccel->decode_params(s->avctx,
nal->type,
nal->raw_data,
nal->raw_size);
if (FF_HW_HAS_CB(s->avctx, decode_params)) {
ret = FF_HW_CALL(s->avctx, decode_params,
nal->type, nal->raw_data, nal->raw_size);
if (ret < 0)
goto fail;
}
@ -3079,13 +3072,13 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
}
if (s->sh.first_slice_in_pic_flag && s->avctx->hwaccel) {
ret = s->avctx->hwaccel->start_frame(s->avctx, NULL, 0);
ret = FF_HW_CALL(s->avctx, start_frame, NULL, 0);
if (ret < 0)
goto fail;
}
if (s->avctx->hwaccel) {
ret = s->avctx->hwaccel->decode_slice(s->avctx, nal->raw_data, nal->raw_size);
ret = FF_HW_CALL(s->avctx, decode_slice, nal->raw_data, nal->raw_size);
if (ret < 0)
goto fail;
} else {
@ -3353,7 +3346,7 @@ static int hevc_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
return ret;
if (avctx->hwaccel) {
if (s->ref && (ret = avctx->hwaccel->end_frame(avctx)) < 0) {
if (s->ref && (ret = FF_HW_SIMPLE_CALL(avctx, end_frame)) < 0) {
av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
ff_hevc_unref_frame(s, s->ref, ~0);
@ -3669,8 +3662,8 @@ static void hevc_decode_flush(AVCodecContext *avctx)
s->max_ra = INT_MAX;
s->eos = 1;
if (avctx->hwaccel && avctx->hwaccel->flush)
avctx->hwaccel->flush(avctx);
if (FF_HW_HAS_CB(avctx, flush))
FF_HW_SIMPLE_CALL(avctx, flush);
}
#define OFFSET(x) offsetof(HEVCContext, x)

View File

@ -23,7 +23,157 @@
#ifndef AVCODEC_HWACCEL_INTERNAL_H
#define AVCODEC_HWACCEL_INTERNAL_H
#include <stdint.h>
#include "avcodec.h"
#define HWACCEL_CAP_ASYNC_SAFE (1 << 0)
#define HWACCEL_CAP_THREAD_SAFE (1 << 1)
typedef struct FFHWAccel {
/**
* The public AVHWAccel. See avcodec.h for it.
*/
AVHWAccel p;
/**
* Allocate a custom buffer
*/
int (*alloc_frame)(AVCodecContext *avctx, AVFrame *frame);
/**
* Called at the beginning of each frame or field picture.
*
* Meaningful frame information (codec specific) is guaranteed to
* be parsed at this point. This function is mandatory.
*
* Note that buf can be NULL along with buf_size set to 0.
* Otherwise, this means the whole frame is available at this point.
*
* @param avctx the codec context
* @param buf the frame data buffer base
* @param buf_size the size of the frame in bytes
* @return zero if successful, a negative value otherwise
*/
int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
/**
* Callback for parameter data (SPS/PPS/VPS etc).
*
* Useful for hardware decoders which keep persistent state about the
* video parameters, and need to receive any changes to update that state.
*
* @param avctx the codec context
* @param type the nal unit type
* @param buf the nal unit data buffer
* @param buf_size the size of the nal unit in bytes
* @return zero if successful, a negative value otherwise
*/
int (*decode_params)(AVCodecContext *avctx, int type, const uint8_t *buf, uint32_t buf_size);
/**
* Callback for each slice.
*
* Meaningful slice information (codec specific) is guaranteed to
* be parsed at this point. This function is mandatory.
*
* @param avctx the codec context
* @param buf the slice data buffer base
* @param buf_size the size of the slice in bytes
* @return zero if successful, a negative value otherwise
*/
int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
/**
* Called at the end of each frame or field picture.
*
* The whole picture is parsed at this point and can now be sent
* to the hardware accelerator. This function is mandatory.
*
* @param avctx the codec context
* @return zero if successful, a negative value otherwise
*/
int (*end_frame)(AVCodecContext *avctx);
/**
* Size of per-frame hardware accelerator private data.
*
* Private data is allocated with av_mallocz() before
* AVCodecContext.get_buffer() and deallocated after
* AVCodecContext.release_buffer().
*/
int frame_priv_data_size;
/**
* Size of the private data to allocate in
* AVCodecInternal.hwaccel_priv_data.
*/
int priv_data_size;
/**
* Internal hwaccel capabilities.
*/
int caps_internal;
/**
* Initialize the hwaccel private data.
*
* This will be called from ff_get_format(), after hwaccel and
* hwaccel_context are set and the hwaccel private data in AVCodecInternal
* is allocated.
*/
int (*init)(AVCodecContext *avctx);
/**
* Uninitialize the hwaccel private data.
*
* This will be called from get_format() or avcodec_close(), after hwaccel
* and hwaccel_context are already uninitialized.
*/
int (*uninit)(AVCodecContext *avctx);
/**
* Fill the given hw_frames context with current codec parameters. Called
* from get_format. Refer to avcodec_get_hw_frames_parameters() for
* details.
*
* This CAN be called before AVHWAccel.init is called, and you must assume
* that avctx->hwaccel_priv_data is invalid.
*/
int (*frame_params)(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx);
/**
* Copy necessary context variables from a previous thread context to the current one.
* For thread-safe hwaccels only.
*/
int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
/**
* Callback to free the hwaccel-specific frame data.
*
* @param hwctx a pointer to an AVHWDeviceContext.
* @param data the per-frame hardware accelerator private data to be freed.
*/
void (*free_frame_priv)(void *hwctx, uint8_t *data);
/**
* Callback to flush the hwaccel state.
*/
void (*flush)(AVCodecContext *avctx);
} FFHWAccel;
static inline const FFHWAccel *ffhwaccel(const AVHWAccel *codec)
{
return (const FFHWAccel*)codec;
}
#define FF_HW_CALL(avctx, function, ...) \
(ffhwaccel((avctx)->hwaccel)->function((avctx), __VA_ARGS__))
#define FF_HW_SIMPLE_CALL(avctx, function) \
(ffhwaccel((avctx)->hwaccel)->function(avctx))
#define FF_HW_HAS_CB(avctx, function) \
((avctx)->hwaccel && ffhwaccel((avctx)->hwaccel)->function)
#endif /* AVCODEC_HWACCEL_INTERNAL */

View File

@ -19,70 +19,68 @@
#ifndef AVCODEC_HWACCELS_H
#define AVCODEC_HWACCELS_H
#include "avcodec.h"
extern const AVHWAccel ff_av1_d3d11va_hwaccel;
extern const AVHWAccel ff_av1_d3d11va2_hwaccel;
extern const AVHWAccel ff_av1_dxva2_hwaccel;
extern const AVHWAccel ff_av1_nvdec_hwaccel;
extern const AVHWAccel ff_av1_vaapi_hwaccel;
extern const AVHWAccel ff_av1_vdpau_hwaccel;
extern const AVHWAccel ff_av1_vulkan_hwaccel;
extern const AVHWAccel ff_h263_vaapi_hwaccel;
extern const AVHWAccel ff_h263_videotoolbox_hwaccel;
extern const AVHWAccel ff_h264_d3d11va_hwaccel;
extern const AVHWAccel ff_h264_d3d11va2_hwaccel;
extern const AVHWAccel ff_h264_dxva2_hwaccel;
extern const AVHWAccel ff_h264_nvdec_hwaccel;
extern const AVHWAccel ff_h264_vaapi_hwaccel;
extern const AVHWAccel ff_h264_vdpau_hwaccel;
extern const AVHWAccel ff_h264_videotoolbox_hwaccel;
extern const AVHWAccel ff_h264_vulkan_hwaccel;
extern const AVHWAccel ff_hevc_d3d11va_hwaccel;
extern const AVHWAccel ff_hevc_d3d11va2_hwaccel;
extern const AVHWAccel ff_hevc_dxva2_hwaccel;
extern const AVHWAccel ff_hevc_nvdec_hwaccel;
extern const AVHWAccel ff_hevc_vaapi_hwaccel;
extern const AVHWAccel ff_hevc_vdpau_hwaccel;
extern const AVHWAccel ff_hevc_videotoolbox_hwaccel;
extern const AVHWAccel ff_hevc_vulkan_hwaccel;
extern const AVHWAccel ff_mjpeg_nvdec_hwaccel;
extern const AVHWAccel ff_mjpeg_vaapi_hwaccel;
extern const AVHWAccel ff_mpeg1_nvdec_hwaccel;
extern const AVHWAccel ff_mpeg1_vdpau_hwaccel;
extern const AVHWAccel ff_mpeg1_videotoolbox_hwaccel;
extern const AVHWAccel ff_mpeg2_d3d11va_hwaccel;
extern const AVHWAccel ff_mpeg2_d3d11va2_hwaccel;
extern const AVHWAccel ff_mpeg2_nvdec_hwaccel;
extern const AVHWAccel ff_mpeg2_dxva2_hwaccel;
extern const AVHWAccel ff_mpeg2_vaapi_hwaccel;
extern const AVHWAccel ff_mpeg2_vdpau_hwaccel;
extern const AVHWAccel ff_mpeg2_videotoolbox_hwaccel;
extern const AVHWAccel ff_mpeg4_nvdec_hwaccel;
extern const AVHWAccel ff_mpeg4_vaapi_hwaccel;
extern const AVHWAccel ff_mpeg4_vdpau_hwaccel;
extern const AVHWAccel ff_mpeg4_videotoolbox_hwaccel;
extern const AVHWAccel ff_prores_videotoolbox_hwaccel;
extern const AVHWAccel ff_vc1_d3d11va_hwaccel;
extern const AVHWAccel ff_vc1_d3d11va2_hwaccel;
extern const AVHWAccel ff_vc1_dxva2_hwaccel;
extern const AVHWAccel ff_vc1_nvdec_hwaccel;
extern const AVHWAccel ff_vc1_vaapi_hwaccel;
extern const AVHWAccel ff_vc1_vdpau_hwaccel;
extern const AVHWAccel ff_vp8_nvdec_hwaccel;
extern const AVHWAccel ff_vp8_vaapi_hwaccel;
extern const AVHWAccel ff_vp9_d3d11va_hwaccel;
extern const AVHWAccel ff_vp9_d3d11va2_hwaccel;
extern const AVHWAccel ff_vp9_dxva2_hwaccel;
extern const AVHWAccel ff_vp9_nvdec_hwaccel;
extern const AVHWAccel ff_vp9_vaapi_hwaccel;
extern const AVHWAccel ff_vp9_vdpau_hwaccel;
extern const AVHWAccel ff_vp9_videotoolbox_hwaccel;
extern const AVHWAccel ff_wmv3_d3d11va_hwaccel;
extern const AVHWAccel ff_wmv3_d3d11va2_hwaccel;
extern const AVHWAccel ff_wmv3_dxva2_hwaccel;
extern const AVHWAccel ff_wmv3_nvdec_hwaccel;
extern const AVHWAccel ff_wmv3_vaapi_hwaccel;
extern const AVHWAccel ff_wmv3_vdpau_hwaccel;
extern const struct FFHWAccel ff_av1_d3d11va_hwaccel;
extern const struct FFHWAccel ff_av1_d3d11va2_hwaccel;
extern const struct FFHWAccel ff_av1_dxva2_hwaccel;
extern const struct FFHWAccel ff_av1_nvdec_hwaccel;
extern const struct FFHWAccel ff_av1_vaapi_hwaccel;
extern const struct FFHWAccel ff_av1_vdpau_hwaccel;
extern const struct FFHWAccel ff_av1_vulkan_hwaccel;
extern const struct FFHWAccel ff_h263_vaapi_hwaccel;
extern const struct FFHWAccel ff_h263_videotoolbox_hwaccel;
extern const struct FFHWAccel ff_h264_d3d11va_hwaccel;
extern const struct FFHWAccel ff_h264_d3d11va2_hwaccel;
extern const struct FFHWAccel ff_h264_dxva2_hwaccel;
extern const struct FFHWAccel ff_h264_nvdec_hwaccel;
extern const struct FFHWAccel ff_h264_vaapi_hwaccel;
extern const struct FFHWAccel ff_h264_vdpau_hwaccel;
extern const struct FFHWAccel ff_h264_videotoolbox_hwaccel;
extern const struct FFHWAccel ff_h264_vulkan_hwaccel;
extern const struct FFHWAccel ff_hevc_d3d11va_hwaccel;
extern const struct FFHWAccel ff_hevc_d3d11va2_hwaccel;
extern const struct FFHWAccel ff_hevc_dxva2_hwaccel;
extern const struct FFHWAccel ff_hevc_nvdec_hwaccel;
extern const struct FFHWAccel ff_hevc_vaapi_hwaccel;
extern const struct FFHWAccel ff_hevc_vdpau_hwaccel;
extern const struct FFHWAccel ff_hevc_videotoolbox_hwaccel;
extern const struct FFHWAccel ff_hevc_vulkan_hwaccel;
extern const struct FFHWAccel ff_mjpeg_nvdec_hwaccel;
extern const struct FFHWAccel ff_mjpeg_vaapi_hwaccel;
extern const struct FFHWAccel ff_mpeg1_nvdec_hwaccel;
extern const struct FFHWAccel ff_mpeg1_vdpau_hwaccel;
extern const struct FFHWAccel ff_mpeg1_videotoolbox_hwaccel;
extern const struct FFHWAccel ff_mpeg2_d3d11va_hwaccel;
extern const struct FFHWAccel ff_mpeg2_d3d11va2_hwaccel;
extern const struct FFHWAccel ff_mpeg2_dxva2_hwaccel;
extern const struct FFHWAccel ff_mpeg2_nvdec_hwaccel;
extern const struct FFHWAccel ff_mpeg2_vaapi_hwaccel;
extern const struct FFHWAccel ff_mpeg2_vdpau_hwaccel;
extern const struct FFHWAccel ff_mpeg2_videotoolbox_hwaccel;
extern const struct FFHWAccel ff_mpeg4_nvdec_hwaccel;
extern const struct FFHWAccel ff_mpeg4_vaapi_hwaccel;
extern const struct FFHWAccel ff_mpeg4_vdpau_hwaccel;
extern const struct FFHWAccel ff_mpeg4_videotoolbox_hwaccel;
extern const struct FFHWAccel ff_prores_videotoolbox_hwaccel;
extern const struct FFHWAccel ff_vc1_d3d11va_hwaccel;
extern const struct FFHWAccel ff_vc1_d3d11va2_hwaccel;
extern const struct FFHWAccel ff_vc1_dxva2_hwaccel;
extern const struct FFHWAccel ff_vc1_nvdec_hwaccel;
extern const struct FFHWAccel ff_vc1_vaapi_hwaccel;
extern const struct FFHWAccel ff_vc1_vdpau_hwaccel;
extern const struct FFHWAccel ff_vp8_nvdec_hwaccel;
extern const struct FFHWAccel ff_vp8_vaapi_hwaccel;
extern const struct FFHWAccel ff_vp9_d3d11va_hwaccel;
extern const struct FFHWAccel ff_vp9_d3d11va2_hwaccel;
extern const struct FFHWAccel ff_vp9_dxva2_hwaccel;
extern const struct FFHWAccel ff_vp9_nvdec_hwaccel;
extern const struct FFHWAccel ff_vp9_vaapi_hwaccel;
extern const struct FFHWAccel ff_vp9_vdpau_hwaccel;
extern const struct FFHWAccel ff_vp9_videotoolbox_hwaccel;
extern const struct FFHWAccel ff_wmv3_d3d11va_hwaccel;
extern const struct FFHWAccel ff_wmv3_d3d11va2_hwaccel;
extern const struct FFHWAccel ff_wmv3_dxva2_hwaccel;
extern const struct FFHWAccel ff_wmv3_nvdec_hwaccel;
extern const struct FFHWAccel ff_wmv3_vaapi_hwaccel;
extern const struct FFHWAccel ff_wmv3_vdpau_hwaccel;
#endif /* AVCODEC_HWACCELS_H */

View File

@ -32,7 +32,7 @@ typedef struct AVCodecHWConfigInternal {
* If this configuration uses a hwaccel, a pointer to it.
* If not, NULL.
*/
const AVHWAccel *hwaccel;
const struct FFHWAccel *hwaccel;
} AVCodecHWConfigInternal;