diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-03-30 21:33:24 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-04-05 19:54:09 +0200 |
commit | ce7dbd0481f990e249c2a05f179228489d3062cf (patch) | |
tree | c5f04e58129705430e1d97a5842131b72e250083 /libavcodec/mpegaudiodec_template.c | |
parent | fb59a42ef977dd91085a602f10c9c82f88d072e5 (diff) | |
download | ffmpeg-ce7dbd0481f990e249c2a05f179228489d3062cf.tar.gz |
avcodec/codec_internal: Make FFCodec.decode use AVFrame*
This increases type-safety by avoiding conversions from/through void*.
It also avoids the boilerplate "AVFrame *frame = data;" line
for non-subtitle decoders.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mpegaudiodec_template.c')
-rw-r--r-- | libavcodec/mpegaudiodec_template.c | 13 |
1 files changed, 6 insertions, 7 deletions
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; |