Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
97b164d0
Commit
97b164d0
authored
Jan 07, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/OggUtil: add OggExpectPageSeek()
parent
61e7e531
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
OggUtil.cxx
src/decoder/OggUtil.cxx
+40
-0
OggUtil.hxx
src/decoder/OggUtil.hxx
+16
-0
No files found.
src/decoder/OggUtil.cxx
View file @
97b164d0
...
...
@@ -76,3 +76,43 @@ OggExpectPageIn(ogg_sync_state &oy, ogg_stream_state &os,
ogg_stream_pagein
(
&
os
,
&
page
);
return
true
;
}
bool
OggExpectPageSeek
(
ogg_sync_state
&
oy
,
ogg_page
&
page
,
decoder
*
decoder
,
input_stream
*
input_stream
)
{
size_t
remaining_skipped
=
16384
;
while
(
true
)
{
int
r
=
ogg_sync_pageseek
(
&
oy
,
&
page
);
if
(
r
>
0
)
return
true
;
if
(
r
<
0
)
{
/* skipped -r bytes */
size_t
nbytes
=
-
r
;
if
(
nbytes
>
remaining_skipped
)
/* still no ogg page - we lost our
patience, abort */
return
false
;
remaining_skipped
-=
nbytes
;
continue
;
}
if
(
!
OggFeed
(
oy
,
decoder
,
input_stream
,
1024
))
return
false
;
}
}
bool
OggExpectPageSeekIn
(
ogg_sync_state
&
oy
,
ogg_stream_state
&
os
,
decoder
*
decoder
,
input_stream
*
is
)
{
ogg_page
page
;
if
(
!
OggExpectPageSeek
(
oy
,
page
,
decoder
,
is
))
return
false
;
ogg_stream_pagein
(
&
os
,
&
page
);
return
true
;
}
src/decoder/OggUtil.hxx
View file @
97b164d0
...
...
@@ -68,4 +68,20 @@ bool
OggExpectPageIn
(
ogg_sync_state
&
oy
,
ogg_stream_state
&
os
,
decoder
*
decoder
,
input_stream
*
is
);
/**
* Like OggExpectPage(), but allow skipping garbage (after seeking).
*/
bool
OggExpectPageSeek
(
ogg_sync_state
&
oy
,
ogg_page
&
page
,
decoder
*
decoder
,
input_stream
*
input_stream
);
/**
* Combines OggExpectPageSeek() and ogg_stream_pagein().
*
* @return true if a page was delivered to the stream
*/
bool
OggExpectPageSeekIn
(
ogg_sync_state
&
oy
,
ogg_stream_state
&
os
,
decoder
*
decoder
,
input_stream
*
is
);
#endif
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