mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
lavf: give more weight to the extension during probing if there is a id3
tag that is larger than the probe buffer. Fixes Ticket336 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
6a3a54f5e3
commit
98d1e9f915
@ -309,14 +309,15 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score
|
|||||||
{
|
{
|
||||||
AVProbeData lpd = *pd;
|
AVProbeData lpd = *pd;
|
||||||
AVInputFormat *fmt1 = NULL, *fmt;
|
AVInputFormat *fmt1 = NULL, *fmt;
|
||||||
int score, score_max=0;
|
int score, nodat = 0, score_max=0;
|
||||||
|
|
||||||
if (lpd.buf_size > 10 && ff_id3v2_match(lpd.buf, ID3v2_DEFAULT_MAGIC)) {
|
if (lpd.buf_size > 10 && ff_id3v2_match(lpd.buf, ID3v2_DEFAULT_MAGIC)) {
|
||||||
int id3len = ff_id3v2_tag_len(lpd.buf);
|
int id3len = ff_id3v2_tag_len(lpd.buf);
|
||||||
if (lpd.buf_size > id3len + 16) {
|
if (lpd.buf_size > id3len + 16) {
|
||||||
lpd.buf += id3len;
|
lpd.buf += id3len;
|
||||||
lpd.buf_size -= id3len;
|
lpd.buf_size -= id3len;
|
||||||
}
|
}else
|
||||||
|
nodat = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt = NULL;
|
fmt = NULL;
|
||||||
@ -327,7 +328,7 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score
|
|||||||
if (fmt1->read_probe) {
|
if (fmt1->read_probe) {
|
||||||
score = fmt1->read_probe(&lpd);
|
score = fmt1->read_probe(&lpd);
|
||||||
if(fmt1->extensions && av_match_ext(lpd.filename, fmt1->extensions))
|
if(fmt1->extensions && av_match_ext(lpd.filename, fmt1->extensions))
|
||||||
score = FFMAX(score, 1);
|
score = FFMAX(score, nodat ? AVPROBE_SCORE_MAX/4-1 : 1);
|
||||||
} else if (fmt1->extensions) {
|
} else if (fmt1->extensions) {
|
||||||
if (av_match_ext(lpd.filename, fmt1->extensions)) {
|
if (av_match_ext(lpd.filename, fmt1->extensions)) {
|
||||||
score = 50;
|
score = 50;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user