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
93d3e278
Commit
93d3e278
authored
Feb 02, 2006
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve mpeg1/2-es detection
Originally committed as revision 4923 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
e2a5fd20
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
21 deletions
+18
-21
raw.c
libavformat/raw.c
+18
-21
No files found.
libavformat/raw.c
View file @
93d3e278
...
...
@@ -286,31 +286,28 @@ static int video_read_header(AVFormatContext *s,
#define SEQ_START_CODE 0x000001b3
#define GOP_START_CODE 0x000001b8
#define PICTURE_START_CODE 0x00000100
#define SLICE_START_CODE 0x00000101
#define PACK_START_CODE 0x000001ba
/* XXX: improve that by looking at several start codes */
static
int
mpegvideo_probe
(
AVProbeData
*
p
)
{
int
code
;
const
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 */
/* 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
;
uint32_t
code
=
-
1
;
int
pic
=
0
,
seq
=
0
,
slice
=
0
,
pspack
=
0
;
int
i
;
for
(
i
=
0
;
i
<
p
->
buf_size
;
i
++
){
code
=
(
code
<<
8
)
+
p
->
buf
[
i
];
if
((
code
&
0xffffff00
)
==
0x100
)
{
switch
(
code
){
case
SEQ_START_CODE
:
seq
++
;
break
;
case
PICTURE_START_CODE
:
pic
++
;
break
;
case
SLICE_START_CODE
:
slice
++
;
break
;
case
PACK_START_CODE
:
pspack
++
;
break
;
}
}
}
if
(
seq
&&
pic
&&
slice
&&
seq
<
pic
&&
(
ABS
(
pic
-
slice
)
-
1
)
*
10
<
pic
&&
!
pspack
)
return
AVPROBE_SCORE_MAX
/
2
+
1
;
// +1 for .mpg
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