aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2021-08-01 03:51:58 +0200
committerMarton Balint <cus@passwd.hu>2021-08-08 21:22:51 +0200
commita2690dcccab4f878319e7af42a8ef64f99c15637 (patch)
tree5e50a157c034fc88413ddda09e44ed3aef5101a8
parent188e17ac85a6b6790f2430f5825ba74111bbf1e5 (diff)
downloadffmpeg-a2690dcccab4f878319e7af42a8ef64f99c15637.tar.gz
avcodec/mpeg12dec: report error when picture type is unknown and err_detect is EXPLODE
Also split error message to error and warning. Signed-off-by: Marton Balint <cus@passwd.hu>
-rw-r--r--libavcodec/mpeg12dec.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 858dca660c..49d865853b 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1529,7 +1529,7 @@ static void mpeg_decode_quant_matrix_extension(MpegEncContext *s)
load_matrix(s, s->chroma_inter_matrix, NULL, 0);
}
-static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
+static int mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
{
MpegEncContext *s = &s1->mpeg_enc_ctx;
@@ -1539,8 +1539,10 @@ static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
s->mpeg_f_code[1][0] = get_bits(&s->gb, 4);
s->mpeg_f_code[1][1] = get_bits(&s->gb, 4);
if (!s->pict_type && s1->mpeg_enc_ctx_allocated) {
- av_log(s->avctx, AV_LOG_ERROR,
- "Missing picture start code, guessing missing values\n");
+ av_log(s->avctx, AV_LOG_ERROR, "Missing picture start code\n");
+ if (s->avctx->err_recognition & AV_EF_EXPLODE)
+ return AVERROR_INVALIDDATA;
+ av_log(s->avctx, AV_LOG_WARNING, "Guessing pict_type from mpeg_f_code\n");
if (s->mpeg_f_code[1][0] == 15 && s->mpeg_f_code[1][1] == 15) {
if (s->mpeg_f_code[0][0] == 15 && s->mpeg_f_code[0][1] == 15)
s->pict_type = AV_PICTURE_TYPE_I;
@@ -1586,6 +1588,8 @@ static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
ff_dlog(s->avctx, "alternate_scan=%d\n", s->alternate_scan);
ff_dlog(s->avctx, "frame_pred_frame_dct=%d\n", s->frame_pred_frame_dct);
ff_dlog(s->avctx, "progressive_frame=%d\n", s->progressive_frame);
+
+ return 0;
}
static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
@@ -2599,7 +2603,9 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture,
break;
case 0x8:
if (last_code == PICTURE_START_CODE) {
- mpeg_decode_picture_coding_extension(s);
+ int ret = mpeg_decode_picture_coding_extension(s);
+ if (ret < 0)
+ return ret;
} else {
av_log(avctx, AV_LOG_ERROR,
"ignoring pic cod ext after %X\n", last_code);