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
59810f83
Commit
59810f83
authored
Sep 08, 2011
by
Yan Jing
Committed by
Michael Niedermayer
Sep 08, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffmdec: handle wrapped file in ffm_seek
parent
6337de92
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
ffmdec.c
libavformat/ffmdec.c
+16
-2
No files found.
libavformat/ffmdec.c
View file @
59810f83
...
...
@@ -461,11 +461,25 @@ static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, in
av_dlog
(
s
,
"wanted_pts=%0.6f
\n
"
,
wanted_pts
/
1000000
.
0
);
/* find the position using linear interpolation (better than
dichotomy in typical cases) */
pos_min
=
FFM_PACKET_SIZE
;
pos_max
=
ffm
->
file_size
-
FFM_PACKET_SIZE
;
if
(
ffm
->
write_index
<
ffm
->
file_size
)
{
if
(
get_dts
(
s
,
FFM_PACKET_SIZE
)
<
wanted_pts
)
{
pos_min
=
FFM_PACKET_SIZE
;
pos_max
=
ffm
->
write_index
-
FFM_PACKET_SIZE
;
}
else
{
pos_min
=
ffm
->
write_index
;
pos_max
=
ffm
->
file_size
-
FFM_PACKET_SIZE
;
}
}
else
{
pos_min
=
FFM_PACKET_SIZE
;
pos_max
=
ffm
->
file_size
-
FFM_PACKET_SIZE
;
}
while
(
pos_min
<=
pos_max
)
{
pts_min
=
get_dts
(
s
,
pos_min
);
pts_max
=
get_dts
(
s
,
pos_max
);
if
(
pts_min
>
wanted_pts
||
pts_max
<
wanted_pts
)
{
pos
=
pts_min
>
wanted_pts
?
pos_min
:
pos_max
;
goto
found
;
}
/* linear interpolation */
pos1
=
(
double
)(
pos_max
-
pos_min
)
*
(
double
)(
wanted_pts
-
pts_min
)
/
(
double
)(
pts_max
-
pts_min
);
...
...
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