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
61e7e531
Commit
61e7e531
authored
Jan 08, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/Opus: move page reader into the decoder class
parent
ceb65291
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
13 deletions
+34
-13
OpusDecoderPlugin.cxx
src/decoder/OpusDecoderPlugin.cxx
+34
-13
No files found.
src/decoder/OpusDecoderPlugin.cxx
View file @
61e7e531
...
...
@@ -84,7 +84,9 @@ public:
:
decoder
(
_decoder
),
input_stream
(
_input_stream
)
{}
~
MPDOpusDecoder
();
enum
decoder_command
HandlePage
(
ogg_page
&
page
);
bool
ReadFirstPage
(
ogg_sync_state
&
oy
);
bool
ReadNextPage
(
ogg_sync_state
&
oy
);
enum
decoder_command
HandlePackets
();
enum
decoder_command
HandlePacket
(
const
ogg_packet
&
packet
);
enum
decoder_command
HandleBOS
(
const
ogg_packet
&
packet
);
...
...
@@ -103,19 +105,33 @@ MPDOpusDecoder::~MPDOpusDecoder()
ogg_stream_clear
(
&
os
);
}
inline
enum
decoder_command
MPDOpusDecoder
::
HandlePage
(
ogg_page
&
page
)
inline
bool
MPDOpusDecoder
::
ReadFirstPage
(
ogg_sync_state
&
oy
)
{
assert
(
!
os_initialized
);
if
(
!
OggExpectFirstPage
(
oy
,
os
,
decoder
,
input_stream
))
return
false
;
os_initialized
=
true
;
return
true
;
}
inline
bool
MPDOpusDecoder
::
ReadNextPage
(
ogg_sync_state
&
oy
)
{
assert
(
os_initialized
);
ogg_page
page
;
if
(
!
OggExpectPage
(
oy
,
page
,
decoder
,
input_stream
))
return
false
;
const
auto
page_serialno
=
ogg_page_serialno
(
&
page
);
if
(
!
os_initialized
)
{
os_initialized
=
true
;
ogg_stream_init
(
&
os
,
page_serialno
);
}
else
if
(
page_serialno
!=
os
.
serialno
)
if
(
page_serialno
!=
os
.
serialno
)
ogg_stream_reset_serialno
(
&
os
,
page_serialno
);
ogg_stream_pagein
(
&
os
,
&
page
);
return
HandlePackets
();
return
true
;
}
inline
enum
decoder_command
...
...
@@ -256,14 +272,19 @@ mpd_opus_stream_decode(struct decoder *decoder,
ogg_sync_state
oy
;
ogg_sync_init
(
&
oy
);
if
(
!
d
.
ReadFirstPage
(
oy
))
{
ogg_sync_clear
(
&
oy
);
return
;
}
while
(
true
)
{
ogg_page
page
;
if
(
!
OggExpectPage
(
oy
,
page
,
decoder
,
input_stream
)
)
enum
decoder_command
cmd
=
d
.
HandlePackets
()
;
if
(
cmd
!=
DECODE_COMMAND_NONE
)
break
;
enum
decoder_command
cmd
=
d
.
HandlePage
(
page
);
if
(
cmd
!=
DECODE_COMMAND_NONE
)
if
(
!
d
.
ReadNextPage
(
oy
))
break
;
}
ogg_sync_clear
(
&
oy
);
...
...
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