Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
Vorbis
Commits
a583b490
Commit
a583b490
authored
Jul 03, 2007
by
Monty
Browse files
New vorbisfile multiplexing support passes built-in playback and seeking
tests. svn path=/trunk/vorbis/; revision=13215
parent
3b6d229f
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/vorbisfile.c
View file @
a583b490
...
...
@@ -1330,8 +1330,14 @@ int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
if
(
result
)
goto
seek_error
;
}
}
else
{
ogg_int64_t
granulepos
=
ogg_page_granulepos
(
&
og
);
ogg_int64_t
granulepos
;
if
(
ogg_page_serialno
(
&
og
)
!=
vf
->
serialnos
[
link
])
continue
;
granulepos
=
ogg_page_granulepos
(
&
og
);
if
(
granulepos
==-
1
)
continue
;
if
(
granulepos
<
target
){
best
=
result
;
/* raw offset of packet with granulepos */
begin
=
vf
->
offset
;
/* raw offset of next page */
...
...
@@ -1378,7 +1384,7 @@ int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
_decode_clear
(
vf
);
vf
->
current_link
=
link
;
vf
->
current_serialno
=
ogg_page_
serialno
(
&
og
)
;
vf
->
current_serialno
=
vf
->
serialno
s
[
link
]
;
vf
->
ready_state
=
STREAMSET
;
}
else
{
...
...
@@ -1403,8 +1409,9 @@ int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
while
(
1
){
result
=
_get_prev_page
(
vf
,
&
og
);
if
(
result
<
0
)
goto
seek_error
;
if
(
ogg_page_granulepos
(
&
og
)
>-
1
||
!
ogg_page_continued
(
&
og
)){
if
(
ogg_page_serialno
(
&
og
)
==
vf
->
current_serialno
&&
(
ogg_page_granulepos
(
&
og
)
>-
1
||
!
ogg_page_continued
(
&
og
))){
return
ov_raw_seek
(
vf
,
result
);
}
vf
->
offset
=
result
;
...
...
@@ -1495,19 +1502,20 @@ int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){
/* suck in a new page */
if
(
_get_next_page
(
vf
,
&
og
,
-
1
)
<
0
)
break
;
if
(
vf
->
current_serialno
!=
ogg_page_
serialno
(
&
og
))
_decode_clear
(
vf
);
if
(
ogg_page_
bos
(
&
og
))
_decode_clear
(
vf
);
if
(
vf
->
ready_state
<
STREAMSET
){
long
serialno
=
ogg_page_serialno
(
&
og
);
int
link
;
vf
->
current_serialno
=
ogg_page_serialno
(
&
og
);
for
(
link
=
0
;
link
<
vf
->
links
;
link
++
)
if
(
vf
->
serialnos
[
link
]
==
vf
->
current_
serialno
)
break
;
if
(
link
==
vf
->
links
)
return
(
OV_EBADLINK
);
if
(
vf
->
serialnos
[
link
]
==
serialno
)
break
;
if
(
link
==
vf
->
links
)
continue
;
vf
->
current_link
=
link
;
ogg_stream_reset_serialno
(
&
vf
->
os
,
vf
->
current_serialno
);
vf
->
ready_state
=
STREAMSET
;
vf
->
current_serialno
=
ogg_page_serialno
(
&
og
);
ogg_stream_reset_serialno
(
&
vf
->
os
,
serialno
);
ret
=
_make_decode_ready
(
vf
);
if
(
ret
)
return
ret
;
lastblock
=
0
;
...
...
Write
Preview
Supports
Markdown
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