Browse Source

Merge commit 'e0f8be6413b6a8d334d6052e610af32935c310af'

* commit 'e0f8be6413b6a8d334d6052e610af32935c310af':
  avformat: Add AVPROBE_SCORE_EXTENSION define and use where appropriate

Conflicts:
	libavformat/ac3dec.c
	libavformat/avformat.h
	libavformat/avs.c
	libavformat/m4vdec.c
	libavformat/mov.c
	libavformat/mp3dec.c
	libavformat/mpeg.c
	libavformat/mpegvideodec.c
	libavformat/psxstr.c
	libavformat/pva.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.0
Michael Niedermayer 12 years ago
parent
commit
f083b4c338
36 changed files with 56 additions and 54 deletions
  1. +3
    -3
      libavformat/aacdec.c
  2. +3
    -3
      libavformat/ac3dec.c
  3. +3
    -1
      libavformat/avformat.h
  4. +1
    -1
      libavformat/avidec.c
  5. +1
    -1
      libavformat/avs.c
  6. +1
    -1
      libavformat/cavsvideodec.c
  7. +1
    -1
      libavformat/dtsdec.c
  8. +1
    -1
      libavformat/flacdec.c
  9. +2
    -2
      libavformat/h261dec.c
  10. +2
    -2
      libavformat/h263dec.c
  11. +1
    -1
      libavformat/h264dec.c
  12. +1
    -1
      libavformat/idcin.c
  13. +1
    -1
      libavformat/img2dec.c
  14. +1
    -1
      libavformat/m4vdec.c
  15. +1
    -1
      libavformat/matroskadec.c
  16. +1
    -1
      libavformat/mm.c
  17. +2
    -2
      libavformat/mov.c
  18. +4
    -4
      libavformat/mp3dec.c
  19. +1
    -1
      libavformat/mpc8.c
  20. +4
    -4
      libavformat/mpeg.c
  21. +2
    -2
      libavformat/mpegvideodec.c
  22. +2
    -2
      libavformat/mtv.c
  23. +1
    -1
      libavformat/nsvdec.c
  24. +1
    -1
      libavformat/omadec.c
  25. +1
    -1
      libavformat/psxstr.c
  26. +1
    -1
      libavformat/pva.c
  27. +1
    -1
      libavformat/rtsp.c
  28. +1
    -1
      libavformat/sierravmd.c
  29. +2
    -2
      libavformat/spdifdec.c
  30. +1
    -1
      libavformat/takdec.c
  31. +1
    -1
      libavformat/tta.c
  32. +3
    -3
      libavformat/utils.c
  33. +1
    -1
      libavformat/vc1test.c
  34. +1
    -1
      libavformat/vqf.c
  35. +1
    -1
      libavformat/westwood_aud.c
  36. +1
    -1
      libavformat/xa.c

+ 3
- 3
libavformat/aacdec.c View File

@@ -55,9 +55,9 @@ static int adts_aac_probe(AVProbeData *p)
if(buf == buf0) if(buf == buf0)
first_frames= frames; first_frames= frames;
} }
if (first_frames>=3) return AVPROBE_SCORE_MAX/2+1;
else if(max_frames>500)return AVPROBE_SCORE_MAX/2;
else if(max_frames>=3) return AVPROBE_SCORE_MAX/4;
if (first_frames>=3) return AVPROBE_SCORE_EXTENSION + 1;
else if(max_frames>500)return AVPROBE_SCORE_EXTENSION;
else if(max_frames>=3) return AVPROBE_SCORE_EXTENSION / 2;
else if(max_frames>=1) return 1; else if(max_frames>=1) return 1;
else return 0; else return 0;
} }


+ 3
- 3
libavformat/ac3dec.c View File

