You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	avformat: replace "AVPROBE_SCORE_MAX / X" by AVPROBE_SCORE_EXTENSION / Y
Demuxers where the changed code looked less readable where skiped Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
		| @@ -43,7 +43,7 @@ static int aqt_probe(AVProbeData *p) | ||||
|     const char *ptr = p->buf; | ||||
|  | ||||
|     if (sscanf(ptr, "-->> %d", &frame) == 1) | ||||
|         return AVPROBE_SCORE_MAX / 2; | ||||
|         return AVPROBE_SCORE_EXTENSION; | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -27,7 +27,7 @@ | ||||
| static int avr_probe(AVProbeData *p) | ||||
| { | ||||
|     if (AV_RL32(p->buf) == MKTAG('2', 'B', 'I', 'T')) | ||||
|         return AVPROBE_SCORE_MAX / 2; | ||||
|         return AVPROBE_SCORE_EXTENSION; | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -44,7 +44,7 @@ static int probe(AVProbeData *p) | ||||
|             return 0; | ||||
|         i+=j; | ||||
|     } | ||||
|     return AVPROBE_SCORE_MAX/2; | ||||
|     return AVPROBE_SCORE_EXTENSION; | ||||
| } | ||||
|  | ||||
| static int read_header(AVFormatContext *s) | ||||
|   | ||||
| @@ -35,7 +35,7 @@ static int probe(AVProbeData *p) | ||||
|         || AV_RL32(p->buf + 48) % AV_RL32(p->buf + 21) | ||||
|         ) | ||||
|         return 0; | ||||
|     return AVPROBE_SCORE_MAX / 2; | ||||
|     return AVPROBE_SCORE_EXTENSION; | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -41,7 +41,7 @@ typedef struct CDXLDemuxContext { | ||||
|  | ||||
| static int cdxl_read_probe(AVProbeData *p) | ||||
| { | ||||
|     int score = AVPROBE_SCORE_MAX / 2 + 10; | ||||
|     int score = AVPROBE_SCORE_EXTENSION + 10; | ||||
|  | ||||
|     if (p->buf_size < CDXL_HEADER_SIZE) | ||||
|         return 0; | ||||
|   | ||||
| @@ -60,7 +60,7 @@ static int jacosub_probe(AVProbeData *p) | ||||
|             ptr++; | ||||
|         if (*ptr != '#' && *ptr != '\n') { | ||||
|             if (timed_line(ptr)) | ||||
|                 return AVPROBE_SCORE_MAX/2 + 1; | ||||
|                 return AVPROBE_SCORE_EXTENSION + 1; | ||||
|             return 0; | ||||
|         } | ||||
|         ptr += strcspn(ptr, "\n") + 1; | ||||
|   | ||||
| @@ -127,7 +127,7 @@ static int libquvi_probe(AVProbeData *p) | ||||
|     rc = quvi_init(&q); | ||||
|     if (rc != QUVI_OK) | ||||
|         return AVERROR(ENOMEM); | ||||
|     score = quvi_supported(q, (char *)p->filename) == QUVI_OK ? AVPROBE_SCORE_MAX/2 : 0; | ||||
|     score = quvi_supported(q, (char *)p->filename) == QUVI_OK ? AVPROBE_SCORE_EXTENSION : 0; | ||||
|     quvi_close(&q); | ||||
|     return score; | ||||
| } | ||||
|   | ||||
| @@ -52,9 +52,9 @@ static int loas_probe(AVProbeData *p) | ||||
|         if(buf == buf0) | ||||
|             first_frames= frames; | ||||
|     } | ||||
|     if   (first_frames>=3) return AVPROBE_SCORE_MAX/2+1; | ||||
|     else if(max_frames>100)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>100)return AVPROBE_SCORE_EXTENSION; | ||||
|     else if(max_frames>=3) return AVPROBE_SCORE_EXTENSION / 2; | ||||
|     else                   return 0; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -26,7 +26,7 @@ | ||||
| static int lvf_probe(AVProbeData *p) | ||||
| { | ||||
|     if (AV_RL32(p->buf) == MKTAG('L', 'V', 'F', 'F')) | ||||
|         return AVPROBE_SCORE_MAX / 2; | ||||
|         return AVPROBE_SCORE_EXTENSION; | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -41,7 +41,7 @@ static int mpsub_probe(AVProbeData *p) | ||||
|  | ||||
|         if (!memcmp(ptr, "FORMAT=TIME", 11) || | ||||
|             sscanf(ptr, "FORMAT=%d", &n) == 1) | ||||
|             return AVPROBE_SCORE_MAX/2; | ||||
|             return AVPROBE_SCORE_EXTENSION; | ||||
|         ptr += strcspn(ptr, "\n") + 1; | ||||
|     } | ||||
|     return 0; | ||||
|   | ||||
| @@ -41,7 +41,7 @@ static int realtext_probe(AVProbeData *p) | ||||
|  | ||||
|     if (AV_RB24(ptr) == 0xEFBBBF) | ||||
|         ptr += 3;  /* skip UTF-8 BOM */ | ||||
|     return !av_strncasecmp(ptr, "<window", 7) ? AVPROBE_SCORE_MAX/2 : 0; | ||||
|     return !av_strncasecmp(ptr, "<window", 7) ? AVPROBE_SCORE_EXTENSION : 0; | ||||
| } | ||||
|  | ||||
| static int read_ts(const char *s) | ||||
|   | ||||
| @@ -36,7 +36,7 @@ static int subviewer1_probe(AVProbeData *p) | ||||
|     const unsigned char *ptr = p->buf; | ||||
|  | ||||
|     if (strstr(ptr, "******** START SCRIPT ********")) | ||||
|         return AVPROBE_SCORE_MAX / 2; | ||||
|         return AVPROBE_SCORE_EXTENSION; | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -44,7 +44,7 @@ static int subviewer_probe(AVProbeData *p) | ||||
|     if (AV_RB24(ptr) == 0xEFBBBF) | ||||
|         ptr += 3;  /* skip UTF-8 BOM */ | ||||
|     if (sscanf(ptr, "%*u:%*u:%*u.%*u,%*u:%*u:%*u.%*u%c", &c) == 1) | ||||
|         return AVPROBE_SCORE_MAX/2; | ||||
|         return AVPROBE_SCORE_EXTENSION; | ||||
|     if (!strncmp(ptr, "[INFORMATION]", 13)) | ||||
|         return AVPROBE_SCORE_MAX/3; | ||||
|     return 0; | ||||
|   | ||||
| @@ -340,7 +340,7 @@ static av_cold int tedcaptions_read_probe(AVProbeData *p) | ||||
|             count++; | ||||
|     } | ||||
|     return count == FF_ARRAY_ELEMS(tags) ? AVPROBE_SCORE_MAX : | ||||
|            count                         ? AVPROBE_SCORE_MAX / 2 : 0; | ||||
|            count                         ? AVPROBE_SCORE_EXTENSION : 0; | ||||
| } | ||||
|  | ||||
| static int tedcaptions_read_seek(AVFormatContext *avf, int stream_index, | ||||
|   | ||||
| @@ -99,7 +99,7 @@ static int wav_probe(AVProbeData *p) | ||||
| static void handle_stream_probing(AVStream *st) | ||||
| { | ||||
|     if (st->codec->codec_id == AV_CODEC_ID_PCM_S16LE) { | ||||
|         st->request_probe = AVPROBE_SCORE_MAX/2; | ||||
|         st->request_probe = AVPROBE_SCORE_EXTENSION; | ||||
|         st->probe_packets = FFMIN(st->probe_packets, 4); | ||||
|     } | ||||
| } | ||||
| @@ -427,7 +427,7 @@ static int wav_read_packet(AVFormatContext *s, AVPacket *pkt) | ||||
|         enum AVCodecID codec; | ||||
|         ret = ff_spdif_probe(s->pb->buffer, s->pb->buf_end - s->pb->buffer, | ||||
|                              &codec); | ||||
|         if (ret > AVPROBE_SCORE_MAX / 2) { | ||||
|         if (ret > AVPROBE_SCORE_EXTENSION) { | ||||
|             s->streams[0]->codec->codec_id = codec; | ||||
|             wav->spdif = 1; | ||||
|         } else { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user