mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-11-06 05:17:42 +00:00
avformat/cavsvideodec: reduce probe score for prefixed streams
cavsvideo_probe() returns a high score whenever it finds a valid sequence and picture start code, even when the sequence header appears only after unrelated leading data. This can make valid JPEG files probe as CAVS. Keep the high score when the sequence header is at the start of the probed stream. Otherwise return AVPROBE_SCORE_EXTENSION / 2 so stronger probes can win. Signed-off-by: Xiujun Wang <xiujunwang.dev@gmail.com>
This commit is contained in:
1 parent
4a13b54376
commit
0f3d20ebf6
2 files changed
+8
-2
No files matched your search
@@ -33,7 +33,7 @@
|
||||
static int cavsvideo_probe(const AVProbeData *p)
|
||||
{
|
||||
uint32_t code= -1;
|
||||
int pic=0, seq=0, slice_pos = 0;
|
||||
int pic=0, seq=0, slice_pos = 0, seq_at_start = 0;
|
||||
const uint8_t *ptr = p->buf, *end = p->buf + p->buf_size;
|
||||
|
||||
while (ptr < end) {
|
||||
@@ -49,6 +49,8 @@ static int cavsvideo_probe(const AVProbeData *p)
|
||||
}
|
||||
if (code == CAVS_SEQ_START_CODE) {
|
||||
seq++;
|
||||
if (ptr == p->buf + 4)
|
||||
seq_at_start = 1;
|
||||
if (*ptr != AV_PROFILE_CAVS_JIZHUN &&
|
||||
*ptr != AV_PROFILE_CAVS_BROADCASTING)
|
||||
return 0;
|
||||
@@ -62,7 +64,8 @@ static int cavsvideo_probe(const AVProbeData *p)
|
||||
}
|
||||
}
|
||||
if(seq && seq*9<=pic*10)
|
||||
return AVPROBE_SCORE_EXTENSION+1;
|
||||
return seq_at_start ? AVPROBE_SCORE_EXTENSION + 1 :
|
||||
AVPROBE_SCORE_EXTENSION / 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@ fate-probe-format-png-concat: CMD = probefmt $(TARGET_SAMPLES)/png1/feed_4x_conc
|
||||
FATE_PROBE_FORMAT-$(call ALLYES, IMAGE_TIFF_PIPE_DEMUXER MPEGTS_DEMUXER) += fate-probe-format-tiff-not-mpegts
|
||||
fate-probe-format-tiff-not-mpegts: REF = tiff_pipe
|
||||
|
||||
FATE_PROBE_FORMAT-$(call ALLYES, IMAGE_JPEG_PIPE_DEMUXER CAVSVIDEO_DEMUXER) += fate-probe-format-jpeg-not-cavsvideo
|
||||
fate-probe-format-jpeg-not-cavsvideo: REF = jpeg_pipe
|
||||
|
||||
FATE_PROBE_FORMAT = $(FATE_PROBE_FORMAT-yes)
|
||||
|
||||
FATE_SAMPLES_FFPROBE += $(FATE_PROBE_FORMAT)
|
||||
|
||||
Reference in new issue
Block a user