@@ -79,9 +79,9 @@ static int ac3_eac3_probe(AVProbeData *p, enum AVCodecID expected_codec_id)
if(codec_id != expected_codec_id) return 0; if(codec_id != expected_codec_id) return 0;
// keep this in sync with mp3 probe, both need to avoid // keep this in sync with mp3 probe, both need to avoid
// issues with MPEG-files! // issues with MPEG-files!
if (first_frames>=4) return AVPROBE_SCORE_MAX/2+1;
else if(max_frames>200)return AVPROBE_SCORE_MAX/2;
else if(max_frames>=4) return AVPROBE_SCORE_MAX/4;
if (first_frames>=4) return AVPROBE_SCORE_EXTENSION + 1;
else if(max_frames>200)return AVPROBE_SCORE_EXTENSION;
else if(max_frames>=4) return AVPROBE_SCORE_EXTENSION/2;
else if(max_frames>=1) return 1; else if(max_frames>=1) return 1;
else return 0; else return 0;
} }


+ 3
- 1
libavformat/avformat.h View File

@@ -337,8 +337,10 @@ typedef struct AVProbeData {
int buf_size; /**< Size of buf except extra allocated bytes */ int buf_size; /**< Size of buf except extra allocated bytes */
} AVProbeData; } AVProbeData;


#define AVPROBE_SCORE_MAX 100 ///< maximum score, half of that is used for file-extension-based detection
#define AVPROBE_SCORE_RETRY (AVPROBE_SCORE_MAX/4) #define AVPROBE_SCORE_RETRY (AVPROBE_SCORE_MAX/4)
#define AVPROBE_SCORE_EXTENSION 50 ///< score for file extension
#define AVPROBE_SCORE_MAX 100 ///< maximum score

#define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer #define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer


/// Demuxer will use avio_open, no opened file should be provided by the caller. /// Demuxer will use avio_open, no opened file should be provided by the caller.


+ 1
- 1
libavformat/avidec.c View File

@@ -830,7 +830,7 @@ static int avi_read_header(AVFormatContext *s)
static int read_gab2_sub(AVStream *st, AVPacket *pkt) { static int read_gab2_sub(AVStream *st, AVPacket *pkt) {
if (pkt->data && !strcmp(pkt->data, "GAB2") && AV_RL16(pkt->data+5) == 2) { if (pkt->data && !strcmp(pkt->data, "GAB2") && AV_RL16(pkt->data+5) == 2) {
uint8_t desc[256]; uint8_t desc[256];
int score = AVPROBE_SCORE_MAX / 2, ret;
int score = AVPROBE_SCORE_EXTENSION, ret;
AVIStream *ast = st->priv_data; AVIStream *ast = st->priv_data;
AVInputFormat *sub_demuxer; AVInputFormat *sub_demuxer;
AVRational time_base; AVRational time_base;


+ 1
- 1
libavformat/avs.c View File

@@ -50,7 +50,7 @@ static int avs_probe(AVProbeData * p)


d = p->buf; d = p->buf;
if (d[0] == 'w' && d[1] == 'W' && d[2] == 0x10 && d[3] == 0) if (d[0] == 'w' && d[1] == 'W' && d[2] == 0x10 && d[3] == 0)
return 55;
return AVPROBE_SCORE_EXTENSION+5;


return 0; return 0;
} }


+ 1
- 1
libavformat/cavsvideodec.c View File

@@ -61,7 +61,7 @@ static int cavsvideo_probe(AVProbeData *p)
} }
} }
if(seq && seq*9<=pic*10) if(seq && seq*9<=pic*10)
return AVPROBE_SCORE_MAX/2;
return AVPROBE_SCORE_EXTENSION;
return 0; return 0;
} }




+ 1
- 1
libavformat/dtsdec.c View File

@@ -60,7 +60,7 @@ static int dts_probe(AVProbeData *p)
max = markers[2] > markers[max] ? 2 : max; max = markers[2] > markers[max] ? 2 : max;
if (markers[max] > 3 && p->buf_size / markers[max] < 32*1024 && if (markers[max] > 3 && p->buf_size / markers[max] < 32*1024 &&
markers[max] * 4 > sum * 3) markers[max] * 4 > sum * 3)
return AVPROBE_SCORE_MAX/2+1;
return AVPROBE_SCORE_EXTENSION + 1;


return 0; return 0;
} }


+ 1
- 1
libavformat/flacdec.c View File

@@ -280,7 +280,7 @@ static int flac_probe(AVProbeData *p)
{ {
if (p->buf_size < 4 || memcmp(p->buf, "fLaC", 4)) if (p->buf_size < 4 || memcmp(p->buf, "fLaC", 4))
return 0; return 0;
return AVPROBE_SCORE_MAX/2;
return AVPROBE_SCORE_EXTENSION;
} }


