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
e3142312
Commit
e3142312
authored
Sep 21, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
player/Control: convert to class
parent
e5d1ac0b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
14 deletions
+37
-14
Client.hxx
src/client/Client.hxx
+1
-1
Control.hxx
src/player/Control.hxx
+29
-2
Thread.cxx
src/player/Thread.cxx
+1
-5
PlaylistQueue.hxx
src/playlist/PlaylistQueue.hxx
+1
-1
Playlist.cxx
src/queue/Playlist.cxx
+3
-3
Playlist.hxx
src/queue/Playlist.hxx
+1
-1
PlaylistState.hxx
src/queue/PlaylistState.hxx
+1
-1
No files found.
src/client/Client.hxx
View file @
e3142312
...
@@ -44,7 +44,7 @@ class EventLoop;
...
@@ -44,7 +44,7 @@ class EventLoop;
class
Path
;
class
Path
;
struct
Instance
;
struct
Instance
;
struct
Partition
;
struct
Partition
;
struct
PlayerControl
;
class
PlayerControl
;
struct
playlist
;
struct
playlist
;
class
Database
;
class
Database
;
class
Storage
;
class
Storage
;
...
...
src/player/Control.hxx
View file @
e3142312
...
@@ -109,7 +109,9 @@ struct PlayerStatus {
...
@@ -109,7 +109,9 @@ struct PlayerStatus {
SongTime
elapsed_time
;
SongTime
elapsed_time
;
};
};
struct
PlayerControl
final
:
AudioOutputClient
{
class
PlayerControl
final
:
public
AudioOutputClient
{
friend
class
Player
;
PlayerListener
&
listener
;
PlayerListener
&
listener
;
PlayerOutputs
&
outputs
;
PlayerOutputs
&
outputs
;
...
@@ -231,6 +233,7 @@ struct PlayerControl final : AudioOutputClient {
...
@@ -231,6 +233,7 @@ struct PlayerControl final : AudioOutputClient {
double
total_play_time
=
0
;
double
total_play_time
=
0
;
public
:
PlayerControl
(
PlayerListener
&
_listener
,
PlayerControl
(
PlayerListener
&
_listener
,
PlayerOutputs
&
_outputs
,
PlayerOutputs
&
_outputs
,
unsigned
buffer_chunks
,
unsigned
buffer_chunks
,
...
@@ -268,6 +271,7 @@ struct PlayerControl final : AudioOutputClient {
...
@@ -268,6 +271,7 @@ struct PlayerControl final : AudioOutputClient {
cond
.
signal
();
cond
.
signal
();
}
}
private
:
/**
/**
* Signals the object. The object is temporarily locked by
* Signals the object. The object is temporarily locked by
* this function.
* this function.
...
@@ -347,7 +351,6 @@ struct PlayerControl final : AudioOutputClient {
...
@@ -347,7 +351,6 @@ struct PlayerControl final : AudioOutputClient {
return
WaitOutputConsumed
(
threshold
);
return
WaitOutputConsumed
(
threshold
);
}
}
private
:
/**
/**
* Wait for the command to be finished by the player thread.
* Wait for the command to be finished by the player thread.
*
*
...
@@ -417,12 +420,14 @@ public:
...
@@ -417,12 +420,14 @@ public:
*/
*/
void
LockSetBorderPause
(
bool
border_pause
)
noexcept
;
void
LockSetBorderPause
(
bool
border_pause
)
noexcept
;
private
:
bool
ApplyBorderPause
()
noexcept
{
bool
ApplyBorderPause
()
noexcept
{
if
(
border_pause
)
if
(
border_pause
)
state
=
PlayerState
::
PAUSE
;
state
=
PlayerState
::
PAUSE
;
return
border_pause
;
return
border_pause
;
}
}
public
:
void
Kill
()
noexcept
;
void
Kill
()
noexcept
;
gcc_pure
gcc_pure
...
@@ -432,6 +437,7 @@ public:
...
@@ -432,6 +437,7 @@ public:
return
state
;
return
state
;
}
}
private
:
/**
/**
* Set the error. Discards any previous error condition.
* Set the error. Discards any previous error condition.
*
*
...
@@ -468,6 +474,7 @@ public:
...
@@ -468,6 +474,7 @@ public:
std
::
rethrow_exception
(
error
);
std
::
rethrow_exception
(
error
);
}
}
public
:
/**
/**
* Like CheckRethrowError(), but locks and unlocks the object.
* Like CheckRethrowError(), but locks and unlocks the object.
*/
*/
...
@@ -482,6 +489,7 @@ public:
...
@@ -482,6 +489,7 @@ public:
return
error_type
;
return
error_type
;
}
}
private
:
/**
/**
* Set the #tagged_song attribute to a newly allocated copy of
* Set the #tagged_song attribute to a newly allocated copy of
* the given #DetachedSong. Locks and unlocks the object.
* the given #DetachedSong. Locks and unlocks the object.
...
@@ -497,6 +505,7 @@ public:
...
@@ -497,6 +505,7 @@ public:
*/
*/
std
::
unique_ptr
<
DetachedSong
>
ReadTaggedSong
()
noexcept
;
std
::
unique_ptr
<
DetachedSong
>
ReadTaggedSong
()
noexcept
;
public
:
/**
/**
* Like ReadTaggedSong(), but locks and unlocks the object.
* Like ReadTaggedSong(), but locks and unlocks the object.
*/
*/
...
@@ -521,6 +530,10 @@ public:
...
@@ -521,6 +530,10 @@ public:
*/
*/
void
LockEnqueueSong
(
std
::
unique_ptr
<
DetachedSong
>
song
)
noexcept
;
void
LockEnqueueSong
(
std
::
unique_ptr
<
DetachedSong
>
song
)
noexcept
;
bool
HasNextSong
()
const
noexcept
{
return
next_song
!=
nullptr
;
}
/**
/**
* Makes the player thread seek the specified song to a position.
* Makes the player thread seek the specified song to a position.
*
*
...
@@ -531,6 +544,19 @@ public:
...
@@ -531,6 +544,19 @@ public:
*/
*/
void
LockSeek
(
std
::
unique_ptr
<
DetachedSong
>
song
,
SongTime
t
);
void
LockSeek
(
std
::
unique_ptr
<
DetachedSong
>
song
,
SongTime
t
);
private
:
/**
* Caller must lock the object.
*/
void
CancelPendingSeek
()
noexcept
{
if
(
!
seeking
)
return
;
seeking
=
false
;
ClientSignal
();
}
public
:
void
SetCrossFade
(
float
cross_fade_seconds
)
noexcept
;
void
SetCrossFade
(
float
cross_fade_seconds
)
noexcept
;
float
GetCrossFade
()
const
noexcept
{
float
GetCrossFade
()
const
noexcept
{
...
@@ -558,6 +584,7 @@ public:
...
@@ -558,6 +584,7 @@ public:
return
total_play_time
;
return
total_play_time
;
}
}
private
:
void
LockUpdateSongTag
(
DetachedSong
&
song
,
void
LockUpdateSongTag
(
DetachedSong
&
song
,
const
Tag
&
new_tag
)
noexcept
;
const
Tag
&
new_tag
)
noexcept
;
...
...
src/player/Thread.cxx
View file @
e3142312
...
@@ -261,12 +261,8 @@ private:
...
@@ -261,12 +261,8 @@ private:
bool
SeekDecoder
()
noexcept
;
bool
SeekDecoder
()
noexcept
;
void
CancelPendingSeek
()
noexcept
{
void
CancelPendingSeek
()
noexcept
{
if
(
!
pc
.
seeking
)
return
;
pending_seek
=
SongTime
::
zero
();
pending_seek
=
SongTime
::
zero
();
pc
.
seeking
=
false
;
pc
.
CancelPendingSeek
();
pc
.
ClientSignal
();
}
}
/**
/**
...
...
src/playlist/PlaylistQueue.hxx
View file @
e3142312
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
class
SongLoader
;
class
SongLoader
;
class
SongEnumerator
;
class
SongEnumerator
;
struct
playlist
;
struct
playlist
;
struct
PlayerControl
;
class
PlayerControl
;
/**
/**
* Loads the contents of a playlist and append it to the specified
* Loads the contents of a playlist and append it to the specified
...
...
src/queue/Playlist.cxx
View file @
e3142312
...
@@ -91,7 +91,7 @@ playlist::SongStarted()
...
@@ -91,7 +91,7 @@ playlist::SongStarted()
inline
void
inline
void
playlist
::
QueuedSongStarted
(
PlayerControl
&
pc
)
playlist
::
QueuedSongStarted
(
PlayerControl
&
pc
)
{
{
assert
(
pc
.
next_song
==
nullptr
);
assert
(
!
pc
.
HasNextSong
()
);
assert
(
queued
>=
-
1
);
assert
(
queued
>=
-
1
);
assert
(
current
>=
0
);
assert
(
current
>=
0
);
...
@@ -197,7 +197,7 @@ playlist::SyncWithPlayer(PlayerControl &pc)
...
@@ -197,7 +197,7 @@ playlist::SyncWithPlayer(PlayerControl &pc)
pc
.
Lock
();
pc
.
Lock
();
const
PlayerState
pc_state
=
pc
.
GetState
();
const
PlayerState
pc_state
=
pc
.
GetState
();
bool
pc_has_next_song
=
pc
.
next_song
!=
nullptr
;
bool
pc_has_next_song
=
pc
.
HasNextSong
()
;
pc
.
Unlock
();
pc
.
Unlock
();
if
(
pc_state
==
PlayerState
::
STOP
)
if
(
pc_state
==
PlayerState
::
STOP
)
...
@@ -213,7 +213,7 @@ playlist::SyncWithPlayer(PlayerControl &pc)
...
@@ -213,7 +213,7 @@ playlist::SyncWithPlayer(PlayerControl &pc)
QueuedSongStarted
(
pc
);
QueuedSongStarted
(
pc
);
pc
.
Lock
();
pc
.
Lock
();
pc_has_next_song
=
pc
.
next_song
!=
nullptr
;
pc_has_next_song
=
pc
.
HasNextSong
()
;
pc
.
Unlock
();
pc
.
Unlock
();
/* make sure the queued song is always set (if
/* make sure the queued song is always set (if
...
...
src/queue/Playlist.hxx
View file @
e3142312
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
enum
TagType
:
uint8_t
;
enum
TagType
:
uint8_t
;
struct
Tag
;
struct
Tag
;
struct
PlayerControl
;
class
PlayerControl
;
class
DetachedSong
;
class
DetachedSong
;
class
Database
;
class
Database
;
class
SongLoader
;
class
SongLoader
;
...
...
src/queue/PlaylistState.hxx
View file @
e3142312
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
struct
StateFileConfig
;
struct
StateFileConfig
;
struct
playlist
;
struct
playlist
;
struct
PlayerControl
;
class
PlayerControl
;
class
TextFile
;
class
TextFile
;
class
BufferedOutputStream
;
class
BufferedOutputStream
;
class
SongLoader
;
class
SongLoader
;
...
...
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