forked from FFmpeg/FFmpeg
replace probe() by one similar to MPEG-ES
Originally committed as revision 4964 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
47f388503b
commit
9870a7bdb8
1 changed files with 10 additions and 21 deletions
|
@ -1262,32 +1262,21 @@ static int mpeg_mux_end(AVFormatContext *ctx)
|
||||||
|
|
||||||
static int mpegps_probe(AVProbeData *p)
|
static int mpegps_probe(AVProbeData *p)
|
||||||
{
|
{
|
||||||
|
uint32_t code= -1;
|
||||||
|
int sys=0, pspack=0;
|
||||||
int i;
|
int i;
|
||||||
int size= FFMIN(20, p->buf_size);
|
|
||||||
uint32_t code=0xFF;
|
|
||||||
|
|
||||||
/* we search the first start code. If it is a packet start code,
|
for(i=0; i<p->buf_size; i++){
|
||||||
then we decide it is mpeg ps. We do not send highest value to
|
code = (code<<8) + p->buf[i];
|
||||||
give a chance to mpegts */
|
|
||||||
/* NOTE: the search range was restricted to avoid too many false
|
|
||||||
detections */
|
|
||||||
|
|
||||||
for (i = 0; i < size; i++) {
|
|
||||||
code = (code << 8) | p->buf[i];
|
|
||||||
if ((code & 0xffffff00) == 0x100) {
|
if ((code & 0xffffff00) == 0x100) {
|
||||||
if (code == PACK_START_CODE ||
|
switch(code){
|
||||||
code == SYSTEM_HEADER_START_CODE ||
|
case SYSTEM_HEADER_START_CODE: sys++; break;
|
||||||
(code >= 0x1e0 && code <= 0x1ef) ||
|
case PACK_START_CODE: pspack++; break;
|
||||||
(code >= 0x1c0 && code <= 0x1df) ||
|
}
|
||||||
code == PRIVATE_STREAM_2 ||
|
|
||||||
code == PROGRAM_STREAM_MAP ||
|
|
||||||
code == PRIVATE_STREAM_1 ||
|
|
||||||
code == PADDING_STREAM)
|
|
||||||
return AVPROBE_SCORE_MAX - 2;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(sys && sys*9 <= pspack*10)
|
||||||
|
return AVPROBE_SCORE_MAX/2+2; // +1 for .mpg
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue