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
1af59d31
Commit
1af59d31
authored
9 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/opus: add method IsInitialized()
parent
20758cef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
OpusDecoderPlugin.cxx
src/decoder/plugins/OpusDecoderPlugin.cxx
+11
-4
No files found.
src/decoder/plugins/OpusDecoderPlugin.cxx
View file @
1af59d31
...
...
@@ -102,6 +102,13 @@ public:
~
MPDOpusDecoder
();
/**
* Has decoder_initialized() been called yet?
*/
bool
IsInitialized
()
const
{
return
previous_channels
!=
0
;
}
bool
ReadNextPage
(
OggSyncState
&
oy
);
DecoderCommand
HandlePackets
();
...
...
@@ -240,9 +247,9 @@ MPDOpusDecoder::HandleBOS(const ogg_packet &packet)
}
assert
(
opus_decoder
==
nullptr
);
assert
(
(
previous_channels
==
0
)
==
(
output_buffer
=
=
nullptr
));
assert
(
IsInitialized
()
==
(
output_buffer
!
=
nullptr
));
if
(
previous_channels
!=
0
&&
channels
!=
previous_channels
)
{
if
(
IsInitialized
()
&&
channels
!=
previous_channels
)
{
FormatWarning
(
opus_domain
,
"Next stream has different channels (%u -> %u)"
,
previous_channels
,
channels
);
...
...
@@ -263,7 +270,7 @@ MPDOpusDecoder::HandleBOS(const ogg_packet &packet)
return
DecoderCommand
::
STOP
;
}
if
(
previous_channels
!=
0
)
{
if
(
IsInitialized
()
)
{
/* decoder was already initialized by the previous
stream; skip the rest of this method */
LogDebug
(
opus_domain
,
"Found another stream"
);
...
...
@@ -293,7 +300,7 @@ MPDOpusDecoder::HandleBOS(const ogg_packet &packet)
inline
DecoderCommand
MPDOpusDecoder
::
HandleEOS
()
{
if
(
eos_granulepos
<
0
&&
previous_channels
!=
0
)
{
if
(
eos_granulepos
<
0
&&
IsInitialized
()
)
{
/* allow chaining of (unseekable) streams */
assert
(
opus_decoder
!=
nullptr
);
assert
(
output_buffer
!=
nullptr
);
...
...
This diff is collapsed.
Click to expand it.
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