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
9fb5aad1
Commit
9fb5aad1
authored
Jan 08, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/OggUtil: add OggExpectFirstPage() and OggExpectPageIn()
parent
a6301d45
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
8 deletions
+48
-8
OggUtil.cxx
src/decoder/OggUtil.cxx
+25
-0
OggUtil.hxx
src/decoder/OggUtil.hxx
+20
-0
OpusDecoderPlugin.cxx
src/decoder/OpusDecoderPlugin.cxx
+3
-8
No files found.
src/decoder/OggUtil.cxx
View file @
9fb5aad1
...
...
@@ -51,3 +51,28 @@ OggExpectPage(ogg_sync_state &oy, ogg_page &page,
return
false
;
}
}
bool
OggExpectFirstPage
(
ogg_sync_state
&
oy
,
ogg_stream_state
&
os
,
decoder
*
decoder
,
input_stream
*
is
)
{
ogg_page
page
;
if
(
!
OggExpectPage
(
oy
,
page
,
decoder
,
is
))
return
false
;
ogg_stream_init
(
&
os
,
ogg_page_serialno
(
&
page
));
ogg_stream_pagein
(
&
os
,
&
page
);
return
true
;
}
bool
OggExpectPageIn
(
ogg_sync_state
&
oy
,
ogg_stream_state
&
os
,
decoder
*
decoder
,
input_stream
*
is
)
{
ogg_page
page
;
if
(
!
OggExpectPage
(
oy
,
page
,
decoder
,
is
))
return
false
;
ogg_stream_pagein
(
&
os
,
&
page
);
return
true
;
}
src/decoder/OggUtil.hxx
View file @
9fb5aad1
...
...
@@ -48,4 +48,24 @@ bool
OggExpectPage
(
ogg_sync_state
&
oy
,
ogg_page
&
page
,
decoder
*
decoder
,
input_stream
*
input_stream
);
/**
* Combines OggExpectPage(), ogg_stream_init() and
* ogg_stream_pagein().
*
* @return true if the stream was initialized and the first page was
* delivered to it
*/
bool
OggExpectFirstPage
(
ogg_sync_state
&
oy
,
ogg_stream_state
&
os
,
decoder
*
decoder
,
input_stream
*
is
);
/**
* Combines OggExpectPage() and ogg_stream_pagein().
*
* @return true if a page was delivered to the stream
*/
bool
OggExpectPageIn
(
ogg_sync_state
&
oy
,
ogg_stream_state
&
os
,
decoder
*
decoder
,
input_stream
*
is
);
#endif
src/decoder/OpusDecoderPlugin.cxx
View file @
9fb5aad1
...
...
@@ -269,8 +269,8 @@ mpd_opus_scan_stream(struct input_stream *is,
ogg_sync_state
oy
;
ogg_sync_init
(
&
oy
);
ogg_
page
page
;
if
(
!
OggExpect
Page
(
oy
,
page
,
nullptr
,
is
))
{
ogg_
stream_state
os
;
if
(
!
OggExpect
FirstPage
(
oy
,
os
,
nullptr
,
is
))
{
ogg_sync_clear
(
&
oy
);
return
false
;
}
...
...
@@ -280,10 +280,6 @@ mpd_opus_scan_stream(struct input_stream *is,
bool
result
=
false
;
ogg_stream_state
os
;
ogg_stream_init
(
&
os
,
ogg_page_serialno
(
&
page
));
ogg_stream_pagein
(
&
os
,
&
page
);
ogg_packet
packet
;
while
(
true
)
{
int
r
=
ogg_stream_packetout
(
&
os
,
&
packet
);
...
...
@@ -296,12 +292,11 @@ mpd_opus_scan_stream(struct input_stream *is,
if
(
remaining_pages
--
==
0
)
break
;
if
(
!
OggExpectPage
(
oy
,
page
,
nullptr
,
is
))
{
if
(
!
OggExpectPage
In
(
oy
,
os
,
nullptr
,
is
))
{
result
=
false
;
break
;
}
ogg_stream_pagein
(
&
os
,
&
page
);
continue
;
}
...
...
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