AVInputFormat ff_flac_demuxer = { AVInputFormat ff_flac_demuxer = {


+ 2
- 2
libavformat/h261dec.c View File

@@ -56,9 +56,9 @@ static int h261_probe(AVProbeData *p)
} }
} }
if(valid_psc > 2*invalid_psc + 6){ if(valid_psc > 2*invalid_psc + 6){
return 50;
return AVPROBE_SCORE_EXTENSION;
}else if(valid_psc > 2*invalid_psc + 2) }else if(valid_psc > 2*invalid_psc + 2)
return 25;
return AVPROBE_SCORE_EXTENSION / 2;
return 0; return 0;
} }




+ 2
- 2
libavformat/h263dec.c View File

@@ -56,9 +56,9 @@ static int h263_probe(AVProbeData *p)
} }
} }
if(valid_psc > 2*invalid_psc + 2*res_change + 3){ if(valid_psc > 2*invalid_psc + 2*res_change + 3){
return 50;
return AVPROBE_SCORE_EXTENSION;
}else if(valid_psc > 2*invalid_psc) }else if(valid_psc > 2*invalid_psc)
return 25;
return AVPROBE_SCORE_EXTENSION / 2;
return 0; return 0;
} }




+ 1
- 1
libavformat/h264dec.c View File

@@ -63,7 +63,7 @@ static int h264_probe(AVProbeData *p)
} }
} }
if(sps && pps && (idr||sli>3) && res<(sps+pps+idr)) if(sps && pps && (idr||sli>3) && res<(sps+pps+idr))
return AVPROBE_SCORE_MAX/2+1; // +1 for .mpg
return AVPROBE_SCORE_EXTENSION + 1; // 1 more than .mpg
return 0; return 0;
} }




+ 1
- 1
libavformat/idcin.c View File

@@ -137,7 +137,7 @@ static int idcin_probe(AVProbeData *p)
return 0; return 0;


/* return half certainty since this check is a bit sketchy */ /* return half certainty since this check is a bit sketchy */
return AVPROBE_SCORE_MAX / 2;
return AVPROBE_SCORE_EXTENSION;
} }


static int idcin_read_header(AVFormatContext *s) static int idcin_read_header(AVFormatContext *s)


+ 1
- 1
libavformat/img2dec.c View File

@@ -185,7 +185,7 @@ static int img_read_probe(AVProbeData *p)
else if (av_match_ext(p->filename, "raw") || av_match_ext(p->filename, "gif")) else if (av_match_ext(p->filename, "raw") || av_match_ext(p->filename, "gif"))
return 5; return 5;
else else
return AVPROBE_SCORE_MAX / 2;
return AVPROBE_SCORE_EXTENSION;
} }
return 0; return 0;
} }


+ 1
- 1
libavformat/m4vdec.c View File

@@ -45,7 +45,7 @@ static int mpeg4video_probe(AVProbeData *probe_packet)
} }


if (VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res==0) if (VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res==0)
return VOP+VO > 3 ? AVPROBE_SCORE_MAX/2 : AVPROBE_SCORE_MAX/4;
return VOP+VO > 3 ? AVPROBE_SCORE_EXTENSION : AVPROBE_SCORE_EXTENSION/2;
return 0; return 0;
} }




+ 1
- 1
libavformat/matroskadec.c View File

@@ -1060,7 +1060,7 @@ static int matroska_probe(AVProbeData *p)
} }


// probably valid EBML header but no recognized doctype // probably valid EBML header but no recognized doctype
return AVPROBE_SCORE_MAX/2;
return AVPROBE_SCORE_EXTENSION;
} }


static MatroskaTrack *matroska_find_track_by_num(MatroskaDemuxContext *matroska, static MatroskaTrack *matroska_find_track_by_num(MatroskaDemuxContext *matroska,


+ 1
- 1
libavformat/mm.c View File

@@ -79,7 +79,7 @@ static int probe(AVProbeData *p)
return 0; return 0;


/* only return half certainty since this check is a bit sketchy */ /* only return half certainty since this check is a bit sketchy */
return AVPROBE_SCORE_MAX / 2;
return AVPROBE_SCORE_EXTENSION;
} }


