summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg4videodec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@googlemail.com>2019-03-11 11:32:05 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2019-03-12 00:48:56 +0100
commit3f086a2f665f9906e0f6197cddbfacc2f4b093a1 (patch)
tree03ea635dc6c568f53acf611cf6f6a33808b405b5 /libavcodec/mpeg4videodec.c
parent5ab44ff20cdc0e05adecbd0cd352d25fcb930094 (diff)
avcodec/mpeg4videodec: Fix nonsense warning
Since db772308941a2a338c7809f90d347219a6a93074 parsing of mpeg4-extradata lead to a "Failed to parse extradata" warning, because ff_mpeg4_decode_picture_header returns AVERROR_INVALIDDATA in case that no VOP was found. This patch adds a parameter to signify whether a header (where the absence of a VOP does not raise an error) or not is parsed. The first mode is of course used for parsing headers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/mpeg4videodec.c')
-rw-r--r--libavcodec/mpeg4videodec.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index ecd028a87c..99b1e10620 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -3203,11 +3203,13 @@ static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
/**
* Decode MPEG-4 headers.
- * @return <0 if no VOP found (or a damaged one)
+ *
+ * @param header If set the absence of a VOP is not treated as error; otherwise, it is treated as such.
+ * @return <0 if an error occured
* FRAME_SKIPPED if a not coded VOP is found
- * 0 if a VOP is found
+ * 0 else
*/
-int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb)
+int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb, int header)
{
MpegEncContext *s = &ctx->m;
unsigned startcode, v;
@@ -3236,6 +3238,8 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb)
(ctx->divx_version >= 0 || ctx->xvid_build >= 0) || s->codec_tag == AV_RL32("QMP4")) {
av_log(s->avctx, AV_LOG_VERBOSE, "frame skip %d\n", gb->size_in_bits);
return FRAME_SKIPPED; // divx bug
+ } else if (header && get_bits_count(gb) == gb->size_in_bits) {
+ return 0; // ordinary return value for parsing of extradata
} else
return AVERROR_INVALIDDATA; // end of stream
}