diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-08-01 19:44:22 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-08-07 09:50:29 +0200 |
commit | e35dfe864d8fb1ee9e28684a5a93e4b75d0d8092 (patch) | |
tree | bbf1004fe094653f8dc00048137f17cc4cb06ab6 /libavcodec/av1dec.c | |
parent | c48cc9c6e90bc8ca0304bd57cb77f7a689f83391 (diff) |
avcodec/avcodec: Add FFHWAccel, hide internals of AVHWAccel
This commit is the AVHWAccel analogue of commit
20f972701806be20a77f808db332d9489343bb78: 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>
Diffstat (limited to 'libavcodec/av1dec.c')
-rw-r--r-- | libavcodec/av1dec.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index 09339529f7..03283ab064 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -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) |