static int read_header(AVFormatContext *s) static int read_header(AVFormatContext *s)


+ 2
- 2
libavformat/mov.c View File

@@ -2887,7 +2887,7 @@ static int mov_probe(AVProbeData *p)
(AV_RB32(p->buf+offset) != 1 || (AV_RB32(p->buf+offset) != 1 ||
offset + 12 > (unsigned int)p->buf_size || offset + 12 > (unsigned int)p->buf_size ||
AV_RB64(p->buf+offset + 8) == 0)) { AV_RB64(p->buf+offset + 8) == 0)) {
score = FFMAX(score, AVPROBE_SCORE_MAX - 50);
score = FFMAX(score, AVPROBE_SCORE_EXTENSION);
} else { } else {
score = AVPROBE_SCORE_MAX; score = AVPROBE_SCORE_MAX;
} }
@@ -2907,7 +2907,7 @@ static int mov_probe(AVProbeData *p)
case MKTAG('u','u','i','d'): case MKTAG('u','u','i','d'):
case MKTAG('p','r','f','l'): case MKTAG('p','r','f','l'):
/* if we only find those cause probedata is too small at least rate them */ /* if we only find those cause probedata is too small at least rate them */
score = FFMAX(score, AVPROBE_SCORE_MAX - 50);
score = FFMAX(score, AVPROBE_SCORE_EXTENSION);
offset = FFMAX(4, AV_RB32(p->buf+offset)) + offset; offset = FFMAX(4, AV_RB32(p->buf+offset)) + offset;
break; break;
default: default:


+ 4
- 4
libavformat/mp3dec.c View File

@@ -76,11 +76,11 @@ static int mp3_read_probe(AVProbeData *p)
} }
// keep this in sync with ac3 probe, both need to avoid // keep this in sync with ac3 probe, both need to avoid
// issues with MPEG-files! // issues with MPEG-files!
if (first_frames>=4) return AVPROBE_SCORE_MAX/2+1;
else if(max_frames>200)return AVPROBE_SCORE_MAX/2;
else if(max_frames>=4) return AVPROBE_SCORE_MAX/4;
if (first_frames>=4) return AVPROBE_SCORE_EXTENSION + 1;
else if(max_frames>200)return AVPROBE_SCORE_EXTENSION;
else if(max_frames>=4) return AVPROBE_SCORE_EXTENSION / 2;
else if(ff_id3v2_match(buf0, ID3v2_DEFAULT_MAGIC) && 2*ff_id3v2_tag_len(buf0) >= p->buf_size) else if(ff_id3v2_match(buf0, ID3v2_DEFAULT_MAGIC) && 2*ff_id3v2_tag_len(buf0) >= p->buf_size)
return AVPROBE_SCORE_MAX/8;
return AVPROBE_SCORE_EXTENSION / 4;
else if(max_frames>=1) return 1; else if(max_frames>=1) return 1;
else return 0; else return 0;
//mpegps_mp3_unrecognized_format.mpg has max_frames=3 //mpegps_mp3_unrecognized_format.mpg has max_frames=3


+ 1
- 1
libavformat/mpc8.c View File

@@ -92,7 +92,7 @@ static int mpc8_probe(AVProbeData *p)
if (size < 2) if (size < 2)
return 0; return 0;
if (bs + size - 2 >= bs_end) if (bs + size - 2 >= bs_end)
return AVPROBE_SCORE_MAX / 4 - 1; //seems to be valid MPC but no header yet
return AVPROBE_SCORE_EXTENSION - 1; // seems to be valid MPC but no header yet
if (header_found) { if (header_found) {
if (size < 11 || size > 28) if (size < 11 || size > 28)
return 0; return 0;


+ 4
- 4
libavformat/mpeg.c View File

@@ -89,14 +89,14 @@ static int mpegps_probe(AVProbeData *p)
} }


if(vid+audio > invalid+1) /* invalid VDR files nd short PES streams */ if(vid+audio > invalid+1) /* invalid VDR files nd short PES streams */
score= AVPROBE_SCORE_MAX/4;
score = AVPROBE_SCORE_EXTENSION / 2;


