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
d0896ea7
Commit
d0896ea7
authored
Sep 27, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PlayerThread: convert struct player to a class
parent
a73d1e4b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
PlayerThread.cxx
src/PlayerThread.cxx
+17
-14
No files found.
src/PlayerThread.cxx
View file @
d0896ea7
...
...
@@ -49,7 +49,7 @@ enum class CrossFadeState : int8_t {
ENABLED
=
1
};
struct
p
layer
{
class
P
layer
{
player_control
&
pc
;
decoder_control
&
dc
;
...
...
@@ -128,7 +128,8 @@ struct player {
*/
float
elapsed_time
;
player
(
player_control
&
_pc
,
decoder_control
&
_dc
,
public
:
Player
(
player_control
&
_pc
,
decoder_control
&
_dc
,
MusicBuffer
&
_buffer
)
:
pc
(
_pc
),
dc
(
_dc
),
buffer
(
_buffer
),
buffering
(
false
),
...
...
@@ -143,6 +144,7 @@ struct player {
cross_fade_tag
(
nullptr
),
elapsed_time
(
0.0
)
{}
private
:
void
ClearAndDeletePipe
()
{
pipe
->
Clear
(
buffer
);
delete
pipe
;
...
...
@@ -262,6 +264,7 @@ struct player {
*/
bool
SongBorder
();
public
:
/*
* The main loop of the player thread, during playback. This
* is basically a state machine, which multiplexes data
...
...
@@ -279,7 +282,7 @@ player_command_finished(player_control &pc)
}
void
p
layer
::
StartDecoder
(
MusicPipe
&
_pipe
)
P
layer
::
StartDecoder
(
MusicPipe
&
_pipe
)
{
assert
(
queued
||
pc
.
command
==
PlayerCommand
::
SEEK
);
assert
(
pc
.
next_song
!=
nullptr
);
...
...
@@ -294,7 +297,7 @@ player::StartDecoder(MusicPipe &_pipe)
}
void
p
layer
::
StopDecoder
()
P
layer
::
StopDecoder
()
{
dc
.
Stop
();
...
...
@@ -311,7 +314,7 @@ player::StopDecoder()
}
bool
p
layer
::
WaitForDecoder
()
P
layer
::
WaitForDecoder
()
{
assert
(
queued
||
pc
.
command
==
PlayerCommand
::
SEEK
);
assert
(
pc
.
next_song
!=
nullptr
);
...
...
@@ -380,7 +383,7 @@ real_song_duration(const Song *song, double decoder_duration)
}
bool
p
layer
::
OpenOutput
()
P
layer
::
OpenOutput
()
{
assert
(
play_audio_format
.
IsDefined
());
assert
(
pc
.
state
==
PlayerState
::
PLAY
||
...
...
@@ -419,7 +422,7 @@ player::OpenOutput()
}
bool
p
layer
::
CheckDecoderStartup
()
P
layer
::
CheckDecoderStartup
()
{
assert
(
decoder_starting
);
...
...
@@ -477,7 +480,7 @@ player::CheckDecoderStartup()
}
bool
p
layer
::
SendSilence
()
P
layer
::
SendSilence
()
{
assert
(
output_open
);
assert
(
play_audio_format
.
IsDefined
());
...
...
@@ -512,7 +515,7 @@ player::SendSilence()
}
inline
bool
p
layer
::
SeekDecoder
()
P
layer
::
SeekDecoder
()
{
assert
(
pc
.
next_song
!=
nullptr
);
...
...
@@ -586,7 +589,7 @@ player::SeekDecoder()
}
inline
void
p
layer
::
ProcessCommand
()
P
layer
::
ProcessCommand
()
{
switch
(
pc
.
command
)
{
case
PlayerCommand
:
:
NONE
:
...
...
@@ -741,7 +744,7 @@ play_chunk(player_control &pc,
}
inline
bool
p
layer
::
PlayNextChunk
()
P
layer
::
PlayNextChunk
()
{
if
(
!
audio_output_all_wait
(
&
pc
,
64
))
/* the output pipe is still large enough, don't send
...
...
@@ -869,7 +872,7 @@ player::PlayNextChunk()
}
inline
bool
p
layer
::
SongBorder
()
P
layer
::
SongBorder
()
{
xfade_state
=
CrossFadeState
::
UNKNOWN
;
...
...
@@ -901,7 +904,7 @@ player::SongBorder()
}
inline
void
p
layer
::
Run
()
P
layer
::
Run
()
{
pipe
=
new
MusicPipe
();
...
...
@@ -1088,7 +1091,7 @@ static void
do_play
(
player_control
&
pc
,
decoder_control
&
dc
,
MusicBuffer
&
buffer
)
{
p
layer
player
(
pc
,
dc
,
buffer
);
P
layer
player
(
pc
,
dc
,
buffer
);
player
.
Run
();
}
...
...
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