diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-01-26 16:33:01 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-01-30 05:14:45 +0100 |
commit | 7c27513d0458c7e80925e27529acee4473baedf6 (patch) | |
tree | 773cf01219127a0a6524da6ade66d58eb6a5d16c /libavcodec/dolby_e_parse.c | |
parent | 8cbff41583409210abef0f57a1afbf8bb1f1f351 (diff) | |
download | ffmpeg-7c27513d0458c7e80925e27529acee4473baedf6.tar.gz |
avcodec/dolby_e: Avoid code duplication when converting input
convert_input, a nontrivial auxiliary function used by both the general
parsing code as well as the decoder itself, has been duplicated in
c7016e35a624a75bb5b82bee932ddfe28d013b3f; this commit removes said
duplication.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/dolby_e_parse.c')
-rw-r--r-- | libavcodec/dolby_e_parse.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/dolby_e_parse.c b/libavcodec/dolby_e_parse.c index 33ec3d7f09..00b5536020 100644 --- a/libavcodec/dolby_e_parse.c +++ b/libavcodec/dolby_e_parse.c @@ -53,7 +53,7 @@ static int parse_key(DBEContext *s) return 0; } -static int convert_input(DBEContext *s, int nb_words, int key) +int ff_dolby_e_convert_input(DBEContext *s, int nb_words, int key) { const uint8_t *src = s->input; uint8_t *dst = s->buffer; @@ -63,6 +63,8 @@ static int convert_input(DBEContext *s, int nb_words, int key) av_assert0(nb_words <= 1024u); if (nb_words > s->input_size) { + if (s->avctx) + av_log(s->avctx, AV_LOG_ERROR, "Packet too short\n"); return AVERROR_INVALIDDATA; } @@ -116,7 +118,7 @@ int ff_dolby_e_parse_header(DBEContext *s, const uint8_t *buf, int buf_size) if ((key = parse_key(s)) < 0) return key; - if ((ret = convert_input(s, 1, key)) < 0) + if ((ret = ff_dolby_e_convert_input(s, 1, key)) < 0) return ret; skip_bits(&s->gb, 4); @@ -127,7 +129,7 @@ int ff_dolby_e_parse_header(DBEContext *s, const uint8_t *buf, int buf_size) return AVERROR_INVALIDDATA; } - if ((ret = convert_input(s, mtd_size, key)) < 0) + if ((ret = ff_dolby_e_convert_input(s, mtd_size, key)) < 0) return ret; skip_bits(&s->gb, 14); |