if(sys>invalid && sys*9 <= pspack*10) if(sys>invalid && sys*9 <= pspack*10)
return (audio > 12 || vid > 3 || pspack > 2) ? AVPROBE_SCORE_MAX/2+2 : AVPROBE_SCORE_MAX/4; // +1 for .mpg
return (audio > 12 || vid > 3 || pspack > 2) ? AVPROBE_SCORE_EXTENSION + 2 : AVPROBE_SCORE_EXTENSION / 2; // 1 more than .mpg
if(pspack > invalid && (priv1+vid+audio)*10 >= pspack*9) if(pspack > invalid && (priv1+vid+audio)*10 >= pspack*9)
return pspack > 2 ? AVPROBE_SCORE_MAX/2+2 : AVPROBE_SCORE_MAX/4; // +1 for .mpg
return pspack > 2 ? AVPROBE_SCORE_EXTENSION + 2 : AVPROBE_SCORE_EXTENSION / 2; // 1 more than .mpg
if((!!vid ^ !!audio) && (audio > 4 || vid > 1) && !sys && !pspack && p->buf_size>2048 && vid + audio > invalid) /* PES stream */ if((!!vid ^ !!audio) && (audio > 4 || vid > 1) && !sys && !pspack && p->buf_size>2048 && vid + audio > invalid) /* PES stream */
return (audio > 12 || vid > 3 + 2*invalid) ? AVPROBE_SCORE_MAX/2+2 : AVPROBE_SCORE_MAX/4;
return (audio > 12 || vid > 3 + 2*invalid) ? AVPROBE_SCORE_EXTENSION + 2 : AVPROBE_SCORE_EXTENSION / 2;


//02-Penguin.flac has sys:0 priv1:0 pspack:0 vid:0 audio:1 //02-Penguin.flac has sys:0 priv1:0 pspack:0 vid:0 audio:1
//mp3_misidentified_2.mp3 has sys:0 priv1:0 pspack:0 vid:0 audio:6 //mp3_misidentified_2.mp3 has sys:0 priv1:0 pspack:0 vid:0 audio:6


+ 2
- 2
libavformat/mpegvideodec.c View File

@@ -63,8 +63,8 @@ static int mpegvideo_probe(AVProbeData *p)
} }
} }
if(seq && seq*9<=pic*10 && pic*9<=slice*10 && !pspack && !apes && !res && slice > sicle) { if(seq && seq*9<=pic*10 && pic*9<=slice*10 && !pspack && !apes && !res && slice > sicle) {
if(vpes) return AVPROBE_SCORE_MAX/8;
else return pic>1 ? AVPROBE_SCORE_MAX/2+1 : AVPROBE_SCORE_MAX/4; // +1 for .mpg
if(vpes) return AVPROBE_SCORE_EXTENSION / 4;
else return pic>1 ? AVPROBE_SCORE_EXTENSION + 1 : AVPROBE_SCORE_EXTENSION / 2; // +1 for .mpg
} }
return 0; return 0;
} }


+ 2
- 2
libavformat/mtv.c View File

@@ -64,13 +64,13 @@ static int mtv_probe(AVProbeData *p)
if(!AV_RL16(&p->buf[52]) || !AV_RL16(&p->buf[54])) if(!AV_RL16(&p->buf[52]) || !AV_RL16(&p->buf[54]))
{ {
if(!!AV_RL16(&p->buf[56])) if(!!AV_RL16(&p->buf[56]))
return AVPROBE_SCORE_MAX/2;
return AVPROBE_SCORE_EXTENSION;
else else
return 0; return 0;
} }


if(p->buf[51] != 16) if(p->buf[51] != 16)
return AVPROBE_SCORE_MAX/4; // But we are going to assume 16bpp anyway ..
return AVPROBE_SCORE_EXTENSION / 2; // But we are going to assume 16bpp anyway ..


return AVPROBE_SCORE_MAX; return AVPROBE_SCORE_MAX;
} }


+ 1
- 1
libavformat/nsvdec.c View File

