diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-03-30 21:33:24 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-04-05 19:54:09 +0200 |
commit | ce7dbd0481f990e249c2a05f179228489d3062cf (patch) | |
tree | c5f04e58129705430e1d97a5842131b72e250083 /libavcodec/cavsdec.c | |
parent | fb59a42ef977dd91085a602f10c9c82f88d072e5 (diff) | |
download | ffmpeg-ce7dbd0481f990e249c2a05f179228489d3062cf.tar.gz |
avcodec/codec_internal: Make FFCodec.decode use AVFrame*
This increases type-safety by avoiding conversions from/through void*.
It also avoids the boilerplate "AVFrame *frame = data;" line
for non-subtitle decoders.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/cavsdec.c')
-rw-r--r-- | libavcodec/cavsdec.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c index 760dd792cb..6e424f4763 100644 --- a/libavcodec/cavsdec.c +++ b/libavcodec/cavsdec.c @@ -1226,8 +1226,8 @@ static void cavs_flush(AVCodecContext * avctx) h->got_keyframe = 0; } -static int cavs_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, - AVPacket *avpkt) +static int cavs_decode_frame(AVCodecContext *avctx, AVFrame *rframe, + int *got_frame, AVPacket *avpkt) { AVSContext *h = avctx->priv_data; const uint8_t *buf = avpkt->data; @@ -1241,7 +1241,7 @@ static int cavs_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, if (buf_size == 0) { if (!h->low_delay && h->DPB[0].f->data[0]) { *got_frame = 1; - av_frame_move_ref(data, h->DPB[0].f); + av_frame_move_ref(rframe, h->DPB[0].f); } return 0; } @@ -1274,7 +1274,7 @@ static int cavs_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return AVERROR_INVALIDDATA; frame_start ++; if (*got_frame) - av_frame_unref(data); + av_frame_unref(rframe); *got_frame = 0; if (!h->got_keyframe) break; @@ -1285,13 +1285,13 @@ static int cavs_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, *got_frame = 1; if (h->cur.f->pict_type != AV_PICTURE_TYPE_B) { if (h->DPB[!h->low_delay].f->data[0]) { - if ((ret = av_frame_ref(data, h->DPB[!h->low_delay].f)) < 0) + if ((ret = av_frame_ref(rframe, h->DPB[!h->low_delay].f)) < 0) return ret; } else { *got_frame = 0; } } else { - av_frame_move_ref(data, h->cur.f); + av_frame_move_ref(rframe, h->cur.f); } break; case EXT_START_CODE: |