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/aacdec_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/aacdec_template.c')
-rw-r--r-- | libavcodec/aacdec_template.c | 14 |
1 files changed, 7 insertions, 7 deletions
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; |