[FFmpeg-devel] [PATCH 3/7] avcodec/codec_internal: Make FFCodec.decode use AVFrame*

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Thu Mar 31 01:49:54 EEST 2022


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
Could be squashed into the preceding commit.

 libavcodec/012v.c                  |  3 +--
 libavcodec/4xm.c                   |  3 +--
 libavcodec/8bps.c                  |  3 +--
 libavcodec/8svx.c                  |  3 +--
 libavcodec/aacdec.c                |  2 +-
 libavcodec/aacdec_template.c       | 14 +++++++-------
 libavcodec/aasc.c                  |  7 +++----
 libavcodec/ac3dec.c                |  3 +--
 libavcodec/adpcm.c                 |  3 +--
 libavcodec/adxdec.c                |  3 +--
 libavcodec/agm.c                   |  3 +--
 libavcodec/aic.c                   |  6 +++---
 libavcodec/alac.c                  |  3 +--
 libavcodec/aliaspixdec.c           |  5 ++---
 libavcodec/alsdec.c                |  5 ++---
 libavcodec/amrnbdec.c              |  3 +--
 libavcodec/amrwbdec.c              |  3 +--
 libavcodec/anm.c                   |  7 +++----
 libavcodec/ansi.c                  |  7 +++----
 libavcodec/apedec.c                |  3 +--
 libavcodec/aptxdec.c               |  3 +--
 libavcodec/arbc.c                  |  3 +--
 libavcodec/argo.c                  |  4 ++--
 libavcodec/asvdec.c                |  5 ++---
 libavcodec/atrac1.c                |  3 +--
 libavcodec/atrac3.c                |  6 ++----
 libavcodec/atrac3plusdec.c         |  3 +--
 libavcodec/atrac9dec.c             |  3 +--
 libavcodec/audiotoolboxdec.c       |  3 +--
 libavcodec/aura.c                  |  6 ++----
 libavcodec/av1dec.c                |  2 +-
 libavcodec/avrndec.c               |  3 +--
 libavcodec/avs.c                   |  6 ++----
 libavcodec/avuidec.c               |  3 +--
 libavcodec/bethsoftvideo.c         |  7 +++----
 libavcodec/bfi.c                   |  3 +--
 libavcodec/bink.c                  |  4 ++--
 libavcodec/bintext.c               |  7 +++----
 libavcodec/bitpacked_dec.c         |  5 ++---
 libavcodec/bmp.c                   |  6 ++----
 libavcodec/bmvaudio.c              |  3 +--
 libavcodec/bmvvideo.c              |  5 ++---
 libavcodec/brenderpix.c            |  6 ++----
 libavcodec/c93.c                   |  4 ++--
 libavcodec/cavsdec.c               | 12 ++++++------
 libavcodec/cdgraphics.c            |  5 ++---
 libavcodec/cdtoons.c               |  4 ++--
 libavcodec/cdxl.c                  |  3 +--
 libavcodec/cfhd.c                  |  5 ++---
 libavcodec/cinepak.c               |  7 +++----
 libavcodec/clearvideo.c            |  4 ++--
 libavcodec/cljrdec.c               |  6 ++----
 libavcodec/cllc.c                  |  3 +--
 libavcodec/cngdec.c                |  3 +--
 libavcodec/codec_internal.h        |  6 +++---
 libavcodec/cook.c                  |  3 +--
 libavcodec/cpia.c                  |  6 +++---
 libavcodec/cri.c                   |  3 +--
 libavcodec/cscd.c                  |  6 +++---
 libavcodec/cyuv.c                  |  6 ++----
 libavcodec/dcadec.c                |  3 +--
 libavcodec/dds.c                   |  3 +--
 libavcodec/dfa.c                   |  6 ++----
 libavcodec/dfpwmdec.c              |  5 ++---
 libavcodec/diracdec.c              | 10 +++++-----
 libavcodec/dnxhddec.c              |  3 +--
 libavcodec/dolby_e.c               |  4 ++--
 libavcodec/dpcm.c                  |  3 +--
 libavcodec/dpx.c                   |  7 ++-----
 libavcodec/dsddec.c                |  3 +--
 libavcodec/dsicinaudio.c           |  3 +--
 libavcodec/dsicinvideo.c           |  7 +++----
 libavcodec/dss_sp.c                |  3 +--
 libavcodec/dstdec.c                |  3 +--
 libavcodec/dvaudiodec.c            |  3 +--
 libavcodec/dvdec.c                 |  3 +--
 libavcodec/dxa.c                   |  4 ++--
 libavcodec/dxtory.c                |  5 ++---
 libavcodec/dxv.c                   |  3 +--
 libavcodec/eacmv.c                 |  6 ++----
 libavcodec/eamad.c                 |  6 ++----
 libavcodec/eatgq.c                 |  6 ++----
 libavcodec/eatgv.c                 |  6 ++----
 libavcodec/eatqi.c                 |  6 ++----
 libavcodec/escape124.c             |  6 ++----
 libavcodec/escape130.c             |  3 +--
 libavcodec/evrcdec.c               |  3 +--
 libavcodec/exr.c                   |  3 +--
 libavcodec/fastaudio.c             |  3 +--
 libavcodec/ffv1dec.c               |  5 +++--
 libavcodec/ffwavesynth.c           |  5 ++---
 libavcodec/fic.c                   |  4 ++--
 libavcodec/fitsdec.c               |  4 ++--
 libavcodec/flacdec.c               |  3 +--
 libavcodec/flashsv.c               |  4 ++--
 libavcodec/flicvideo.c             | 23 +++++++++++------------
 libavcodec/fmvc.c                  |  3 +--
 libavcodec/fraps.c                 |  6 ++----
 libavcodec/frwu.c                  |  5 ++---
 libavcodec/g2meet.c                |  3 +--
 libavcodec/g722dec.c               |  3 +--
 libavcodec/g723_1dec.c             |  3 +--
 libavcodec/g726.c                  |  3 +--
 libavcodec/g729dec.c               |  5 ++---
 libavcodec/gdv.c                   |  3 +--
 libavcodec/gemdec.c                |  6 ++----
 libavcodec/gifdec.c                |  5 +++--
 libavcodec/gsmdec.c                |  3 +--
 libavcodec/h261dec.c               |  3 +--
 libavcodec/h263dec.c               |  5 ++---
 libavcodec/h263dec.h               |  5 ++---
 libavcodec/h264dec.c               |  3 +--
 libavcodec/hapdec.c                |  3 +--
 libavcodec/hcadec.c                |  3 +--
 libavcodec/hcom.c                  |  3 +--
 libavcodec/hevcdec.c               |  8 ++++----
 libavcodec/hnm4video.c             |  3 +--
 libavcodec/hq_hqa.c                |  3 +--
 libavcodec/hqx.c                   |  5 ++---
 libavcodec/huffyuvdec.c            |  5 ++---
 libavcodec/idcinvideo.c            |  6 ++----
 libavcodec/iff.c                   |  6 ++----
 libavcodec/ilbcdec.c               |  3 +--
 libavcodec/imc.c                   |  3 +--
 libavcodec/imm4.c                  |  3 +--
 libavcodec/imm5.c                  |  3 +--
 libavcodec/imx.c                   |  4 ++--
 libavcodec/indeo2.c                |  6 ++----
 libavcodec/indeo3.c                |  5 ++---
 libavcodec/interplayacm.c          |  3 +--
 libavcodec/interplayvideo.c        |  6 ++----
 libavcodec/ivi.c                   |  7 +++----
 libavcodec/ivi.h                   |  4 ++--
 libavcodec/jpeg2000dec.c           |  3 +--
 libavcodec/jvdec.c                 |  6 +++---
 libavcodec/kgv1dec.c               |  5 ++---
 libavcodec/kmvc.c                  |  5 ++---
 libavcodec/lagarith.c              |  5 ++---
 libavcodec/lcldec.c                |  4 ++--
 libavcodec/libaomdec.c             |  5 ++---
 libavcodec/libcelt_dec.c           |  3 +--
 libavcodec/libcodec2.c             |  3 +--
 libavcodec/libdavs2.c              |  3 +--
 libavcodec/libfdk-aacdec.c         |  3 +--
 libavcodec/libgsmdec.c             |  3 +--
 libavcodec/libilbc.c               |  3 +--
 libavcodec/libopencore-amr.c       |  6 ++----
 libavcodec/libopenh264dec.c        |  3 +--
 libavcodec/libopenjpegdec.c        |  6 ++----
 libavcodec/libopusdec.c            |  3 +--
 libavcodec/librsvgdec.c            |  4 ++--
 libavcodec/libspeexdec.c           |  3 +--
 libavcodec/libuavs3d.c             |  8 ++++----
 libavcodec/libvorbisdec.c          |  5 ++---
 libavcodec/libvpxdec.c             |  5 ++---
 libavcodec/loco.c                  |  6 ++----
 libavcodec/lscrdec.c               |  7 +++----
 libavcodec/m101.c                  |  5 ++---
 libavcodec/mace.c                  |  3 +--
 libavcodec/magicyuv.c              |  3 +--
 libavcodec/mdec.c                  |  6 ++----
 libavcodec/midivid.c               |  4 ++--
 libavcodec/mimic.c                 |  6 +++---
 libavcodec/mjpegbdec.c             |  7 +++----
 libavcodec/mlpdec.c                |  4 ++--
 libavcodec/mmvideo.c               |  7 +++----
 libavcodec/mobiclip.c              |  6 +++---
 libavcodec/motionpixels.c          |  7 +++----
 libavcodec/mpc7.c                  |  3 +--
 libavcodec/mpc8.c                  |  3 +--
 libavcodec/mpeg12dec.c             |  6 ++----
 libavcodec/mpegaudiodec_template.c | 13 ++++++-------
 libavcodec/mscc.c                  |  6 ++----
 libavcodec/msp2dec.c               |  6 ++----
 libavcodec/msrle.c                 |  7 +++----
 libavcodec/mss1.c                  |  6 +++---
 libavcodec/mss2.c                  |  5 ++---
 libavcodec/mss3.c                  |  8 ++++----
 libavcodec/mss4.c                  |  8 ++++----
 libavcodec/msvideo1.c              |  7 +++----
 libavcodec/mv30.c                  |  3 +--
 libavcodec/mvcdec.c                |  5 ++---
 libavcodec/mvha.c                  |  6 ++----
 libavcodec/mwsc.c                  |  6 ++----
 libavcodec/mxpegdec.c              |  7 +++----
 libavcodec/nellymoserdec.c         |  3 +--
 libavcodec/notchlc.c               |  6 ++----
 libavcodec/nuv.c                   |  5 ++---
 libavcodec/on2avc.c                |  3 +--
 libavcodec/opusdec.c               |  3 +--
 libavcodec/pafaudio.c              |  3 +--
 libavcodec/pafvideo.c              |  4 ++--
 libavcodec/pcm-bluray.c            |  3 +--
 libavcodec/pcm-dvd.c               |  3 +--
 libavcodec/pcm.c                   |  5 ++---
 libavcodec/pcx.c                   |  5 ++---
 libavcodec/pgxdec.c                |  3 +--
 libavcodec/photocd.c               |  3 +--
 libavcodec/pictordec.c             |  6 ++----
 libavcodec/pixlet.c                |  3 +--
 libavcodec/pngdec.c                | 12 ++++--------
 libavcodec/pnmdec.c                |  3 +--
 libavcodec/proresdec2.c            |  5 ++---
 libavcodec/prosumer.c              |  3 +--
 libavcodec/psd.c                   |  4 +---
 libavcodec/ptx.c                   |  6 +++---
 libavcodec/qcelpdec.c              |  3 +--
 libavcodec/qdm2.c                  |  3 +--
 libavcodec/qdmc.c                  |  3 +--
 libavcodec/qdrw.c                  |  6 ++----
 libavcodec/qpeg.c                  |  6 ++----
 libavcodec/qsvdec.c                |  3 +--
 libavcodec/qtrle.c                 |  7 +++----
 libavcodec/r210dec.c               |  5 ++---
 libavcodec/ra144dec.c              |  3 +--
 libavcodec/ra288.c                 |  3 +--
 libavcodec/ralf.c                  |  5 ++---
 libavcodec/rasc.c                  |  6 ++----
 libavcodec/rawdec.c                |  6 ++----
 libavcodec/rl2.c                   |  6 ++----
 libavcodec/roqvideodec.c           |  7 +++----
 libavcodec/rpza.c                  |  7 +++----
 libavcodec/rscc.c                  |  5 ++---
 libavcodec/rv10.c                  |  5 ++---
 libavcodec/rv34.c                  |  6 ++----
 libavcodec/rv34.h                  |  3 ++-
 libavcodec/s302m.c                 |  3 +--
 libavcodec/sanm.c                  |  4 ++--
 libavcodec/sbcdec.c                |  6 ++----
 libavcodec/scpr.c                  |  7 +++----
 libavcodec/screenpresso.c          |  3 +--
 libavcodec/sga.c                   |  3 +--
 libavcodec/sgidec.c                |  6 ++----
 libavcodec/sgirledec.c             |  3 +--
 libavcodec/sheervideo.c            |  6 ++----
 libavcodec/shorten.c               |  3 +--
 libavcodec/sipr.c                  |  3 +--
 libavcodec/siren.c                 |  3 +--
 libavcodec/smacker.c               |  9 ++++-----
 libavcodec/smc.c                   |  7 +++----
 libavcodec/snowdec.c               |  5 ++---
 libavcodec/sonic.c                 |  6 ++----
 libavcodec/speedhq.c               |  6 ++----
 libavcodec/speexdec.c              |  3 +--
 libavcodec/sunrast.c               |  3 +--
 libavcodec/svq1dec.c               |  3 +--
 libavcodec/svq3.c                  |  8 ++++----
 libavcodec/takdec.c                |  3 +--
 libavcodec/targa.c                 |  6 ++----
 libavcodec/targa_y216dec.c         |  3 +--
 libavcodec/tdsc.c                  |  3 +--
 libavcodec/tiertexseqv.c           |  7 +++----
 libavcodec/tiff.c                  |  7 +++----
 libavcodec/tmv.c                   |  3 +--
 libavcodec/truemotion1.c           |  7 +++----
 libavcodec/truemotion2.c           |  7 +++----
 libavcodec/truemotion2rt.c         |  3 +--
 libavcodec/truespeech.c            |  3 +--
 libavcodec/tscc.c                  |  6 +++---
 libavcodec/tscc2.c                 |  4 ++--
 libavcodec/tta.c                   |  3 +--
 libavcodec/twinvq.c                |  3 +--
 libavcodec/twinvq.h                |  2 +-
 libavcodec/txd.c                   |  6 +++---
 libavcodec/ulti.c                  |  7 +++----
 libavcodec/utvideodec.c            |  5 ++---
 libavcodec/v210dec.c               |  5 ++---
 libavcodec/v210x.c                 |  5 ++---
 libavcodec/v308dec.c               |  3 +--
 libavcodec/v408dec.c               |  3 +--
 libavcodec/v410dec.c               |  3 +--
 libavcodec/vb.c                    |  5 ++---
 libavcodec/vble.c                  |  5 ++---
 libavcodec/vc1dec.c                |  3 +--
 libavcodec/vcr1.c                  |  3 +--
 libavcodec/vima.c                  |  3 +--
 libavcodec/vmdaudio.c              |  3 +--
 libavcodec/vmdvideo.c              |  6 ++----
 libavcodec/vmnc.c                  |  6 +++---
 libavcodec/vorbisdec.c             |  3 +--
 libavcodec/vp3.c                   |  8 +++-----
 libavcodec/vp56.c                  |  6 +++---
 libavcodec/vp56.h                  |  4 ++--
 libavcodec/vp8.c                   | 16 ++++++++--------
 libavcodec/vp8.h                   |  4 ++--
 libavcodec/vp9.c                   |  6 +++---
 libavcodec/vqavideo.c              |  7 +++----
 libavcodec/wavpack.c               |  4 ++--
 libavcodec/wcmv.c                  |  6 ++----
 libavcodec/webp.c                  |  7 +++----
 libavcodec/wmadec.c                |  7 +++----
 libavcodec/wmalosslessdec.c        |  6 +++---
 libavcodec/wmaprodec.c             | 21 +++++++--------------
 libavcodec/wmavoice.c              |  6 +++---
 libavcodec/wnv1.c                  |  6 ++----
 libavcodec/wrapped_avframe.c       |  5 ++---
 libavcodec/ws-snd1.c               |  3 +--
 libavcodec/xan.c                   |  6 ++----
 libavcodec/xbmdec.c                |  3 +--
 libavcodec/xfacedec.c              |  6 ++----
 libavcodec/xl.c                    |  6 ++----
 libavcodec/xpmdec.c                |  3 +--
 libavcodec/xwddec.c                |  3 +--
 libavcodec/xxan.c                  |  7 +++----
 libavcodec/y41pdec.c               |  3 +--
 libavcodec/ylc.c                   |  6 ++----
 libavcodec/yop.c                   |  6 +++---
 libavcodec/yuv4dec.c               |  3 +--
 libavcodec/zerocodec.c             |  3 +--
 libavcodec/zmbv.c                  |  4 ++--
 310 files changed, 588 insertions(+), 903 deletions(-)

