mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-02-04 14:30:55 +08:00
avcodec/mjpegdec: decode only SOF fields when finding stream info
When called from avformat_find_stream_info(), we are only interested in
decoding SOF fields.
This patch makes the decoder skip all other fields (including SOI, SOS,
and EOI). This also prevents the decoder from incorrectly printing the
warning "EOI missing, emulating" (which is the case since 2ae82788).
Fixes: #20119
This commit is contained in:
committed by
James Almer
parent
f610b55525
commit
5733e08c97
@@ -2463,9 +2463,6 @@ redo_for_pal8:
|
||||
case SOF2:
|
||||
case SOF3:
|
||||
case SOF48:
|
||||
case SOI:
|
||||
case SOS:
|
||||
case EOI:
|
||||
break;
|
||||
default:
|
||||
goto skip;
|
||||
@@ -2541,7 +2538,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
break;
|
||||
case EOI:
|
||||
eoi_parser:
|
||||
if (!avctx->hwaccel && avctx->skip_frame != AVDISCARD_ALL &&
|
||||
if (!avctx->hwaccel &&
|
||||
s->progressive && s->cur_scan && s->got_picture)
|
||||
mjpeg_idct_scan_progressive_ac(s);
|
||||
s->cur_scan = 0;
|
||||
@@ -2556,10 +2553,6 @@ eoi_parser:
|
||||
if (s->bottom_field == !s->interlace_polarity)
|
||||
break;
|
||||
}
|
||||
if (avctx->skip_frame == AVDISCARD_ALL) {
|
||||
s->got_picture = 0;
|
||||
goto the_end_no_picture;
|
||||
}
|
||||
if (avctx->hwaccel) {
|
||||
ret = FF_HW_SIMPLE_CALL(avctx, end_frame);
|
||||
if (ret < 0)
|
||||
@@ -2588,10 +2581,6 @@ eoi_parser:
|
||||
s->raw_scan_buffer_size = buf_end - buf_ptr;
|
||||
|
||||
s->cur_scan++;
|
||||
if (avctx->skip_frame == AVDISCARD_ALL) {
|
||||
skip_bits(&s->gb, get_bits_left(&s->gb));
|
||||
break;
|
||||
}
|
||||
|
||||
if ((ret = ff_mjpeg_decode_sos(s, NULL, 0, NULL)) < 0 &&
|
||||
(avctx->err_recognition & AV_EF_EXPLODE))
|
||||
@@ -2616,6 +2605,18 @@ eoi_parser:
|
||||
break;
|
||||
}
|
||||
|
||||
if (avctx->skip_frame == AVDISCARD_ALL) {
|
||||
switch(start_code) {
|
||||
case SOF0:
|
||||
case SOF1:
|
||||
case SOF2:
|
||||
case SOF3:
|
||||
case SOF48:
|
||||
s->got_picture = 0;
|
||||
goto the_end_no_picture;
|
||||
}
|
||||
}
|
||||
|
||||
skip:
|
||||
/* eof process start code */
|
||||
buf_ptr += (get_bits_count(&s->gb) + 7) / 8;
|
||||
|
||||
Reference in New Issue
Block a user