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
c1868e7e
Commit
c1868e7e
authored
Jan 13, 2014
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf: simplify handling of offset in av_probe_input_buuffer()
parent
99e20125
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
utils.c
libavformat/utils.c
+4
-6
No files found.
libavformat/utils.c
View file @
c1868e7e
...
@@ -242,7 +242,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
...
@@ -242,7 +242,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
const
char
*
filename
,
void
*
logctx
,
const
char
*
filename
,
void
*
logctx
,
unsigned
int
offset
,
unsigned
int
max_probe_size
)
unsigned
int
offset
,
unsigned
int
max_probe_size
)
{
{
AVProbeData
pd
=
{
filename
?
filename
:
""
,
NULL
,
-
offset
};
AVProbeData
pd
=
{
filename
?
filename
:
""
};
unsigned
char
*
buf
=
NULL
;
unsigned
char
*
buf
=
NULL
;
int
ret
=
0
,
probe_size
;
int
ret
=
0
,
probe_size
;
...
@@ -257,16 +257,14 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
...
@@ -257,16 +257,14 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
if
(
offset
>=
max_probe_size
)
{
if
(
offset
>=
max_probe_size
)
{
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
}
}
avio_skip
(
pb
,
offset
);
max_probe_size
-=
offset
;
for
(
probe_size
=
PROBE_BUF_MIN
;
probe_size
<=
max_probe_size
&&
!*
fmt
;
for
(
probe_size
=
PROBE_BUF_MIN
;
probe_size
<=
max_probe_size
&&
!*
fmt
;
probe_size
=
FFMIN
(
probe_size
<<
1
,
FFMAX
(
max_probe_size
,
probe_size
+
1
)))
{
probe_size
=
FFMIN
(
probe_size
<<
1
,
FFMAX
(
max_probe_size
,
probe_size
+
1
)))
{
int
score
=
probe_size
<
max_probe_size
?
AVPROBE_SCORE_MAX
/
4
:
0
;
int
score
=
probe_size
<
max_probe_size
?
AVPROBE_SCORE_MAX
/
4
:
0
;
int
buf_offset
=
(
probe_size
==
PROBE_BUF_MIN
)
?
0
:
probe_size
>>
1
;
int
buf_offset
=
(
probe_size
==
PROBE_BUF_MIN
)
?
0
:
probe_size
>>
1
;
if
(
probe_size
<
offset
)
{
continue
;
}
/* read probe data */
/* read probe data */
if
((
ret
=
av_reallocp
(
&
buf
,
probe_size
+
AVPROBE_PADDING_SIZE
))
<
0
)
if
((
ret
=
av_reallocp
(
&
buf
,
probe_size
+
AVPROBE_PADDING_SIZE
))
<
0
)
return
ret
;
return
ret
;
...
@@ -280,7 +278,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
...
@@ -280,7 +278,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
ret
=
0
;
/* error was end of file, nothing read */
ret
=
0
;
/* error was end of file, nothing read */
}
}
pd
.
buf_size
+=
ret
;
pd
.
buf_size
+=
ret
;
pd
.
buf
=
&
buf
[
offset
]
;
pd
.
buf
=
buf
;
memset
(
pd
.
buf
+
pd
.
buf_size
,
0
,
AVPROBE_PADDING_SIZE
);
memset
(
pd
.
buf
+
pd
.
buf_size
,
0
,
AVPROBE_PADDING_SIZE
);
...
...
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