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
b3723274
Commit
b3723274
authored
Dec 03, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/Bridge: move code to DecoderControl::SetReady()
parent
9fb7cc79
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
17 deletions
+36
-17
Bridge.cxx
src/decoder/Bridge.cxx
+6
-17
DecoderControl.cxx
src/decoder/DecoderControl.cxx
+21
-0
DecoderControl.hxx
src/decoder/DecoderControl.hxx
+9
-0
No files found.
src/decoder/Bridge.cxx
View file @
b3723274
...
...
@@ -248,27 +248,20 @@ DecoderBridge::Ready(const AudioFormat audio_format,
{
struct
audio_format_string
af_string
;
assert
(
dc
.
state
==
DecoderState
::
START
);
assert
(
dc
.
pipe
!=
nullptr
);
assert
(
dc
.
pipe
->
IsEmpty
());
assert
(
convert
==
nullptr
);
assert
(
stream_tag
==
nullptr
);
assert
(
decoder_tag
==
nullptr
);
assert
(
!
seeking
);
assert
(
audio_format
.
IsDefined
());
assert
(
audio_format
.
IsValid
());
dc
.
in_audio_format
=
audio_format
;
dc
.
out_audio_format
=
audio_format
;
dc
.
out_audio_format
.
ApplyMask
(
dc
.
configured_audio_format
);
dc
.
seekable
=
seekable
;
dc
.
total_time
=
duration
;
FormatDebug
(
decoder_domain
,
"audio_format=%s, seekable=%s"
,
audio_format_to_string
(
dc
.
in_
audio_format
,
&
af_string
),
audio_format_to_string
(
audio_format
,
&
af_string
),
seekable
?
"true"
:
"false"
);
{
const
ScopeLock
protect
(
dc
.
mutex
);
dc
.
SetReady
(
audio_format
,
seekable
,
duration
);
}
if
(
dc
.
in_audio_format
!=
dc
.
out_audio_format
)
{
FormatDebug
(
decoder_domain
,
"converting to %s"
,
audio_format_to_string
(
dc
.
out_audio_format
,
...
...
@@ -283,10 +276,6 @@ DecoderBridge::Ready(const AudioFormat audio_format,
error
=
std
::
current_exception
();
}
}
const
ScopeLock
protect
(
dc
.
mutex
);
dc
.
state
=
DecoderState
::
DECODE
;
dc
.
client_cond
.
signal
();
}
DecoderCommand
...
...
src/decoder/DecoderControl.cxx
View file @
b3723274
...
...
@@ -53,6 +53,27 @@ DecoderControl::WaitForDecoder()
client_is_waiting
=
false
;
}
void
DecoderControl
::
SetReady
(
const
AudioFormat
audio_format
,
bool
_seekable
,
SignedSongTime
_duration
)
{
assert
(
state
==
DecoderState
::
START
);
assert
(
pipe
!=
nullptr
);
assert
(
pipe
->
IsEmpty
());
assert
(
audio_format
.
IsDefined
());
assert
(
audio_format
.
IsValid
());
in_audio_format
=
audio_format
;
out_audio_format
=
audio_format
;
out_audio_format
.
ApplyMask
(
configured_audio_format
);
seekable
=
_seekable
;
total_time
=
_duration
;
state
=
DecoderState
::
DECODE
;
client_cond
.
signal
();
}
bool
DecoderControl
::
IsCurrentSong
(
const
DetachedSong
&
_song
)
const
{
...
...
src/decoder/DecoderControl.hxx
View file @
b3723274
...
...
@@ -255,6 +255,15 @@ struct DecoderControl {
}
/**
* Transition this obejct from DecoderState::START to
* DecoderState::DECODE.
*
* Caller must lock the object.
*/
void
SetReady
(
const
AudioFormat
audio_format
,
bool
_seekable
,
SignedSongTime
_duration
);
/**
* Checks whether an error has occurred, and if so, rethrows
* 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