diff --git a/libavcodec/012v.c b/libavcodec/012v.c
index 9c7fb56d59..4d57b57082 100644
--- a/libavcodec/012v.c
+++ b/libavcodec/012v.c
@@ -36,12 +36,11 @@ static av_cold int zero12v_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
+static int zero12v_decode_frame(AVCodecContext *avctx, AVFrame *pic,
                                 int *got_frame, AVPacket *avpkt)
 {
     int line, ret;
     const int width = avctx->width;
-    AVFrame *pic = data;
     uint16_t *y, *u, *v;
     const uint8_t *line_end, *src = avpkt->data;
     int stride = avctx->width * 8 / 3;
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index 1c4446fe13..413b4f9330 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -834,13 +834,12 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
                         int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf    = avpkt->data;
     int buf_size          = avpkt->size;
     FourXContext *const f = avctx->priv_data;
-    AVFrame *picture      = data;
     int i, frame_4cc, frame_size, ret;
 
     if (buf_size < 20)
diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c
index 3e8cd2591f..d5146043ac 100644
--- a/libavcodec/8bps.c
+++ b/libavcodec/8bps.c
@@ -54,10 +54,9 @@ typedef struct EightBpsContext {
     uint32_t pal[256];
 } EightBpsContext;
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
                         int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *frame = data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     EightBpsContext * const c = avctx->priv_data;
diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c
index 7317ea3117..937800304c 100644
--- a/libavcodec/8svx.c
+++ b/libavcodec/8svx.c
@@ -86,11 +86,10 @@ static void delta_decode(uint8_t *dst, const uint8_t *src, int src_size,
 }
 
 /** decode a frame */
-static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
+static int eightsvx_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                  int *got_frame_ptr, AVPacket *avpkt)
 {
     EightSvxContext *esc = avctx->priv_data;
-    AVFrame *frame       = data;
     int channels         = avctx->ch_layout.nb_channels;
     int buf_size;
     int ch, ret;
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 6f560909f3..5fc6738b38 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -480,7 +480,7 @@ static int read_audio_mux_element(struct LATMContext *latmctx,
 }
 
 
-static int latm_decode_frame(AVCodecContext *avctx, void *out,
+static int latm_decode_frame(AVCodecContext *avctx, AVFrame *out,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
     struct LATMContext *latmctx = avctx->priv_data;
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index 524f656cff..463bf92fc0 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -3235,7 +3235,7 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
     return 0;
 }
 
-static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
+static int aac_decode_frame_int(AVCodecContext *avctx, AVFrame *frame,
                                 int *got_frame_ptr, GetBitContext *gb,
                                 const AVPacket *avpkt)
 {
@@ -3248,7 +3248,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
     int payload_alignment;
     uint8_t che_presence[4][MAX_ELEM_ID] = {{0}};
 
-    ac->frame = data;
+    ac->frame = frame;
 
     if (show_bits(gb, 12) == 0xfff) {
         if ((err = parse_adts_frame_header(ac, gb)) < 0) {
@@ -3437,9 +3437,9 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
                                           &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO);
     if (is_dmono) {
         if (ac->dmono_mode == 1)
-            ((AVFrame *)data)->data[1] =((AVFrame *)data)->data[0];
+            frame->data[1] = frame->data[0];
         else if (ac->dmono_mode == 2)
-            ((AVFrame *)data)->data[0] =((AVFrame *)data)->data[1];
+            frame->data[0] = frame->data[1];
     }
 
     return 0;
@@ -3448,7 +3448,7 @@ fail:
     return err;
 }
 
-static int aac_decode_frame(AVCodecContext *avctx, void *data,
+static int aac_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame_ptr, AVPacket *avpkt)
 {
     AACContext *ac = avctx->priv_data;
@@ -3495,10 +3495,10 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data,
     case AOT_ER_AAC_LTP:
     case AOT_ER_AAC_LD:
     case AOT_ER_AAC_ELD:
-        err = aac_decode_er_frame(avctx, data, got_frame_ptr, &gb);
+        err = aac_decode_er_frame(avctx, frame, got_frame_ptr, &gb);
         break;
     default:
-        err = aac_decode_frame_int(avctx, data, got_frame_ptr, &gb, avpkt);
+        err = aac_decode_frame_int(avctx, frame, got_frame_ptr, &gb, avpkt);
     }
     if (err < 0)
         return err;
diff --git a/libavcodec/aasc.c b/libavcodec/aasc.c
index 9b1b64106e..a462e2f05e 100644
--- a/libavcodec/aasc.c
+++ b/libavcodec/aasc.c
@@ -78,9 +78,8 @@ static av_cold int aasc_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int aasc_decode_frame(AVCodecContext *avctx,
-                              void *data, int *got_frame,
-                              AVPacket *avpkt)
+static int aasc_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                             int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
@@ -134,7 +133,7 @@ static int aasc_decode_frame(AVCodecContext *avctx,
         memcpy(s->frame->data[1], s->palette, s->palette_size);
 
     *got_frame = 1;
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
 
     /* report that the buffer was completely consumed */
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index c4ba781d9e..fe330d0d3b 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1481,10 +1481,9 @@ static int decode_audio_block(AC3DecodeContext *s, int blk, int offset)
 /**
  * Decode a single AC-3 frame.
  */
-static int ac3_decode_frame(AVCodecContext * avctx, void *data,
+static int ac3_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size, full_buf_size = avpkt->size;
     AC3DecodeContext *s = avctx->priv_data;
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index f5ad14d331..ccb625ab54 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1062,10 +1062,9 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
     return nb_samples;
 }
 
-static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
+static int adpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                               int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     ADPCMDecodeContext *c = avctx->priv_data;
diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c
index fd540f7d54..870f485726 100644
--- a/libavcodec/adxdec.c
+++ b/libavcodec/adxdec.c
@@ -93,10 +93,9 @@ static int adx_decode(ADXContext *c, int16_t *out, int offset,
     return 0;
 }
 
-static int adx_decode_frame(AVCodecContext *avctx, void *data,
+static int adx_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame      = data;
     int buf_size        = avpkt->size;
     ADXContext *c       = avctx->priv_data;
     int16_t **samples;
diff --git a/libavcodec/agm.c b/libavcodec/agm.c
index 28b66cd30d..795b34a415 100644
--- a/libavcodec/agm.c
+++ b/libavcodec/agm.c
@@ -1094,13 +1094,12 @@ static int decode_huffman2(AVCodecContext *avctx, int header, int size)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
                         int *got_frame, AVPacket *avpkt)
 {
     AGMContext *s = avctx->priv_data;
     GetBitContext *gb = &s->gb;
     GetByteContext *gbyte = &s->gbyte;
-    AVFrame *frame = data;
     int w, h, width, height, header;
     unsigned compressed_size;
     long skip;
diff --git a/libavcodec/aic.c b/libavcodec/aic.c
index fa99205533..7f124f5126 100644
--- a/libavcodec/aic.c
+++ b/libavcodec/aic.c
@@ -381,8 +381,8 @@ static int aic_decode_slice(AICContext *ctx, int mb_x, int mb_y,
     return 0;
 }
 
-static int aic_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int aic_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                            int *got_frame, AVPacket *avpkt)
 {
     AICContext *ctx    = avctx->priv_data;
     const uint8_t *buf = avpkt->data;
@@ -392,7 +392,7 @@ static int aic_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     int x, y, ret;
     int slice_size;
 
-    ctx->frame            = data;
+    ctx->frame            = frame;
     ctx->frame->pict_type = AV_PICTURE_TYPE_I;
     ctx->frame->key_frame = 1;
 
diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index 90bd246fa6..b2d47e27c1 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -413,11 +413,10 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
     return 0;
 }
 
-static int alac_decode_frame(AVCodecContext *avctx, void *data,
+static int alac_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
     ALACContext *alac = avctx->priv_data;
-    AVFrame *frame    = data;
     enum AlacRawDataBlockType element;
     int channels;
     int ch, ret, got_end;
diff --git a/libavcodec/aliaspixdec.c b/libavcodec/aliaspixdec.c
index 1c156c3825..8dc579079f 100644
--- a/libavcodec/aliaspixdec.c
+++ b/libavcodec/aliaspixdec.c
@@ -28,10 +28,9 @@
 
 #define ALIAS_HEADER_SIZE 10
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *f,
+                        int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *f = data;
     GetByteContext gb;
     int width, height, ret, bits_pixel, pixel;
     uint8_t *out_buf;
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 8f0b061602..1a517916d5 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1791,11 +1791,10 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
 
 /** Decode an ALS frame.
  */
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame_ptr, AVPacket *avpkt)
 {
     ALSDecContext *ctx       = avctx->priv_data;
-    AVFrame *frame           = data;
     ALSSpecificConfig *sconf = &ctx->sconf;
     const uint8_t *buffer    = avpkt->data;
     int buffer_size          = avpkt->size;
diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c
index 86fbd17700..72482b25e4 100644
--- a/libavcodec/amrnbdec.c
+++ b/libavcodec/amrnbdec.c
@@ -955,12 +955,11 @@ static void postfilter(AMRContext *p, float *lpc, float *buf_out)
 
 /// @}
 
-static int amrnb_decode_frame(AVCodecContext *avctx, void *data,
+static int amrnb_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                               int *got_frame_ptr, AVPacket *avpkt)
 {
 
     AMRChannelsContext *s = avctx->priv_data;        // pointer to private data
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     int ret;
diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c
index 6f019e3a6f..e12078e028 100644
--- a/libavcodec/amrwbdec.c
+++ b/libavcodec/amrwbdec.c
@@ -1102,11 +1102,10 @@ static void update_sub_state(AMRWBContext *ctx)
             LP_ORDER_16k * sizeof(float));
 }
 
-static int amrwb_decode_frame(AVCodecContext *avctx, void *data,
+static int amrwb_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                               int *got_frame_ptr, AVPacket *avpkt)
 {
     AMRWBChannelsContext *s  = avctx->priv_data;
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     int sub, i, ret;
diff --git a/libavcodec/anm.c b/libavcodec/anm.c
index 8b05a20eb8..5e07247992 100644
--- a/libavcodec/anm.c
+++ b/libavcodec/anm.c
@@ -108,9 +108,8 @@ exhausted:
     return 1;
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                        int *got_frame, AVPacket *avpkt)
 {
     AnmContext *s = avctx->priv_data;
     const int buf_size = avpkt->size;
@@ -176,7 +175,7 @@ static int decode_frame(AVCodecContext *avctx,
     memcpy(s->frame->data[1], s->palette, AVPALETTE_SIZE);
 
     *got_frame = 1;
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
 
     return buf_size;
diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index 0ccd351794..80b3df0d92 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -354,9 +354,8 @@ static int execute_code(AVCodecContext * avctx, int c)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                        int *got_frame, AVPacket *avpkt)
 {
     AnsiContext *s = avctx->priv_data;
     uint8_t *buf = avpkt->data;
@@ -463,7 +462,7 @@ static int decode_frame(AVCodecContext *avctx,
     }
 
     *got_frame = 1;
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
     return buf_size;
 }
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index f7f8a88994..89b6bb04e5 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1461,10 +1461,9 @@ static void ape_unpack_stereo(APEContext *ctx, int count)
     }
 }
 
-static int ape_decode_frame(AVCodecContext *avctx, void *data,
+static int ape_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     APEContext *s = avctx->priv_data;
     uint8_t *sample8;
diff --git a/libavcodec/aptxdec.c b/libavcodec/aptxdec.c
index 3e30336964..03eb27cd5c 100644
--- a/libavcodec/aptxdec.c
+++ b/libavcodec/aptxdec.c
@@ -137,11 +137,10 @@ static int aptx_decode_samples(AptXContext *ctx,
     return ret;
 }
 
-static int aptx_decode_frame(AVCodecContext *avctx, void *data,
+static int aptx_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
     AptXContext *s = avctx->priv_data;
-    AVFrame *frame = data;
     int pos, opos, channel, sample, ret;
 
     if (avpkt->size < s->block_size) {
diff --git a/libavcodec/arbc.c b/libavcodec/arbc.c
index 04d10c33bb..d5171ee41e 100644
--- a/libavcodec/arbc.c
+++ b/libavcodec/arbc.c
@@ -116,11 +116,10 @@ static int fill_tileX(AVCodecContext *avctx, int tile_width, int tile_height,
     return pixels_overwritten;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
                         int *got_frame, AVPacket *avpkt)
 {
     ARBCContext *s = avctx->priv_data;
-    AVFrame *frame = data;
     int ret, nb_segments;
     int prev_pixels = avctx->width * avctx->height;
 
diff --git a/libavcodec/argo.c b/libavcodec/argo.c
index 44ab7a22b7..5c52b35b61 100644
--- a/libavcodec/argo.c
+++ b/libavcodec/argo.c
@@ -599,7 +599,7 @@ static int decode_rle(AVCodecContext *avctx, AVFrame *frame)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
                         int *got_frame, AVPacket *avpkt)
 {
     ArgoContext *s = avctx->priv_data;
@@ -665,7 +665,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
     if (avctx->pix_fmt == AV_PIX_FMT_PAL8)
         memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);
 
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
 
     frame->pict_type = s->key ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c
index 3bed903516..0cce79d8b8 100644
--- a/libavcodec/asvdec.c
+++ b/libavcodec/asvdec.c
@@ -213,13 +213,12 @@ static inline void idct_put(ASV1Context *a, AVFrame *frame, int mb_x, int mb_y)
     }
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *p,
+                        int *got_frame, AVPacket *avpkt)
 {
     ASV1Context *const a = avctx->priv_data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
-    AVFrame *const p = data;
     int mb_x, mb_y, ret;
 
     if (buf_size * 8LL < a->mb_height * a->mb_width * 13LL)
diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c
index aaf58da7d6..9c953d8772 100644
--- a/libavcodec/atrac1.c
+++ b/libavcodec/atrac1.c
@@ -273,10 +273,9 @@ static void at1_subband_synthesis(AT1Ctx *q, AT1SUCtx* su, float *pOut)
 }
 
 
-static int atrac1_decode_frame(AVCodecContext *avctx, void *data,
+static int atrac1_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     AT1Ctx *q          = avctx->priv_data;
diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c
index be53fe44f9..123acdc7e3 100644
--- a/libavcodec/atrac3.c
+++ b/libavcodec/atrac3.c
@@ -790,10 +790,9 @@ static int al_decode_frame(AVCodecContext *avctx, const uint8_t *databuf,
     return 0;
 }
 
-static int atrac3_decode_frame(AVCodecContext *avctx, void *data,
+static int atrac3_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     ATRAC3Context *q = avctx->priv_data;
@@ -830,10 +829,9 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data,
     return avctx->block_align;
 }
 
-static int atrac3al_decode_frame(AVCodecContext *avctx, void *data,
+static int atrac3al_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                  int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame = data;
     int ret;
 
     frame->nb_samples = SAMPLES_PER_FRAME;
diff --git a/libavcodec/atrac3plusdec.c b/libavcodec/atrac3plusdec.c
index 435fe75152..3524ed22e3 100644
--- a/libavcodec/atrac3plusdec.c
+++ b/libavcodec/atrac3plusdec.c
@@ -331,11 +331,10 @@ static void reconstruct_frame(ATRAC3PContext *ctx, Atrac3pChanUnitCtx *ch_unit,
     FFSWAP(Atrac3pWaveSynthParams *, ch_unit->waves_info, ch_unit->waves_info_prev);
 }
 
-static int atrac3p_decode_frame(AVCodecContext *avctx, void *data,
+static int atrac3p_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                 int *got_frame_ptr, AVPacket *avpkt)
 {
     ATRAC3PContext *ctx = avctx->priv_data;
-    AVFrame *frame      = data;
     int i, ret, ch_unit_id, ch_block = 0, out_ch_index = 0, channels_to_process;
     float **samples_p = (float **)frame->extended_data;
 
diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c
index 4af5f7e0ba..5d51c23f19 100644
--- a/libavcodec/atrac9dec.c
+++ b/libavcodec/atrac9dec.c
@@ -787,12 +787,11 @@ imdct:
     return 0;
 }
 
-static int atrac9_decode_frame(AVCodecContext *avctx, void *data,
+static int atrac9_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                int *got_frame_ptr, AVPacket *avpkt)
 {
     int ret;
     GetBitContext gb;
-    AVFrame *frame = data;
     ATRAC9Context *s = avctx->priv_data;
     const int frames = FFMIN(avpkt->size / s->avg_frame_size, s->frame_count);
 
diff --git a/libavcodec/audiotoolboxdec.c b/libavcodec/audiotoolboxdec.c
index 3b5fc942bb..3f6089f29a 100644
--- a/libavcodec/audiotoolboxdec.c
+++ b/libavcodec/audiotoolboxdec.c
@@ -478,11 +478,10 @@ static void ffat_copy_samples(AVCodecContext *avctx, AVFrame *frame)
     }
 }
 
-static int ffat_decode(AVCodecContext *avctx, void *data,
+static int ffat_decode(AVCodecContext *avctx, AVFrame *frame,
                        int *got_frame_ptr, AVPacket *avpkt)
 {
     ATDecodeContext *at = avctx->priv_data;
-    AVFrame *frame = data;
     int pkt_size = avpkt->size;
     OSStatus ret;
     AudioBufferList out_buffers;
diff --git a/libavcodec/aura.c b/libavcodec/aura.c
index 290fd83de4..1896013cfb 100644
--- a/libavcodec/aura.c
+++ b/libavcodec/aura.c
@@ -38,11 +38,9 @@ static av_cold int aura_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int aura_decode_frame(AVCodecContext *avctx,
-                             void *data, int *got_frame,
-                             AVPacket *pkt)
+static int aura_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                             int *got_frame, AVPacket *pkt)
 {
-    AVFrame *frame = data;
     uint8_t *Y, *U, *V;
     uint8_t val;
     int x, y, ret;
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index 0646b86908..517fa701f4 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -999,7 +999,7 @@ static int get_current_frame(AVCodecContext *avctx)
     return ret;
 }
 
-static int av1_decode_frame(AVCodecContext *avctx, void *frame,
+static int av1_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame, AVPacket *pkt)
 {
     AV1DecContext *s = avctx->priv_data;
diff --git a/libavcodec/avrndec.c b/libavcodec/avrndec.c
index dd00a6fd39..8f716a129e 100644
--- a/libavcodec/avrndec.c
+++ b/libavcodec/avrndec.c
@@ -50,11 +50,10 @@ static av_cold int init(AVCodecContext *avctx)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *p,
                         int *got_frame, AVPacket *avpkt)
 {
     AVRnContext *a = avctx->priv_data;
-    AVFrame *p = data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     int y, ret, true_height;
diff --git a/libavcodec/avs.c b/libavcodec/avs.c
index 1367491ea2..a26a3bbc00 100644
--- a/libavcodec/avs.c
+++ b/libavcodec/avs.c
@@ -43,15 +43,13 @@ typedef enum {
 } AvsVideoSubType;
 
 
-static int
-avs_decode_frame(AVCodecContext * avctx,
-                 void *data, int *got_frame, AVPacket *avpkt)
+static int avs_decode_frame(AVCodecContext * avctx, AVFrame *picture,
+                            int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     const uint8_t *buf_end = avpkt->data + avpkt->size;
     int buf_size = avpkt->size;
     AvsContext *const avs = avctx->priv_data;
-    AVFrame *picture = data;
     AVFrame *const p =  avs->frame;
     const uint8_t *table, *vect;
     uint8_t *out;
diff --git a/libavcodec/avuidec.c b/libavcodec/avuidec.c
index b9ead39d6f..a86b0d5668 100644
--- a/libavcodec/avuidec.c
+++ b/libavcodec/avuidec.c
@@ -31,11 +31,10 @@ static av_cold int avui_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int avui_decode_frame(AVCodecContext *avctx, void *data,
+static int avui_decode_frame(AVCodecContext *avctx, AVFrame *pic,
                              int *got_frame, AVPacket *avpkt)
 {
     int ret;
-    AVFrame *pic = data;
     const uint8_t *src = avpkt->data, *extradata = avctx->extradata;
     const uint8_t *srca;
     uint8_t *y, *u, *v, *a;
diff --git a/libavcodec/bethsoftvideo.c b/libavcodec/bethsoftvideo.c
index 74dce58f73..44175805f1 100644
--- a/libavcodec/bethsoftvideo.c
+++ b/libavcodec/bethsoftvideo.c
@@ -67,9 +67,8 @@ static int set_palette(BethsoftvidContext *ctx)
     return 0;
 }
 
-static int bethsoftvid_decode_frame(AVCodecContext *avctx,
-                              void *data, int *got_frame,
-                              AVPacket *avpkt)
+static int bethsoftvid_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                                    int *got_frame, AVPacket *avpkt)
 {
     BethsoftvidContext * vid = avctx->priv_data;
     char block_type;
@@ -144,7 +143,7 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx,
     }
     end:
 
-    if ((ret = av_frame_ref(data, vid->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, vid->frame)) < 0)
         return ret;
 
     *got_frame = 1;
diff --git a/libavcodec/bfi.c b/libavcodec/bfi.c
index 6e838df02b..fb22b0e1b1 100644
--- a/libavcodec/bfi.c
+++ b/libavcodec/bfi.c
@@ -48,10 +48,9 @@ static av_cold int bfi_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int bfi_decode_frame(AVCodecContext *avctx, void *data,
+static int bfi_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *frame = data;
     GetByteContext g;
     int buf_size    = avpkt->size;
     BFIContext *bfi = avctx->priv_data;
diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index 9b83d73348..941c2244a7 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -1253,10 +1253,10 @@ end:
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *pkt)
 {
     BinkContext * const c = avctx->priv_data;
-    AVFrame *frame = data;
     GetBitContext gb;
     int plane, plane_idx, ret;
     int bits_count = pkt->size << 3;
diff --git a/libavcodec/bintext.c b/libavcodec/bintext.c
index 0fad8305f8..183fea5b84 100644
--- a/libavcodec/bintext.c
+++ b/libavcodec/bintext.c
@@ -140,9 +140,8 @@ static void draw_char(AVCodecContext *avctx, int c, int a)
     }
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
     XbinContext *s = avctx->priv_data;
     const uint8_t *buf = avpkt->data;
@@ -153,7 +152,7 @@ static int decode_frame(AVCodecContext *avctx,
     if ((avctx->width / FONT_WIDTH) * (avctx->height / s->font_height) / 256 > buf_size)
         return AVERROR_INVALIDDATA;
 
-    s->frame = data;
+    s->frame = frame;
     s->x = s->y = 0;
     if ((ret = ff_get_buffer(avctx, s->frame, 0)) < 0)
         return ret;
diff --git a/libavcodec/bitpacked_dec.c b/libavcodec/bitpacked_dec.c
index 3301a72752..3b8f2d8fd9 100644
--- a/libavcodec/bitpacked_dec.c
+++ b/libavcodec/bitpacked_dec.c
@@ -122,12 +122,11 @@ static av_cold int bitpacked_init_decoder(AVCodecContext *avctx)
     return 0;
 }
 
-static int bitpacked_decode(AVCodecContext *avctx, void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int bitpacked_decode(AVCodecContext *avctx, AVFrame *frame,
+                            int *got_frame, AVPacket *avpkt)
 {
     struct BitpackedContext *bc = avctx->priv_data;
     int buf_size = avpkt->size;
-    AVFrame *frame = data;
     int res;
 
     res = bc->decode(avctx, frame, avpkt);
diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c
index d8ff7b8342..c971ff0f59 100644
--- a/libavcodec/bmp.c
+++ b/libavcodec/bmp.c
@@ -28,13 +28,11 @@
 #include "internal.h"
 #include "msrledec.h"
 
-static int bmp_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int bmp_decode_frame(AVCodecContext *avctx, AVFrame *p,
+                            int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
-    AVFrame *p         = data;
     unsigned int fsize, hsize;
     int width, height;
     unsigned int depth;
diff --git a/libavcodec/bmvaudio.c b/libavcodec/bmvaudio.c
index be04f7be94..d21370938f 100644
--- a/libavcodec/bmvaudio.c
+++ b/libavcodec/bmvaudio.c
@@ -39,10 +39,9 @@ static av_cold int bmv_aud_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int bmv_aud_decode_frame(AVCodecContext *avctx, void *data,
+static int bmv_aud_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                 int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     int blocks = 0, total_blocks, i;
diff --git a/libavcodec/bmvvideo.c b/libavcodec/bmvvideo.c
index 94e9734e38..baa8e37e46 100644
--- a/libavcodec/bmvvideo.c
+++ b/libavcodec/bmvvideo.c
@@ -196,11 +196,10 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame,
     }
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *pkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *pkt)
 {
     BMVDecContext * const c = avctx->priv_data;
-    AVFrame *frame = data;
     int type, scr_off;
     int i, ret;
     uint8_t *srcptr, *outptr;
diff --git a/libavcodec/brenderpix.c b/libavcodec/brenderpix.c
index 8cb0c16d4d..98db6e6950 100644
--- a/libavcodec/brenderpix.c
+++ b/libavcodec/brenderpix.c
@@ -130,11 +130,9 @@ static int pix_decode_header(PixHeader *out, GetByteContext *pgb)
     return 0;
 }
 
-static int pix_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int pix_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                            int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *frame = data;
-
     int ret, i;
     GetByteContext gb;
 
diff --git a/libavcodec/c93.c b/libavcodec/c93.c
index bc66ad6b0c..a5dee1d1a3 100644
--- a/libavcodec/c93.c
+++ b/libavcodec/c93.c
@@ -120,7 +120,7 @@ static inline void draw_n_color(uint8_t *out, int stride, int width,
     }
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
                         int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
@@ -251,7 +251,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
             memcpy(newpic->data[1], oldpic->data[1], 256 * 4);
     }
 
-    if ((ret = av_frame_ref(data, newpic)) < 0)
+    if ((ret = av_frame_ref(rframe, newpic)) < 0)
         return ret;
     *got_frame = 1;
 
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:
diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c
index 5797134d10..8d72e6d87c 100644
--- a/libavcodec/cdgraphics.c
+++ b/libavcodec/cdgraphics.c
@@ -262,15 +262,14 @@ static void cdg_scroll(CDGraphicsContext *cc, uint8_t *data,
 
 }
 
-static int cdg_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame, AVPacket *avpkt)
+static int cdg_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                            int *got_frame, AVPacket *avpkt)
 {
     GetByteContext gb;
     int buf_size       = avpkt->size;
     int ret;
     uint8_t command, inst;
     uint8_t cdg_data[CDG_DATA_SIZE] = {0};
-    AVFrame *frame = data;
     CDGraphicsContext *cc = avctx->priv_data;
 
     if (buf_size < CDG_MINIMUM_PKT_SIZE) {
diff --git a/libavcodec/cdtoons.c b/libavcodec/cdtoons.c
index e99d703e53..1b1c1f827e 100644
--- a/libavcodec/cdtoons.c
+++ b/libavcodec/cdtoons.c
@@ -151,7 +151,7 @@ static int cdtoons_render_sprite(AVCodecContext *avctx, const uint8_t *data,
     return 0;
 }
 
-static int cdtoons_decode_frame(AVCodecContext *avctx, void *data,
+static int cdtoons_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
                                 int *got_frame, AVPacket *avpkt)
 {
     CDToonsContext *c = avctx->priv_data;
@@ -398,7 +398,7 @@ done:
 
     memcpy(c->frame->data[1], c->pal, AVPALETTE_SIZE);
 
-    if ((ret = av_frame_ref(data, c->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, c->frame)) < 0)
         return ret;
 
     *got_frame = 1;
diff --git a/libavcodec/cdxl.c b/libavcodec/cdxl.c
index d11106a4e4..34481fe2a3 100644
--- a/libavcodec/cdxl.c
+++ b/libavcodec/cdxl.c
@@ -243,11 +243,10 @@ static void cdxl_decode_ham8(CDXLVideoContext *c, AVFrame *frame)
     }
 }
 
-static int cdxl_decode_frame(AVCodecContext *avctx, void *data,
+static int cdxl_decode_frame(AVCodecContext *avctx, AVFrame *p,
                              int *got_frame, AVPacket *pkt)
 {
     CDXLVideoContext *c = avctx->priv_data;
-    AVFrame * const p = data;
     int ret, w, h, encoding, aligned_width, buf_size = pkt->size;
     const uint8_t *buf = pkt->data;
 
diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index 97cfdebba2..ab074043c1 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -373,13 +373,12 @@ static int alloc_buffers(AVCodecContext *avctx)
     return 0;
 }
 
-static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
-                       AVPacket *avpkt)
+static int cfhd_decode(AVCodecContext *avctx, AVFrame *pic,
+                       int *got_frame, AVPacket *avpkt)
 {
     CFHDContext *s = avctx->priv_data;
     CFHDDSPContext *dsp = &s->dsp;
     GetByteContext gb;
-    AVFrame *const pic = data;
     int ret = 0, i, j, plane, got_buffer = 0;
     int16_t *coeff_data;
 
diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c
index d215e0c11c..9bc7a681e5 100644
--- a/libavcodec/cinepak.c
+++ b/libavcodec/cinepak.c
@@ -449,9 +449,8 @@ static av_cold int cinepak_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int cinepak_decode_frame(AVCodecContext *avctx,
-                                void *data, int *got_frame,
-                                AVPacket *avpkt)
+static int cinepak_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                                int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int ret = 0, buf_size = avpkt->size;
@@ -489,7 +488,7 @@ static int cinepak_decode_frame(AVCodecContext *avctx,
     if (s->palette_video)
         memcpy (s->frame->data[1], s->pal, AVPALETTE_SIZE);
 
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
 
     *got_frame = 1;
diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c
index 8400fafd78..4e54ccb680 100644
--- a/libavcodec/clearvideo.c
+++ b/libavcodec/clearvideo.c
@@ -499,7 +499,7 @@ static void extend_edges(AVFrame *buf, int tile_size)
     }
 }
 
-static int clv_decode_frame(AVCodecContext *avctx, void *data,
+static int clv_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
                             int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
@@ -638,7 +638,7 @@ static int clv_decode_frame(AVCodecContext *avctx, void *data,
         c->pic->pict_type = AV_PICTURE_TYPE_P;
     }
 
-    if ((ret = av_frame_ref(data, c->pic)) < 0)
+    if ((ret = av_frame_ref(rframe, c->pic)) < 0)
         return ret;
 
     FFSWAP(AVFrame *, c->pic, c->prev);
diff --git a/libavcodec/cljrdec.c b/libavcodec/cljrdec.c
index 47b75186c0..e3a278f16f 100644
--- a/libavcodec/cljrdec.c
+++ b/libavcodec/cljrdec.c
@@ -29,14 +29,12 @@
 #include "get_bits.h"
 #include "internal.h"
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *p,
+                        int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     GetBitContext gb;
-    AVFrame * const p = data;
     int x, y, ret;
 
     if (avctx->height <= 0 || avctx->width <= 0) {
diff --git a/libavcodec/cllc.c b/libavcodec/cllc.c
index dd7c6fcad6..f01498310a 100644
--- a/libavcodec/cllc.c
+++ b/libavcodec/cllc.c
@@ -355,11 +355,10 @@ static int decode_yuv_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic)
     return 0;
 }
 
-static int cllc_decode_frame(AVCodecContext *avctx, void *data,
+static int cllc_decode_frame(AVCodecContext *avctx, AVFrame *pic,
                              int *got_picture_ptr, AVPacket *avpkt)
 {
     CLLCContext *ctx = avctx->priv_data;
-    AVFrame *pic = data;
     uint8_t *src = avpkt->data;
     uint32_t info_tag, info_offset;
     int data_size;
diff --git a/libavcodec/cngdec.c b/libavcodec/cngdec.c
index e59aa2e60e..f396d5a5d0 100644
--- a/libavcodec/cngdec.c
+++ b/libavcodec/cngdec.c
@@ -102,10 +102,9 @@ static void cng_decode_flush(AVCodecContext *avctx)
     p->inited = 0;
 }
 
-static int cng_decode_frame(AVCodecContext *avctx, void *data,
+static int cng_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame = data;
     CNGContext *p = avctx->priv_data;
     int buf_size  = avpkt->size;
     int ret, i;
diff --git a/libavcodec/codec_internal.h b/libavcodec/codec_internal.h
index 5c57c438f9..4e8c06a49e 100644
--- a/libavcodec/codec_internal.h
+++ b/libavcodec/codec_internal.h
@@ -148,17 +148,17 @@ typedef struct FFCodec {
     int (*encode2)(struct AVCodecContext *avctx, struct AVPacket *avpkt,
                    const struct AVFrame *frame, int *got_packet_ptr);
     /**
-     * Decode picture data.
+     * Decode to an AVFrame.
      *
      * @param      avctx          codec context
-     * @param      outdata        codec type dependent output struct
+     * @param      frame          AVFrame for output
      * @param[out] got_frame_ptr  decoder sets to 0 or 1 to indicate that a
      *                            non-empty frame was returned in outdata.
      * @param[in]  avpkt          AVPacket containing the data to be decoded
      * @return amount of bytes read from the packet on success, negative error
      *         code on failure
      */
-    int (*decode)(struct AVCodecContext *avctx, void *outdata,
+    int (*decode)(struct AVCodecContext *avctx, struct AVFrame *frame,
                   int *got_frame_ptr, struct AVPacket *avpkt);
     /**
      * Decode subtitle data. Same as decode except that it uses
diff --git a/libavcodec/cook.c b/libavcodec/cook.c
index c305f5e56d..783623d7db 100644
--- a/libavcodec/cook.c
+++ b/libavcodec/cook.c
@@ -978,10 +978,9 @@ static int decode_subpacket(COOKContext *q, COOKSubpacket *p,
 }
 
 
-static int cook_decode_frame(AVCodecContext *avctx, void *data,
+static int cook_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     COOKContext *q = avctx->priv_data;
diff --git a/libavcodec/cpia.c b/libavcodec/cpia.c
index e19160a506..1b50aa9d30 100644
--- a/libavcodec/cpia.c
+++ b/libavcodec/cpia.c
@@ -48,8 +48,8 @@ typedef struct {
 } CpiaContext;
 
 
-static int cpia_decode_frame(AVCodecContext *avctx,
-                             void *data, int *got_frame, AVPacket* avpkt)
+static int cpia_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                             int *got_frame, AVPacket* avpkt)
 {
     CpiaContext* const cpia = avctx->priv_data;
     int i,j,ret;
@@ -185,7 +185,7 @@ static int cpia_decode_frame(AVCodecContext *avctx,
     }
 
     *got_frame = 1;
-    if ((ret = av_frame_ref(data, cpia->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, cpia->frame)) < 0)
         return ret;
 
     return avpkt->size;
diff --git a/libavcodec/cri.c b/libavcodec/cri.c
index 4757a1da03..b1922d5e9b 100644
--- a/libavcodec/cri.c
+++ b/libavcodec/cri.c
@@ -170,7 +170,7 @@ static void unpack_10bit(GetByteContext *gb, uint16_t *dst, int shift,
     }
 }
 
-static int cri_decode_frame(AVCodecContext *avctx, void *data,
+static int cri_decode_frame(AVCodecContext *avctx, AVFrame *p,
                             int *got_frame, AVPacket *avpkt)
 {
     CRIContext *s = avctx->priv_data;
@@ -178,7 +178,6 @@ static int cri_decode_frame(AVCodecContext *avctx, void *data,
     int ret, bps, hflip = 0, vflip = 0;
     AVFrameSideData *rotation;
     int compressed = 0;
-    AVFrame *p = data;
 
     s->data = NULL;
     s->data_size = 0;
diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c
index fd513d8402..9b87c1b91d 100644
--- a/libavcodec/cscd.c
+++ b/libavcodec/cscd.c
@@ -65,8 +65,8 @@ static void add_frame_default(AVFrame *f, const uint8_t *src,
     }
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                        int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
@@ -123,7 +123,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     }
 
     *got_frame = 1;
-    if ((ret = av_frame_ref(data, c->pic)) < 0)
+    if ((ret = av_frame_ref(rframe, c->pic)) < 0)
         return ret;
 
     return buf_size;
diff --git a/libavcodec/cyuv.c b/libavcodec/cyuv.c
index a59dd358bf..ba20cd02da 100644
--- a/libavcodec/cyuv.c
+++ b/libavcodec/cyuv.c
@@ -59,14 +59,12 @@ static av_cold int cyuv_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int cyuv_decode_frame(AVCodecContext *avctx,
-                             void *data, int *got_frame,
-                             AVPacket *avpkt)
+static int cyuv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                             int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     CyuvDecodeContext *s=avctx->priv_data;
-    AVFrame *frame = data;
 
     unsigned char *y_plane;
     unsigned char *u_plane;
diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index 3fc1bc705f..62684b8042 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -147,11 +147,10 @@ void ff_dca_downmix_to_stereo_float(AVFloatDSPContext *fdsp, float **samples,
     }
 }
 
-static int dcadec_decode_frame(AVCodecContext *avctx, void *data,
+static int dcadec_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                int *got_frame_ptr, AVPacket *avpkt)
 {
     DCAContext *s = avctx->priv_data;
-    AVFrame *frame = data;
     uint8_t *input = avpkt->data;
     int input_size = avpkt->size;
     int i, ret, prev_packet = s->packet;
diff --git a/libavcodec/dds.c b/libavcodec/dds.c
index 32690e1fd7..c5691a4afd 100644
--- a/libavcodec/dds.c
+++ b/libavcodec/dds.c
@@ -606,12 +606,11 @@ static void run_postproc(AVCodecContext *avctx, AVFrame *frame)
     }
 }
 
-static int dds_decode(AVCodecContext *avctx, void *data,
+static int dds_decode(AVCodecContext *avctx, AVFrame *frame,
                       int *got_frame, AVPacket *avpkt)
 {
     DDSContext *ctx = avctx->priv_data;
     GetByteContext *gbc = &ctx->gbc;
-    AVFrame *frame = data;
     int mipmap;
     int ret;
     int width, height;
diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c
index 97a9bd5a1f..4625f62ec6 100644
--- a/libavcodec/dfa.c
+++ b/libavcodec/dfa.c
@@ -337,11 +337,9 @@ static const char chunk_name[8][5] = {
     "COPY", "TSW1", "BDLT", "WDLT", "TDLT", "DSW1", "BLCK", "DDS1"
 };
 
-static int dfa_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int dfa_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                            int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *frame = data;
     DfaContext *s = avctx->priv_data;
     GetByteContext gb;
     const uint8_t *buf = avpkt->data;
diff --git a/libavcodec/dfpwmdec.c b/libavcodec/dfpwmdec.c
index dca7678795..4237200c6b 100644
--- a/libavcodec/dfpwmdec.c
+++ b/libavcodec/dfpwmdec.c
@@ -100,11 +100,10 @@ static av_cold int dfpwm_dec_init(struct AVCodecContext *ctx)
     return 0;
 }
 
-static int dfpwm_dec_frame(struct AVCodecContext *ctx, void *data,
-    int *got_frame, struct AVPacket *packet)
+static int dfpwm_dec_frame(struct AVCodecContext *ctx, AVFrame *frame,
+                           int *got_frame, struct AVPacket *packet)
 {
     DFPWMState *state = ctx->priv_data;
-    AVFrame *frame = data;
     int ret;
 
     if (packet->size * 8LL % ctx->ch_layout.nb_channels)
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index d5c095c689..319067bc79 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -2260,10 +2260,10 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int
     return 0;
 }
 
-static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt)
+static int dirac_decode_frame(AVCodecContext *avctx, AVFrame *picture,
+                              int *got_frame, AVPacket *pkt)
 {
     DiracContext *s     = avctx->priv_data;
-    AVFrame *picture    = data;
     uint8_t *buf        = pkt->data;
     int buf_size        = pkt->size;
     int i, buf_idx      = 0;
@@ -2282,7 +2282,7 @@ static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
 
     /* end of stream, so flush delayed pics */
     if (buf_size == 0)
-        return get_delayed_pic(s, (AVFrame *)data, got_frame);
+        return get_delayed_pic(s, picture, got_frame);
 
     for (;;) {
         /*[DIRAC_STD] Here starts the code from parse_info() defined in 9.6
@@ -2339,13 +2339,13 @@ static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
 
         if (delayed_frame) {
             delayed_frame->reference ^= DELAYED_PIC_REF;
-            if((ret=av_frame_ref(data, delayed_frame->avframe)) < 0)
+            if((ret = av_frame_ref(picture, delayed_frame->avframe)) < 0)
                 return ret;
             *got_frame = 1;
         }
     } else if (s->current_picture->avframe->display_picture_number == s->frame_number) {
         /* The right frame at the right time :-) */
-        if((ret=av_frame_ref(data, s->current_picture->avframe)) < 0)
+        if((ret = av_frame_ref(picture, s->current_picture->avframe)) < 0)
             return ret;
         *got_frame = 1;
     }
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 141ca94359..4b22a4134e 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -613,13 +613,12 @@ static int dnxhd_decode_row(AVCodecContext *avctx, void *data,
     return 0;
 }
 
-static int dnxhd_decode_frame(AVCodecContext *avctx, void *data,
+static int dnxhd_decode_frame(AVCodecContext *avctx, AVFrame *picture,
                               int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     DNXHDContext *ctx = avctx->priv_data;
-    AVFrame *picture = data;
     int first_field = 1;
     int ret, i;
 
diff --git a/libavcodec/dolby_e.c b/libavcodec/dolby_e.c
index 20435f8f25..6c86f74c94 100644
--- a/libavcodec/dolby_e.c
+++ b/libavcodec/dolby_e.c
@@ -1084,7 +1084,7 @@ static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
     return 0;
 }
 
-static int dolby_e_decode_frame(AVCodecContext *avctx, void *data,
+static int dolby_e_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                 int *got_frame_ptr, AVPacket *avpkt)
 {
     DBEDecodeContext *s1 = avctx->priv_data;
@@ -1135,7 +1135,7 @@ static int dolby_e_decode_frame(AVCodecContext *avctx, void *data,
         return ret;
     if ((ret = parse_meter(s1)) < 0)
         return ret;
-    if ((ret = filter_frame(s1, data)) < 0)
+    if ((ret = filter_frame(s1, frame)) < 0)
         return ret;
 
     *got_frame_ptr = 1;
diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c
index ddd6b47ff4..db09ef274b 100644
--- a/libavcodec/dpcm.c
+++ b/libavcodec/dpcm.c
@@ -207,12 +207,11 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx)
 }
 
 
-static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
+static int dpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
     int buf_size = avpkt->size;
     DPCMContext *s = avctx->priv_data;
-    AVFrame *frame = data;
     int out = 0, ret;
     int predictor[2];
     int ch = 0;
diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index fb7005e8a8..7a3054b140 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -150,14 +150,11 @@ static uint16_t read12in32(const uint8_t **ptr, uint32_t *lbuf,
     }
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data,
-                        int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *p,
+                        int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
-    AVFrame *const p = data;
     uint8_t *ptr[AV_NUM_DATA_POINTERS];
     uint32_t header_version, version = 0;
     char creator[101] = { 0 };
diff --git a/libavcodec/dsddec.c b/libavcodec/dsddec.c
index 2838392e77..e0578bc9cc 100644
--- a/libavcodec/dsddec.c
+++ b/libavcodec/dsddec.c
@@ -95,11 +95,10 @@ static int dsd_channel(AVCodecContext *avctx, void *tdata, int j, int threadnr)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
                         int *got_frame_ptr, AVPacket *avpkt)
 {
     ThreadData td;
-    AVFrame *frame = data;
     int ret;
 
     frame->nb_samples = avpkt->size / avctx->ch_layout.nb_channels;
diff --git a/libavcodec/dsicinaudio.c b/libavcodec/dsicinaudio.c
index 14a0c6fec3..231afb2a69 100644
--- a/libavcodec/dsicinaudio.c
+++ b/libavcodec/dsicinaudio.c
@@ -87,10 +87,9 @@ static av_cold int cinaudio_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int cinaudio_decode_frame(AVCodecContext *avctx, void *data,
+static int cinaudio_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                  int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame         = data;
     const uint8_t *buf     = avpkt->data;
     CinAudioContext *cin   = avctx->priv_data;
     const uint8_t *buf_end = buf + avpkt->size;
diff --git a/libavcodec/dsicinvideo.c b/libavcodec/dsicinvideo.c
index 41e90344e9..b33959ef77 100644
--- a/libavcodec/dsicinvideo.c
+++ b/libavcodec/dsicinvideo.c
@@ -194,9 +194,8 @@ static int cin_decode_rle(const unsigned char *src, int src_size,
     return 0;
 }
 
-static int cinvideo_decode_frame(AVCodecContext *avctx,
-                                 void *data, int *got_frame,
-                                 AVPacket *avpkt)
+static int cinvideo_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                                 int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf   = avpkt->data;
     int buf_size         = avpkt->size;
@@ -303,7 +302,7 @@ static int cinvideo_decode_frame(AVCodecContext *avctx,
     FFSWAP(uint8_t *, cin->bitmap_table[CIN_CUR_BMP],
                       cin->bitmap_table[CIN_PRE_BMP]);
 
-    if ((res = av_frame_ref(data, cin->frame)) < 0)
+    if ((res = av_frame_ref(rframe, cin->frame)) < 0)
         return res;
 
     *got_frame = 1;
diff --git a/libavcodec/dss_sp.c b/libavcodec/dss_sp.c
index d305f993b4..4d7a169f26 100644
--- a/libavcodec/dss_sp.c
+++ b/libavcodec/dss_sp.c
@@ -740,11 +740,10 @@ static int dss_sp_decode_one_frame(DssSpContext *p,
     return 0;
 }
 
-static int dss_sp_decode_frame(AVCodecContext *avctx, void *data,
+static int dss_sp_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                int *got_frame_ptr, AVPacket *avpkt)
 {
     DssSpContext *p    = avctx->priv_data;
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
 
diff --git a/libavcodec/dstdec.c b/libavcodec/dstdec.c
index 3ea3f38eee..e1d06a9c36 100644
--- a/libavcodec/dstdec.c
+++ b/libavcodec/dstdec.c
@@ -237,7 +237,7 @@ static void build_filter(int16_t table[DST_MAX_ELEMENTS][16][256], const Table *
     }
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
                         int *got_frame_ptr, AVPacket *avpkt)
 {
     unsigned samples_per_frame = DST_SAMPLES_PER_FRAME(avctx->sample_rate);
@@ -249,7 +249,6 @@ static int decode_frame(AVCodecContext *avctx, void *data,
     DSTContext *s = avctx->priv_data;
     GetBitContext *gb = &s->gb;
     ArithCoder *ac = &s->ac;
-    AVFrame *frame = data;
     uint8_t *dsd;
     float *pcm;
     int ret;
diff --git a/libavcodec/dvaudiodec.c b/libavcodec/dvaudiodec.c
index 96aa1c2005..97851981c5 100644
--- a/libavcodec/dvaudiodec.c
+++ b/libavcodec/dvaudiodec.c
@@ -85,11 +85,10 @@ static inline uint16_t dv_audio_12to16(uint16_t sample)
     return result;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
                         int *got_frame_ptr, AVPacket *pkt)
 {
     DVAudioContext *s = avctx->priv_data;
-    AVFrame *frame = data;
     const uint8_t *src = pkt->data;
     int16_t *dst;
     int ret, i;
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index 2e64cb2f55..5a1de7a409 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -607,13 +607,12 @@ retry:
 
 /* NOTE: exactly one frame must be given (120000 bytes for NTSC,
  * 144000 bytes for PAL - or twice those for 50Mbps) */
-static int dvvideo_decode_frame(AVCodecContext *avctx, void *data,
+static int dvvideo_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                 int *got_frame, AVPacket *avpkt)
 {
     uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     DVVideoContext *s = avctx->priv_data;
-    AVFrame *const frame = data;
     const uint8_t *vsc_pack;
     int apt, is16_9, ret;
     const AVDVProfile *sys;
diff --git a/libavcodec/dxa.c b/libavcodec/dxa.c
index a3a7cf217b..1a383f182e 100644
--- a/libavcodec/dxa.c
+++ b/libavcodec/dxa.c
@@ -208,9 +208,9 @@ static int decode_13(AVCodecContext *avctx, DxaDecContext *c, uint8_t* dst,
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *frame = data;
     DxaDecContext * const c = avctx->priv_data;
     uint8_t *outptr, *srcptr, *tmpptr;
     unsigned long dsize;
diff --git a/libavcodec/dxtory.c b/libavcodec/dxtory.c
index bd51e5c1b9..e7aaee7cb6 100644
--- a/libavcodec/dxtory.c
+++ b/libavcodec/dxtory.c
@@ -784,10 +784,9 @@ static int dxtory_decode_v2_444(AVCodecContext *avctx, AVFrame *pic,
                             AV_PIX_FMT_YUV444P, vflipped);
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *pic,
+                        int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *pic = data;
     const uint8_t *src = avpkt->data;
     uint32_t type;
     int vflipped, ret;
diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c
index 9aa7aa0d35..63fec7a14e 100644
--- a/libavcodec/dxv.c
+++ b/libavcodec/dxv.c
@@ -1038,11 +1038,10 @@ static int dxv_decompress_raw(AVCodecContext *avctx)
     return 0;
 }
 
-static int dxv_decode(AVCodecContext *avctx, void *data,
+static int dxv_decode(AVCodecContext *avctx, AVFrame *frame,
                       int *got_frame, AVPacket *avpkt)
 {
     DXVContext *ctx = avctx->priv_data;
-    AVFrame *const frame = data;
     GetByteContext *gbc = &ctx->gbc;
     int (*decompress_tex)(AVCodecContext *avctx);
     const char *msgcomp, *msgtext;
diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c
index f060b57459..bd332a9106 100644
--- a/libavcodec/eacmv.c
+++ b/libavcodec/eacmv.c
@@ -169,15 +169,13 @@ static int cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *
 #define EA_PREAMBLE_SIZE 8
 #define MVIh_TAG MKTAG('M', 'V', 'I', 'h')
 
-static int cmv_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int cmv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                            int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     CmvContext *s = avctx->priv_data;
     const uint8_t *buf_end = buf + buf_size;
-    AVFrame *frame = data;
     int ret;
 
     if (buf_end - buf < EA_PREAMBLE_SIZE)
diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c
index 239ee1b38e..e6e90d6bd7 100644
--- a/libavcodec/eamad.c
+++ b/libavcodec/eamad.c
@@ -247,14 +247,12 @@ static void calc_quant_matrix(MadContext *s, int qscale)
         s->quant_matrix[i] = (ff_inv_aanscales[i]*ff_mpeg1_default_intra_matrix[i]*qscale + 32) >> 10;
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     MadContext *s     = avctx->priv_data;
-    AVFrame *frame    = data;
     GetByteContext gb;
     int width, height;
     int chunk_type;
diff --git a/libavcodec/eatgq.c b/libavcodec/eatgq.c
index 93024b7e9f..ea5f4386bc 100644
--- a/libavcodec/eatgq.c
+++ b/libavcodec/eatgq.c
@@ -201,14 +201,12 @@ static void tgq_calculate_qtable(TgqContext *s, int quant)
                                     ff_inv_aanscales[j * 8 + i]) >> (14 - 4);
 }
 
-static int tgq_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int tgq_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                            int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     TgqContext *s      = avctx->priv_data;
-    AVFrame *frame     = data;
     int x, y, ret;
     int big_endian;
 
diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c
index 8475509ccb..525c80a570 100644
--- a/libavcodec/eatgv.c
+++ b/libavcodec/eatgv.c
@@ -262,15 +262,13 @@ static int tgv_decode_inter(TgvContext *s, AVFrame *frame,
     return 0;
 }
 
-static int tgv_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int tgv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                            int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf     = avpkt->data;
     int buf_size           = avpkt->size;
     TgvContext *s          = avctx->priv_data;
     const uint8_t *buf_end = buf + buf_size;
-    AVFrame *frame         = data;
     int chunk_type, ret;
 
     if (buf_end - buf < EA_PREAMBLE_SIZE)
diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c
index 59dec04137..dad742996c 100644
--- a/libavcodec/eatqi.c
+++ b/libavcodec/eatqi.c
@@ -124,15 +124,13 @@ static void tqi_calculate_qtable(TqiContext *t, int quant)
         t->intra_matrix[i] = (ff_inv_aanscales[i] * ff_mpeg1_default_intra_matrix[i] * qscale + 32) >> 14;
 }
 
-static int tqi_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int tqi_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                            int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     const uint8_t *buf_end = buf+buf_size;
     TqiContext *t = avctx->priv_data;
-    AVFrame *frame = data;
     int ret, w, h;
 
     if (buf_size < 12)
diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c
index 94af68edae..f52573107c 100644
--- a/libavcodec/escape124.c
+++ b/libavcodec/escape124.c
@@ -196,13 +196,11 @@ static const uint16_t mask_matrix[] = {0x1,   0x2,   0x10,   0x20,
                                        0x100, 0x200, 0x1000, 0x2000,
                                        0x400, 0x800, 0x4000, 0x8000};
 
-static int escape124_decode_frame(AVCodecContext *avctx,
-                                  void *data, int *got_frame,
-                                  AVPacket *avpkt)
+static int escape124_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                                  int *got_frame, AVPacket *avpkt)
 {
     int buf_size = avpkt->size;
     Escape124Context *s = avctx->priv_data;
-    AVFrame *frame = data;
 
     GetBitContext gb;
     unsigned frame_flags, frame_size;
diff --git a/libavcodec/escape130.c b/libavcodec/escape130.c
index 1826d4ec68..ffa2274ea9 100644
--- a/libavcodec/escape130.c
+++ b/libavcodec/escape130.c
@@ -187,12 +187,11 @@ static int decode_skip_count(GetBitContext* gb)
     return -1;
 }
 
-static int escape130_decode_frame(AVCodecContext *avctx, void *data,
+static int escape130_decode_frame(AVCodecContext *avctx, AVFrame *pic,
                                   int *got_frame, AVPacket *avpkt)
 {
     int buf_size        = avpkt->size;
     Escape130Context *s = avctx->priv_data;
-    AVFrame *pic        = data;
     GetBitContext gb;
     int ret;
 
diff --git a/libavcodec/evrcdec.c b/libavcodec/evrcdec.c
index 904994f7c2..d3703977ba 100644
--- a/libavcodec/evrcdec.c
+++ b/libavcodec/evrcdec.c
@@ -741,11 +741,10 @@ static void frame_erasure(EVRCContext *e, float *samples)
     }
 }
 
-static int evrc_decode_frame(AVCodecContext *avctx, void *data,
+static int evrc_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
-    AVFrame *frame     = data;
     EVRCContext *e     = avctx->priv_data;
     int buf_size       = avpkt->size;
     float ilspf[FILTER_ORDER], ilpc[FILTER_ORDER], idelay[NB_SUBFRAMES];
diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index dd5924245f..88e7c01488 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -2023,12 +2023,11 @@ fail:
     return ret;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
                         int *got_frame, AVPacket *avpkt)
 {
     EXRContext *s = avctx->priv_data;
     GetByteContext *gb = &s->gb;
-    AVFrame *picture = data;
     uint8_t *ptr;
 
     int i, y, ret, ymax;
diff --git a/libavcodec/fastaudio.c b/libavcodec/fastaudio.c
index 151f03931a..fc525e58d1 100644
--- a/libavcodec/fastaudio.c
+++ b/libavcodec/fastaudio.c
@@ -105,12 +105,11 @@ static void set_sample(int i, int j, int v, float *result, int *pads, float valu
     result[i * 64 + pads[i] + j * 3] = value * (2 * v - 7);
 }
 
-static int fastaudio_decode(AVCodecContext *avctx, void *data,
+static int fastaudio_decode(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame, AVPacket *pkt)
 {
     FastAudioContext *s = avctx->priv_data;
     GetByteContext gb;
-    AVFrame *frame = data;
     int subframes;
     int ret;
 
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index d1f69ae6e1..81fa249885 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -831,7 +831,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                        int *got_frame, AVPacket *avpkt)
 {
     uint8_t *buf        = avpkt->data;
     int buf_size        = avpkt->size;
@@ -969,7 +970,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
 
     if (f->last_picture.f)
         ff_thread_release_ext_buffer(avctx, &f->last_picture);
-    if ((ret = av_frame_ref(data, f->picture.f)) < 0)
+    if ((ret = av_frame_ref(rframe, f->picture.f)) < 0)
         return ret;
 
     *got_frame = 1;
diff --git a/libavcodec/ffwavesynth.c b/libavcodec/ffwavesynth.c
index ea939b9009..0426386058 100644
--- a/libavcodec/ffwavesynth.c
+++ b/libavcodec/ffwavesynth.c
@@ -413,11 +413,10 @@ static void wavesynth_enter_intervals(struct wavesynth_context *ws, int64_t ts)
     *last = -1;
 }
 
-static int wavesynth_decode(AVCodecContext *avc, void *rframe, int *rgot_frame,
-                            AVPacket *packet)
+static int wavesynth_decode(AVCodecContext *avc, AVFrame *frame,
+                            int *rgot_frame, AVPacket *packet)
 {
     struct wavesynth_context *ws = avc->priv_data;
-    AVFrame *frame = rframe;
     int64_t ts;
     int duration;
     int s, c, r;
diff --git a/libavcodec/fic.c b/libavcodec/fic.c
index 79e45ec0d8..86a5012587 100644
--- a/libavcodec/fic.c
+++ b/libavcodec/fic.c
@@ -267,7 +267,7 @@ static void fic_draw_cursor(AVCodecContext *avctx, int cur_x, int cur_y)
     }
 }
 
-static int fic_decode_frame(AVCodecContext *avctx, void *data,
+static int fic_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
                             int *got_frame, AVPacket *avpkt)
 {
     FICContext *ctx = avctx->priv_data;
@@ -436,7 +436,7 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data,
 
 skip:
     *got_frame = 1;
-    if ((ret = av_frame_ref(data, ctx->final_frame)) < 0)
+    if ((ret = av_frame_ref(rframe, ctx->final_frame)) < 0)
         return ret;
 
     return avpkt->size;
diff --git a/libavcodec/fitsdec.c b/libavcodec/fitsdec.c
index b285787056..25857a1799 100644
--- a/libavcodec/fitsdec.c
+++ b/libavcodec/fitsdec.c
@@ -181,9 +181,9 @@ static int fits_read_header(AVCodecContext *avctx, const uint8_t **ptr, FITSHead
     return 0;
 }
 
-static int fits_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
+static int fits_decode_frame(AVCodecContext *avctx, AVFrame *p,
+                             int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *p=data;
     const uint8_t *ptr8 = avpkt->data, *end;
     uint8_t t8;
     int16_t t16;
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index dd6026f9de..11a62daab5 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -554,10 +554,9 @@ static int decode_frame(FLACContext *s)
     return 0;
 }
 
-static int flac_decode_frame(AVCodecContext *avctx, void *data,
+static int flac_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     FLACContext *s = avctx->priv_data;
diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c
index 013f0c7989..3cf01336c8 100644
--- a/libavcodec/flashsv.c
+++ b/libavcodec/flashsv.c
@@ -263,7 +263,7 @@ static int flashsv_decode_block(AVCodecContext *avctx, const AVPacket *avpkt,
     return 0;
 }
 
-static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
+static int flashsv_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
                                 int *got_frame, AVPacket *avpkt)
 {
     int buf_size = avpkt->size;
@@ -480,7 +480,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
                s->frame->linesize[0] * avctx->height);
     }
 
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
 
     *got_frame = 1;
diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c
index 2169202f4f..79e50aa71d 100644
--- a/libavcodec/flicvideo.c
+++ b/libavcodec/flicvideo.c
@@ -149,7 +149,7 @@ static av_cold int flic_decode_init(AVCodecContext *avctx)
 }
 
 static int flic_decode_frame_8BPP(AVCodecContext *avctx,
-                                  void *data, int *got_frame,
+                                  AVFrame *rframe, int *got_frame,
                                   const uint8_t *buf, int buf_size)
 {
     FlicDecodeContext *s = avctx->priv_data;
@@ -479,7 +479,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
         s->new_palette = 0;
     }
 
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
 
     *got_frame = 1;
@@ -488,7 +488,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
 }
 
 static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
-                                      void *data, int *got_frame,
+                                      AVFrame *rframe, int *got_frame,
                                       const uint8_t *buf, int buf_size)
 {
     /* Note, the only difference between the 15Bpp and 16Bpp */
@@ -781,7 +781,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
         av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \
                "and final chunk ptr = %d\n", buf_size, bytestream2_tell(&g2));
 
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
 
     *got_frame = 1;
@@ -790,7 +790,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
 }
 
 static int flic_decode_frame_24BPP(AVCodecContext *avctx,
-                                   void *data, int *got_frame,
+                                   AVFrame *rframe, int *got_frame,
                                    const uint8_t *buf, int buf_size)
 {
     FlicDecodeContext *s = avctx->priv_data;
@@ -1061,7 +1061,7 @@ static int flic_decode_frame_24BPP(AVCodecContext *avctx,
         av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \
                "and final chunk ptr = %d\n", buf_size, bytestream2_tell(&g2));
 
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
 
     *got_frame = 1;
@@ -1069,21 +1069,20 @@ static int flic_decode_frame_24BPP(AVCodecContext *avctx,
     return buf_size;
 }
 
-static int flic_decode_frame(AVCodecContext *avctx,
-                             void *data, int *got_frame,
-                             AVPacket *avpkt)
+static int flic_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                             int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
-        return flic_decode_frame_8BPP(avctx, data, got_frame,
+        return flic_decode_frame_8BPP(avctx, frame, got_frame,
                                       buf, buf_size);
     } else if ((avctx->pix_fmt == AV_PIX_FMT_RGB555) ||
                (avctx->pix_fmt == AV_PIX_FMT_RGB565)) {
-        return flic_decode_frame_15_16BPP(avctx, data, got_frame,
+        return flic_decode_frame_15_16BPP(avctx, frame, got_frame,
                                           buf, buf_size);
     } else if (avctx->pix_fmt == AV_PIX_FMT_BGR24) {
-        return flic_decode_frame_24BPP(avctx, data, got_frame,
+        return flic_decode_frame_24BPP(avctx, frame, got_frame,
                                        buf, buf_size);
     }
 
diff --git a/libavcodec/fmvc.c b/libavcodec/fmvc.c
index 385c737e0e..0dc918bc8c 100644
--- a/libavcodec/fmvc.c
+++ b/libavcodec/fmvc.c
@@ -394,13 +394,12 @@ static int decode_type1(GetByteContext *gb, PutByteContext *pb)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
                         int *got_frame, AVPacket *avpkt)
 {
     FMVCContext *s = avctx->priv_data;
     GetByteContext *gb = &s->gb;
     PutByteContext *pb = &s->pb;
-    AVFrame *frame = data;
     int ret, y, x;
 
     if (avpkt->size < 8)
diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c
index 7a8acc418f..82851e74de 100644
--- a/libavcodec/fraps.c
+++ b/libavcodec/fraps.c
@@ -133,14 +133,12 @@ static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w,
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *f,
+                        int *got_frame, AVPacket *avpkt)
 {
     FrapsContext * const s = avctx->priv_data;
     const uint8_t *buf     = avpkt->data;
     int buf_size           = avpkt->size;
-    AVFrame * const f = data;
     uint32_t header;
     unsigned int version,header_size;
     unsigned int x, y;
diff --git a/libavcodec/frwu.c b/libavcodec/frwu.c
index 558fac8d54..6ec88808df 100644
--- a/libavcodec/frwu.c
+++ b/libavcodec/frwu.c
@@ -42,12 +42,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *pic,
+                        int *got_frame, AVPacket *avpkt)
 {
     FRWUContext *s = avctx->priv_data;
     int field, ret;
-    AVFrame *pic = data;
     const uint8_t *buf = avpkt->data;
     const uint8_t *buf_end = buf + avpkt->size;
 
diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c
index 30432867e3..72368d9f4f 100644
--- a/libavcodec/g2meet.c
+++ b/libavcodec/g2meet.c
@@ -1372,13 +1372,12 @@ static void g2m_paint_cursor(G2MContext *c, uint8_t *dst, int stride)
     }
 }
 
-static int g2m_decode_frame(AVCodecContext *avctx, void *data,
+static int g2m_decode_frame(AVCodecContext *avctx, AVFrame *pic,
                             int *got_picture_ptr, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     G2MContext *c = avctx->priv_data;
-    AVFrame *pic = data;
     GetByteContext bc, tbc;
     int magic;
     int got_header = 0;
diff --git a/libavcodec/g722dec.c b/libavcodec/g722dec.c
index 727d88b7ba..e7e846b264 100644
--- a/libavcodec/g722dec.c
+++ b/libavcodec/g722dec.c
@@ -84,11 +84,10 @@ static const int16_t * const low_inv_quants[3] = { ff_g722_low_inv_quant6,
                                                            low_inv_quant5,
                                                    ff_g722_low_inv_quant4 };
 
-static int g722_decode_frame(AVCodecContext *avctx, void *data,
+static int g722_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
     G722Context *c = avctx->priv_data;
-    AVFrame *frame = data;
     int16_t *out_buf;
     int j, ret;
     const int skip = 8 - c->bits_per_codeword;
diff --git a/libavcodec/g723_1dec.c b/libavcodec/g723_1dec.c
index 71f758b55b..b025cb2b8e 100644
--- a/libavcodec/g723_1dec.c
+++ b/libavcodec/g723_1dec.c
@@ -925,11 +925,10 @@ static void generate_noise(G723_1_ChannelContext *p)
            PITCH_MAX * sizeof(*p->excitation));
 }
 
-static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
+static int g723_1_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                int *got_frame_ptr, AVPacket *avpkt)
 {
     G723_1_Context *s  = avctx->priv_data;
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     int dec_mode       = buf[0] & 3;
diff --git a/libavcodec/g726.c b/libavcodec/g726.c
index 5c944d95b6..0e19a2a8fc 100644
--- a/libavcodec/g726.c
+++ b/libavcodec/g726.c
@@ -461,10 +461,9 @@ static av_cold int g726_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int g726_decode_frame(AVCodecContext *avctx, void *data,
+static int g726_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     G726Context *c = avctx->priv_data;
diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c
index 3ca141a2da..0d54f555bd 100644
--- a/libavcodec/g729dec.c
+++ b/libavcodec/g729dec.c
@@ -401,8 +401,8 @@ static av_cold int decoder_init(AVCodecContext * avctx)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame_ptr, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
@@ -427,7 +427,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
     int16_t synth[SUBFRAME_SIZE+10]; // fixed-codebook vector
     int j, ret;
     int gain_before, gain_after;
-    AVFrame *frame = data;
 
     frame->nb_samples = SUBFRAME_SIZE<<1;
     if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
diff --git a/libavcodec/gdv.c b/libavcodec/gdv.c
index e8af2f563f..d4c763cffb 100644
--- a/libavcodec/gdv.c
+++ b/libavcodec/gdv.c
@@ -456,13 +456,12 @@ static int decompress_68(AVCodecContext *avctx, unsigned skip, unsigned use8)
     return 0;
 }
 
-static int gdv_decode_frame(AVCodecContext *avctx, void *data,
+static int gdv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame, AVPacket *avpkt)
 {
     GDVContext *gdv = avctx->priv_data;
     GetByteContext *gb = &gdv->gb;
     PutByteContext *pb = &gdv->pb;
-    AVFrame *frame = data;
     int ret, i;
     int compression;
     unsigned flags;
diff --git a/libavcodec/gemdec.c b/libavcodec/gemdec.c
index 83b71727d6..0844f8cfb3 100644
--- a/libavcodec/gemdec.c
+++ b/libavcodec/gemdec.c
@@ -85,14 +85,12 @@ static void put_lines_bytes(AVCodecContext *avctx, int planes, int row_width, in
     state->vdup = 1;
 }
 
-static int gem_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int gem_decode_frame(AVCodecContext *avctx, AVFrame *p,
+                            int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf     = avpkt->data;
     int buf_size           = avpkt->size;
     const uint8_t *buf_end = buf + buf_size;
-    AVFrame *p             = data;
     int header_size, planes, pattern_size, tag = 0, count_scalar = 1, ret;
     unsigned int x, count, v;
     GetByteContext gb;
diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c
index aeeefe477d..adb8d0cec3 100644
--- a/libavcodec/gifdec.c
+++ b/libavcodec/gifdec.c
@@ -465,7 +465,8 @@ static av_cold int gif_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int gif_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
+static int gif_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                            int *got_frame, AVPacket *avpkt)
 {
     GifState *s = avctx->priv_data;
     int ret;
@@ -520,7 +521,7 @@ static int gif_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, A
     if (ret < 0)
         return ret;
 
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
     *got_frame = 1;
 
diff --git a/libavcodec/gsmdec.c b/libavcodec/gsmdec.c
index 02d988ae40..84852c8b11 100644
--- a/libavcodec/gsmdec.c
+++ b/libavcodec/gsmdec.c
@@ -65,10 +65,9 @@ static av_cold int gsm_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int gsm_decode_frame(AVCodecContext *avctx, void *data,
+static int gsm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame = data;
     int res;
     GetBitContext gb;
     const uint8_t *buf = avpkt->data;
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 2830966eb6..a826c1ca1c 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -594,7 +594,7 @@ static int get_consumed_bytes(MpegEncContext *s, int buf_size)
     return pos;
 }
 
-static int h261_decode_frame(AVCodecContext *avctx, void *data,
+static int h261_decode_frame(AVCodecContext *avctx, AVFrame *pict,
                              int *got_frame, AVPacket *avpkt)
 {
     H261DecContext *const h = avctx->priv_data;
@@ -602,7 +602,6 @@ static int h261_decode_frame(AVCodecContext *avctx, void *data,
     int buf_size       = avpkt->size;
     MpegEncContext *s  = &h->s;
     int ret;
-    AVFrame *pict = data;
 
     ff_dlog(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size);
     ff_dlog(avctx, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 965a7d30c4..731f442b01 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -425,15 +425,14 @@ static int decode_slice(MpegEncContext *s)
     return AVERROR_INVALIDDATA;
 }
 
-int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                         AVPacket *avpkt)
+int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict,
+                         int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     MpegEncContext *s  = avctx->priv_data;
     int ret;
     int slice_ret = 0;
-    AVFrame *pict = data;
 
     /* no supplementary picture */
     if (buf_size == 0) {
diff --git a/libavcodec/h263dec.h b/libavcodec/h263dec.h
index 8d5f9a7add..9f1db72903 100644
--- a/libavcodec/h263dec.h
+++ b/libavcodec/h263dec.h
@@ -42,9 +42,8 @@ extern const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[];
 
 int ff_h263_decode_motion(MpegEncContext * s, int pred, int f_code);
 int ff_h263_decode_init(AVCodecContext *avctx);
-int ff_h263_decode_frame(AVCodecContext *avctx,
-                             void *data, int *got_frame,
-                             AVPacket *avpkt);
+int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                         int *got_frame, AVPacket *avpkt);
 int ff_h263_decode_end(AVCodecContext *avctx);
 void ff_h263_decode_init_vlc(void);
 int ff_h263_decode_picture_header(MpegEncContext *s);
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 9faa35e36d..1dbf136934 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -974,13 +974,12 @@ static int send_next_delayed_frame(H264Context *h, AVFrame *dst_frame,
     return buf_index;
 }
 
-static int h264_decode_frame(AVCodecContext *avctx, void *data,
+static int h264_decode_frame(AVCodecContext *avctx, AVFrame *pict,
                              int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     H264Context *h     = avctx->priv_data;
-    AVFrame *pict      = data;
     int buf_index;
     int ret;
 
diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c
index 4a7ac15a8e..1a0472d432 100644
--- a/libavcodec/hapdec.c
+++ b/libavcodec/hapdec.c
@@ -301,11 +301,10 @@ static int decompress_texture2_thread(AVCodecContext *avctx, void *arg,
     return decompress_texture_thread_internal(avctx, arg, slice, thread_nb, 1);
 }
 
-static int hap_decode(AVCodecContext *avctx, void *data,
+static int hap_decode(AVCodecContext *avctx, AVFrame *frame,
                       int *got_frame, AVPacket *avpkt)
 {
     HapContext *ctx = avctx->priv_data;
-    AVFrame *const frame = data;
     int ret, i, t;
     int section_size;
     enum HapSectionType section_type;
diff --git a/libavcodec/hcadec.c b/libavcodec/hcadec.c
index b178456e1c..8539c772d8 100644
--- a/libavcodec/hcadec.c
+++ b/libavcodec/hcadec.c
@@ -387,10 +387,9 @@ static void unpack(HCAContext *c, ChannelContext *ch,
         ch->base[i] = dequantizer_scaling_table[ch->scale_factors[i]] * quant_step_size[ch->scale[i]];
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
                         int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame = data;
     HCAContext *c = avctx->priv_data;
     int ch, ret, packed_noise_level;
     GetBitContext *gb = &c->gb;
diff --git a/libavcodec/hcom.c b/libavcodec/hcom.c
index 17e99c91bf..4d55360294 100644
--- a/libavcodec/hcom.c
+++ b/libavcodec/hcom.c
@@ -80,11 +80,10 @@ static av_cold int hcom_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int hcom_decode(AVCodecContext *avctx, void *data,
+static int hcom_decode(AVCodecContext *avctx, AVFrame *frame,
                        int *got_frame, AVPacket *pkt)
 {
     HCOMContext *s = avctx->priv_data;
-    AVFrame *frame = data;
     GetBitContext gb;
     int ret, n = 0;
 
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 09c07acdc2..9c2958b643 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -3474,8 +3474,8 @@ static int hevc_decode_extradata(HEVCContext *s, uint8_t *buf, int length, int f
     return 0;
 }
 
-static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output,
-                             AVPacket *avpkt)
+static int hevc_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                             int *got_output, AVPacket *avpkt)
 {
     int ret;
     uint8_t *sd;
@@ -3483,7 +3483,7 @@ static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output,
     HEVCContext *s = avctx->priv_data;
 
     if (!avpkt->size) {
-        ret = ff_hevc_output_frame(s, data, 1);
+        ret = ff_hevc_output_frame(s, rframe, 1);
         if (ret < 0)
             return ret;
 
@@ -3533,7 +3533,7 @@ static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output,
     }
 
     if (s->output_frame->buf[0]) {
-        av_frame_move_ref(data, s->output_frame);
+        av_frame_move_ref(rframe, s->output_frame);
         *got_output = 1;
     }
 
diff --git a/libavcodec/hnm4video.c b/libavcodec/hnm4video.c
index 25228420ec..deba534766 100644
--- a/libavcodec/hnm4video.c
+++ b/libavcodec/hnm4video.c
@@ -388,10 +388,9 @@ static void hnm_update_palette(AVCodecContext *avctx, uint8_t *src,
     }
 }
 
-static int hnm_decode_frame(AVCodecContext *avctx, void *data,
+static int hnm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *frame = data;
     Hnm4VideoContext *hnm = avctx->priv_data;
     int ret;
     uint16_t chunk_id;
diff --git a/libavcodec/hq_hqa.c b/libavcodec/hq_hqa.c
index fac22e95f6..a53b4641a0 100644
--- a/libavcodec/hq_hqa.c
+++ b/libavcodec/hq_hqa.c
@@ -301,11 +301,10 @@ static int hqa_decode_frame(HQContext *ctx, AVFrame *pic, size_t data_size)
     return 0;
 }
 
-static int hq_hqa_decode_frame(AVCodecContext *avctx, void *data,
+static int hq_hqa_decode_frame(AVCodecContext *avctx, AVFrame *pic,
                                int *got_frame, AVPacket *avpkt)
 {
     HQContext *ctx = avctx->priv_data;
-    AVFrame *pic = data;
     uint32_t info_tag;
     unsigned int data_size;
     int ret;
diff --git a/libavcodec/hqx.c b/libavcodec/hqx.c
index a1b3b39a0a..8c7fc9b1ec 100644
--- a/libavcodec/hqx.c
+++ b/libavcodec/hqx.c
@@ -400,11 +400,10 @@ static int decode_slice_thread(AVCodecContext *avctx, void *arg,
     return decode_slice(ctx, slice_no);
 }
 
-static int hqx_decode_frame(AVCodecContext *avctx, void *data,
+static int hqx_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_picture_ptr, AVPacket *avpkt)
 {
     HQXContext *ctx = avctx->priv_data;
-    AVFrame *const frame = data;
     uint8_t *src = avpkt->data;
     uint32_t info_tag;
     int data_start;
@@ -433,7 +432,7 @@ static int hqx_decode_frame(AVCodecContext *avctx, void *data,
     data_start     = src - avpkt->data;
     ctx->data_size = avpkt->size - data_start;
     ctx->src       = src;
-    ctx->pic       = data;
+    ctx->pic       = frame;
 
     if (ctx->data_size < HQX_HEADER_SIZE) {
         av_log(avctx, AV_LOG_ERROR, "Frame too small.\n");
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 5fdefa9bd5..d98156e26d 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -1179,15 +1179,14 @@ static int decode_slice(AVCodecContext *avctx, AVFrame *p, int height,
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *p,
+                        int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     HYuvContext *s = avctx->priv_data;
     const int width  = s->width;
     const int height = s->height;
-    AVFrame *const p = data;
     int slice, table_size = 0, ret, nb_slices;
     unsigned slices_info_offset;
     int slice_height;
diff --git a/libavcodec/idcinvideo.c b/libavcodec/idcinvideo.c
index a73c82b8fa..1a3792be0e 100644
--- a/libavcodec/idcinvideo.c
+++ b/libavcodec/idcinvideo.c
@@ -209,14 +209,12 @@ static int idcin_decode_vlcs(IdcinContext *s, AVFrame *frame)
     return 0;
 }
 
-static int idcin_decode_frame(AVCodecContext *avctx,
-                              void *data, int *got_frame,
-                              AVPacket *avpkt)
+static int idcin_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                              int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     IdcinContext *s = avctx->priv_data;
-    AVFrame *frame = data;
     int ret;
 
     s->buf = buf;
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 95ce10b554..184e3b865e 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -1527,12 +1527,10 @@ static int unsupported(AVCodecContext *avctx)
     return AVERROR_INVALIDDATA;
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
     IffContext *s          = avctx->priv_data;
-    AVFrame *frame         = data;
     const uint8_t *buf     = avpkt->data;
     int buf_size           = avpkt->size;
     const uint8_t *buf_end = buf + buf_size;
diff --git a/libavcodec/ilbcdec.c b/libavcodec/ilbcdec.c
index 19ecd14411..182a014d11 100644
--- a/libavcodec/ilbcdec.c
+++ b/libavcodec/ilbcdec.c
@@ -1356,11 +1356,10 @@ static void hp_output(int16_t *signal, const int16_t *ba, int16_t *y,
     }
 }
 
-static int ilbc_decode_frame(AVCodecContext *avctx, void *data,
+static int ilbc_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
-    AVFrame *frame     = data;
     ILBCContext *s     = avctx->priv_data;
     int mode = s->mode, ret;
     int16_t *plc_data = &s->plc_residual[LPC_FILTERORDER];
diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index f11d28d28c..7b0e9d3b55 100644
--- a/libavcodec/imc.c
+++ b/libavcodec/imc.c
@@ -1020,10 +1020,9 @@ static int imc_decode_block(AVCodecContext *avctx, IMCContext *q, int ch)
     return 0;
 }
 
-static int imc_decode_frame(AVCodecContext *avctx, void *data,
+static int imc_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     int ret, i;
diff --git a/libavcodec/imm4.c b/libavcodec/imm4.c
index 40dc67f5d0..d531bbdc3d 100644
--- a/libavcodec/imm4.c
+++ b/libavcodec/imm4.c
@@ -353,12 +353,11 @@ static int decode_inter(AVCodecContext *avctx, GetBitContext *gb,
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
                         int *got_frame, AVPacket *avpkt)
 {
     IMM4Context *s = avctx->priv_data;
     GetBitContext *gb = &s->gb;
-    AVFrame *frame = data;
     int width, height;
     unsigned type;
     int ret, scaled;
diff --git a/libavcodec/imm5.c b/libavcodec/imm5.c
index eed3f89cc7..eb30cc5509 100644
--- a/libavcodec/imm5.c
+++ b/libavcodec/imm5.c
@@ -83,11 +83,10 @@ static av_cold int imm5_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int imm5_decode_frame(AVCodecContext *avctx, void *data,
+static int imm5_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame, AVPacket *avpkt)
 {
     IMM5Context *ctx = avctx->priv_data;
-    AVFrame *frame = data;
     AVCodecContext *codec_avctx = ctx->h264_avctx;
     int ret;
 
diff --git a/libavcodec/imx.c b/libavcodec/imx.c
index 0f94c1ec57..0d8924bf45 100644
--- a/libavcodec/imx.c
+++ b/libavcodec/imx.c
@@ -47,7 +47,7 @@ static av_cold int imx_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int imx_decode_frame(AVCodecContext *avctx, void *data,
+static int imx_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
                             int *got_frame, AVPacket *avpkt)
 {
     SimbiosisIMXContext *imx = avctx->priv_data;
@@ -153,7 +153,7 @@ static int imx_decode_frame(AVCodecContext *avctx, void *data,
 
     frame->pict_type = frame->key_frame ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
 
-    if ((ret = av_frame_ref(data, frame)) < 0)
+    if ((ret = av_frame_ref(rframe, frame)) < 0)
         return ret;
 
     *got_frame = 1;
diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c
index aec118c84c..8b47b59f79 100644
--- a/libavcodec/indeo2.c
+++ b/libavcodec/indeo2.c
@@ -151,14 +151,12 @@ static int ir2_decode_plane_inter(Ir2Context *ctx, int width, int height, uint8_
     return 0;
 }
 
-static int ir2_decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int ir2_decode_frame(AVCodecContext *avctx, AVFrame *picture,
+                            int *got_frame, AVPacket *avpkt)
 {
     Ir2Context * const s = avctx->priv_data;
     const uint8_t *buf   = avpkt->data;
     int buf_size         = avpkt->size;
-    AVFrame *picture     = data;
     AVFrame * const p    = s->picture;
     int start, ret;
     int ltab, ctab;
diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c
index c697432cbe..753f1b2560 100644
--- a/libavcodec/indeo3.c
+++ b/libavcodec/indeo3.c
@@ -1065,13 +1065,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
 }
 
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
     Indeo3DecodeContext *ctx = avctx->priv_data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
-    AVFrame *frame     = data;
     int res;
 
     res = decode_frame_headers(ctx, avctx, buf, buf_size);
diff --git a/libavcodec/interplayacm.c b/libavcodec/interplayacm.c
index c6aab6c4c3..f669d6cd31 100644
--- a/libavcodec/interplayacm.c
+++ b/libavcodec/interplayacm.c
@@ -552,12 +552,11 @@ static int decode_block(InterplayACMContext *s)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
                         int *got_frame_ptr, AVPacket *pkt)
 {
     InterplayACMContext *s = avctx->priv_data;
     GetBitContext *gb = &s->gb;
-    AVFrame *frame = data;
     const uint8_t *buf;
     int16_t *samples;
     int ret, n, buf_size, input_buf_size;
diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c
index 8b86d5513a..ff0efc127c 100644
--- a/libavcodec/interplayvideo.c
+++ b/libavcodec/interplayvideo.c
@@ -1189,14 +1189,12 @@ static av_cold int ipvideo_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int ipvideo_decode_frame(AVCodecContext *avctx,
-                                void *data, int *got_frame,
-                                AVPacket *avpkt)
+static int ipvideo_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                                int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     IpvideoContext *s = avctx->priv_data;
-    AVFrame *frame = data;
     int ret;
     int send_buffer;
     int frame_format;
diff --git a/libavcodec/ivi.c b/libavcodec/ivi.c
index 77979d04e7..48fcf9bfd8 100644
--- a/libavcodec/ivi.c
+++ b/libavcodec/ivi.c
@@ -1065,12 +1065,11 @@ static int decode_band(IVI45DecContext *ctx,
     return result;
 }
 
-int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+int ff_ivi_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
     IVI45DecContext *ctx = avctx->priv_data;
     const uint8_t   *buf = avpkt->data;
-    AVFrame       *frame = data;
     int             buf_size = avpkt->size;
     int             result, p, b;
 
@@ -1091,7 +1090,7 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
 
     if (ctx->is_indeo4 && ctx->frame_type == IVI4_FRAMETYPE_NULL_LAST) {
         if (ctx->got_p_frame) {
-            av_frame_move_ref(data, ctx->p_frame);
+            av_frame_move_ref(frame, ctx->p_frame);
             *got_frame = 1;
             ctx->got_p_frame = 0;
         } else {
diff --git a/libavcodec/ivi.h b/libavcodec/ivi.h
index 1427535547..06cd4d95ff 100644
--- a/libavcodec/ivi.h
+++ b/libavcodec/ivi.h
@@ -335,8 +335,8 @@ int  ff_ivi_init_planes(AVCodecContext *avctx, IVIPlaneDesc *planes,
  */
 int  ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_height);
 
-int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt);
+int ff_ivi_decode_frame(AVCodecContext *avctx, AVFrame *data,
+                        int *got_frame, AVPacket *avpkt);
 int ff_ivi_decode_close(AVCodecContext *avctx);
 
 #endif /* AVCODEC_IVI_H */
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 67638e589f..23f4cb768b 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -2473,11 +2473,10 @@ static av_cold int jpeg2000_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data,
+static int jpeg2000_decode_frame(AVCodecContext *avctx, AVFrame *picture,
                                  int *got_frame, AVPacket *avpkt)
 {
     Jpeg2000DecoderContext *s = avctx->priv_data;
-    AVFrame *picture = data;
     int ret;
 
     s->avctx     = avctx;
diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index 5849f4d1fd..805ff9dda5 100644
--- a/libavcodec/jvdec.c
+++ b/libavcodec/jvdec.c
@@ -144,8 +144,8 @@ static inline void decode8x8(GetBitContext *gb, uint8_t *dst, int linesize,
     }
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                        int *got_frame, AVPacket *avpkt)
 {
     JvContext *s = avctx->priv_data;
     const uint8_t *buf = avpkt->data;
@@ -217,7 +217,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
         s->palette_has_changed        = 0;
         memcpy(s->frame->data[1], s->palette, AVPALETTE_SIZE);
 
-        if ((ret = av_frame_ref(data, s->frame)) < 0)
+        if ((ret = av_frame_ref(rframe, s->frame)) < 0)
             return ret;
         *got_frame = 1;
     }
diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c
index 8378dd20ff..83dbc8291f 100644
--- a/libavcodec/kgv1dec.c
+++ b/libavcodec/kgv1dec.c
@@ -44,10 +44,9 @@ static void decode_flush(AVCodecContext *avctx)
     av_freep(&c->last_frame_buffer);
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *frame = data;
     const uint8_t *buf = avpkt->data;
     const uint8_t *buf_end = buf + avpkt->size;
     KgvContext * const c = avctx->priv_data;
diff --git a/libavcodec/kmvc.c b/libavcodec/kmvc.c
index c9b54c3514..f031d37b7f 100644
--- a/libavcodec/kmvc.c
+++ b/libavcodec/kmvc.c
@@ -261,11 +261,10 @@ static int kmvc_decode_inter_8x8(KmvcContext * ctx, int w, int h)
     return 0;
 }
 
-static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext * avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
     KmvcContext *const ctx = avctx->priv_data;
-    AVFrame *frame = data;
     uint8_t *out, *src;
     int i, ret;
     int header;
diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c
index 39fbfab94f..2276616bb8 100644
--- a/libavcodec/lagarith.c
+++ b/libavcodec/lagarith.c
@@ -534,13 +534,12 @@ static int lag_decode_arith_plane(LagarithContext *l, uint8_t *dst,
  * @param avpkt input packet
  * @return number of consumed bytes on success or negative if decode fails
  */
-static int lag_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame, AVPacket *avpkt)
+static int lag_decode_frame(AVCodecContext *avctx, AVFrame *p,
+                            int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     unsigned int buf_size = avpkt->size;
     LagarithContext *l = avctx->priv_data;
-    AVFrame *const p  = data;
     uint8_t frametype;
     uint32_t offset_gu = 0, offset_bv = 0, offset_ry = 9;
     uint32_t offs[4];
diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
index 254ed503ab..6285e71d6e 100644
--- a/libavcodec/lcldec.c
+++ b/libavcodec/lcldec.c
@@ -159,9 +159,9 @@ static int zlib_decomp(AVCodecContext *avctx, const uint8_t *src, int src_len, i
 #endif
 
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *frame = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     LclDecContext * const c = avctx->priv_data;
diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c
index 7bcade4628..a083487c33 100644
--- a/libavcodec/libaomdec.c
+++ b/libavcodec/libaomdec.c
@@ -156,11 +156,10 @@ static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img)
     }
 }
 
-static int aom_decode(AVCodecContext *avctx, void *data, int *got_frame,
-                      AVPacket *avpkt)
+static int aom_decode(AVCodecContext *avctx, AVFrame *picture,
+                      int *got_frame, AVPacket *avpkt)
 {
     AV1DecodeContext *ctx = avctx->priv_data;
-    AVFrame *picture      = data;
     const void *iter      = NULL;
     struct aom_image *img;
     int ret;
diff --git a/libavcodec/libcelt_dec.c b/libavcodec/libcelt_dec.c
index bae6e680d3..b5fc391731 100644
--- a/libavcodec/libcelt_dec.c
+++ b/libavcodec/libcelt_dec.c
@@ -103,11 +103,10 @@ static av_cold int libcelt_dec_close(AVCodecContext *c)
     return 0;
 }
 
-static int libcelt_dec_decode(AVCodecContext *c, void *data,
+static int libcelt_dec_decode(AVCodecContext *c, AVFrame *frame,
                               int *got_frame_ptr, AVPacket *pkt)
 {
     struct libcelt_context *celt = c->priv_data;
-    AVFrame *frame = data;
     int err;
     int16_t *pcm;
 
diff --git a/libavcodec/libcodec2.c b/libavcodec/libcodec2.c
index f59cb31bf2..2cfa1542e4 100644
--- a/libavcodec/libcodec2.c
+++ b/libavcodec/libcodec2.c
@@ -130,11 +130,10 @@ static av_cold int libcodec2_close(AVCodecContext *avctx)
     return 0;
 }
 
-static int libcodec2_decode(AVCodecContext *avctx, void *data,
+static int libcodec2_decode(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame_ptr, AVPacket *pkt)
 {
     LibCodec2Context *c2 = avctx->priv_data;
-    AVFrame *frame = data;
     int ret, nframes, i;
     uint8_t *input;
     int16_t *output;
diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index caf030b877..564f9fb7c5 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -176,13 +176,12 @@ static av_cold int davs2_end(AVCodecContext *avctx)
     return 0;
 }
 
-static int davs2_decode_frame(AVCodecContext *avctx, void *data,
+static int davs2_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                               int *got_frame, AVPacket *avpkt)
 {
     DAVS2Context *cad      = avctx->priv_data;
     int           buf_size = avpkt->size;
     uint8_t      *buf_ptr  = avpkt->data;
-    AVFrame      *frame    = data;
     int           ret      = DAVS2_DEFAULT;
 
     /* end of stream, output what is still in the buffers */
diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c
index e9096a08e6..c90324a3c8 100644
--- a/libavcodec/libfdk-aacdec.c
+++ b/libavcodec/libfdk-aacdec.c
@@ -377,11 +377,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
     return 0;
 }
 
-static int fdk_aac_decode_frame(AVCodecContext *avctx, void *data,
+static int fdk_aac_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                 int *got_frame_ptr, AVPacket *avpkt)
 {
     FDKAACDecContext *s = avctx->priv_data;
-    AVFrame *frame = data;
     int ret;
     AAC_DECODER_ERROR err;
     UINT valid = avpkt->size;
diff --git a/libavcodec/libgsmdec.c b/libavcodec/libgsmdec.c
index 07fae624ff..88f0a0b3d6 100644
--- a/libavcodec/libgsmdec.c
+++ b/libavcodec/libgsmdec.c
@@ -82,12 +82,11 @@ static av_cold int libgsm_decode_close(AVCodecContext *avctx) {
     return 0;
 }
 
-static int libgsm_decode_frame(AVCodecContext *avctx, void *data,
+static int libgsm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                int *got_frame_ptr, AVPacket *avpkt)
 {
     int i, ret;
     LibGSMDecodeContext *s = avctx->priv_data;
-    AVFrame *frame         = data;
     uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     int16_t *samples;
diff --git a/libavcodec/libilbc.c b/libavcodec/libilbc.c
index 83d8e33ed9..0fecbd4bba 100644
--- a/libavcodec/libilbc.c
+++ b/libavcodec/libilbc.c
@@ -87,13 +87,12 @@ static av_cold int ilbc_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int ilbc_decode_frame(AVCodecContext *avctx, void *data,
+static int ilbc_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     ILBCDecContext *s  = avctx->priv_data;
-    AVFrame *frame     = data;
     int ret;
 
     if (s->decoder.no_of_bytes > buf_size) {
diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c
index 82e0bd708e..8650296113 100644
--- a/libavcodec/libopencore-amr.c
+++ b/libavcodec/libopencore-amr.c
@@ -96,10 +96,9 @@ static av_cold int amr_nb_decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-static int amr_nb_decode_frame(AVCodecContext *avctx, void *data,
+static int amr_nb_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     AMRContext *s      = avctx->priv_data;
@@ -330,10 +329,9 @@ static av_cold int amr_wb_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int amr_wb_decode_frame(AVCodecContext *avctx, void *data,
+static int amr_wb_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     AMRWBContext *s    = avctx->priv_data;
diff --git a/libavcodec/libopenh264dec.c b/libavcodec/libopenh264dec.c
index 2cef2fbd47..a88974cc62 100644
--- a/libavcodec/libopenh264dec.c
+++ b/libavcodec/libopenh264dec.c
@@ -87,14 +87,13 @@ static av_cold int svc_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int svc_decode_frame(AVCodecContext *avctx, void *data,
+static int svc_decode_frame(AVCodecContext *avctx, AVFrame *avframe,
                             int *got_frame, AVPacket *avpkt)
 {
     SVCContext *s = avctx->priv_data;
     SBufferInfo info = { 0 };
     uint8_t *ptrs[4] = { NULL };
     int ret, linesize[4];
-    AVFrame *avframe = data;
     DECODING_STATE state;
 #if OPENH264_VER_AT_LEAST(1, 7)
     int opt;
diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c
index 451dc7f65f..1458ea3fdf 100644
--- a/libavcodec/libopenjpegdec.c
+++ b/libavcodec/libopenjpegdec.c
@@ -318,14 +318,12 @@ static av_cold int libopenjpeg_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int libopenjpeg_decode_frame(AVCodecContext *avctx,
-                                    void *data, int *got_frame,
-                                    AVPacket *avpkt)
+static int libopenjpeg_decode_frame(AVCodecContext *avctx, AVFrame *picture,
+                                    int *got_frame, AVPacket *avpkt)
 {
     uint8_t *buf            = avpkt->data;
     int buf_size            = avpkt->size;
     LibOpenJPEGContext *ctx = avctx->priv_data;
-    AVFrame *picture        = data;
     const AVPixFmtDescriptor *desc;
     int width, height, ret;
     int pixel_size = 0;
diff --git a/libavcodec/libopusdec.c b/libavcodec/libopusdec.c
index 2271eed917..dcc1599d63 100644
--- a/libavcodec/libopusdec.c
+++ b/libavcodec/libopusdec.c
@@ -156,11 +156,10 @@ static av_cold int libopus_decode_close(AVCodecContext *avc)
 
 #define MAX_FRAME_SIZE (960 * 6)
 
-static int libopus_decode(AVCodecContext *avc, void *data,
+static int libopus_decode(AVCodecContext *avc, AVFrame *frame,
                           int *got_frame_ptr, AVPacket *pkt)
 {
     struct libopus_context *opus = avc->priv_data;
-    AVFrame *frame               = data;
     int ret, nb_samples;
 
     frame->nb_samples = MAX_FRAME_SIZE;
diff --git a/libavcodec/librsvgdec.c b/libavcodec/librsvgdec.c
index 4a3b0c8ce7..c37fbbb0c9 100644
--- a/libavcodec/librsvgdec.c
+++ b/libavcodec/librsvgdec.c
@@ -33,11 +33,11 @@ typedef struct LibRSVGContext {
     int keep_ar;
 } LibRSVGContext;
 
-static int librsvg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt)
+static int librsvg_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                                int *got_frame, AVPacket *pkt)
 {
     int ret;
     LibRSVGContext *s = avctx->priv_data;
-    AVFrame *frame = data;
 
     RsvgHandle *handle;
     RsvgDimensionData unscaled_dimensions, dimensions;
diff --git a/libavcodec/libspeexdec.c b/libavcodec/libspeexdec.c
index bb7ccea647..da47b271e0 100644
--- a/libavcodec/libspeexdec.c
+++ b/libavcodec/libspeexdec.c
@@ -124,13 +124,12 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int libspeex_decode_frame(AVCodecContext *avctx, void *data,
+static int libspeex_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                  int *got_frame_ptr, AVPacket *avpkt)
 {
     uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     LibSpeexContext *s = avctx->priv_data;
-    AVFrame *frame     = data;
     int16_t *output;
     int ret, consumed = 0;
     avctx->sample_fmt = AV_SAMPLE_FMT_S16;
diff --git a/libavcodec/libuavs3d.c b/libavcodec/libuavs3d.c
index a228082f59..b5e861bd1f 100644
--- a/libavcodec/libuavs3d.c
+++ b/libavcodec/libuavs3d.c
@@ -142,14 +142,14 @@ static void libuavs3d_flush(AVCodecContext * avctx)
 }
 
 #define UAVS3D_CHECK_INVALID_RANGE(v, l, r) ((v)<(l)||(v)>(r))
-static int libuavs3d_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
+static int libuavs3d_decode_frame(AVCodecContext *avctx, AVFrame *frm,
+                                  int *got_frame, AVPacket *avpkt)
 {
     uavs3d_context *h = avctx->priv_data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     const uint8_t *buf_end;
     const uint8_t *buf_ptr;
-    AVFrame *frm = data;
     int left_bytes;
     int ret, finish = 0;
 
@@ -162,7 +162,7 @@ static int libuavs3d_decode_frame(AVCodecContext *avctx, void *data, int *got_fr
             if (!frm->data[0] && (ret = ff_get_buffer(avctx, frm, 0)) < 0) {
                 return ret;
             }
-            h->dec_frame.priv = data;   // AVFrame
+            h->dec_frame.priv = frm;   // AVFrame
         }
         do {
             ret = uavs3d_flush(h->dec_handle, &h->dec_frame);
@@ -182,7 +182,7 @@ static int libuavs3d_decode_frame(AVCodecContext *avctx, void *data, int *got_fr
                 if (!frm->data[0] && (ret = ff_get_buffer(avctx, frm, 0)) < 0) {
                     return ret;
                 }
-                h->dec_frame.priv = data;   // AVFrame
+                h->dec_frame.priv = frm;   // AVFrame
             }
 
             if (uavs3d_find_next_start_code(buf_ptr, buf_end - buf_ptr, &left_bytes)) {
diff --git a/libavcodec/libvorbisdec.c b/libavcodec/libvorbisdec.c
index 7d2fdcf785..26bd0c994e 100644
--- a/libavcodec/libvorbisdec.c
+++ b/libavcodec/libvorbisdec.c
@@ -149,11 +149,10 @@ static inline int conv(int samples, float **pcm, char *buf, int channels) {
     return 0 ;
 }
 
-static int oggvorbis_decode_frame(AVCodecContext *avccontext, void *data,
-                        int *got_frame_ptr, AVPacket *avpkt)
+static int oggvorbis_decode_frame(AVCodecContext *avccontext, AVFrame *frame,
+                                  int *got_frame_ptr, AVPacket *avpkt)
 {
     OggVorbisDecContext *context = avccontext->priv_data ;
-    AVFrame *frame = data;
     float **pcm ;
     ogg_packet *op= &context->op;
     int samples, total_samples, total_bytes;
diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index 592474b301..51bdd13832 100644
--- a/libavcodec/libvpxdec.c
+++ b/libavcodec/libvpxdec.c
@@ -215,11 +215,10 @@ static int decode_frame(AVCodecContext *avctx, vpx_codec_ctx_t *decoder,
     return 0;
 }
 
-static int vpx_decode(AVCodecContext *avctx,
-                      void *data, int *got_frame, AVPacket *avpkt)
+static int vpx_decode(AVCodecContext *avctx, AVFrame *picture,
+                      int *got_frame, AVPacket *avpkt)
 {
     VPxContext *ctx = avctx->priv_data;
-    AVFrame *picture = data;
     const void *iter = NULL;
     const void *iter_alpha = NULL;
     struct vpx_image *img, *img_alpha;
diff --git a/libavcodec/loco.c b/libavcodec/loco.c
index 0501a70ceb..c21214a626 100644
--- a/libavcodec/loco.c
+++ b/libavcodec/loco.c
@@ -196,14 +196,12 @@ static void rotate_faulty_loco(uint8_t *data, int width, int height, int stride)
     }
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *p,
+                        int *got_frame, AVPacket *avpkt)
 {
     LOCOContext * const l = avctx->priv_data;
     const uint8_t *buf    = avpkt->data;
     int buf_size          = avpkt->size;
-    AVFrame * const p     = data;
     int decoded, ret;
 
     if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
diff --git a/libavcodec/lscrdec.c b/libavcodec/lscrdec.c
index ab5a391c94..dc2c7a51c2 100644
--- a/libavcodec/lscrdec.c
+++ b/libavcodec/lscrdec.c
@@ -107,9 +107,8 @@ static int decode_idat(LSCRContext *s, z_stream *zstream, int length)
     return 0;
 }
 
-static int decode_frame_lscr(AVCodecContext *avctx,
-                             void *data, int *got_frame,
-                             AVPacket *avpkt)
+static int decode_frame_lscr(AVCodecContext *avctx, AVFrame *rframe,
+                             int *got_frame, AVPacket *avpkt)
 {
     LSCRContext *const s = avctx->priv_data;
     GetByteContext *gb = &s->gb;
@@ -202,7 +201,7 @@ static int decode_frame_lscr(AVCodecContext *avctx,
 
     frame->pict_type = frame->key_frame ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
 
-    if ((ret = av_frame_ref(data, frame)) < 0)
+    if ((ret = av_frame_ref(rframe, frame)) < 0)
         return ret;
 
     *got_frame = 1;
diff --git a/libavcodec/m101.c b/libavcodec/m101.c
index 2c9e084ef1..a635b153f7 100644
--- a/libavcodec/m101.c
+++ b/libavcodec/m101.c
@@ -44,15 +44,14 @@ static av_cold int m101_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int m101_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                      AVPacket *avpkt)
+static int m101_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                             int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int stride, ret;
     int x, y;
     int min_stride = 2 * avctx->width;
     int bits = avctx->extradata[2*4];
-    AVFrame *frame = data;
 
     if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
         return ret;
diff --git a/libavcodec/mace.c b/libavcodec/mace.c
index bb96acfba3..b32890c578 100644
--- a/libavcodec/mace.c
+++ b/libavcodec/mace.c
@@ -234,10 +234,9 @@ static av_cold int mace_decode_init(AVCodecContext * avctx)
     return 0;
 }
 
-static int mace_decode_frame(AVCodecContext *avctx, void *data,
+static int mace_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     int channels = avctx->ch_layout.nb_channels;
diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c
index 2d698251cb..b99905f4ad 100644
--- a/libavcodec/magicyuv.c
+++ b/libavcodec/magicyuv.c
@@ -428,11 +428,10 @@ static int build_huffman(AVCodecContext *avctx, const uint8_t *table,
     return 0;
 }
 
-static int magy_decode_frame(AVCodecContext *avctx, void *data,
+static int magy_decode_frame(AVCodecContext *avctx, AVFrame *p,
                              int *got_frame, AVPacket *avpkt)
 {
     MagicYUVContext *s = avctx->priv_data;
-    AVFrame *p = data;
     GetByteContext gb;
     uint32_t first_offset, offset, next_offset, header_size, slice_width;
     int width, height, format, version, table_size;
diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
index 579fd59b00..24c0fc1adc 100644
--- a/libavcodec/mdec.c
+++ b/libavcodec/mdec.c
@@ -167,14 +167,12 @@ static inline void idct_put(MDECContext *a, AVFrame *frame, int mb_x, int mb_y)
     }
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
     MDECContext * const a = avctx->priv_data;
     const uint8_t *buf    = avpkt->data;
     int buf_size          = avpkt->size;
-    AVFrame *const frame  = data;
     int ret;
 
     if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0)
diff --git a/libavcodec/midivid.c b/libavcodec/midivid.c
index fa338c71ec..55fca27085 100644
--- a/libavcodec/midivid.c
+++ b/libavcodec/midivid.c
@@ -188,7 +188,7 @@ static ptrdiff_t lzss_uncompress(MidiVidContext *s, GetByteContext *gb, uint8_t
     return dst - dst_start;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
                         int *got_frame, AVPacket *avpkt)
 {
     MidiVidContext *s = avctx->priv_data;
@@ -224,7 +224,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
         return ret;
     key = ret;
 
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
 
     frame->pict_type = key ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c
index 377c84c4c2..05c193989b 100644
--- a/libavcodec/mimic.c
+++ b/libavcodec/mimic.c
@@ -339,7 +339,7 @@ static void flip_swap_frame(AVFrame *f)
         f->linesize[i] *= -1;
 }
 
-static int mimic_decode_frame(AVCodecContext *avctx, void *data,
+static int mimic_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
                               int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
@@ -425,11 +425,11 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
         return res;
     }
 
-    if ((res = av_frame_ref(data, ctx->frames[ctx->cur_index].f)) < 0)
+    if ((res = av_frame_ref(rframe, ctx->frames[ctx->cur_index].f)) < 0)
         return res;
     *got_frame      = 1;
 
-    flip_swap_frame(data);
+    flip_swap_frame(rframe);
 
     ctx->prev_index = ctx->next_prev_index;
     ctx->cur_index  = ctx->next_cur_index;
diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c
index e73ae1d35f..b04d61c0e0 100644
--- a/libavcodec/mjpegbdec.c
+++ b/libavcodec/mjpegbdec.c
@@ -40,9 +40,8 @@ static uint32_t read_offs(AVCodecContext *avctx, GetBitContext *gb, uint32_t siz
     return offs;
 }
 
-static int mjpegb_decode_frame(AVCodecContext *avctx,
-                              void *data, int *got_frame,
-                              AVPacket *avpkt)
+static int mjpegb_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                               int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
@@ -145,7 +144,7 @@ read_header:
         return buf_size;
     }
 
-    if ((ret = av_frame_ref(data, s->picture_ptr)) < 0)
+    if ((ret = av_frame_ref(rframe, s->picture_ptr)) < 0)
         return ret;
     *got_frame = 1;
 
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index 5a4d272f78..a3c1850d33 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -1164,7 +1164,7 @@ static int output_data(MLPDecodeContext *m, unsigned int substr,
  *  @return negative on error, 0 if not enough data is present in the input stream,
  *  otherwise the number of bytes consumed. */
 
-static int read_access_unit(AVCodecContext *avctx, void* data,
+static int read_access_unit(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame_ptr, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
@@ -1356,7 +1356,7 @@ skip_substr:
         buf += substream_data_len[substr];
     }
 
-    if ((ret = output_data(m, m->max_decoded_substream, data, got_frame_ptr)) < 0)
+    if ((ret = output_data(m, m->max_decoded_substream, frame, got_frame_ptr)) < 0)
         return ret;
 
     for (substr = 0; substr <= m->max_decoded_substream; substr++){
diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c
index fcc9602666..54ed5fad14 100644
--- a/libavcodec/mmvideo.c
+++ b/libavcodec/mmvideo.c
@@ -186,9 +186,8 @@ static int mm_decode_inter(MmContext * s, int half_horiz, int half_vert)
     return 0;
 }
 
-static int mm_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int mm_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                           int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
@@ -222,7 +221,7 @@ static int mm_decode_frame(AVCodecContext *avctx,
 
     memcpy(s->frame->data[1], s->palette, AVPALETTE_SIZE);
 
-    if ((res = av_frame_ref(data, s->frame)) < 0)
+    if ((res = av_frame_ref(rframe, s->frame)) < 0)
         return res;
 
     *got_frame      = 1;
diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
index 1f619d6a52..0b7230f326 100644
--- a/libavcodec/mobiclip.c
+++ b/libavcodec/mobiclip.c
@@ -1208,8 +1208,8 @@ static int predict_motion(AVCodecContext *avctx,
     return 0;
 }
 
-static int mobiclip_decode(AVCodecContext *avctx, void *data,
-                            int *got_frame, AVPacket *pkt)
+static int mobiclip_decode(AVCodecContext *avctx, AVFrame *rframe,
+                           int *got_frame, AVPacket *pkt)
 {
     MobiClipContext *s = avctx->priv_data;
     GetBitContext *gb = &s->gb;
@@ -1308,7 +1308,7 @@ static int mobiclip_decode(AVCodecContext *avctx, void *data,
         avctx->colorspace = AVCOL_SPC_YCGCO;
 
     s->current_pic = (s->current_pic + 1) % 6;
-    ret = av_frame_ref(data, frame);
+    ret = av_frame_ref(rframe, frame);
     if (ret < 0)
         return ret;
     *got_frame = 1;
diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c
index fcc848f59a..aeea4e6865 100644
--- a/libavcodec/motionpixels.c
+++ b/libavcodec/motionpixels.c
@@ -278,9 +278,8 @@ static void mp_decode_frame_helper(MotionPixelsContext *mp, GetBitContext *gb)
             mp_decode_line(mp, gb, y);
 }
 
-static int mp_decode_frame(AVCodecContext *avctx,
-                                 void *data, int *got_frame,
-                                 AVPacket *avpkt)
+static int mp_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                           int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
@@ -340,7 +339,7 @@ static int mp_decode_frame(AVCodecContext *avctx,
     ff_free_vlc(&mp->vlc);
 
 end:
-    if ((ret = av_frame_ref(data, mp->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, mp->frame)) < 0)
         return ret;
     *got_frame       = 1;
     return buf_size;
diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c
index 2fb0e38e77..5d8280ee2e 100644
--- a/libavcodec/mpc7.c
+++ b/libavcodec/mpc7.c
@@ -172,10 +172,9 @@ static int get_scale_idx(GetBitContext *gb, int ref)
     return ref + t;
 }
 
-static int mpc7_decode_frame(AVCodecContext * avctx, void *data,
+static int mpc7_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size;
     MPCContext *c = avctx->priv_data;
diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c
index 4c5b7fe23e..e876de4813 100644
--- a/libavcodec/mpc8.c
+++ b/libavcodec/mpc8.c
@@ -178,10 +178,9 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx)
     return 0;
 }
 
-static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
+static int mpc8_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     MPCContext *c = avctx->priv_data;
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 887b8036f8..599ee8dcb1 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2762,14 +2762,13 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture,
     }
 }
 
-static int mpeg_decode_frame(AVCodecContext *avctx, void *data,
+static int mpeg_decode_frame(AVCodecContext *avctx, AVFrame *picture,
                              int *got_output, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int ret;
     int buf_size = avpkt->size;
     Mpeg1Context *s = avctx->priv_data;
-    AVFrame *picture = data;
     MpegEncContext *s2 = &s->mpeg_enc_ctx;
 
     if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) {
@@ -2969,13 +2968,12 @@ typedef struct IPUContext {
     DECLARE_ALIGNED(32, int16_t, block)[6][64];
 } IPUContext;
 
-static int ipu_decode_frame(AVCodecContext *avctx, void *data,
+static int ipu_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame, AVPacket *avpkt)
 {
     IPUContext *s = avctx->priv_data;
     MpegEncContext *m = &s->m;
     GetBitContext *gb = &m->gb;
-    AVFrame * const frame = data;
     int ret;
 
     ret = ff_get_buffer(avctx, frame, 0);
diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c
index 77b4addaf5..a28cac9867 100644
--- a/libavcodec/mpegaudiodec_template.c
+++ b/libavcodec/mpegaudiodec_template.c
@@ -1548,8 +1548,8 @@ static int mp_decode_frame(MPADecodeContext *s, OUT_INT **samples,
     return nb_frames * 32 * sizeof(OUT_INT) * s->nb_channels;
 }
 
-static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame_ptr, AVPacket *avpkt)
 {
     const uint8_t *buf  = avpkt->data;
     int buf_size        = avpkt->size;
@@ -1596,7 +1596,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr,
         buf_size= s->frame_size;
     }
 
-    s->frame = data;
+    s->frame = frame;
 
     ret = mp_decode_frame(s, NULL, buf, buf_size);
     if (ret >= 0) {
@@ -1633,7 +1633,7 @@ static void flush(AVCodecContext *avctx)
 }
 
 #if CONFIG_MP3ADU_DECODER || CONFIG_MP3ADUFLOAT_DECODER
-static int decode_frame_adu(AVCodecContext *avctx, void *data,
+static int decode_frame_adu(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame_ptr, AVPacket *avpkt)
 {
     const uint8_t *buf  = avpkt->data;
@@ -1672,7 +1672,7 @@ static int decode_frame_adu(AVCodecContext *avctx, void *data,
 
     s->frame_size = len;
 
-    s->frame = data;
+    s->frame = frame;
 
     ret = mp_decode_frame(s, NULL, buf, buf_size);
     if (ret < 0) {
@@ -1813,10 +1813,9 @@ static void flush_mp3on4(AVCodecContext *avctx)
 }
 
 
-static int decode_frame_mp3on4(AVCodecContext *avctx, void *data,
+static int decode_frame_mp3on4(AVCodecContext *avctx, AVFrame *frame,
                                int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame         = data;
     const uint8_t *buf     = avpkt->data;
     int buf_size           = avpkt->size;
     MP3On4DecodeContext *s = avctx->priv_data;
diff --git a/libavcodec/mscc.c b/libavcodec/mscc.c
index a0cd18adab..e7f6015554 100644
--- a/libavcodec/mscc.c
+++ b/libavcodec/mscc.c
@@ -129,13 +129,11 @@ static int rle_uncompress(AVCodecContext *avctx, GetByteContext *gb, PutByteCont
     return AVERROR_INVALIDDATA;
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
     MSCCContext *s = avctx->priv_data;
     z_stream *const zstream = &s->zstream.zstream;
-    AVFrame *frame = data;
     uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     GetByteContext gb;
diff --git a/libavcodec/msp2dec.c b/libavcodec/msp2dec.c
index b0c772ce4f..99dcf7e9f9 100644
--- a/libavcodec/msp2dec.c
+++ b/libavcodec/msp2dec.c
@@ -29,13 +29,11 @@
 #include "codec_internal.h"
 #include "internal.h"
 
-static int msp2_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int msp2_decode_frame(AVCodecContext *avctx, AVFrame *p,
+                             int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
-    AVFrame *p         = data;
     int ret;
     unsigned int x, y, width = (avctx->width + 7) / 8;
     GetByteContext idx, gb;
diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c
index 2506fe1acd..49fd3c86e2 100644
--- a/libavcodec/msrle.c
+++ b/libavcodec/msrle.c
@@ -82,9 +82,8 @@ static av_cold int msrle_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int msrle_decode_frame(AVCodecContext *avctx,
-                              void *data, int *got_frame,
-                              AVPacket *avpkt)
+static int msrle_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                              int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
@@ -134,7 +133,7 @@ static int msrle_decode_frame(AVCodecContext *avctx,
         ff_msrle_decode(avctx, s->frame, avctx->bits_per_coded_sample, &s->gb);
     }
 
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
 
     *got_frame      = 1;
diff --git a/libavcodec/mss1.c b/libavcodec/mss1.c
index 6641bec89b..844a6bde9c 100644
--- a/libavcodec/mss1.c
+++ b/libavcodec/mss1.c
@@ -140,8 +140,8 @@ static int decode_pal(MSS12Context *ctx, ArithCoder *acoder)
     return !!ncol;
 }
 
-static int mss1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                             AVPacket *avpkt)
+static int mss1_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                             int *got_frame, AVPacket *avpkt)
 {
     MSS1Context *ctx = avctx->priv_data;
     MSS12Context *c = &ctx->ctx;
@@ -180,7 +180,7 @@ static int mss1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     memcpy(ctx->pic->data[1], c->pal, AVPALETTE_SIZE);
     ctx->pic->palette_has_changed = pal_changed;
 
-    if ((ret = av_frame_ref(data, ctx->pic)) < 0)
+    if ((ret = av_frame_ref(rframe, ctx->pic)) < 0)
         return ret;
 
     *got_frame      = 1;
diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c
index efe656d1f1..235149b906 100644
--- a/libavcodec/mss2.c
+++ b/libavcodec/mss2.c
@@ -472,14 +472,13 @@ struct Rectangle {
 #define MAX_WMV9_RECTANGLES 20
 #define ARITH2_PADDING 2
 
-static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                             AVPacket *avpkt)
+static int mss2_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                             int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     MSS2Context *ctx = avctx->priv_data;
     MSS12Context *c  = &ctx->c;
-    AVFrame *frame   = data;
     GetBitContext gb;
     GetByteContext gB;
     ArithCoder acoder;
diff --git a/libavcodec/mss3.c b/libavcodec/mss3.c
index 7b615e9b80..3e12ea0399 100644
--- a/libavcodec/mss3.c
+++ b/libavcodec/mss3.c
@@ -682,8 +682,8 @@ static av_cold void init_coders(MSS3Context *ctx)
     }
 }
 
-static int mss3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                             AVPacket *avpkt)
+static int mss3_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                             int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
@@ -743,7 +743,7 @@ static int mss3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     c->pic->key_frame = keyframe;
     c->pic->pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
     if (!bytestream2_get_bytes_left(&gb)) {
-        if ((ret = av_frame_ref(data, c->pic)) < 0)
+        if ((ret = av_frame_ref(rframe, c->pic)) < 0)
             return ret;
         *got_frame      = 1;
 
@@ -802,7 +802,7 @@ static int mss3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
         dst[2] += c->pic->linesize[2] * 8;
     }
 
-    if ((ret = av_frame_ref(data, c->pic)) < 0)
+    if ((ret = av_frame_ref(rframe, c->pic)) < 0)
         return ret;
 
     *got_frame      = 1;
diff --git a/libavcodec/mss4.c b/libavcodec/mss4.c
index 2d1953729d..c29d885077 100644
--- a/libavcodec/mss4.c
+++ b/libavcodec/mss4.c
@@ -444,8 +444,8 @@ static inline void mss4_update_dc_cache(MSS4Context *c, int mb_x)
     }
 }
 
-static int mss4_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                             AVPacket *avpkt)
+static int mss4_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                             int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
@@ -504,7 +504,7 @@ static int mss4_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
                                                    : AV_PICTURE_TYPE_P;
     if (frame_type == SKIP_FRAME) {
         *got_frame      = 1;
-        if ((ret = av_frame_ref(data, c->pic)) < 0)
+        if ((ret = av_frame_ref(rframe, c->pic)) < 0)
             return ret;
 
         return buf_size;
@@ -559,7 +559,7 @@ static int mss4_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
         dst[2] += c->pic->linesize[2] * 16;
     }
 
-    if ((ret = av_frame_ref(data, c->pic)) < 0)
+    if ((ret = av_frame_ref(rframe, c->pic)) < 0)
         return ret;
 
     *got_frame      = 1;
diff --git a/libavcodec/msvideo1.c b/libavcodec/msvideo1.c
index 416f3c5798..fa08e2cdfd 100644
--- a/libavcodec/msvideo1.c
+++ b/libavcodec/msvideo1.c
@@ -294,9 +294,8 @@ static void msvideo1_decode_16bit(Msvideo1Context *s)
     }
 }
 
-static int msvideo1_decode_frame(AVCodecContext *avctx,
-                                void *data, int *got_frame,
-                                AVPacket *avpkt)
+static int msvideo1_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                                 int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
@@ -324,7 +323,7 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
     else
         msvideo1_decode_16bit(s);
 
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
 
     *got_frame      = 1;
diff --git a/libavcodec/mv30.c b/libavcodec/mv30.c
index fd2acedbb2..75ed23d493 100644
--- a/libavcodec/mv30.c
+++ b/libavcodec/mv30.c
@@ -601,12 +601,11 @@ fail:
     return ret;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
                         int *got_frame, AVPacket *avpkt)
 {
     MV30Context *s = avctx->priv_data;
     GetBitContext *gb = &s->gb;
-    AVFrame *frame = data;
     int ret;
 
     if ((ret = init_get_bits8(gb, avpkt->data, avpkt->size)) < 0)
diff --git a/libavcodec/mvcdec.c b/libavcodec/mvcdec.c
index 7d69eaefae..2bef903bfa 100644
--- a/libavcodec/mvcdec.c
+++ b/libavcodec/mvcdec.c
@@ -225,11 +225,10 @@ static int decode_mvc2(AVCodecContext *avctx, GetByteContext *gb,
     return 0;
 }
 
-static int mvc_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int mvc_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                            int *got_frame, AVPacket *avpkt)
 {
     MvcContext *s = avctx->priv_data;
-    AVFrame *frame = data;
     GetByteContext gb;
     int ret;
 
diff --git a/libavcodec/mvha.c b/libavcodec/mvha.c
index c5b5ce0615..7c312d8562 100644
--- a/libavcodec/mvha.c
+++ b/libavcodec/mvha.c
@@ -148,12 +148,10 @@ static int build_vlc(AVCodecContext *avctx, VLC *vlc)
     return ff_init_vlc_sparse(vlc, 12, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0);
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
     MVHAContext *s = avctx->priv_data;
-    AVFrame *frame = data;
     uint32_t type, size;
     int ret;
 
diff --git a/libavcodec/mwsc.c b/libavcodec/mwsc.c
index 67fc5a03dd..82d149a295 100644
--- a/libavcodec/mwsc.c
+++ b/libavcodec/mwsc.c
@@ -87,13 +87,11 @@ static int rle_uncompress(GetByteContext *gb, PutByteContext *pb, GetByteContext
     return intra;
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
     MWSCContext *s = avctx->priv_data;
     z_stream *const zstream = &s->zstream.zstream;
-    AVFrame *frame = data;
     uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     GetByteContext gb;
diff --git a/libavcodec/mxpegdec.c b/libavcodec/mxpegdec.c
index 6fa650124b..19a4bfcd8b 100644
--- a/libavcodec/mxpegdec.c
+++ b/libavcodec/mxpegdec.c
@@ -180,9 +180,8 @@ static int mxpeg_check_dimensions(MXpegDecodeContext *s, MJpegDecodeContext *jpg
     return 0;
 }
 
-static int mxpeg_decode_frame(AVCodecContext *avctx,
-                          void *data, int *got_frame,
-                          AVPacket *avpkt)
+static int mxpeg_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                              int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
@@ -324,7 +323,7 @@ static int mxpeg_decode_frame(AVCodecContext *avctx,
 
 the_end:
     if (jpg->got_picture) {
-        int ret = av_frame_ref(data, jpg->picture_ptr);
+        int ret = av_frame_ref(rframe, jpg->picture_ptr);
         if (ret < 0)
             return ret;
         *got_frame = 1;
diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c
index dfd96da80b..1d51b989a5 100644
--- a/libavcodec/nellymoserdec.c
+++ b/libavcodec/nellymoserdec.c
@@ -139,10 +139,9 @@ static av_cold int decode_init(AVCodecContext * avctx) {
     return 0;
 }
 
-static int decode_tag(AVCodecContext *avctx, void *data,
+static int decode_tag(AVCodecContext *avctx, AVFrame *frame,
                       int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     NellyMoserDecodeContext *s = avctx->priv_data;
diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c
index f3c68905c7..36967a6f63 100644
--- a/libavcodec/notchlc.c
+++ b/libavcodec/notchlc.c
@@ -460,15 +460,13 @@ static int decode_blocks(AVCodecContext *avctx, AVFrame *p,
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *p,
+                        int *got_frame, AVPacket *avpkt)
 {
     NotchLCContext *s = avctx->priv_data;
     GetByteContext *gb = &s->gb;
     PutByteContext *pb = &s->pb;
     unsigned uncompressed_size;
-    AVFrame *p = data;
     int ret;
 
     if (avpkt->size <= 40)
diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index ab0279ebfc..2fdb023751 100644
--- a/libavcodec/nuv.c
+++ b/libavcodec/nuv.c
@@ -152,13 +152,12 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height,
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
+                        int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     NuvContext *c      = avctx->priv_data;
-    AVFrame *picture   = data;
     int orig_size      = buf_size;
     int keyframe, ret;
     int size_change = 0;
diff --git a/libavcodec/on2avc.c b/libavcodec/on2avc.c
index 79af3d9692..9ba4d764a0 100644
--- a/libavcodec/on2avc.c
+++ b/libavcodec/on2avc.c
@@ -839,10 +839,9 @@ static int on2avc_decode_subframe(On2AVCContext *c, const uint8_t *buf,
     return 0;
 }
 
-static int on2avc_decode_frame(AVCodecContext * avctx, void *data,
+static int on2avc_decode_frame(AVCodecContext * avctx, AVFrame *frame,
                                int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     On2AVCContext *c   = avctx->priv_data;
diff --git a/libavcodec/opusdec.c b/libavcodec/opusdec.c
index 8ad53c7cb3..ff7dd6c631 100644
--- a/libavcodec/opusdec.c
+++ b/libavcodec/opusdec.c
@@ -412,11 +412,10 @@ finish:
     return output_samples;
 }
 
-static int opus_decode_packet(AVCodecContext *avctx, void *data,
+static int opus_decode_packet(AVCodecContext *avctx, AVFrame *frame,
                               int *got_frame_ptr, AVPacket *avpkt)
 {
     OpusContext *c      = avctx->priv_data;
-    AVFrame *frame      = data;
     const uint8_t *buf  = avpkt->data;
     int buf_size        = avpkt->size;
     int coded_samples   = 0;
diff --git a/libavcodec/pafaudio.c b/libavcodec/pafaudio.c
index a71b0eb50a..6e8da3d3c4 100644
--- a/libavcodec/pafaudio.c
+++ b/libavcodec/pafaudio.c
@@ -42,10 +42,9 @@ static av_cold int paf_audio_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int paf_audio_decode(AVCodecContext *avctx, void *data,
+static int paf_audio_decode(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame, AVPacket *pkt)
 {
-    AVFrame *frame = data;
     int16_t *output_samples;
     const uint8_t *src = pkt->data;
     int frames, ret, i, j;
diff --git a/libavcodec/pafvideo.c b/libavcodec/pafvideo.c
index 68f6b9b4df..3199e7f44c 100644
--- a/libavcodec/pafvideo.c
+++ b/libavcodec/pafvideo.c
@@ -268,7 +268,7 @@ static int decode_0(PAFVideoDecContext *c, uint8_t *pkt, uint8_t code)
     return 0;
 }
 
-static int paf_video_decode(AVCodecContext *avctx, void *data,
+static int paf_video_decode(AVCodecContext *avctx, AVFrame *rframe,
                             int *got_frame, AVPacket *pkt)
 {
     PAFVideoDecContext *c = avctx->priv_data;
@@ -400,7 +400,7 @@ static int paf_video_decode(AVCodecContext *avctx, void *data,
                         c->width, c->height);
 
     c->current_frame = (c->current_frame + 1) & 3;
-    if ((ret = av_frame_ref(data, c->pic)) < 0)
+    if ((ret = av_frame_ref(rframe, c->pic)) < 0)
         return ret;
 
     *got_frame = 1;
diff --git a/libavcodec/pcm-bluray.c b/libavcodec/pcm-bluray.c
index 9493b10ecd..fb9d06a36f 100644
--- a/libavcodec/pcm-bluray.c
+++ b/libavcodec/pcm-bluray.c
@@ -122,10 +122,9 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx,
     return 0;
 }
 
-static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data,
+static int pcm_bluray_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                    int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *src = avpkt->data;
     int buf_size = avpkt->size;
     GetByteContext gb;
diff --git a/libavcodec/pcm-dvd.c b/libavcodec/pcm-dvd.c
index 6c11bb7792..f7a5ba6600 100644
--- a/libavcodec/pcm-dvd.c
+++ b/libavcodec/pcm-dvd.c
@@ -225,10 +225,9 @@ static void *pcm_dvd_decode_samples(AVCodecContext *avctx, const uint8_t *src,
     }
 }
 
-static int pcm_dvd_decode_frame(AVCodecContext *avctx, void *data,
+static int pcm_dvd_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                 int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *src = avpkt->data;
     int buf_size       = avpkt->size;
     PCMDVDContext *s   = avctx->priv_data;
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index aaccd86199..dfb10095c2 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -326,13 +326,12 @@ static av_cold int pcm_decode_init(AVCodecContext *avctx)
         }                                                                      \
     }
 
-static int pcm_decode_frame(AVCodecContext *avctx, void *data,
-                            int *got_frame_ptr, AVPacket *avpkt)
+static int pcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+            int *got_frame_ptr, AVPacket *avpkt)
 {
     const uint8_t *src = avpkt->data;
     int buf_size       = avpkt->size;
     PCMDecode *s       = avctx->priv_data;
-    AVFrame *frame     = data;
     int channels       = avctx->ch_layout.nb_channels;
     int sample_size, c, n, ret, samples_per_block;
     uint8_t *samples;
diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c
index 9c36e76343..2831f1bc3b 100644
--- a/libavcodec/pcx.c
+++ b/libavcodec/pcx.c
@@ -70,11 +70,10 @@ static void pcx_palette(GetByteContext *gb, uint32_t *dst, int pallen)
         memset(dst, 0, (256 - pallen) * sizeof(*dst));
 }
 
-static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int pcx_decode_frame(AVCodecContext *avctx, AVFrame *p,
+                            int *got_frame, AVPacket *avpkt)
 {
     GetByteContext gb;
-    AVFrame * const p  = data;
     int compressed, xmin, ymin, xmax, ymax;
     int ret;
     unsigned int w, h, bits_per_pixel, bytes_per_line, nplanes, stride, y, x,
diff --git a/libavcodec/pgxdec.c b/libavcodec/pgxdec.c
index 2dba42cafb..01cd484da2 100644
--- a/libavcodec/pgxdec.c
+++ b/libavcodec/pgxdec.c
@@ -117,10 +117,9 @@ error:
 WRITE_FRAME(8, int8_t, byte)
 WRITE_FRAME(16, int16_t, be16)
 
-static int pgx_decode_frame(AVCodecContext *avctx, void *data,
+static int pgx_decode_frame(AVCodecContext *avctx, AVFrame *p,
                             int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *p = data;
     int ret;
     int bpp;
     int width, height, depth;
diff --git a/libavcodec/photocd.c b/libavcodec/photocd.c
index a088ed0fa3..48dc1b88c4 100644
--- a/libavcodec/photocd.c
+++ b/libavcodec/photocd.c
@@ -290,13 +290,12 @@ static av_noinline int decode_huff(AVCodecContext *avctx, AVFrame *frame,
     return 0;
 }
 
-static int photocd_decode_frame(AVCodecContext *avctx, void *data,
+static int photocd_decode_frame(AVCodecContext *avctx, AVFrame *p,
                                 int *got_frame, AVPacket *avpkt)
 {
     PhotoCDContext *s = avctx->priv_data;
     const uint8_t *buf = avpkt->data;
     GetByteContext *gb = &s->gb;
-    AVFrame *p = data;
     uint8_t *ptr, *ptr1, *ptr2;
     int ret;
 
diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c
index 987212e8b7..3c32cbc4e6 100644
--- a/libavcodec/pictordec.c
+++ b/libavcodec/pictordec.c
@@ -119,12 +119,10 @@ static const uint8_t cga_mode45_index[6][4] = {
     [5] = { 0, 11, 12, 15 }, // mode5, high intensity
 };
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
     PicContext *s = avctx->priv_data;
-    AVFrame *frame = data;
     uint32_t *palette;
     int bits_per_plane, bpp, etype, esize, npal, pos_after_pal;
     int i, x, y, plane, tmp, ret, val;
diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c
index 9b61a8b1cd..12857919fe 100644
--- a/libavcodec/pixlet.c
+++ b/libavcodec/pixlet.c
@@ -601,12 +601,11 @@ static int decode_plane(AVCodecContext *avctx, int plane,
     return 0;
 }
 
-static int pixlet_decode_frame(AVCodecContext *avctx, void *data,
+static int pixlet_decode_frame(AVCodecContext *avctx, AVFrame *p,
                                int *got_frame, AVPacket *avpkt)
 {
     PixletContext *ctx = avctx->priv_data;
     int i, w, h, width, height, ret, version;
-    AVFrame *p = data;
     uint32_t pktsize, depth;
 
     bytestream2_init(&ctx->gb, avpkt->data, avpkt->size);
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 73fda21ca0..59302c898a 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1515,14 +1515,12 @@ fail:
 }
 
 #if CONFIG_PNG_DECODER
-static int decode_frame_png(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame_png(AVCodecContext *avctx, AVFrame *dst_frame,
+                            int *got_frame, AVPacket *avpkt)
 {
     PNGDecContext *const s = avctx->priv_data;
     const uint8_t *buf     = avpkt->data;
     int buf_size           = avpkt->size;
-    AVFrame     *dst_frame = data;
     AVFrame *p = s->picture.f;
     int64_t sig;
     int ret;
@@ -1576,12 +1574,10 @@ the_end:
 #endif
 
 #if CONFIG_APNG_DECODER
-static int decode_frame_apng(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame_apng(AVCodecContext *avctx, AVFrame *dst_frame,
+                             int *got_frame, AVPacket *avpkt)
 {
     PNGDecContext *const s = avctx->priv_data;
-    AVFrame     *dst_frame = data;
     int ret;
     AVFrame *p = s->picture.f;
 
diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c
index 5984b60999..a6f5d7c55d 100644
--- a/libavcodec/pnmdec.c
+++ b/libavcodec/pnmdec.c
@@ -39,13 +39,12 @@ static void samplecpy(uint8_t *dst, const uint8_t *src, int n, int maxval)
     }
 }
 
-static int pnm_decode_frame(AVCodecContext *avctx, void *data,
+static int pnm_decode_frame(AVCodecContext *avctx, AVFrame *p,
                             int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf   = avpkt->data;
     int buf_size         = avpkt->size;
     PNMContext * const s = avctx->priv_data;
-    AVFrame * const p    = data;
     int i, j, k, n, linesize, h, upgrade = 0, is_mono = 0;
     unsigned char *ptr;
     int components, sample_len, ret;
diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 020206ab22..46ca26150b 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -778,11 +778,10 @@ static int decode_picture(AVCodecContext *avctx)
     return ctx->slices[0].ret;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
     ProresContext *ctx = avctx->priv_data;
-    AVFrame *frame = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     int frame_hdr_size, pic_size, ret;
diff --git a/libavcodec/prosumer.c b/libavcodec/prosumer.c
index b890a42a32..db17cd5083 100644
--- a/libavcodec/prosumer.c
+++ b/libavcodec/prosumer.c
@@ -144,11 +144,10 @@ static void vertical_predict(uint32_t *dst, int offset, const uint32_t *src, int
     }
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
                         int *got_frame, AVPacket *avpkt)
 {
     ProSumerContext *s = avctx->priv_data;
-    AVFrame * const frame = data;
     int ret;
 
     if (avpkt->size <= 32)
diff --git a/libavcodec/psd.c b/libavcodec/psd.c
index 3496759c5b..da802a5585 100644
--- a/libavcodec/psd.c
+++ b/libavcodec/psd.c
@@ -289,7 +289,7 @@ static int decode_rle(PSDContext * s){
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
                         int *got_frame, AVPacket *avpkt)
 {
     int ret;
@@ -299,8 +299,6 @@ static int decode_frame(AVCodecContext *avctx, void *data,
     uint8_t eq_channel[4] = {2,0,1,3};/* RGBA -> GBRA channel order */
     uint8_t plane_number;
 
-    AVFrame *picture = data;
-
     PSDContext *s = avctx->priv_data;
     s->avctx     = avctx;
     s->channel_count = 0;
diff --git a/libavcodec/ptx.c b/libavcodec/ptx.c
index 5f00f7fbee..b782bf1db3 100644
--- a/libavcodec/ptx.c
+++ b/libavcodec/ptx.c
@@ -26,11 +26,11 @@
 #include "codec_internal.h"
 #include "internal.h"
 
-static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                            AVPacket *avpkt) {
+static int ptx_decode_frame(AVCodecContext *avctx, AVFrame *p,
+                            int *got_frame, AVPacket *avpkt)
+{
     const uint8_t *buf = avpkt->data;
     const uint8_t *buf_end = avpkt->data + avpkt->size;
-    AVFrame * const p = data;
     unsigned int offset, w, h, y, stride, bytes_per_pixel;
     int ret;
     uint8_t *ptr;
diff --git a/libavcodec/qcelpdec.c b/libavcodec/qcelpdec.c
index 2338ec240c..16ece70e63 100644
--- a/libavcodec/qcelpdec.c
+++ b/libavcodec/qcelpdec.c
@@ -684,13 +684,12 @@ static void postfilter(QCELPContext *q, float *samples, float *lpc)
                              160, 0.9375, &q->postfilter_agc_mem);
 }
 
-static int qcelp_decode_frame(AVCodecContext *avctx, void *data,
+static int qcelp_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                               int *got_frame_ptr, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     QCELPContext *q    = avctx->priv_data;
-    AVFrame *frame     = data;
     float *outbuffer;
     int   i, ret;
     float quantized_lspf[10], lpc[10];
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index b6a3a7be50..9d0b541964 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -1838,10 +1838,9 @@ static int qdm2_decode(QDM2Context *q, const uint8_t *in, int16_t *out)
     return 0;
 }
 
-static int qdm2_decode_frame(AVCodecContext *avctx, void *data,
+static int qdm2_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     QDM2Context *s = avctx->priv_data;
diff --git a/libavcodec/qdmc.c b/libavcodec/qdmc.c
index 44cb6e3b99..4ef4be19f5 100644
--- a/libavcodec/qdmc.c
+++ b/libavcodec/qdmc.c
@@ -696,11 +696,10 @@ static av_cold void qdmc_flush(AVCodecContext *avctx)
     s->buffer_offset = 0;
 }
 
-static int qdmc_decode_frame(AVCodecContext *avctx, void *data,
+static int qdmc_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
     QDMCContext *s = avctx->priv_data;
-    AVFrame *frame = data;
     GetBitContext gb;
     int ret;
 
diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c
index a4cda83096..bf67f8523d 100644
--- a/libavcodec/qdrw.c
+++ b/libavcodec/qdrw.c
@@ -288,11 +288,9 @@ static int check_header(const char *buf, int buf_size)
 }
 
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *p,
+                        int *got_frame, AVPacket *avpkt)
 {
-    AVFrame * const p      = data;
     GetByteContext gbc;
     int colors;
     int w, h, ret;
diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c
index 658cb028ea..0f33e87de1 100644
--- a/libavcodec/qpeg.c
+++ b/libavcodec/qpeg.c
@@ -266,13 +266,11 @@ static void av_noinline qpeg_decode_inter(QpegContext *qctx, uint8_t *dst,
     }
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *p,
+                        int *got_frame, AVPacket *avpkt)
 {
     uint8_t ctable[128];
     QpegContext * const a = avctx->priv_data;
-    AVFrame * const p = data;
     AVFrame * const ref = a->ref;
     uint8_t* outdata;
     int delta, intra, ret;
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 661f15bc75..08eda5bc26 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -910,11 +910,10 @@ fail:
     return ret;
 }
 
-static int qsv_decode_frame(AVCodecContext *avctx, void *data,
+static int qsv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame, AVPacket *avpkt)
 {
     QSVDecContext *s = avctx->priv_data;
-    AVFrame *frame    = data;
     int ret;
 
     /* buffer the input packet */
diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c
index 0e28884b9d..b7f114bdec 100644
--- a/libavcodec/qtrle.c
+++ b/libavcodec/qtrle.c
@@ -446,9 +446,8 @@ static av_cold int qtrle_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int qtrle_decode_frame(AVCodecContext *avctx,
-                              void *data, int *got_frame,
-                              AVPacket *avpkt)
+static int qtrle_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                              int *got_frame, AVPacket *avpkt)
 {
     QtrleContext *s = avctx->priv_data;
     int header, start_line;
@@ -558,7 +557,7 @@ done:
             return ret;
     }
 
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
     *got_frame      = 1;
 
diff --git a/libavcodec/r210dec.c b/libavcodec/r210dec.c
index cfe6401a21..da20ffe067 100644
--- a/libavcodec/r210dec.c
+++ b/libavcodec/r210dec.c
@@ -35,11 +35,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *pic,
+                        int *got_frame, AVPacket *avpkt)
 {
     int h, w, ret;
-    AVFrame *pic = data;
     const uint32_t *src = (const uint32_t *)avpkt->data;
     int aligned_width = FFALIGN(avctx->width,
                                 avctx->codec_id == AV_CODEC_ID_R10K ? 1 : 64);
diff --git a/libavcodec/ra144dec.c b/libavcodec/ra144dec.c
index b3683db549..b795e327a2 100644
--- a/libavcodec/ra144dec.c
+++ b/libavcodec/ra144dec.c
@@ -60,10 +60,9 @@ static void do_output_subblock(RA144Context *ractx, const int16_t  *lpc_coefs,
 }
 
 /** Uncompress one block (20 bytes -> 160*2 bytes). */
-static int ra144_decode_frame(AVCodecContext * avctx, void *data,
+static int ra144_decode_frame(AVCodecContext * avctx, AVFrame *frame,
                               int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     static const uint8_t sizes[LPC_ORDER] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2};
diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c
index ddf9331e39..f904d471a3 100644
--- a/libavcodec/ra288.c
+++ b/libavcodec/ra288.c
@@ -187,10 +187,9 @@ static void backward_filter(RA288Context *ractx,
     memmove(hist, hist + n, move_size*sizeof(*hist));
 }
 
-static int ra288_decode_frame(AVCodecContext * avctx, void *data,
+static int ra288_decode_frame(AVCodecContext * avctx, AVFrame *frame,
                               int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     float *out;
diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c
index 93970fd1ee..3887c29ee9 100644
--- a/libavcodec/ralf.c
+++ b/libavcodec/ralf.c
@@ -410,11 +410,10 @@ static int decode_block(AVCodecContext *avctx, GetBitContext *gb,
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame_ptr, AVPacket *avpkt)
 {
     RALFContext *ctx = avctx->priv_data;
-    AVFrame *frame   = data;
     int16_t *samples0;
     int16_t *samples1;
     int ret;
diff --git a/libavcodec/rasc.c b/libavcodec/rasc.c
index 8a4e2b7600..6966ada2d0 100644
--- a/libavcodec/rasc.c
+++ b/libavcodec/rasc.c
@@ -671,14 +671,12 @@ static void draw_cursor(AVCodecContext *avctx)
     }
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
     RASCContext *s = avctx->priv_data;
     GetByteContext *gb = &s->gb;
     int ret, intra = 0;
-    AVFrame *frame = data;
 
     bytestream2_init(gb, avpkt->data, avpkt->size);
 
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index b1c12a500b..7ed7492337 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -163,8 +163,8 @@ static void name(AVCodecContext *avctx, uint8_t * dst, const uint8_t *buf, int b
 MKSCALE16(scale16be, AV_RB16, AV_WB16)
 MKSCALE16(scale16le, AV_RL16, AV_WL16)
 
-static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
-                      AVPacket *avpkt)
+static int raw_decode(AVCodecContext *avctx, AVFrame *frame,
+                      int *got_frame, AVPacket *avpkt)
 {
     const AVPixFmtDescriptor *desc;
     RawVideoContext *context       = avctx->priv_data;
@@ -175,8 +175,6 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
     int res, len;
     int need_copy;
 
-    AVFrame   *frame   = data;
-
     if (avctx->width <= 0) {
         av_log(avctx, AV_LOG_ERROR, "width is not set\n");
         return AVERROR_INVALIDDATA;
diff --git a/libavcodec/rl2.c b/libavcodec/rl2.c
index b4548c0247..37c9bf5d82 100644
--- a/libavcodec/rl2.c
+++ b/libavcodec/rl2.c
@@ -178,11 +178,9 @@ static av_cold int rl2_decode_init(AVCodecContext *avctx)
 }
 
 
-static int rl2_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int rl2_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                            int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int ret, buf_size  = avpkt->size;
     Rl2Context *s = avctx->priv_data;
diff --git a/libavcodec/roqvideodec.c b/libavcodec/roqvideodec.c
index 7ce3dc8b59..99aa1ce24c 100644
--- a/libavcodec/roqvideodec.c
+++ b/libavcodec/roqvideodec.c
@@ -191,9 +191,8 @@ static av_cold int roq_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int roq_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int roq_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                            int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
@@ -214,7 +213,7 @@ static int roq_decode_frame(AVCodecContext *avctx,
     bytestream2_init(&gb, buf, buf_size);
     roqvideo_decode_frame(s, &gb);
 
-    if ((ret = av_frame_ref(data, s->current_frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->current_frame)) < 0)
         return ret;
     *got_frame      = 1;
 
diff --git a/libavcodec/rpza.c b/libavcodec/rpza.c
index e3989f7d9f..4482dfc8c8 100644
--- a/libavcodec/rpza.c
+++ b/libavcodec/rpza.c
@@ -256,9 +256,8 @@ static av_cold int rpza_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int rpza_decode_frame(AVCodecContext *avctx,
-                             void *data, int *got_frame,
-                             AVPacket *avpkt)
+static int rpza_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                             int *got_frame, AVPacket *avpkt)
 {
     RpzaContext *s = avctx->priv_data;
     int ret;
@@ -269,7 +268,7 @@ static int rpza_decode_frame(AVCodecContext *avctx,
     if (ret < 0)
         return ret;
 
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
 
     *got_frame      = 1;
diff --git a/libavcodec/rscc.c b/libavcodec/rscc.c
index bbbf14c6e6..3891cf24e4 100644
--- a/libavcodec/rscc.c
+++ b/libavcodec/rscc.c
@@ -148,13 +148,12 @@ static av_cold int rscc_close(AVCodecContext *avctx)
     return 0;
 }
 
-static int rscc_decode_frame(AVCodecContext *avctx, void *data,
-                                     int *got_frame, AVPacket *avpkt)
+static int rscc_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                             int *got_frame, AVPacket *avpkt)
 {
     RsccContext *ctx = avctx->priv_data;
     GetByteContext *gbc = &ctx->gbc;
     GetByteContext tiles_gbc;
-    AVFrame *frame = data;
     const uint8_t *pixels, *raw;
     uint8_t *inflated_tiles = NULL;
     int tiles_nb, packed_size, pixel_size = 0;
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index 23d0ea8516..8c2188bc05 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -593,13 +593,12 @@ static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n)
         return AV_RL32(buf + n * 8);
 }
 
-static int rv10_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                             AVPacket *avpkt)
+static int rv10_decode_frame(AVCodecContext *avctx, AVFrame *pict,
+                             int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     MpegEncContext *s = avctx->priv_data;
-    AVFrame *pict = data;
     int i, ret;
     int slice_count;
     const uint8_t *slices_hdr = NULL;
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index fb5b19c913..3494c0c579 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1596,15 +1596,13 @@ static AVRational update_sar(int old_w, int old_h, AVRational sar, int new_w, in
     return sar;
 }
 
-int ff_rv34_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_picture_ptr,
-                            AVPacket *avpkt)
+int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict,
+                         int *got_picture_ptr, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     RV34DecContext *r = avctx->priv_data;
     MpegEncContext *s = &r->s;
-    AVFrame *pict = data;
     SliceInfo si;
     int i, ret;
     int slice_count;
diff --git a/libavcodec/rv34.h b/libavcodec/rv34.h
index 53b29dc245..84789625ce 100644
--- a/libavcodec/rv34.h
+++ b/libavcodec/rv34.h
@@ -136,7 +136,8 @@ typedef struct RV34DecContext{
  */
 int ff_rv34_get_start_offset(GetBitContext *gb, int blocks);
 int ff_rv34_decode_init(AVCodecContext *avctx);
-int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt);
+int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                         int *got_frame, AVPacket *avpkt);
 int ff_rv34_decode_end(AVCodecContext *avctx);
 int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src);
 
diff --git a/libavcodec/s302m.c b/libavcodec/s302m.c
index d90549e487..68533be6c6 100644
--- a/libavcodec/s302m.c
+++ b/libavcodec/s302m.c
@@ -98,11 +98,10 @@ static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t *buf,
     return frame_size;
 }
 
-static int s302m_decode_frame(AVCodecContext *avctx, void *data,
+static int s302m_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                               int *got_frame_ptr, AVPacket *avpkt)
 {
     S302Context *s = avctx->priv_data;
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     int block_size, ret, channels;
diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index 7d8a45a298..b5e12fccc1 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -1387,13 +1387,13 @@ static int copy_output(SANMVideoContext *ctx, SANMFrameHeader *hdr)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
                         int *got_frame_ptr, AVPacket *pkt)
 {
     SANMVideoContext *ctx = avctx->priv_data;
     int i, ret;
 
-    ctx->frame = data;
+    ctx->frame = frame;
     bytestream2_init(&ctx->gb, pkt->data, pkt->size);
 
     if (!ctx->version) {
diff --git a/libavcodec/sbcdec.c b/libavcodec/sbcdec.c
index 53e5ce2583..6b79136fac 100644
--- a/libavcodec/sbcdec.c
+++ b/libavcodec/sbcdec.c
@@ -337,12 +337,10 @@ static int sbc_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int sbc_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame_ptr,
-                            AVPacket *avpkt)
+static int sbc_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                            int *got_frame_ptr, AVPacket *avpkt)
 {
     SBCDecContext *sbc = avctx->priv_data;
-    AVFrame *frame = data;
     int ret, frame_length;
 
     if (!sbc)
diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c
index 9e10c960b6..c744db2539 100644
--- a/libavcodec/scpr.c
+++ b/libavcodec/scpr.c
@@ -492,12 +492,11 @@ static int decompress_p(AVCodecContext *avctx,
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
     SCPRContext *s = avctx->priv_data;
     GetByteContext *gb = &s->gb;
-    AVFrame *frame = data;
     int ret, type;
 
     if (avctx->bits_per_coded_sample == 16) {
@@ -582,7 +581,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
         return AVERROR_INVALIDDATA;
 
     if (avctx->bits_per_coded_sample != 16) {
-        ret = av_frame_ref(data, s->current_frame);
+        ret = av_frame_ref(frame, s->current_frame);
         if (ret < 0)
             return ret;
     } else {
diff --git a/libavcodec/screenpresso.c b/libavcodec/screenpresso.c
index c51fd513c8..b2b71a00b3 100644
--- a/libavcodec/screenpresso.c
+++ b/libavcodec/screenpresso.c
@@ -102,11 +102,10 @@ static void sum_delta_flipped(uint8_t       *dst, int dst_linesize,
     }
 }
 
-static int screenpresso_decode_frame(AVCodecContext *avctx, void *data,
+static int screenpresso_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                      int *got_frame, AVPacket *avpkt)
 {
     ScreenpressoContext *ctx = avctx->priv_data;
-    AVFrame *frame = data;
     uLongf length = ctx->inflated_size;
     int keyframe, component_size, src_linesize;
     int ret;
diff --git a/libavcodec/sga.c b/libavcodec/sga.c
index 566a53ee75..cb6d8db3f4 100644
--- a/libavcodec/sga.c
+++ b/libavcodec/sga.c
@@ -306,12 +306,11 @@ static int decode_tiledata(AVCodecContext *avctx)
     return 0;
 }
 
-static int sga_decode_frame(AVCodecContext *avctx, void *data,
+static int sga_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame, AVPacket *avpkt)
 {
     SGAVideoContext *s = avctx->priv_data;
     GetByteContext *gb = &s->gb;
-    AVFrame *frame = data;
     int ret, type;
 
     if (avpkt->size <= 14)
diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c
index 8ff6b4f024..a0669590ed 100644
--- a/libavcodec/sgidec.c
+++ b/libavcodec/sgidec.c
@@ -199,12 +199,10 @@ static int read_uncompressed_sgi(unsigned char *out_buf, SgiState *s)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *p,
+                        int *got_frame, AVPacket *avpkt)
 {
     SgiState *s = avctx->priv_data;
-    AVFrame *p = data;
     unsigned int dimension, rle;
     int ret = 0;
     uint8_t *out_buf, *out_end;
diff --git a/libavcodec/sgirledec.c b/libavcodec/sgirledec.c
index fc3231a5b4..8e00fdf183 100644
--- a/libavcodec/sgirledec.c
+++ b/libavcodec/sgirledec.c
@@ -110,10 +110,9 @@ static int decode_sgirle8(AVCodecContext *avctx, uint8_t *dst,
     return 0;
 }
 
-static int sgirle_decode_frame(AVCodecContext *avctx, void *data,
+static int sgirle_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *frame = data;
     int ret;
 
     if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
diff --git a/libavcodec/sheervideo.c b/libavcodec/sheervideo.c
index 8ed48b1cee..ecde9e1637 100644
--- a/libavcodec/sheervideo.c
+++ b/libavcodec/sheervideo.c
@@ -1801,13 +1801,11 @@ static av_cold int build_vlc(VLC *vlc, const SheerTable *table)
                                     lens, sizeof(*lens), NULL, 0, 0, 0, 0, NULL);
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *p,
+                        int *got_frame, AVPacket *avpkt)
 {
     SheerVideoContext *s = avctx->priv_data;
     const SheerTable *table;
-    AVFrame *p = data;
     GetBitContext gb;
     unsigned format;
     int ret;
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index bbb955c177..96dec88191 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -522,10 +522,9 @@ end:
     return 0;
 }
 
-static int shorten_decode_frame(AVCodecContext *avctx, void *data,
+static int shorten_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                 int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     ShortenContext *s  = avctx->priv_data;
diff --git a/libavcodec/sipr.c b/libavcodec/sipr.c
index 67450c94a3..dde39f154a 100644
--- a/libavcodec/sipr.c
+++ b/libavcodec/sipr.c
@@ -520,11 +520,10 @@ static av_cold int sipr_decoder_init(AVCodecContext * avctx)
     return 0;
 }
 
-static int sipr_decode_frame(AVCodecContext *avctx, void *data,
+static int sipr_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
     SiprContext *ctx = avctx->priv_data;
-    AVFrame *frame   = data;
     const uint8_t *buf=avpkt->data;
     SiprParameters parm;
     const SiprModeParam *mode_par = &modes[ctx->mode];
diff --git a/libavcodec/siren.c b/libavcodec/siren.c
index 96907bfbf1..70e8267dad 100644
--- a/libavcodec/siren.c
+++ b/libavcodec/siren.c
@@ -703,12 +703,11 @@ static int decode_vector(SirenContext *s, int number_of_regions,
     return error == 1 ? AVERROR_INVALIDDATA : (get_bits_left(gb) - s->checksum_bits);
 }
 
-static int siren_decode(AVCodecContext *avctx, void *data,
+static int siren_decode(AVCodecContext *avctx, AVFrame *frame,
                         int *got_frame, AVPacket *avpkt)
 {
     SirenContext *s = avctx->priv_data;
     GetBitContext *gb = &s->gb;
-    AVFrame *frame = data;
     int ret, number_of_valid_coefs = REGION_SIZE * s->number_of_regions;
     int frame_error = 0, rate_control = 0;
     int bits_per_frame;
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index c1b94213c0..1ef2161dbb 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -371,8 +371,8 @@ static av_always_inline int smk_get_code(GetBitContext *gb, int *recode, int *la
     return v;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                        int *got_frame, AVPacket *avpkt)
 {
     SmackVContext * const smk = avctx->priv_data;
     uint8_t *out;
@@ -518,7 +518,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
 
     }
 
-    if ((ret = av_frame_ref(data, smk->pic)) < 0)
+    if ((ret = av_frame_ref(rframe, smk->pic)) < 0)
         return ret;
 
     *got_frame = 1;
@@ -588,10 +588,9 @@ static av_cold int smka_decode_init(AVCodecContext *avctx)
 /**
  * Decode Smacker audio data
  */
-static int smka_decode_frame(AVCodecContext *avctx, void *data,
+static int smka_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     GetBitContext gb;
diff --git a/libavcodec/smc.c b/libavcodec/smc.c
index 0a32773944..2f87937c49 100644
--- a/libavcodec/smc.c
+++ b/libavcodec/smc.c
@@ -428,9 +428,8 @@ static av_cold int smc_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int smc_decode_frame(AVCodecContext *avctx,
-                             void *data, int *got_frame,
-                             AVPacket *avpkt)
+static int smc_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                            int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
@@ -453,7 +452,7 @@ static int smc_decode_frame(AVCodecContext *avctx,
         return ret;
 
     *got_frame      = 1;
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
 
     /* always report that the buffer was completely consumed */
diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c
index d1e11cd5f6..4208707da0 100644
--- a/libavcodec/snowdec.c
+++ b/libavcodec/snowdec.c
@@ -436,15 +436,14 @@ static int decode_blocks(SnowContext *s){
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
+                        int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     SnowContext *s = avctx->priv_data;
     RangeCoder * const c= &s->c;
     int bytes_read;
-    AVFrame *picture = data;
     int level, orientation, plane_index;
     int res;
 
diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
index 264a5ff2b3..f20365485d 100644
--- a/libavcodec/sonic.c
+++ b/libavcodec/sonic.c
@@ -980,9 +980,8 @@ static av_cold int sonic_decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-static int sonic_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame_ptr,
-                            AVPacket *avpkt)
+static int sonic_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                              int *got_frame_ptr, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
@@ -991,7 +990,6 @@ static int sonic_decode_frame(AVCodecContext *avctx,
     uint8_t state[32];
     int i, quant, ch, j, ret;
     int16_t *samples;
-    AVFrame *frame = data;
 
     if (buf_size == 0) return 0;
 
diff --git a/libavcodec/speedhq.c b/libavcodec/speedhq.c
index 1e441862d9..fbe2d584d0 100644
--- a/libavcodec/speedhq.c
+++ b/libavcodec/speedhq.c
@@ -489,14 +489,12 @@ static void compute_quant_matrix(int *output, int qscale)
     for (i = 0; i < 64; i++) output[i] = unscaled_quant_matrix[ff_zigzag_direct[i]] * qscale;
 }
 
-static int speedhq_decode_frame(AVCodecContext *avctx,
-                                void *data, int *got_frame,
-                                AVPacket *avpkt)
+static int speedhq_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                                int *got_frame, AVPacket *avpkt)
 {
     SHQContext * const s = avctx->priv_data;
     const uint8_t *buf   = avpkt->data;
     int buf_size         = avpkt->size;
-    AVFrame *frame       = data;
     uint8_t quality;
     uint32_t second_field_offset;
     int ret;
diff --git a/libavcodec/speexdec.c b/libavcodec/speexdec.c
index 940f521686..28a6b67a66 100644
--- a/libavcodec/speexdec.c
+++ b/libavcodec/speexdec.c
@@ -1533,11 +1533,10 @@ static void speex_decode_stereo(float *data, int frame_size, StereoState *stereo
     }
 }
 
-static int speex_decode_frame(AVCodecContext *avctx, void *data,
+static int speex_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                               int *got_frame_ptr, AVPacket *avpkt)
 {
     SpeexContext *s = avctx->priv_data;
-    AVFrame *frame = data;
     const float scale = 1.f / 32768.f;
     int buf_size = avpkt->size;
     float *dst;
diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c
index d52a34df0f..65b4f359b2 100644
--- a/libavcodec/sunrast.c
+++ b/libavcodec/sunrast.c
@@ -27,12 +27,11 @@
 #include "internal.h"
 #include "sunrast.h"
 
-static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
+static int sunrast_decode_frame(AVCodecContext *avctx, AVFrame *p,
                                 int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf       = avpkt->data;
     const uint8_t *buf_end   = avpkt->data + avpkt->size;
-    AVFrame * const p        = data;
     unsigned int w, h, depth, type, maptype, maplength, stride, x, y, len, alen;
     uint8_t *ptr, *ptr2 = NULL;
     const uint8_t *bufstart = buf;
diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c
index a223cb4da3..e0a599bb36 100644
--- a/libavcodec/svq1dec.c
+++ b/libavcodec/svq1dec.c
@@ -617,13 +617,12 @@ static int svq1_decode_frame_header(AVCodecContext *avctx, AVFrame *frame)
     return 0;
 }
 
-static int svq1_decode_frame(AVCodecContext *avctx, void *data,
+static int svq1_decode_frame(AVCodecContext *avctx, AVFrame *cur,
                              int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     SVQ1Context     *s = avctx->priv_data;
-    AVFrame       *cur = data;
     uint8_t *current;
     int result, i, x, y, width, height;
     int ret;
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 7c2d5147b0..69949b7e63 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -1371,7 +1371,7 @@ fail:
     return ret;
 }
 
-static int svq3_decode_frame(AVCodecContext *avctx, void *data,
+static int svq3_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
                              int *got_frame, AVPacket *avpkt)
 {
     SVQ3Context *s     = avctx->priv_data;
@@ -1382,7 +1382,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
     /* special case for last picture */
     if (buf_size == 0) {
         if (s->next_pic->f->data[0] && !s->low_delay && !s->last_frame_output) {
-            ret = av_frame_ref(data, s->next_pic->f);
+            ret = av_frame_ref(rframe, s->next_pic->f);
             if (ret < 0)
                 return ret;
             s->last_frame_output = 1;
@@ -1553,9 +1553,9 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
     }
 
     if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay)
-        ret = av_frame_ref(data, s->cur_pic->f);
+        ret = av_frame_ref(rframe, s->cur_pic->f);
     else if (s->last_pic->f->data[0])
-        ret = av_frame_ref(data, s->last_pic->f);
+        ret = av_frame_ref(rframe, s->last_pic->f);
     if (ret < 0)
         return ret;
 
diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c
index 0ce08b564c..0ef42adc81 100644
--- a/libavcodec/takdec.c
+++ b/libavcodec/takdec.c
@@ -674,11 +674,10 @@ static int decorrelate(TAKDecContext *s, int c1, int c2, int length)
     return 0;
 }
 
-static int tak_decode_frame(AVCodecContext *avctx, void *data,
+static int tak_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame_ptr, AVPacket *pkt)
 {
     TAKDecContext *s  = avctx->priv_data;
-    AVFrame *frame    = data;
     GetBitContext *gb = &s->gb;
     int chan, i, ret, hsize;
 
diff --git a/libavcodec/targa.c b/libavcodec/targa.c
index a354bca06e..d6c46f8dce 100644
--- a/libavcodec/targa.c
+++ b/libavcodec/targa.c
@@ -107,12 +107,10 @@ static int targa_decode_rle(AVCodecContext *avctx, TargaContext *s,
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *p,
+                        int *got_frame, AVPacket *avpkt)
 {
     TargaContext * const s = avctx->priv_data;
-    AVFrame * const p = data;
     uint8_t *dst;
     int stride;
     int idlen, pal, compr, y, w, h, bpp, flags, ret;
diff --git a/libavcodec/targa_y216dec.c b/libavcodec/targa_y216dec.c
index 57c8211118..c6339ab92a 100644
--- a/libavcodec/targa_y216dec.c
+++ b/libavcodec/targa_y216dec.c
@@ -31,10 +31,9 @@ static av_cold int y216_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int y216_decode_frame(AVCodecContext *avctx, void *data,
+static int y216_decode_frame(AVCodecContext *avctx, AVFrame *pic,
                              int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *pic = data;
     const uint16_t *src = (uint16_t *)avpkt->data;
     uint16_t *y, *u, *v;
     int aligned_width = FFALIGN(avctx->width, 4);
diff --git a/libavcodec/tdsc.c b/libavcodec/tdsc.c
index d25a4d4dd0..701cd8b9ad 100644
--- a/libavcodec/tdsc.c
+++ b/libavcodec/tdsc.c
@@ -522,11 +522,10 @@ static int tdsc_parse_dtsm(AVCodecContext *avctx)
     return 0;
 }
 
-static int tdsc_decode_frame(AVCodecContext *avctx, void *data,
+static int tdsc_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame, AVPacket *avpkt)
 {
     TDSCContext *ctx = avctx->priv_data;
-    AVFrame *frame = data;
     int ret, tag_header, keyframe = 0;
     uLongf dlen;
 
diff --git a/libavcodec/tiertexseqv.c b/libavcodec/tiertexseqv.c
index d269fb96c9..06d9c39880 100644
--- a/libavcodec/tiertexseqv.c
+++ b/libavcodec/tiertexseqv.c
@@ -230,9 +230,8 @@ static av_cold int seqvideo_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int seqvideo_decode_frame(AVCodecContext *avctx,
-                                 void *data, int *got_frame,
-                                 AVPacket *avpkt)
+static int seqvideo_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                                 int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
@@ -246,7 +245,7 @@ static int seqvideo_decode_frame(AVCodecContext *avctx,
     if (seqvideo_decode(seq, buf, buf_size))
         return AVERROR_INVALIDDATA;
 
-    if ((ret = av_frame_ref(data, seq->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, seq->frame)) < 0)
         return ret;
     *got_frame       = 1;
 
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index fdd3ae5c68..3d5b3c28ac 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1740,11 +1740,10 @@ end:
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *p,
+                        int *got_frame, AVPacket *avpkt)
 {
     TiffContext *const s = avctx->priv_data;
-    AVFrame *const p = data;
     unsigned off, last_off;
     int le, ret, plane, planes;
     int i, j, entries, stride;
@@ -1940,7 +1939,7 @@ again:
             avpriv_report_missing_feature(avctx, "DNG JPG-compressed tiled non-bayer-encoded images");
             return AVERROR_PATCHWELCOME;
         } else {
-            if ((ret = dng_decode_tiles(avctx, (AVFrame*)data, avpkt)) > 0)
+            if ((ret = dng_decode_tiles(avctx, p, avpkt)) > 0)
                 *got_frame = 1;
             return ret;
         }
diff --git a/libavcodec/tmv.c b/libavcodec/tmv.c
index f4c7474136..263a63aa55 100644
--- a/libavcodec/tmv.c
+++ b/libavcodec/tmv.c
@@ -36,10 +36,9 @@
 
 #include "cga_data.h"
 
-static int tmv_decode_frame(AVCodecContext *avctx, void *data,
+static int tmv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *src = avpkt->data;
     uint8_t *dst;
     unsigned char_cols = avctx->width >> 3;
diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
index f8da11b6b3..7ef025b43e 100644
--- a/libavcodec/truemotion1.c
+++ b/libavcodec/truemotion1.c
@@ -869,9 +869,8 @@ static void truemotion1_decode_24bit(TrueMotion1Context *s)
 }
 
 
-static int truemotion1_decode_frame(AVCodecContext *avctx,
-                                    void *data, int *got_frame,
-                                    AVPacket *avpkt)
+static int truemotion1_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                                    int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int ret, buf_size = avpkt->size;
@@ -892,7 +891,7 @@ static int truemotion1_decode_frame(AVCodecContext *avctx,
         truemotion1_decode_16bit(s);
     }
 
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
 
     *got_frame      = 1;
diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index eff7d77e03..a89f999ce5 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -886,9 +886,8 @@ static const int tm2_stream_order[TM2_NUM_STREAMS] = {
 
 #define TM2_HEADER_SIZE 40
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                        int *got_frame, AVPacket *avpkt)
 {
     TM2Context * const l = avctx->priv_data;
     const uint8_t *buf   = avpkt->data;
@@ -939,7 +938,7 @@ static int decode_frame(AVCodecContext *avctx,
 
     l->cur = !l->cur;
     *got_frame      = 1;
-    ret = av_frame_ref(data, l->pic);
+    ret = av_frame_ref(rframe, l->pic);
 
     return (ret < 0) ? ret : buf_size;
 }
diff --git a/libavcodec/truemotion2rt.c b/libavcodec/truemotion2rt.c
index d2a78a35ef..0383cb090f 100644
--- a/libavcodec/truemotion2rt.c
+++ b/libavcodec/truemotion2rt.c
@@ -102,11 +102,10 @@ static int truemotion2rt_decode_header(AVCodecContext *avctx, const AVPacket *av
     return header_size;
 }
 
-static int truemotion2rt_decode_frame(AVCodecContext *avctx, void *data,
+static int truemotion2rt_decode_frame(AVCodecContext *avctx, AVFrame *p,
                                       int *got_frame, AVPacket *avpkt)
 {
     TrueMotion2RTContext *s = avctx->priv_data;
-    AVFrame * const p = data;
     GetBitContext *gb = &s->gb;
     uint8_t *dst;
     int x, y, delta_mode;
diff --git a/libavcodec/truespeech.c b/libavcodec/truespeech.c
index 1d0a8d3f1e..a8bf43d2a4 100644
--- a/libavcodec/truespeech.c
+++ b/libavcodec/truespeech.c
@@ -306,10 +306,9 @@ static void truespeech_save_prevvec(TSContext *c)
         c->prevfilt[i] = c->cvector[i];
 }
 
-static int truespeech_decode_frame(AVCodecContext *avctx, void *data,
+static int truespeech_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                    int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     TSContext *c = avctx->priv_data;
diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c
index 83db8b46ff..a841fd2c9d 100644
--- a/libavcodec/tscc.c
+++ b/libavcodec/tscc.c
@@ -64,8 +64,8 @@ typedef struct TsccContext {
     uint32_t pal[256];
 } CamtasiaContext;
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                        int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
@@ -114,7 +114,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
         memcpy(frame->data[1], c->pal, AVPALETTE_SIZE);
     }
 
-    if ((ret = av_frame_ref(data, frame)) < 0)
+    if ((ret = av_frame_ref(rframe, frame)) < 0)
         return ret;
     *got_frame      = 1;
 
diff --git a/libavcodec/tscc2.c b/libavcodec/tscc2.c
index 5ff15656ce..6879f42cd9 100644
--- a/libavcodec/tscc2.c
+++ b/libavcodec/tscc2.c
@@ -205,7 +205,7 @@ static int tscc2_decode_slice(TSCC2Context *c, int mb_y,
     return 0;
 }
 
-static int tscc2_decode_frame(AVCodecContext *avctx, void *data,
+static int tscc2_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
                               int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
@@ -313,7 +313,7 @@ static int tscc2_decode_frame(AVCodecContext *avctx, void *data,
     }
 
     *got_frame      = 1;
-    if ((ret = av_frame_ref(data, c->pic)) < 0)
+    if ((ret = av_frame_ref(rframe, c->pic)) < 0)
         return ret;
 
     /* always report that the buffer was completely consumed */
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index 7fa36a6926..506a61b881 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -224,10 +224,9 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
     return allocate_buffers(avctx);
 }
 
-static int tta_decode_frame(AVCodecContext *avctx, void *data,
+static int tta_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     TTAContext *s = avctx->priv_data;
diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c
index 77dfa31dc2..ba84c8c6b0 100644
--- a/libavcodec/twinvq.c
+++ b/libavcodec/twinvq.c
@@ -475,10 +475,9 @@ const enum TwinVQFrameType ff_twinvq_wtype_to_ftype_table[] = {
     TWINVQ_FT_MEDIUM
 };
 
-int ff_twinvq_decode_frame(AVCodecContext *avctx, void *data,
+int ff_twinvq_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                            int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     TwinVQContext *tctx = avctx->priv_data;
diff --git a/libavcodec/twinvq.h b/libavcodec/twinvq.h
index 5f49796f03..b3c881cfac 100644
--- a/libavcodec/twinvq.h
+++ b/libavcodec/twinvq.h
@@ -194,7 +194,7 @@ static inline float twinvq_mulawinv(float y, float clip, float mu)
     return clip * FFSIGN(y) * (exp(log(1 + mu) * fabs(y)) - 1) / mu;
 }
 
-int ff_twinvq_decode_frame(AVCodecContext *avctx, void *data,
+int ff_twinvq_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                            int *got_frame_ptr, AVPacket *avpkt);
 int ff_twinvq_decode_close(AVCodecContext *avctx);
 /** Requires the caller to call ff_twinvq_decode_close() upon failure. */
diff --git a/libavcodec/txd.c b/libavcodec/txd.c
index dec033182c..854ef1522d 100644
--- a/libavcodec/txd.c
+++ b/libavcodec/txd.c
@@ -32,11 +32,11 @@
 #define TXD_DXT1 0x31545844
 #define TXD_DXT3 0x33545844
 
-static int txd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                            AVPacket *avpkt) {
+static int txd_decode_frame(AVCodecContext *avctx, AVFrame *p,
+                            int *got_frame, AVPacket *avpkt)
+{
     GetByteContext gb;
     TextureDSPContext dxtc;
-    AVFrame * const p = data;
     unsigned int version, w, h, d3d_format, depth, stride, flags;
     unsigned int y, v;
     uint8_t *ptr;
diff --git a/libavcodec/ulti.c b/libavcodec/ulti.c
index fa689a1e89..c5be1dffda 100644
--- a/libavcodec/ulti.c
+++ b/libavcodec/ulti.c
@@ -214,9 +214,8 @@ static void ulti_grad(AVFrame *frame, int x, int y, uint8_t *Y, int chroma, int
     ulti_convert_yuv(frame, x, y, Luma, chroma);
 }
 
-static int ulti_decode_frame(AVCodecContext *avctx,
-                             void *data, int *got_frame,
-                             AVPacket *avpkt)
+static int ulti_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                             int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
@@ -408,7 +407,7 @@ static int ulti_decode_frame(AVCodecContext *avctx,
     }
 
     *got_frame = 1;
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
 
     return buf_size;
diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 4d41da4543..051f90c9db 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -557,13 +557,12 @@ static void restore_gradient_planar_il(UtvideoContext *c, uint8_t *src, ptrdiff_
     }
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     UtvideoContext *c = avctx->priv_data;
-    AVFrame *const frame = data;
     int i, j;
     const uint8_t *plane_start[5];
     int plane_size, max_slice_size = 0, slice_start, slice_end, slice_size;
diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c
index 47af2e6655..f208a0786f 100644
--- a/libavcodec/v210dec.c
+++ b/libavcodec/v210dec.c
@@ -136,13 +136,12 @@ static int v210_decode_slice(AVCodecContext *avctx, void *arg, int jobnr, int th
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *pic,
+                        int *got_frame, AVPacket *avpkt)
 {
     V210DecContext *s = avctx->priv_data;
     ThreadData td;
     int ret, stride, aligned_input;
-    AVFrame *pic = data;
     const uint8_t *psrc = avpkt->data;
 
     if (s->custom_stride )
diff --git a/libavcodec/v210x.c b/libavcodec/v210x.c
index 7273694ed8..34eb54e447 100644
--- a/libavcodec/v210x.c
+++ b/libavcodec/v210x.c
@@ -36,11 +36,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *pic,
+                        int *got_frame, AVPacket *avpkt)
 {
     const uint32_t *src = (const uint32_t *)avpkt->data;
-    AVFrame *pic        = data;
     int width           = avctx->width;
     int y               = 0;
     uint16_t *ydst, *udst, *vdst, *yend;
diff --git a/libavcodec/v308dec.c b/libavcodec/v308dec.c
index 99b92cc227..6c85bc585d 100644
--- a/libavcodec/v308dec.c
+++ b/libavcodec/v308dec.c
@@ -33,10 +33,9 @@ static av_cold int v308_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int v308_decode_frame(AVCodecContext *avctx, void *data,
+static int v308_decode_frame(AVCodecContext *avctx, AVFrame *pic,
                              int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *pic = data;
     const uint8_t *src = avpkt->data;
     uint8_t *y, *u, *v;
     int i, j, ret;
diff --git a/libavcodec/v408dec.c b/libavcodec/v408dec.c
index cbddc723de..32ea98b724 100644
--- a/libavcodec/v408dec.c
+++ b/libavcodec/v408dec.c
@@ -32,10 +32,9 @@ static av_cold int v408_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int v408_decode_frame(AVCodecContext *avctx, void *data,
+static int v408_decode_frame(AVCodecContext *avctx, AVFrame *pic,
                              int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *pic = data;
     const uint8_t *src = avpkt->data;
     uint8_t *y, *u, *v, *a;
     int i, j, ret;
diff --git a/libavcodec/v410dec.c b/libavcodec/v410dec.c
index a91a3384e6..bb1dd5d0c6 100644
--- a/libavcodec/v410dec.c
+++ b/libavcodec/v410dec.c
@@ -85,11 +85,10 @@ static int v410_decode_slice(AVCodecContext *avctx, void *arg, int jobnr, int th
     return 0;
 }
 
-static int v410_decode_frame(AVCodecContext *avctx, void *data,
+static int v410_decode_frame(AVCodecContext *avctx, AVFrame *pic,
                              int *got_frame, AVPacket *avpkt)
 {
     ThreadData td;
-    AVFrame *pic = data;
     uint8_t *src = avpkt->data;
     int ret;
     int thread_count = av_clip(avctx->thread_count, 1, avctx->height/4);
diff --git a/libavcodec/vb.c b/libavcodec/vb.c
index 362221982e..1a05bd949f 100644
--- a/libavcodec/vb.c
+++ b/libavcodec/vb.c
@@ -189,11 +189,10 @@ static int vb_decode_framedata(VBDecContext *c, int offset)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
     VBDecContext * const c = avctx->priv_data;
-    AVFrame *frame         = data;
     uint8_t *outptr, *srcptr;
     int i, j, ret;
     int flags;
diff --git a/libavcodec/vble.c b/libavcodec/vble.c
index a7646cedcf..85b1fec855 100644
--- a/libavcodec/vble.c
+++ b/libavcodec/vble.c
@@ -114,11 +114,10 @@ static void vble_restore_plane(VBLEContext *ctx, AVFrame *pic,
     }
 }
 
-static int vble_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                             AVPacket *avpkt)
+static int vble_decode_frame(AVCodecContext *avctx, AVFrame *pic,
+                             int *got_frame, AVPacket *avpkt)
 {
     VBLEContext *ctx = avctx->priv_data;
-    AVFrame *pic     = data;
     GetBitContext gb;
     const uint8_t *src = avpkt->data;
     int version;
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index e279ffd1c1..0f5a07ff33 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -623,14 +623,13 @@ av_cold int ff_vc1_decode_end(AVCodecContext *avctx)
 /** Decode a VC1/WMV3 frame
  * @todo TODO: Handle VC-1 IDUs (Transport level?)
  */
-static int vc1_decode_frame(AVCodecContext *avctx, void *data,
+static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict,
                             int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size, n_slices = 0, i, ret;
     VC1Context *v = avctx->priv_data;
     MpegEncContext *s = &v->s;
-    AVFrame *pict = data;
     uint8_t *buf2 = NULL;
     const uint8_t *buf_start = buf, *buf_start_second_field = NULL;
     int mb_height, n_slices1=-1;
diff --git a/libavcodec/vcr1.c b/libavcodec/vcr1.c
index 17a1f9b710..d062700259 100644
--- a/libavcodec/vcr1.c
+++ b/libavcodec/vcr1.c
@@ -47,11 +47,10 @@ static av_cold int vcr1_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int vcr1_decode_frame(AVCodecContext *avctx, void *data,
+static int vcr1_decode_frame(AVCodecContext *avctx, AVFrame *p,
                              int *got_frame, AVPacket *avpkt)
 {
     VCR1Context *const a      = avctx->priv_data;
-    AVFrame *const p          = data;
     const uint8_t *bytestream = avpkt->data;
     const uint8_t *bytestream_end = bytestream + avpkt->size;
     int i, x, y, ret;
diff --git a/libavcodec/vima.c b/libavcodec/vima.c
index 9ca4406802..e429855245 100644
--- a/libavcodec/vima.c
+++ b/libavcodec/vima.c
@@ -117,11 +117,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data,
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
                         int *got_frame_ptr, AVPacket *pkt)
 {
     GetBitContext gb;
-    AVFrame *frame = data;
     int16_t pcm_data[2];
     uint32_t samples;
     int8_t channel_hint[2];
diff --git a/libavcodec/vmdaudio.c b/libavcodec/vmdaudio.c
index 875930061a..b81e5b0ced 100644
--- a/libavcodec/vmdaudio.c
+++ b/libavcodec/vmdaudio.c
@@ -132,10 +132,9 @@ static void decode_audio_s16(int16_t *out, const uint8_t *buf, int buf_size,
     }
 }
 
-static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data,
+static int vmdaudio_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                  int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     const uint8_t *buf_end;
     int buf_size = avpkt->size;
diff --git a/libavcodec/vmdvideo.c b/libavcodec/vmdvideo.c
index 1d39b6a4d8..fd48dc3255 100644
--- a/libavcodec/vmdvideo.c
+++ b/libavcodec/vmdvideo.c
@@ -430,14 +430,12 @@ static av_cold int vmdvideo_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int vmdvideo_decode_frame(AVCodecContext *avctx,
-                                 void *data, int *got_frame,
-                                 AVPacket *avpkt)
+static int vmdvideo_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                                 int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     VmdVideoContext *s = avctx->priv_data;
-    AVFrame *frame = data;
     int ret;
 
     s->buf = buf;
diff --git a/libavcodec/vmnc.c b/libavcodec/vmnc.c
index b6884b7aa6..e7db38e85c 100644
--- a/libavcodec/vmnc.c
+++ b/libavcodec/vmnc.c
@@ -324,8 +324,8 @@ static void reset_buffers(VmncContext *c)
 
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                        int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
@@ -518,7 +518,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
         }
     }
     *got_frame = 1;
-    if ((ret = av_frame_ref(data, c->pic)) < 0)
+    if ((ret = av_frame_ref(rframe, c->pic)) < 0)
         return ret;
 
     /* always report that the buffer was completely consumed */
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index e83a83f641..433fbfc6f9 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -1767,13 +1767,12 @@ static int vorbis_parse_audio_packet(vorbis_context *vc, float **floor_ptr)
 
 // Return the decoded audio packet through the standard api
 
-static int vorbis_decode_frame(AVCodecContext *avctx, void *data,
+static int vorbis_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                int *got_frame_ptr, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     vorbis_context *vc = avctx->priv_data;
-    AVFrame *frame     = data;
     GetBitContext *gb = &vc->gb;
     float *channel_ptrs[255];
     int i, len, ret;
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index d493b331ef..528029203d 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2586,11 +2586,9 @@ static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext *
 }
 #endif
 
-static int vp3_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int vp3_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                            int *got_frame, AVPacket *avpkt)
 {
-    AVFrame     *frame  = data;
     const uint8_t *buf  = avpkt->data;
     int buf_size        = avpkt->size;
     Vp3DecodeContext *s = avctx->priv_data;
@@ -2818,7 +2816,7 @@ static int vp3_decode_frame(AVCodecContext *avctx,
     vp3_draw_horiz_band(s, s->height);
 
     /* output frame, offset as needed */
-    if ((ret = av_frame_ref(data, s->current_frame.f)) < 0)
+    if ((ret = av_frame_ref(frame, s->current_frame.f)) < 0)
         return ret;
 
     frame->crop_left   = s->offset_x;
diff --git a/libavcodec/vp56.c b/libavcodec/vp56.c
index 9819393447..a2efca1c9c 100644
--- a/libavcodec/vp56.c
+++ b/libavcodec/vp56.c
@@ -565,8 +565,8 @@ static int vp56_size_changed(VP56Context *s)
 
 static int ff_vp56_decode_mbs(AVCodecContext *avctx, void *, int, int);
 
-int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                         AVPacket *avpkt)
+int ff_vp56_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                         int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     VP56Context *s = avctx->priv_data;
@@ -649,7 +649,7 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     if (s->discard_frame)
         return AVERROR_INVALIDDATA;
 
-    if ((res = av_frame_ref(data, p)) < 0)
+    if ((res = av_frame_ref(rframe, p)) < 0)
         return res;
     *got_frame = 1;
 
diff --git a/libavcodec/vp56.h b/libavcodec/vp56.h
index e0dfaa8981..d2e6ad3ed0 100644
--- a/libavcodec/vp56.h
+++ b/libavcodec/vp56.h
@@ -224,8 +224,8 @@ int ff_vp56_init_context(AVCodecContext *avctx, VP56Context *s,
                           int flip, int has_alpha);
 int ff_vp56_free_context(VP56Context *s);
 void ff_vp56_init_dequant(VP56Context *s, int quantizer);
-int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                         AVPacket *avpkt);
+int ff_vp56_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                         int *got_frame, AVPacket *avpkt);
 
 
 /**
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 2e7ca63236..acb61ceede 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -2625,7 +2625,7 @@ static int vp8_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata,
 }
 
 static av_always_inline
-int vp78_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+int vp78_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame,
                       const AVPacket *avpkt, int is_vp7)
 {
     VP8Context *s = avctx->priv_data;
@@ -2800,7 +2800,7 @@ skip_decode:
         s->prob[0] = s->prob[1];
 
     if (!s->invisible) {
-        if ((ret = av_frame_ref(data, curframe->tf.f)) < 0)
+        if ((ret = av_frame_ref(rframe, curframe->tf.f)) < 0)
             return ret;
         *got_frame = 1;
     }
@@ -2811,17 +2811,17 @@ err:
     return ret;
 }
 
-int ff_vp8_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt)
+int ff_vp8_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
-    return vp78_decode_frame(avctx, data, got_frame, avpkt, IS_VP8);
+    return vp78_decode_frame(avctx, frame, got_frame, avpkt, IS_VP8);
 }
 
 #if CONFIG_VP7_DECODER
-static int vp7_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int vp7_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                            int *got_frame, AVPacket *avpkt)
 {
-    return vp78_decode_frame(avctx, data, got_frame, avpkt, IS_VP7);
+    return vp78_decode_frame(avctx, frame, got_frame, avpkt, IS_VP7);
 }
 #endif /* CONFIG_VP7_DECODER */
 
diff --git a/libavcodec/vp8.h b/libavcodec/vp8.h
index fc2662bf0d..8fe45573ed 100644
--- a/libavcodec/vp8.h
+++ b/libavcodec/vp8.h
@@ -344,8 +344,8 @@ typedef struct VP8Context {
 
 int ff_vp8_decode_init(AVCodecContext *avctx);
 
-int ff_vp8_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                        AVPacket *avpkt);
+int ff_vp8_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt);
 
 int ff_vp8_decode_free(AVCodecContext *avctx);
 
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 1b822c4592..8f2c52da87 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -1550,7 +1550,7 @@ static int vp9_export_enc_params(VP9Context *s, VP9Frame *frame)
     return 0;
 }
 
-static int vp9_decode_frame(AVCodecContext *avctx, void *frame,
+static int vp9_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame, AVPacket *pkt)
 {
     const uint8_t *data = pkt->data;
@@ -1570,8 +1570,8 @@ static int vp9_decode_frame(AVCodecContext *avctx, void *frame,
         }
         if ((ret = av_frame_ref(frame, s->s.refs[ref].f)) < 0)
             return ret;
-        ((AVFrame *)frame)->pts = pkt->pts;
-        ((AVFrame *)frame)->pkt_dts = pkt->dts;
+        frame->pts     = pkt->pts;
+        frame->pkt_dts = pkt->dts;
         for (i = 0; i < 8; i++) {
             if (s->next_refs[i].f->buf[0])
                 ff_thread_release_ext_buffer(avctx, &s->next_refs[i]);
diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c
index 4a25a5cd07..e8555e2570 100644
--- a/libavcodec/vqavideo.c
+++ b/libavcodec/vqavideo.c
@@ -794,9 +794,8 @@ static int vqa_decode_frame_hicolor(VqaContext *s, AVFrame *frame)
     return 0;
 }
 
-static int vqa_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int vqa_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                            int *got_frame, AVPacket *avpkt)
 {
     VqaContext *s = avctx->priv_data;
     int res;
@@ -821,7 +820,7 @@ static int vqa_decode_frame(AVCodecContext *avctx,
         return AVERROR_BUG;
     }
 
-    if ((res = av_frame_ref(data, s->frame)) < 0)
+    if ((res = av_frame_ref(rframe, s->frame)) < 0)
         return res;
 
     *got_frame      = 1;
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index e0ba525893..8bb03e5b4f 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -1627,7 +1627,7 @@ static int dsd_channel(AVCodecContext *avctx, void *frmptr, int jobnr, int threa
     return 0;
 }
 
-static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
+static int wavpack_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
                                 int *got_frame_ptr, AVPacket *avpkt)
 {
     WavpackContext *s  = avctx->priv_data;
@@ -1685,7 +1685,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
 
     ff_thread_report_progress(&s->curr_frame, INT_MAX, 0);
 
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
 
     *got_frame_ptr = 1;
diff --git a/libavcodec/wcmv.c b/libavcodec/wcmv.c
index 99584b9da2..8dfc1363a5 100644
--- a/libavcodec/wcmv.c
+++ b/libavcodec/wcmv.c
@@ -41,13 +41,11 @@ typedef struct WCMVContext {
     uint8_t     block_data[65536*8];
 } WCMVContext;
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
     WCMVContext *s = avctx->priv_data;
     z_stream *const zstream = &s->zstream.zstream;
-    AVFrame *frame = data;
     int skip, blocks, zret, ret, intra = 0, flags = 0, bpp = s->bpp;
     GetByteContext gb;
     uint8_t *dst;
diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index 696868f854..a0b51ac1e7 100644
--- a/libavcodec/webp.c
+++ b/libavcodec/webp.c
@@ -1334,10 +1334,9 @@ static int vp8_lossy_decode_frame(AVCodecContext *avctx, AVFrame *p,
     return ret;
 }
 
-static int webp_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                             AVPacket *avpkt)
+static int webp_decode_frame(AVCodecContext *avctx, AVFrame *p,
+                             int *got_frame, AVPacket *avpkt)
 {
-    AVFrame * const p = data;
     WebPContext *s = avctx->priv_data;
     GetByteContext gb;
     int ret;
@@ -1480,7 +1479,7 @@ static int webp_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
                 goto exif_end;
             }
 
-            av_dict_copy(&((AVFrame *) data)->metadata, exif_metadata, 0);
+            av_dict_copy(&p->metadata, exif_metadata, 0);
 
 exif_end:
             av_dict_free(&exif_metadata);
diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
index 24542ffced..945fd8c843 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -820,10 +820,9 @@ static int wma_decode_frame(WMACodecContext *s, float **samples,
     return 0;
 }
 
-static int wma_decode_superframe(AVCodecContext *avctx, void *data,
+static int wma_decode_superframe(AVCodecContext *avctx, AVFrame *frame,
                                  int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame = data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     WMACodecContext *s = avctx->priv_data;
@@ -974,9 +973,9 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
         samples_offset += s->frame_len;
     }
 
-    ff_dlog(s->avctx, "%d %d %d %d outbytes:%"PTRDIFF_SPECIFIER" eaten:%d\n",
+    ff_dlog(s->avctx, "%d %d %d %d eaten:%d\n",
             s->frame_len_bits, s->block_len_bits, s->frame_len, s->block_len,
-            (int8_t *) samples - (int8_t *) data, avctx->block_align);
+            avctx->block_align);
 
     *got_frame_ptr = 1;
 
diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index d4f3462804..daa775314d 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -1184,8 +1184,8 @@ static void save_bits(WmallDecodeCtx *s, GetBitContext* gb, int len,
     skip_bits(&s->gb, s->frame_offset);
 }
 
-static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr,
-                         AVPacket* avpkt)
+static int decode_packet(AVCodecContext *avctx, AVFrame *rframe,
+                         int *got_frame_ptr, AVPacket* avpkt)
 {
     WmallDecodeCtx *s = avctx->priv_data;
     GetBitContext* gb  = &s->pgb;
@@ -1298,7 +1298,7 @@ static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr,
     }
 
     *got_frame_ptr   = s->frame->nb_samples > 0;
-    av_frame_move_ref(data, s->frame);
+    av_frame_move_ref(rframe, s->frame);
 
     s->packet_offset = get_bits_count(gb) & 7;
 
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 8e1675dc78..245241aa50 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -1610,7 +1610,7 @@ static void save_bits(WMAProDecodeCtx *s, GetBitContext* gb, int len,
 }
 
 static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s,
-                         void *data, int *got_frame_ptr, AVPacket *avpkt)
+                         AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
 {
     GetBitContext* gb  = &s->pgb;
     const uint8_t* buf = avpkt->data;
@@ -1622,7 +1622,6 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s,
     *got_frame_ptr = 0;
 
     if (!buf_size) {
-        AVFrame *frame = data;
         int i;
 
         /** Must output remaining samples after stream end. WMAPRO 5.1 created
@@ -1714,7 +1713,7 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s,
 
             /** decode the cross packet frame if it is valid */
             if (!s->packet_loss)
-                decode_frame(s, data, got_frame_ptr);
+                decode_frame(s, frame, got_frame_ptr);
         } else if (s->num_saved_bits - s->frame_offset) {
             ff_dlog(avctx, "ignoring %x previously saved bits\n",
                     s->num_saved_bits - s->frame_offset);
@@ -1745,7 +1744,7 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s,
             frame_size <= remaining_bits(s, gb)) {
             save_bits(s, gb, frame_size, 0);
             if (!s->packet_loss)
-                s->packet_done = !decode_frame(s, data, got_frame_ptr);
+                s->packet_done = !decode_frame(s, frame, got_frame_ptr);
         } else if (!s->len_prefix
                    && s->num_saved_bits > get_bits_count(&s->gb)) {
             /** when the frames do not have a length prefix, we don't know
@@ -1755,7 +1754,7 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s,
                 therefore we save the incoming packet first, then we append
                 the "previous frame" data from the next packet so that
                 we get a buffer that only contains full frames */
-            s->packet_done = !decode_frame(s, data, got_frame_ptr);
+            s->packet_done = !decode_frame(s, frame, got_frame_ptr);
         } else {
             s->packet_done = 1;
         }
@@ -1778,8 +1777,6 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s,
         return AVERROR_INVALIDDATA;
 
     if (s->trim_start && avctx->codec_id == AV_CODEC_ID_WMAPRO) {
-        AVFrame *frame = data;
-
         if (s->trim_start < frame->nb_samples) {
             for (int ch = 0; ch < frame->ch_layout.nb_channels; ch++)
                 frame->extended_data[ch] += s->trim_start * 4;
@@ -1793,8 +1790,6 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s,
     }
 
     if (s->trim_end && avctx->codec_id == AV_CODEC_ID_WMAPRO) {
-        AVFrame *frame = data;
-
         if (s->trim_end < frame->nb_samples) {
             frame->nb_samples -= s->trim_end;
         } else {
@@ -1814,11 +1809,10 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s,
  *@param avpkt input packet
  *@return number of bytes that were read from the input buffer
  */
-static int wmapro_decode_packet(AVCodecContext *avctx, void *data,
+static int wmapro_decode_packet(AVCodecContext *avctx, AVFrame *frame,
                                 int *got_frame_ptr, AVPacket *avpkt)
 {
     WMAProDecodeCtx *s = avctx->priv_data;
-    AVFrame *frame = data;
     int ret;
 
     /* get output buffer */
@@ -1828,15 +1822,14 @@ static int wmapro_decode_packet(AVCodecContext *avctx, void *data,
         return 0;
     }
 
-    return decode_packet(avctx, s, data, got_frame_ptr, avpkt);
+    return decode_packet(avctx, s, frame, got_frame_ptr, avpkt);
 }
 
-static int xma_decode_packet(AVCodecContext *avctx, void *data,
+static int xma_decode_packet(AVCodecContext *avctx, AVFrame *frame,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
     XMADecodeCtx *s = avctx->priv_data;
     int got_stream_frame_ptr = 0;
-    AVFrame *frame = data;
     int i, ret = 0, eof = 0;
 
     if (!s->frames[s->current_stream]->data[0]) {
diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index c251c9e1ec..571dd5803b 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -1903,7 +1903,7 @@ static void copy_bits(PutBitContext *pb,
  *
  * For more information about frames, see #synth_superframe().
  */
-static int wmavoice_decode_packet(AVCodecContext *ctx, void *data,
+static int wmavoice_decode_packet(AVCodecContext *ctx, AVFrame *frame,
                                   int *got_frame_ptr, AVPacket *avpkt)
 {
     WMAVoiceContext *s = ctx->priv_data;
@@ -1942,7 +1942,7 @@ static int wmavoice_decode_packet(AVCodecContext *ctx, void *data,
             copy_bits(&s->pb, avpkt->data, size, gb, s->spillover_nbits);
             flush_put_bits(&s->pb);
             s->sframe_cache_size += s->spillover_nbits;
-            if ((res = synth_superframe(ctx, data, got_frame_ptr)) == 0 &&
+            if ((res = synth_superframe(ctx, frame, got_frame_ptr)) == 0 &&
                 *got_frame_ptr) {
                 cnt += s->spillover_nbits;
                 s->skip_bits_next = cnt & 7;
@@ -1965,7 +1965,7 @@ static int wmavoice_decode_packet(AVCodecContext *ctx, void *data,
         *got_frame_ptr = 0;
         return size;
     } else if (s->nb_superframes > 0) {
-        if ((res = synth_superframe(ctx, data, got_frame_ptr)) < 0) {
+        if ((res = synth_superframe(ctx, frame, got_frame_ptr)) < 0) {
             return res;
         } else if (*got_frame_ptr) {
             int cnt = get_bits_count(gb);
diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c
index 156a8a09a4..913b42a78f 100644
--- a/libavcodec/wnv1.c
+++ b/libavcodec/wnv1.c
@@ -52,13 +52,11 @@ static inline int wnv1_get_code(GetBitContext *gb, int shift, int base_value)
         return base_value + v * (1 << shift);
 }
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *p,
+                        int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf    = avpkt->data;
     int buf_size          = avpkt->size;
-    AVFrame * const p     = data;
     GetBitContext gb;
     unsigned char *Y,*U,*V;
     int i, j, ret, shift;
diff --git a/libavcodec/wrapped_avframe.c b/libavcodec/wrapped_avframe.c
index 291f4d5d31..6794dd2045 100644
--- a/libavcodec/wrapped_avframe.c
+++ b/libavcodec/wrapped_avframe.c
@@ -76,10 +76,10 @@ static int wrapped_avframe_encode(AVCodecContext *avctx, AVPacket *pkt,
     return 0;
 }
 
-static int wrapped_avframe_decode(AVCodecContext *avctx, void *data,
+static int wrapped_avframe_decode(AVCodecContext *avctx, AVFrame *out,
                                   int *got_frame, AVPacket *pkt)
 {
-    AVFrame *in, *out;
+    AVFrame *in;
     int err;
 
     if (!(pkt->flags & AV_PKT_FLAG_TRUSTED)) {
@@ -91,7 +91,6 @@ static int wrapped_avframe_decode(AVCodecContext *avctx, void *data,
         return AVERROR(EINVAL);
 
     in  = (AVFrame*)pkt->data;
-    out = data;
 
     err = ff_decode_frame_props(avctx, out);
     if (err < 0)
diff --git a/libavcodec/ws-snd1.c b/libavcodec/ws-snd1.c
index f99f492988..00e4d91d4f 100644
--- a/libavcodec/ws-snd1.c
+++ b/libavcodec/ws-snd1.c
@@ -51,10 +51,9 @@ static av_cold int ws_snd_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int ws_snd_decode_frame(AVCodecContext *avctx, void *data,
+static int ws_snd_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                                int *got_frame_ptr, AVPacket *avpkt)
 {
-    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
 
diff --git a/libavcodec/xan.c b/libavcodec/xan.c
index c7916de569..e9f6c334a1 100644
--- a/libavcodec/xan.c
+++ b/libavcodec/xan.c
@@ -538,11 +538,9 @@ static const uint8_t gamma_lookup[256] = {
 };
 #endif
 
-static int xan_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int xan_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                            int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *frame = data;
     const uint8_t *buf = avpkt->data;
     int ret, buf_size = avpkt->size;
     XanContext *s = avctx->priv_data;
diff --git a/libavcodec/xbmdec.c b/libavcodec/xbmdec.c
index 9dbd0ac571..bf9446195f 100644
--- a/libavcodec/xbmdec.c
+++ b/libavcodec/xbmdec.c
@@ -65,10 +65,9 @@ static int parse_str_int(const uint8_t *p, const uint8_t *end, const uint8_t *ke
     return INT_MIN;
 }
 
-static int xbm_decode_frame(AVCodecContext *avctx, void *data,
+static int xbm_decode_frame(AVCodecContext *avctx, AVFrame *p,
                             int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *p = data;
     int ret, linesize, i, j;
     int width  = 0;
     int height = 0;
diff --git a/libavcodec/xfacedec.c b/libavcodec/xfacedec.c
index 32b484a667..0542a36a5d 100644
--- a/libavcodec/xfacedec.c
+++ b/libavcodec/xfacedec.c
@@ -109,9 +109,8 @@ static av_cold int xface_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int xface_decode_frame(AVCodecContext *avctx,
-                              void *data, int *got_frame,
-                              AVPacket *avpkt)
+static int xface_decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                              int *got_frame, AVPacket *avpkt)
 {
     XFaceContext *xface = avctx->priv_data;
     int ret, i, j, k;
@@ -119,7 +118,6 @@ static int xface_decode_frame(AVCodecContext *avctx,
     BigInt b = {0};
     char *buf;
     int64_t c;
-    AVFrame *frame = data;
 
     if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
         return ret;
diff --git a/libavcodec/xl.c b/libavcodec/xl.c
index 8b3e950af6..d414bcf95d 100644
--- a/libavcodec/xl.c
+++ b/libavcodec/xl.c
@@ -37,13 +37,11 @@ static const int xl_table[32] = {
  120, 121, 122, 123, 124, 125, 126, 127
 };
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *p,
+                        int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
-    AVFrame *const p   = data;
     uint8_t *Y, *U, *V;
     int i, j, ret;
     int stride;
diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c
index 584ffaa995..468175fc4b 100644
--- a/libavcodec/xpmdec.c
+++ b/libavcodec/xpmdec.c
@@ -303,11 +303,10 @@ static int ascii2index(const uint8_t *cpixel, int cpp)
     return n;
 }
 
-static int xpm_decode_frame(AVCodecContext *avctx, void *data,
+static int xpm_decode_frame(AVCodecContext *avctx, AVFrame *p,
                             int *got_frame, AVPacket *avpkt)
 {
     XPMDecContext *x = avctx->priv_data;
-    AVFrame *p=data;
     const uint8_t *end, *ptr;
     int ncolors, cpp, ret, i, j;
     int64_t size;
diff --git a/libavcodec/xwddec.c b/libavcodec/xwddec.c
index 3d86b2b82d..650a0bf774 100644
--- a/libavcodec/xwddec.c
+++ b/libavcodec/xwddec.c
@@ -29,10 +29,9 @@
 #include "internal.h"
 #include "xwd.h"
 
-static int xwd_decode_frame(AVCodecContext *avctx, void *data,
+static int xwd_decode_frame(AVCodecContext *avctx, AVFrame *p,
                             int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *p = data;
     const uint8_t *buf = avpkt->data;
     int i, ret, buf_size = avpkt->size;
     uint32_t version, header_size, vclass, ncolors;
diff --git a/libavcodec/xxan.c b/libavcodec/xxan.c
index 759ec2c90b..9a79e58d8a 100644
--- a/libavcodec/xxan.c
+++ b/libavcodec/xxan.c
@@ -399,9 +399,8 @@ static int xan_decode_frame_type1(AVCodecContext *avctx)
     return 0;
 }
 
-static int xan_decode_frame(AVCodecContext *avctx,
-                            void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int xan_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                            int *got_frame, AVPacket *avpkt)
 {
     XanContext *s = avctx->priv_data;
     int ftype;
@@ -426,7 +425,7 @@ static int xan_decode_frame(AVCodecContext *avctx,
     if (ret)
         return ret;
 
-    if ((ret = av_frame_ref(data, s->pic)) < 0)
+    if ((ret = av_frame_ref(rframe, s->pic)) < 0)
         return ret;
 
     *got_frame = 1;
diff --git a/libavcodec/y41pdec.c b/libavcodec/y41pdec.c
index 507e784d3c..663a1cc910 100644
--- a/libavcodec/y41pdec.c
+++ b/libavcodec/y41pdec.c
@@ -36,10 +36,9 @@ static av_cold int y41p_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int y41p_decode_frame(AVCodecContext *avctx, void *data,
+static int y41p_decode_frame(AVCodecContext *avctx, AVFrame *pic,
                              int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *pic = data;
     uint8_t *src = avpkt->data;
     uint8_t *y, *u, *v;
     int i, j, ret;
diff --git a/libavcodec/ylc.c b/libavcodec/ylc.c
index b49b960b3a..9b19405b24 100644
--- a/libavcodec/ylc.c
+++ b/libavcodec/ylc.c
@@ -278,16 +278,14 @@ static const uint8_t table_v[] = {
     0x01, 0x00,
 };
 
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *got_frame,
-                        AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *p,
+                        int *got_frame, AVPacket *avpkt)
 {
     int TL[4] = { 128, 128, 128, 128 };
     int L[4]  = { 128, 128, 128, 128 };
     YLCContext *s = avctx->priv_data;
     const uint8_t *buf = avpkt->data;
     int ret, x, y, toffset, boffset;
-    AVFrame * const p = data;
     GetBitContext gb;
     uint8_t *dst;
 
diff --git a/libavcodec/yop.c b/libavcodec/yop.c
index 01090ddbf8..3079af061f 100644
--- a/libavcodec/yop.c
+++ b/libavcodec/yop.c
@@ -191,8 +191,8 @@ static uint8_t yop_get_next_nibble(YopDecContext *s)
     return ret;
 }
 
-static int yop_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-                            AVPacket *avpkt)
+static int yop_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
+                            int *got_frame, AVPacket *avpkt)
 {
     YopDecContext *s = avctx->priv_data;
     AVFrame *frame = s->frame;
@@ -259,7 +259,7 @@ static int yop_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
         s->dstptr += 2*frame->linesize[0] - x;
     }
 
-    if ((ret = av_frame_ref(data, s->frame)) < 0)
+    if ((ret = av_frame_ref(rframe, s->frame)) < 0)
         return ret;
 
     *got_frame = 1;
diff --git a/libavcodec/yuv4dec.c b/libavcodec/yuv4dec.c
index 83e03ba782..3c6d6eda6e 100644
--- a/libavcodec/yuv4dec.c
+++ b/libavcodec/yuv4dec.c
@@ -31,10 +31,9 @@ static av_cold int yuv4_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int yuv4_decode_frame(AVCodecContext *avctx, void *data,
+static int yuv4_decode_frame(AVCodecContext *avctx, AVFrame *pic,
                              int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *pic = data;
     const uint8_t *src = avpkt->data;
     uint8_t *y, *u, *v;
     int i, j, ret;
diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c
index 49b0968129..b4d189cd7a 100644
--- a/libavcodec/zerocodec.c
+++ b/libavcodec/zerocodec.c
@@ -29,11 +29,10 @@ typedef struct ZeroCodecContext {
     FFZStream zstream;
 } ZeroCodecContext;
 
-static int zerocodec_decode_frame(AVCodecContext *avctx, void *data,
+static int zerocodec_decode_frame(AVCodecContext *avctx, AVFrame *pic,
                                   int *got_frame, AVPacket *avpkt)
 {
     ZeroCodecContext *zc = avctx->priv_data;
-    AVFrame *pic         = data;
     AVFrame *prev_pic    = zc->previous_frame;
     z_stream *const zstream = &zc->zstream.zstream;
     uint8_t *prev        = prev_pic->data[0];
diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index 86f7f265c6..4a845a333d 100644
--- a/libavcodec/zmbv.c
+++ b/libavcodec/zmbv.c
@@ -410,9 +410,9 @@ static int zmbv_decode_intra(ZmbvContext *c)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
+                        int *got_frame, AVPacket *avpkt)
 {
-    AVFrame *frame = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     ZmbvContext * const c = avctx->priv_data;
-- 
2.32.0



More information about the ffmpeg-devel mailing list