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
9bc281be
Commit
9bc281be
authored
Jan 17, 2016
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/icodec: Improve autodetection.
Avoids misdetection of MPEG (B-)frames. Reviewed-by: Michael Bradshaw
parent
f59b727e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
3 deletions
+25
-3
icodec.c
libavformat/icodec.c
+25
-3
No files found.
libavformat/icodec.c
View file @
9bc281be
...
...
@@ -27,6 +27,7 @@
#include "libavutil/intreadwrite.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/bmp.h"
#include "libavcodec/png.h"
#include "avformat.h"
#include "internal.h"
...
...
@@ -44,9 +45,30 @@ typedef struct {
static
int
probe
(
AVProbeData
*
p
)
{
if
(
AV_RL16
(
p
->
buf
)
==
0
&&
AV_RL16
(
p
->
buf
+
2
)
==
1
&&
AV_RL16
(
p
->
buf
+
4
))
return
AVPROBE_SCORE_MAX
/
4
;
unsigned
i
,
frames
=
AV_RL16
(
p
->
buf
+
4
);
if
(
AV_RL16
(
p
->
buf
)
||
AV_RL16
(
p
->
buf
+
2
)
!=
1
||
!
frames
)
return
0
;
for
(
i
=
0
;
i
<
frames
;
i
++
)
{
unsigned
offset
;
if
(
AV_RL16
(
p
->
buf
+
10
+
i
*
16
)
&
~
1
)
return
FFMIN
(
i
,
AVPROBE_SCORE_MAX
/
4
);
if
(
p
->
buf
[
13
+
i
*
16
])
return
FFMIN
(
i
,
AVPROBE_SCORE_MAX
/
4
);
if
(
AV_RL32
(
p
->
buf
+
14
+
i
*
16
)
<
40
)
return
FFMIN
(
i
,
AVPROBE_SCORE_MAX
/
4
);
offset
=
AV_RL32
(
p
->
buf
+
18
+
i
*
16
);
if
(
offset
<
22
)
return
FFMIN
(
i
,
AVPROBE_SCORE_MAX
/
4
);
if
(
offset
+
8
>
p
->
buf_size
)
return
AVPROBE_SCORE_MAX
/
4
+
FFMIN
(
i
,
1
);
if
(
p
->
buf
[
offset
]
!=
40
&&
AV_RB64
(
p
->
buf
+
offset
)
!=
PNGSIG
)
return
FFMIN
(
i
,
AVPROBE_SCORE_MAX
/
4
);
if
(
i
*
16
+
6
>
p
->
buf_size
)
return
AVPROBE_SCORE_MAX
/
4
+
FFMIN
(
i
,
1
);
}
return
AVPROBE_SCORE_MAX
/
2
+
1
;
}
static
int
read_header
(
AVFormatContext
*
s
)
...
...
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