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
56466d7b
Commit
56466d7b
authored
Jun 04, 2006
by
Måns Rullgård
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix seek related bugs
Originally committed as revision 5453 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
0d18f798
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
ogg2.c
libavformat/ogg2.c
+14
-6
No files found.
libavformat/ogg2.c
View file @
56466d7b
...
...
@@ -449,6 +449,7 @@ ogg_get_length (AVFormatContext * s)
{
ogg_t
*
ogg
=
s
->
priv_data
;
int
idx
=
-
1
,
i
;
offset_t
size
,
end
;
if
(
s
->
pb
.
is_streamed
)
return
0
;
...
...
@@ -457,8 +458,13 @@ ogg_get_length (AVFormatContext * s)
if
(
s
->
duration
!=
AV_NOPTS_VALUE
)
return
0
;
size
=
url_fsize
(
&
s
->
pb
);
if
(
size
<
0
)
return
0
;
end
=
size
>
MAX_PAGE_SIZE
?
size
-
MAX_PAGE_SIZE
:
size
;
ogg_save
(
s
);
url_fseek
(
&
s
->
pb
,
-
MAX_PAGE_SIZE
,
SEEK_END
);
url_fseek
(
&
s
->
pb
,
end
,
SEEK_SET
);
while
(
!
ogg_read_page
(
s
,
&
i
)){
if
(
ogg
->
streams
[
i
].
granule
!=
-
1
&&
ogg
->
streams
[
i
].
granule
!=
0
)
...
...
@@ -470,7 +476,7 @@ ogg_get_length (AVFormatContext * s)
ogg_gptopts
(
s
,
idx
,
ogg
->
streams
[
idx
].
granule
);
}
ogg
->
size
=
url_fsize
(
&
s
->
pb
)
;
ogg
->
size
=
size
;
ogg_restore
(
s
,
0
);
return
0
;
...
...
@@ -547,10 +553,11 @@ static int
ogg_read_seek
(
AVFormatContext
*
s
,
int
stream_index
,
int64_t
target_ts
,
int
flags
)
{
AVStream
*
st
=
s
->
streams
[
stream_index
];
ogg_t
*
ogg
=
s
->
priv_data
;
ByteIOContext
*
bc
=
&
s
->
pb
;
uint64_t
min
=
0
,
max
=
ogg
->
size
;
uint64_t
tmin
=
0
,
tmax
=
s
->
duration
;
uint64_t
tmin
=
0
,
tmax
=
s
t
->
duration
;
int64_t
pts
=
AV_NOPTS_VALUE
;
ogg_save
(
s
);
...
...
@@ -562,7 +569,8 @@ ogg_read_seek (AVFormatContext * s, int stream_index, int64_t target_ts,
url_fseek
(
bc
,
p
,
SEEK_SET
);
while
(
!
ogg_read_page
(
s
,
&
i
)){
if
(
ogg
->
streams
[
i
].
granule
!=
0
&&
ogg
->
streams
[
i
].
granule
!=
-
1
)
if
(
i
==
stream_index
&&
ogg
->
streams
[
i
].
granule
!=
0
&&
ogg
->
streams
[
i
].
granule
!=
-
1
)
break
;
}
...
...
@@ -572,7 +580,7 @@ ogg_read_seek (AVFormatContext * s, int stream_index, int64_t target_ts,
pts
=
ogg_gptopts
(
s
,
i
,
ogg
->
streams
[
i
].
granule
);
p
=
url_ftell
(
bc
);
if
(
ABS
(
pts
-
target_ts
)
<
1000000LL
)
if
(
ABS
(
pts
-
target_ts
)
*
st
->
time_base
.
num
<
st
->
time_base
.
den
)
break
;
if
(
pts
>
target_ts
){
...
...
@@ -584,7 +592,7 @@ ogg_read_seek (AVFormatContext * s, int stream_index, int64_t target_ts,
}
}
if
(
ABS
(
pts
-
target_ts
)
<
1000000LL
){
if
(
ABS
(
pts
-
target_ts
)
*
st
->
time_base
.
num
<
st
->
time_base
.
den
){
ogg_restore
(
s
,
1
);
ogg_reset
(
ogg
);
}
else
{
...
...
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