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
ac8c1d0a
Commit
ac8c1d0a
authored
Nov 26, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Playlist: move more functions into the class
parent
921d01b5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
28 deletions
+29
-28
Playlist.cxx
src/queue/Playlist.cxx
+18
-28
Playlist.hxx
src/queue/Playlist.hxx
+11
-0
No files found.
src/queue/Playlist.cxx
View file @
ac8c1d0a
...
@@ -44,21 +44,18 @@ playlist::TagModified(DetachedSong &&song)
...
@@ -44,21 +44,18 @@ playlist::TagModified(DetachedSong &&song)
idle_add
(
IDLE_PLAYLIST
);
idle_add
(
IDLE_PLAYLIST
);
}
}
/**
inline
void
* Queue a song, addressed by its order number.
playlist
::
QueueSongOrder
(
PlayerControl
&
pc
,
unsigned
order
)
*/
static
void
playlist_queue_song_order
(
playlist
&
playlist
,
PlayerControl
&
pc
,
unsigned
order
)
{
{
assert
(
playlist
.
queue
.
IsValidOrder
(
order
));
assert
(
queue
.
IsValidOrder
(
order
));
playlist
.
queued
=
order
;
queued
=
order
;
const
DetachedSong
&
song
=
playlist
.
queue
.
GetOrder
(
order
);
const
DetachedSong
&
song
=
queue
.
GetOrder
(
order
);
FormatDebug
(
playlist_domain
,
"queue song %i:
\"
%s
\"
"
,
FormatDebug
(
playlist_domain
,
"queue song %i:
\"
%s
\"
"
,
playlist
.
queued
,
song
.
GetURI
());
queued
,
song
.
GetURI
());
pc
.
EnqueueSong
(
new
DetachedSong
(
song
));
pc
.
EnqueueSong
(
new
DetachedSong
(
song
));
}
}
...
@@ -137,7 +134,7 @@ playlist::UpdateQueuedSong(PlayerControl &pc, const DetachedSong *prev)
...
@@ -137,7 +134,7 @@ playlist::UpdateQueuedSong(PlayerControl &pc, const DetachedSong *prev)
if
(
next_order
>=
0
)
{
if
(
next_order
>=
0
)
{
if
(
next_song
!=
prev
)
if
(
next_song
!=
prev
)
playlist_queue_song_order
(
*
this
,
pc
,
next_order
);
QueueSongOrder
(
pc
,
next_order
);
else
else
queued
=
next_order
;
queued
=
next_order
;
}
}
...
@@ -157,9 +154,6 @@ playlist::PlayOrder(PlayerControl &pc, int order)
...
@@ -157,9 +154,6 @@ playlist::PlayOrder(PlayerControl &pc, int order)
current
=
order
;
current
=
order
;
}
}
static
void
playlist_resume_playback
(
playlist
&
playlist
,
PlayerControl
&
pc
);
void
void
playlist
::
SyncWithPlayer
(
PlayerControl
&
pc
)
playlist
::
SyncWithPlayer
(
PlayerControl
&
pc
)
{
{
...
@@ -178,7 +172,7 @@ playlist::SyncWithPlayer(PlayerControl &pc)
...
@@ -178,7 +172,7 @@ playlist::SyncWithPlayer(PlayerControl &pc)
should be restarted with the next song. That can
should be restarted with the next song. That can
happen if the playlist isn't filling the queue fast
happen if the playlist isn't filling the queue fast
enough */
enough */
playlist_resume_playback
(
*
this
,
pc
);
ResumePlayback
(
pc
);
else
{
else
{
/* check if the player thread has already started
/* check if the player thread has already started
playing the queued song */
playing the queued song */
...
@@ -196,31 +190,27 @@ playlist::SyncWithPlayer(PlayerControl &pc)
...
@@ -196,31 +190,27 @@ playlist::SyncWithPlayer(PlayerControl &pc)
}
}
}
}
/**
inline
void
* The player has stopped for some reason. Check the error, and
playlist
::
ResumePlayback
(
PlayerControl
&
pc
)
* decide whether to re-start playback
*/
static
void
playlist_resume_playback
(
playlist
&
playlist
,
PlayerControl
&
pc
)
{
{
assert
(
play
list
.
play
ing
);
assert
(
playing
);
assert
(
pc
.
GetState
()
==
PlayerState
::
STOP
);
assert
(
pc
.
GetState
()
==
PlayerState
::
STOP
);
const
auto
error
=
pc
.
GetErrorType
();
const
auto
error
=
pc
.
GetErrorType
();
if
(
error
==
PlayerError
::
NONE
)
if
(
error
==
PlayerError
::
NONE
)
playlist
.
error_count
=
0
;
error_count
=
0
;
else
else
++
playlist
.
error_count
;
++
error_count
;
if
((
playlist
.
stop_on_error
&&
error
!=
PlayerError
::
NONE
)
||
if
((
stop_on_error
&&
error
!=
PlayerError
::
NONE
)
||
error
==
PlayerError
::
OUTPUT
||
error
==
PlayerError
::
OUTPUT
||
playlist
.
error_count
>=
playlist
.
queue
.
GetLength
())
error_count
>=
queue
.
GetLength
())
/* too many errors, or critical error: stop
/* too many errors, or critical error: stop
playback */
playback */
playlist
.
Stop
(
pc
);
Stop
(
pc
);
else
else
/* continue playback at the next song */
/* continue playback at the next song */
playlist
.
PlayNext
(
pc
);
PlayNext
(
pc
);
}
}
void
void
...
...
src/queue/Playlist.hxx
View file @
ac8c1d0a
...
@@ -146,11 +146,22 @@ protected:
...
@@ -146,11 +146,22 @@ protected:
void
UpdateQueuedSong
(
PlayerControl
&
pc
,
const
DetachedSong
*
prev
);
void
UpdateQueuedSong
(
PlayerControl
&
pc
,
const
DetachedSong
*
prev
);
/**
/**
* Queue a song, addressed by its order number.
*/
void
QueueSongOrder
(
PlayerControl
&
pc
,
unsigned
order
);
/**
* Called when the player thread has started playing the
* Called when the player thread has started playing the
* "queued" song.
* "queued" song.
*/
*/
void
QueuedSongStarted
(
PlayerControl
&
pc
);
void
QueuedSongStarted
(
PlayerControl
&
pc
);
/**
* The player has stopped for some reason. Check the error,
* and decide whether to re-start playback.
*/
void
ResumePlayback
(
PlayerControl
&
pc
);
public
:
public
:
void
BeginBulk
();
void
BeginBulk
();
void
CommitBulk
(
PlayerControl
&
pc
);
void
CommitBulk
(
PlayerControl
&
pc
);
...
...
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