@@ -786,7 +786,7 @@ static int nsv_probe(AVProbeData *p)
} }
/* so we'll have more luck on extension... */ /* so we'll have more luck on extension... */
if (av_match_ext(p->filename, "nsv")) if (av_match_ext(p->filename, "nsv"))
return AVPROBE_SCORE_MAX/2;
return AVPROBE_SCORE_EXTENSION;
/* FIXME: add mime-type check */ /* FIXME: add mime-type check */
return score; return score;
} }


+ 1
- 1
libavformat/omadec.c View File

@@ -433,7 +433,7 @@ static int oma_read_probe(AVProbeData *p)
/* This check cannot overflow as tag_len has at most 28 bits */ /* This check cannot overflow as tag_len has at most 28 bits */
if (p->buf_size < tag_len + 5) if (p->buf_size < tag_len + 5)
/* EA3 header comes late, might be outside of the probe buffer */ /* EA3 header comes late, might be outside of the probe buffer */
return AVPROBE_SCORE_MAX / 2;
return AVPROBE_SCORE_EXTENSION;


buf += tag_len; buf += tag_len;




+ 1
- 1
libavformat/psxstr.c View File

@@ -126,7 +126,7 @@ static int str_probe(AVProbeData *p)
} }
/* MPEG files (like those ripped from VCDs) can also look like this; /* MPEG files (like those ripped from VCDs) can also look like this;
* only return half certainty */ * only return half certainty */
if(vid+aud > 3) return 50;
if(vid+aud > 3) return AVPROBE_SCORE_EXTENSION;
else if(vid+aud) return 1; else if(vid+aud) return 1;
else return 0; else return 0;
} }


+ 1
- 1
libavformat/pva.c View File

@@ -49,7 +49,7 @@ static int pva_probe(AVProbeData * pd) {


if (pd->buf_size >= len + 8 && if (pd->buf_size >= len + 8 &&
pva_check(buf + len) >= 0) pva_check(buf + len) >= 0)
return AVPROBE_SCORE_MAX / 2;
return AVPROBE_SCORE_EXTENSION;


return AVPROBE_SCORE_MAX / 4; return AVPROBE_SCORE_MAX / 4;
} }


+ 1
- 1
libavformat/rtsp.c View File

@@ -2030,7 +2030,7 @@ static int sdp_probe(AVProbeData *p1)
while (p < p_end && *p != '\0') { while (p < p_end && *p != '\0') {
if (p + sizeof("c=IN IP") - 1 < p_end && if (p + sizeof("c=IN IP") - 1 < p_end &&
av_strstart(p, "c=IN IP", NULL)) av_strstart(p, "c=IN IP", NULL))
return AVPROBE_SCORE_MAX / 2;
return AVPROBE_SCORE_EXTENSION;


while (p < p_end - 1 && *p != '\n') p++; while (p < p_end - 1 && *p != '\n') p++;
if (++p >= p_end) if (++p >= p_end)


+ 1
- 1
libavformat/sierravmd.c View File

@@ -77,7 +77,7 @@ static int vmd_probe(AVProbeData *p)
return 0; return 0;


/* only return half certainty since this check is a bit sketchy */ /* only return half certainty since this check is a bit sketchy */
return AVPROBE_SCORE_MAX / 2;
return AVPROBE_SCORE_EXTENSION;
} }


static int vmd_read_header(AVFormatContext *s) static int vmd_read_header(AVFormatContext *s)


+ 2
- 2
libavformat/spdifdec.c View File

@@ -154,10 +154,10 @@ int ff_spdif_probe(const uint8_t *p_buf, int buf_size, enum AVCodecID *codec)


if (sync_codes >= 6) if (sync_codes >= 6)
/* good amount of sync codes but with unexpected offsets */ /* good amount of sync codes but with unexpected offsets */
return AVPROBE_SCORE_MAX / 2;
return AVPROBE_SCORE_EXTENSION;


/* some sync codes were found */ /* some sync codes were found */
return AVPROBE_SCORE_MAX / 8;
return AVPROBE_SCORE_EXTENSION / 4;
} }


static int spdif_read_header(AVFormatContext *s) static int spdif_read_header(AVFormatContext *s)


+ 1
- 1
libavformat/takdec.c View File

