Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
fa777321
Commit
fa777321
authored
Feb 02, 2003
by
Fabrice Bellard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid too many false detections
Originally committed as revision 1537 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
4c7e8619
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
31 deletions
+37
-31
mpeg.c
libavformat/mpeg.c
+21
-18
raw.c
libavformat/raw.c
+16
-13
No files found.
libavformat/mpeg.c
View file @
fa777321
...
...
@@ -405,28 +405,31 @@ static int mpeg_mux_end(AVFormatContext *ctx)
static
int
mpegps_probe
(
AVProbeData
*
p
)
{
int
code
,
c
,
i
;
co
de
=
0xff
;
int
code
;
co
nst
uint8_t
*
d
;
/* we search the first start code. If it is a packet start code,
then we decide it is mpeg ps. We do not send highest value to
give a chance to mpegts */
for
(
i
=
0
;
i
<
p
->
buf_size
;
i
++
)
{
c
=
p
->
buf
[
i
];
code
=
(
code
<<
8
)
|
c
;
if
((
code
&
0xffffff00
)
==
0x100
)
{
if
(
code
==
PACK_START_CODE
||
code
==
SYSTEM_HEADER_START_CODE
||
(
code
>=
0x1e0
&&
code
<=
0x1ef
)
||
(
code
>=
0x1c0
&&
code
<=
0x1df
)
||
code
==
PRIVATE_STREAM_2
||
code
==
PROGRAM_STREAM_MAP
||
code
==
PRIVATE_STREAM_1
||
code
==
PADDING_STREAM
)
return
AVPROBE_SCORE_MAX
-
1
;
else
return
0
;
}
/* NOTE: the search range was restricted to avoid too many false
detections */
if
(
p
->
buf_size
<
6
)
return
0
;
d
=
p
->
buf
;
code
=
(
d
[
0
]
<<
24
)
|
(
d
[
1
]
<<
16
)
|
(
d
[
2
]
<<
8
)
|
(
d
[
3
]);
if
((
code
&
0xffffff00
)
==
0x100
)
{
if
(
code
==
PACK_START_CODE
||
code
==
SYSTEM_HEADER_START_CODE
||
(
code
>=
0x1e0
&&
code
<=
0x1ef
)
||
(
code
>=
0x1c0
&&
code
<=
0x1df
)
||
code
==
PRIVATE_STREAM_2
||
code
==
PROGRAM_STREAM_MAP
||
code
==
PRIVATE_STREAM_1
||
code
==
PADDING_STREAM
)
return
AVPROBE_SCORE_MAX
-
1
;
else
return
0
;
}
return
0
;
}
...
...
libavformat/raw.c
View file @
fa777321
...
...
@@ -153,23 +153,26 @@ static int video_read_header(AVFormatContext *s,
/* XXX: improve that by looking at several start codes */
static
int
mpegvideo_probe
(
AVProbeData
*
p
)
{
int
code
,
c
,
i
;
co
de
=
0xff
;
int
code
;
co
nst
uint8_t
*
d
;
/* we search the first start code. If it is a sequence, gop or
picture start code then we decide it is an mpeg video
stream. We do not send highest value to give a chance to mpegts */
for
(
i
=
0
;
i
<
p
->
buf_size
;
i
++
)
{
c
=
p
->
buf
[
i
];
code
=
(
code
<<
8
)
|
c
;
if
((
code
&
0xffffff00
)
==
0x100
)
{
if
(
code
==
SEQ_START_CODE
||
code
==
GOP_START_CODE
||
code
==
PICTURE_START_CODE
)
return
50
-
1
;
else
return
0
;
}
/* NOTE: the search range was restricted to avoid too many false
detections */
if
(
p
->
buf_size
<
6
)
return
0
;
d
=
p
->
buf
;
code
=
(
d
[
0
]
<<
24
)
|
(
d
[
1
]
<<
16
)
|
(
d
[
2
]
<<
8
)
|
(
d
[
3
]);
if
((
code
&
0xffffff00
)
==
0x100
)
{
if
(
code
==
SEQ_START_CODE
||
code
==
GOP_START_CODE
||
code
==
PICTURE_START_CODE
)
return
50
-
1
;
else
return
0
;
}
return
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment