|
|
|
@ -57,10 +57,30 @@ static int ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id) |
|
|
|
|
if(codec_id != expected_codec_id) return 0; |
|
|
|
|
// keep this in sync with mp3 probe, both need to avoid
|
|
|
|
|
// issues with MPEG-files!
|
|
|
|
|
if (first_frames>=4) return AVPROBE_SCORE_MAX/2+1; |
|
|
|
|
else if(max_frames>500)return AVPROBE_SCORE_MAX/2; |
|
|
|
|
else if(max_frames>=4) return AVPROBE_SCORE_MAX/4; |
|
|
|
|
else if(max_frames>=1) return 1; |
|
|
|
|
if (first_frames >= 4) return AVPROBE_SCORE_MAX / 2 + 1; |
|
|
|
|
|
|
|
|
|
if (max_frames) { |
|
|
|
|
int pes = 0, i; |
|
|
|
|
unsigned int code = -1; |
|
|
|
|
|
|
|
|
|
#define VIDEO_ID 0x000001e0 |
|
|
|
|
#define AUDIO_ID 0x000001c0 |
|
|
|
|
/* do a search for mpegps headers to be able to properly bias
|
|
|
|
|
* towards mpegps if we detect this stream as both. */ |
|
|
|
|
for (i = 0; i<p->buf_size; i++) { |
|
|
|
|
code = (code << 8) + p->buf[i]; |
|
|
|
|
if ((code & 0xffffff00) == 0x100) { |
|
|
|
|
if ((code & 0x1f0) == VIDEO_ID) pes++; |
|
|
|
|
else if((code & 0x1e0) == AUDIO_ID) pes++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (pes) |
|
|
|
|
max_frames = (max_frames + pes - 1) / pes; |
|
|
|
|
} |
|
|
|
|
if (max_frames > 500) return AVPROBE_SCORE_MAX / 2; |
|
|
|
|
else if (max_frames >= 4) return AVPROBE_SCORE_MAX / 4; |
|
|
|
|
else if (max_frames >= 1) return 1; |
|
|
|
|
else return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|