@@ -33,7 +33,7 @@ typedef struct TAKDemuxContext {
static int tak_probe(AVProbeData *p) static int tak_probe(AVProbeData *p)
{ {
if (!memcmp(p->buf, "tBaK", 4)) if (!memcmp(p->buf, "tBaK", 4))
return AVPROBE_SCORE_MAX / 2;
return AVPROBE_SCORE_EXTENSION;
return 0; return 0;
} }




+ 1
- 1
libavformat/tta.c View File

@@ -36,7 +36,7 @@ static int tta_probe(AVProbeData *p)
const uint8_t *d = p->buf; const uint8_t *d = p->buf;


if (d[0] == 'T' && d[1] == 'T' && d[2] == 'A' && d[3] == '1') if (d[0] == 'T' && d[1] == 'T' && d[2] == 'A' && d[3] == '1')
return 80;
return AVPROBE_SCORE_EXTENSION + 30;
return 0; return 0;
} }




+ 3
- 3
libavformat/utils.c View File

@@ -376,10 +376,10 @@ 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, nodat ? AVPROBE_SCORE_MAX/4-1 : 1);
score = FFMAX(score, nodat ? AVPROBE_SCORE_EXTENSION / 2 - 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 = AVPROBE_SCORE_EXTENSION;
} }
} }
if (score > score_max) { if (score > score_max) {
@@ -389,7 +389,7 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score
fmt = NULL; fmt = NULL;
} }
if(nodat) if(nodat)
score_max = FFMIN(AVPROBE_SCORE_MAX/4-1, score_max);
score_max = FFMIN(AVPROBE_SCORE_EXTENSION / 2 - 1, score_max);
*score_ret= score_max; *score_ret= score_max;


return fmt; return fmt;


+ 1
- 1
libavformat/vc1test.c View File

@@ -39,7 +39,7 @@ static int vc1t_probe(AVProbeData *p)
if (p->buf[3] != 0xC5 || AV_RL32(&p->buf[4]) != 4 || AV_RL32(&p->buf[20]) != 0xC) if (p->buf[3] != 0xC5 || AV_RL32(&p->buf[4]) != 4 || AV_RL32(&p->buf[20]) != 0xC)
return 0; return 0;


return AVPROBE_SCORE_MAX/2;
return AVPROBE_SCORE_EXTENSION;
} }


static int vc1t_read_header(AVFormatContext *s) static int vc1t_read_header(AVFormatContext *s)


+ 1
- 1
libavformat/vqf.c View File

@@ -43,7 +43,7 @@ static int vqf_probe(AVProbeData *probe_packet)
if (!memcmp(probe_packet->buf + 4, "00052200", 8)) if (!memcmp(probe_packet->buf + 4, "00052200", 8))
return AVPROBE_SCORE_MAX; return AVPROBE_SCORE_MAX;


return AVPROBE_SCORE_MAX/2;
return AVPROBE_SCORE_EXTENSION;
} }


static void add_metadata(AVFormatContext *s, uint32_t tag, static void add_metadata(AVFormatContext *s, uint32_t tag,


+ 1
- 1
libavformat/westwood_aud.c View File

@@ -77,7 +77,7 @@ static int wsaud_probe(AVProbeData *p)
return 0; return 0;


/* return 1/2 certainty since this file check is a little sketchy */ /* return 1/2 certainty since this file check is a little sketchy */
return AVPROBE_SCORE_MAX / 2;
return AVPROBE_SCORE_EXTENSION;
} }


static int wsaud_read_header(AVFormatContext *s) static int wsaud_read_header(AVFormatContext *s)


+ 1
- 1
libavformat/xa.c View File

@@ -59,7 +59,7 @@ static int xa_probe(AVProbeData *p)
if (!channels || channels > 8 || !srate || srate > 192000 || if (!channels || channels > 8 || !srate || srate > 192000 ||
bits_per_sample < 4 || bits_per_sample > 32) bits_per_sample < 4 || bits_per_sample > 32)
return 0; return 0;
return AVPROBE_SCORE_MAX/2;
return AVPROBE_SCORE_EXTENSION;
} }


static int xa_read_header(AVFormatContext *s) static int xa_read_header(AVFormatContext *s)


Loading…
Cancel
Save