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
7f865f72
Commit
7f865f72
authored
Jul 28, 2009
by
Courtney Cavin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist: CamelCaseIsBad
Renamed all playlist functions to non-CamelCase.
parent
614a0118
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
128 additions
and
107 deletions
+128
-107
command.c
src/command.c
+21
-21
event_pipe.h
src/event_pipe.h
+1
-1
playlist.c
src/playlist.c
+35
-25
playlist.h
src/playlist.h
+36
-25
playlist_control.c
src/playlist_control.c
+19
-19
playlist_edit.c
src/playlist_edit.c
+3
-3
playlist_global.c
src/playlist_global.c
+1
-1
playlist_internal.h
src/playlist_internal.h
+1
-1
playlist_print.c
src/playlist_print.c
+1
-1
playlist_state.c
src/playlist_state.c
+9
-9
update.c
src/update.c
+1
-1
No files found.
src/command.c
View file @
7f865f72
...
...
@@ -399,7 +399,7 @@ handle_play(struct client *client, int argc, char *argv[])
if
(
argc
==
2
&&
!
check_int
(
client
,
&
song
,
argv
[
1
],
need_positive
))
return
COMMAND_RETURN_ERROR
;
result
=
play
Playlist
(
&
g_playlist
,
song
);
result
=
play
list_play
(
&
g_playlist
,
song
);
return
print_playlist_result
(
client
,
result
);
}
...
...
@@ -412,7 +412,7 @@ handle_playid(struct client *client, int argc, char *argv[])
if
(
argc
==
2
&&
!
check_int
(
client
,
&
id
,
argv
[
1
],
need_positive
))
return
COMMAND_RETURN_ERROR
;
result
=
play
PlaylistByI
d
(
&
g_playlist
,
id
);
result
=
play
list_play_i
d
(
&
g_playlist
,
id
);
return
print_playlist_result
(
client
,
result
);
}
...
...
@@ -420,7 +420,7 @@ static enum command_return
handle_stop
(
G_GNUC_UNUSED
struct
client
*
client
,
G_GNUC_UNUSED
int
argc
,
G_GNUC_UNUSED
char
*
argv
[])
{
stopPlaylist
(
&
g_playlist
);
playlist_stop
(
&
g_playlist
);
return
COMMAND_RETURN_OK
;
}
...
...
@@ -479,21 +479,21 @@ handle_status(struct client *client,
COMMAND_STATUS_CROSSFADE
": %i
\n
"
COMMAND_STATUS_STATE
": %s
\n
"
,
volume_level_get
(),
getPlaylistRepeatStatus
(
&
g_playlist
),
getPlaylistRandomStatus
(
&
g_playlist
),
getPlaylistSingleStatus
(
&
g_playlist
),
getPlaylistConsumeStatus
(
&
g_playlist
),
getPlaylistV
ersion
(
&
g_playlist
),
getPlaylistL
ength
(
&
g_playlist
),
playlist_get_repeat
(
&
g_playlist
),
playlist_get_random
(
&
g_playlist
),
playlist_get_single
(
&
g_playlist
),
playlist_get_consume
(
&
g_playlist
),
playlist_get_v
ersion
(
&
g_playlist
),
playlist_get_l
ength
(
&
g_playlist
),
(
int
)(
getPlayerCrossFade
()
+
0
.
5
),
state
);
song
=
getPlaylistCurrentS
ong
(
&
g_playlist
);
song
=
playlist_get_current_s
ong
(
&
g_playlist
);
if
(
song
>=
0
)
{
client_printf
(
client
,
COMMAND_STATUS_SONG
": %i
\n
"
COMMAND_STATUS_SONGID
": %u
\n
"
,
song
,
getPlaylistSongI
d
(
&
g_playlist
,
song
));
song
,
playlist_get_song_i
d
(
&
g_playlist
,
song
));
}
if
(
getPlayerState
()
!=
PLAYER_STATE_STOP
)
{
...
...
@@ -521,12 +521,12 @@ handle_status(struct client *client,
getPlayerErrorStr
());
}
song
=
getPlaylistNextS
ong
(
&
g_playlist
);
song
=
playlist_get_next_s
ong
(
&
g_playlist
);
if
(
song
>=
0
)
{
client_printf
(
client
,
COMMAND_STATUS_NEXTSONG
": %i
\n
"
COMMAND_STATUS_NEXTSONGID
": %u
\n
"
,
song
,
getPlaylistSongI
d
(
&
g_playlist
,
song
));
song
,
playlist_get_song_i
d
(
&
g_playlist
,
song
));
}
return
COMMAND_RETURN_OK
;
...
...
@@ -1021,7 +1021,7 @@ handle_next(G_GNUC_UNUSED struct client *client,
int
single
=
g_playlist
.
queue
.
single
;
g_playlist
.
queue
.
single
=
false
;
nextSongInPlaylis
t
(
&
g_playlist
);
playlist_nex
t
(
&
g_playlist
);
g_playlist
.
queue
.
single
=
single
;
return
COMMAND_RETURN_OK
;
...
...
@@ -1031,7 +1031,7 @@ static enum command_return
handle_previous
(
G_GNUC_UNUSED
struct
client
*
client
,
G_GNUC_UNUSED
int
argc
,
G_GNUC_UNUSED
char
*
argv
[])
{
p
reviousSongInPlaylist
(
&
g_playlist
);
p
laylist_previous
(
&
g_playlist
);
return
COMMAND_RETURN_OK
;
}
...
...
@@ -1090,7 +1090,7 @@ handle_repeat(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
return
COMMAND_RETURN_ERROR
;
}
setPlaylistRepeatStatus
(
&
g_playlist
,
status
);
playlist_set_repeat
(
&
g_playlist
,
status
);
return
COMMAND_RETURN_OK
;
}
...
...
@@ -1108,7 +1108,7 @@ handle_single(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
return
COMMAND_RETURN_ERROR
;
}
setPlaylistSingleStatus
(
&
g_playlist
,
status
);
playlist_set_single
(
&
g_playlist
,
status
);
return
COMMAND_RETURN_OK
;
}
...
...
@@ -1126,7 +1126,7 @@ handle_consume(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
return
COMMAND_RETURN_ERROR
;
}
setPlaylistConsumeStatus
(
&
g_playlist
,
status
);
playlist_set_consume
(
&
g_playlist
,
status
);
return
COMMAND_RETURN_OK
;
}
...
...
@@ -1144,7 +1144,7 @@ handle_random(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
return
COMMAND_RETURN_ERROR
;
}
setPlaylistRandomStatus
(
&
g_playlist
,
status
);
playlist_set_random
(
&
g_playlist
,
status
);
return
COMMAND_RETURN_OK
;
}
...
...
@@ -1285,7 +1285,7 @@ handle_seek(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
if
(
!
check_int
(
client
,
&
seek_time
,
argv
[
2
],
check_integer
,
argv
[
2
]))
return
COMMAND_RETURN_ERROR
;
result
=
seekSongInPlaylist
(
&
g_playlist
,
song
,
seek_time
);
result
=
playlist_seek_song
(
&
g_playlist
,
song
,
seek_time
);
return
print_playlist_result
(
client
,
result
);
}
...
...
@@ -1300,7 +1300,7 @@ handle_seekid(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
if
(
!
check_int
(
client
,
&
seek_time
,
argv
[
2
],
check_integer
,
argv
[
2
]))
return
COMMAND_RETURN_ERROR
;
result
=
seekSongInPlaylistByI
d
(
&
g_playlist
,
id
,
seek_time
);
result
=
playlist_seek_song_i
d
(
&
g_playlist
,
id
,
seek_time
);
return
print_playlist_result
(
client
,
result
);
}
...
...
src/event_pipe.h
View file @
7f865f72
...
...
@@ -32,7 +32,7 @@ enum pipe_event {
/** an idle event was emitted */
PIPE_EVENT_IDLE
,
/** must call
syncPlayerAndPlaylist
() */
/** must call
playlist_sync
() */
PIPE_EVENT_PLAYLIST
,
/** the current song's tag has changed */
...
...
src/playlist.c
View file @
7f865f72
...
...
@@ -34,7 +34,8 @@
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "playlist"
void
playlistVersionChange
(
struct
playlist
*
playlist
)
void
playlist_increment_version_all
(
struct
playlist
*
playlist
)
{
queue_modify_all
(
&
playlist
->
queue
);
idle_add
(
IDLE_PLAYLIST
);
...
...
@@ -98,7 +99,8 @@ playlist_queue_song_order(struct playlist *playlist, unsigned order)
* Check if the player thread has already started playing the "queued"
* song.
*/
static
void
syncPlaylistWithQueue
(
struct
playlist
*
playlist
)
static
void
playlist_sync_with_queue
(
struct
playlist
*
playlist
)
{
if
(
pc
.
next_song
==
NULL
&&
playlist
->
queued
!=
-
1
)
{
/* queued song has started: copy queued to current,
...
...
@@ -178,7 +180,7 @@ playlist_update_queued_song(struct playlist *playlist, const struct song *prev)
}
void
play
PlaylistOrderNumb
er
(
struct
playlist
*
playlist
,
int
orderNum
)
play
list_play_ord
er
(
struct
playlist
*
playlist
,
int
orderNum
)
{
struct
song
*
song
;
char
*
uri
;
...
...
@@ -197,13 +199,14 @@ playPlaylistOrderNumber(struct playlist *playlist, int orderNum)
}
static
void
play
PlaylistIfPlayerStopped
(
struct
playlist
*
playlist
);
play
list_resume_playback
(
struct
playlist
*
playlist
);
/**
* This is the "PLAYLIST" event handler. It is invoked by the player
* thread whenever it requests a new queued song, or when it exits.
*/
void
syncPlayerAndPlaylist
(
struct
playlist
*
playlist
)
void
playlist_sync
(
struct
playlist
*
playlist
)
{
if
(
!
playlist
->
playing
)
/* this event has reached us out of sync: we aren't
...
...
@@ -215,11 +218,11 @@ void syncPlayerAndPlaylist(struct playlist *playlist)
should be restarted with the next song. That can
happen if the playlist isn't filling the queue fast
enough */
play
PlaylistIfPlayerStopped
(
playlist
);
play
list_resume_playback
(
playlist
);
else
{
/* check if the player thread has already started
playing the queued song */
syncPlaylistWithQ
ueue
(
playlist
);
playlist_sync_with_q
ueue
(
playlist
);
/* make sure the queued song is always set (if
possible) */
...
...
@@ -233,7 +236,7 @@ void syncPlayerAndPlaylist(struct playlist *playlist)
* decide whether to re-start playback
*/
static
void
play
PlaylistIfPlayerStopped
(
struct
playlist
*
playlist
)
play
list_resume_playback
(
struct
playlist
*
playlist
)
{
enum
player_error
error
;
...
...
@@ -251,37 +254,38 @@ playPlaylistIfPlayerStopped(struct playlist *playlist)
playlist
->
error_count
>=
queue_length
(
&
playlist
->
queue
))
/* too many errors, or critical error: stop
playback */
stopPlaylist
(
playlist
);
playlist_stop
(
playlist
);
else
/* continue playback at the next song */
nextSongInPlaylis
t
(
playlist
);
playlist_nex
t
(
playlist
);
}
bool
getPlaylistRepeatStatus
(
const
struct
playlist
*
playlist
)
playlist_get_repeat
(
const
struct
playlist
*
playlist
)
{
return
playlist
->
queue
.
repeat
;
}
bool
getPlaylistRandomStatus
(
const
struct
playlist
*
playlist
)
playlist_get_random
(
const
struct
playlist
*
playlist
)
{
return
playlist
->
queue
.
random
;
}
bool
getPlaylistSingleStatus
(
const
struct
playlist
*
playlist
)
playlist_get_single
(
const
struct
playlist
*
playlist
)
{
return
playlist
->
queue
.
single
;
}
bool
getPlaylistConsumeStatus
(
const
struct
playlist
*
playlist
)
playlist_get_consume
(
const
struct
playlist
*
playlist
)
{
return
playlist
->
queue
.
consume
;
}
void
setPlaylistRepeatStatus
(
struct
playlist
*
playlist
,
bool
status
)
void
playlist_set_repeat
(
struct
playlist
*
playlist
,
bool
status
)
{
if
(
status
==
playlist
->
queue
.
repeat
)
return
;
...
...
@@ -296,7 +300,8 @@ void setPlaylistRepeatStatus(struct playlist *playlist, bool status)
idle_add
(
IDLE_OPTIONS
);
}
static
void
orderPlaylist
(
struct
playlist
*
playlist
)
static
void
playlist_order
(
struct
playlist
*
playlist
)
{
if
(
playlist
->
current
>=
0
)
/* update playlist.current, order==position now */
...
...
@@ -306,7 +311,8 @@ static void orderPlaylist(struct playlist *playlist)
queue_restore_order
(
&
playlist
->
queue
);
}
void
setPlaylistSingleStatus
(
struct
playlist
*
playlist
,
bool
status
)
void
playlist_set_single
(
struct
playlist
*
playlist
,
bool
status
)
{
if
(
status
==
playlist
->
queue
.
single
)
return
;
...
...
@@ -321,7 +327,8 @@ void setPlaylistSingleStatus(struct playlist *playlist, bool status)
idle_add
(
IDLE_OPTIONS
);
}
void
setPlaylistConsumeStatus
(
struct
playlist
*
playlist
,
bool
status
)
void
playlist_set_consume
(
struct
playlist
*
playlist
,
bool
status
)
{
if
(
status
==
playlist
->
queue
.
consume
)
return
;
...
...
@@ -330,7 +337,8 @@ void setPlaylistConsumeStatus(struct playlist *playlist, bool status)
idle_add
(
IDLE_OPTIONS
);
}
void
setPlaylistRandomStatus
(
struct
playlist
*
playlist
,
bool
status
)
void
playlist_set_random
(
struct
playlist
*
playlist
,
bool
status
)
{
const
struct
song
*
queued
;
...
...
@@ -365,14 +373,15 @@ void setPlaylistRandomStatus(struct playlist *playlist, bool status)
}
else
playlist
->
current
=
-
1
;
}
else
orderPlaylist
(
playlist
);
playlist_order
(
playlist
);
playlist_update_queued_song
(
playlist
,
queued
);
idle_add
(
IDLE_OPTIONS
);
}
int
getPlaylistCurrentSong
(
const
struct
playlist
*
playlist
)
int
playlist_get_current_song
(
const
struct
playlist
*
playlist
)
{
if
(
playlist
->
current
>=
0
)
return
queue_order_to_position
(
&
playlist
->
queue
,
...
...
@@ -381,7 +390,8 @@ int getPlaylistCurrentSong(const struct playlist *playlist)
return
-
1
;
}
int
getPlaylistNextSong
(
const
struct
playlist
*
playlist
)
int
playlist_get_next_song
(
const
struct
playlist
*
playlist
)
{
if
(
playlist
->
current
>=
0
)
{
...
...
@@ -404,19 +414,19 @@ int getPlaylistNextSong(const struct playlist *playlist)
}
unsigned
long
getPlaylistV
ersion
(
const
struct
playlist
*
playlist
)
playlist_get_v
ersion
(
const
struct
playlist
*
playlist
)
{
return
playlist
->
queue
.
version
;
}
int
getPlaylistL
ength
(
const
struct
playlist
*
playlist
)
playlist_get_l
ength
(
const
struct
playlist
*
playlist
)
{
return
queue_length
(
&
playlist
->
queue
);
}
unsigned
getPlaylistSongI
d
(
const
struct
playlist
*
playlist
,
unsigned
song
)
playlist_get_song_i
d
(
const
struct
playlist
*
playlist
,
unsigned
song
)
{
return
queue_position_to_id
(
&
playlist
->
queue
,
song
);
}
src/playlist.h
View file @
7f865f72
...
...
@@ -117,7 +117,8 @@ playlist_get_queue(const struct playlist *playlist)
return
&
playlist
->
queue
;
}
void
playlist_clear
(
struct
playlist
*
playlist
);
void
playlist_clear
(
struct
playlist
*
playlist
);
#ifndef WIN32
/**
...
...
@@ -143,19 +144,23 @@ playlist_delete(struct playlist *playlist, unsigned song);
enum
playlist_result
playlist_delete_id
(
struct
playlist
*
playlist
,
unsigned
song
);
void
stopPlaylist
(
struct
playlist
*
playlist
);
void
playlist_stop
(
struct
playlist
*
playlist
);
enum
playlist_result
play
Playlist
(
struct
playlist
*
playlist
,
int
song
);
play
list_play
(
struct
playlist
*
playlist
,
int
song
);
enum
playlist_result
play
PlaylistByI
d
(
struct
playlist
*
playlist
,
int
song
);
play
list_play_i
d
(
struct
playlist
*
playlist
,
int
song
);
void
nextSongInPlaylist
(
struct
playlist
*
playlist
);
void
playlist_next
(
struct
playlist
*
playlist
);
void
syncPlayerAndPlaylist
(
struct
playlist
*
playlist
);
void
playlist_sync
(
struct
playlist
*
playlist
);
void
previousSongInPlaylist
(
struct
playlist
*
playlist
);
void
playlist_previous
(
struct
playlist
*
playlist
);
void
playlist_shuffle
(
struct
playlist
*
playlist
,
unsigned
start
,
unsigned
end
);
...
...
@@ -176,46 +181,52 @@ enum playlist_result
playlist_swap_songs_id
(
struct
playlist
*
playlist
,
unsigned
id1
,
unsigned
id2
);
bool
getPlaylistRepeatStatus
(
const
struct
playlist
*
playlist
);
playlist_get_repeat
(
const
struct
playlist
*
playlist
);
void
setPlaylistRepeatStatus
(
struct
playlist
*
playlist
,
bool
status
);
void
playlist_set_repeat
(
struct
playlist
*
playlist
,
bool
status
);
bool
getPlaylistRandomStatus
(
const
struct
playlist
*
playlist
);
playlist_get_random
(
const
struct
playlist
*
playlist
);
void
setPlaylistRandomStatus
(
struct
playlist
*
playlist
,
bool
status
);
void
playlist_set_random
(
struct
playlist
*
playlist
,
bool
status
);
bool
getPlaylistSingleStatus
(
const
struct
playlist
*
playlist
);
playlist_get_single
(
const
struct
playlist
*
playlist
);
void
setPlaylistSingleStatus
(
struct
playlist
*
playlist
,
bool
status
);
void
playlist_set_single
(
struct
playlist
*
playlist
,
bool
status
);
bool
getPlaylistConsumeStatus
(
const
struct
playlist
*
playlist
);
playlist_get_consume
(
const
struct
playlist
*
playlist
);
void
setPlaylistConsumeStatus
(
struct
playlist
*
playlist
,
bool
status
);
void
playlist_set_consume
(
struct
playlist
*
playlist
,
bool
status
);
int
getPlaylistCurrentSong
(
const
struct
playlist
*
playlist
);
int
playlist_get_current_song
(
const
struct
playlist
*
playlist
);
int
getPlaylistNextSong
(
const
struct
playlist
*
playlist
);
int
playlist_get_next_song
(
const
struct
playlist
*
playlist
);
unsigned
getPlaylistSongI
d
(
const
struct
playlist
*
playlist
,
unsigned
song
);
playlist_get_song_i
d
(
const
struct
playlist
*
playlist
,
unsigned
song
);
int
getPlaylistLength
(
const
struct
playlist
*
playlist
);
int
playlist_get_length
(
const
struct
playlist
*
playlist
);
unsigned
long
getPlaylistV
ersion
(
const
struct
playlist
*
playlist
);
playlist_get_v
ersion
(
const
struct
playlist
*
playlist
);
enum
playlist_result
seekSongInPlaylist
(
struct
playlist
*
playlist
,
unsigned
song
,
float
seek_time
);
playlist_seek_song
(
struct
playlist
*
playlist
,
unsigned
song
,
float
seek_time
);
enum
playlist_result
seekSongInPlaylistByI
d
(
struct
playlist
*
playlist
,
playlist_seek_song_i
d
(
struct
playlist
*
playlist
,
unsigned
id
,
float
seek_time
);
void
playlistVersionChange
(
struct
playlist
*
playlist
);
int
is_valid_playlist_name
(
const
char
*
utf8path
);
void
playlist_increment_version_all
(
struct
playlist
*
playlist
);
#endif
src/playlist_control.c
View file @
7f865f72
...
...
@@ -38,7 +38,7 @@ enum {
PLAYLIST_PREV_UNLESS_ELAPSED
=
10
,
};
void
stopPlaylist
(
struct
playlist
*
playlist
)
void
playlist_stop
(
struct
playlist
*
playlist
)
{
if
(
!
playlist
->
playing
)
return
;
...
...
@@ -68,7 +68,7 @@ void stopPlaylist(struct playlist *playlist)
}
}
enum
playlist_result
play
Playlist
(
struct
playlist
*
playlist
,
int
song
)
enum
playlist_result
play
list_play
(
struct
playlist
*
playlist
,
int
song
)
{
unsigned
i
=
song
;
...
...
@@ -115,28 +115,28 @@ enum playlist_result playPlaylist(struct playlist *playlist, int song)
playlist
->
stop_on_error
=
false
;
playlist
->
error_count
=
0
;
play
PlaylistOrderNumb
er
(
playlist
,
i
);
play
list_play_ord
er
(
playlist
,
i
);
return
PLAYLIST_RESULT_SUCCESS
;
}
enum
playlist_result
play
PlaylistByI
d
(
struct
playlist
*
playlist
,
int
id
)
play
list_play_i
d
(
struct
playlist
*
playlist
,
int
id
)
{
int
song
;
if
(
id
==
-
1
)
{
return
play
Playlist
(
playlist
,
id
);
return
play
list_play
(
playlist
,
id
);
}
song
=
queue_id_to_position
(
&
playlist
->
queue
,
id
);
if
(
song
<
0
)
return
PLAYLIST_RESULT_NO_SUCH_SONG
;
return
play
Playlist
(
playlist
,
song
);
return
play
list_play
(
playlist
,
song
);
}
void
nextSongInPlaylis
t
(
struct
playlist
*
playlist
)
playlist_nex
t
(
struct
playlist
*
playlist
)
{
int
next_order
;
int
current
;
...
...
@@ -157,7 +157,7 @@ nextSongInPlaylist(struct playlist *playlist)
/* cancel single */
playlist
->
queue
.
single
=
false
;
/* no song after this one: stop playback */
stopPlaylist
(
playlist
);
playlist_stop
(
playlist
);
/* reset "current song" */
playlist
->
current
=
-
1
;
...
...
@@ -174,11 +174,11 @@ nextSongInPlaylist(struct playlist *playlist)
queue_shuffle_order
(
&
playlist
->
queue
);
/* note that playlist->current and playlist->queued are
now invalid, but play
PlaylistOrderNumb
er() will
now invalid, but play
list_play_ord
er() will
discard them anyway */
}
play
PlaylistOrderNumb
er
(
playlist
,
next_order
);
play
list_play_ord
er
(
playlist
,
next_order
);
}
/* Consume mode removes each played songs. */
...
...
@@ -186,7 +186,7 @@ nextSongInPlaylist(struct playlist *playlist)
playlist_delete
(
playlist
,
queue_order_to_position
(
&
playlist
->
queue
,
current
));
}
void
p
reviousSongInPlaylist
(
struct
playlist
*
playlist
)
void
p
laylist_previous
(
struct
playlist
*
playlist
)
{
if
(
!
playlist
->
playing
)
return
;
...
...
@@ -196,20 +196,20 @@ void previousSongInPlaylist(struct playlist *playlist)
/* re-start playing the current song (just like the
"prev" button on CD players) */
play
PlaylistOrderNumb
er
(
playlist
,
playlist
->
current
);
play
list_play_ord
er
(
playlist
,
playlist
->
current
);
}
else
{
if
(
playlist
->
current
>
0
)
{
/* play the preceding song */
play
PlaylistOrderNumb
er
(
playlist
,
play
list_play_ord
er
(
playlist
,
playlist
->
current
-
1
);
}
else
if
(
playlist
->
queue
.
repeat
)
{
/* play the last song in "repeat" mode */
play
PlaylistOrderNumb
er
(
playlist
,
play
list_play_ord
er
(
playlist
,
queue_length
(
&
playlist
->
queue
)
-
1
);
}
else
{
/* re-start playing the current song if it's
the first one */
play
PlaylistOrderNumb
er
(
playlist
,
playlist
->
current
);
play
list_play_ord
er
(
playlist
,
playlist
->
current
);
}
}
...
...
@@ -217,7 +217,7 @@ void previousSongInPlaylist(struct playlist *playlist)
}
enum
playlist_result
seekSongInPlaylist
(
struct
playlist
*
playlist
,
unsigned
song
,
float
seek_time
)
playlist_seek_song
(
struct
playlist
*
playlist
,
unsigned
song
,
float
seek_time
)
{
const
struct
song
*
queued
;
unsigned
i
;
...
...
@@ -241,7 +241,7 @@ seekSongInPlaylist(struct playlist *playlist, unsigned song, float seek_time)
/* seeking is not within the current song - first
start playing the new song */
play
PlaylistOrderNumb
er
(
playlist
,
i
);
play
list_play_ord
er
(
playlist
,
i
);
queued
=
NULL
;
}
...
...
@@ -259,11 +259,11 @@ seekSongInPlaylist(struct playlist *playlist, unsigned song, float seek_time)
}
enum
playlist_result
seekSongInPlaylistByI
d
(
struct
playlist
*
playlist
,
unsigned
id
,
float
seek_time
)
playlist_seek_song_i
d
(
struct
playlist
*
playlist
,
unsigned
id
,
float
seek_time
)
{
int
song
=
queue_id_to_position
(
&
playlist
->
queue
,
id
);
if
(
song
<
0
)
return
PLAYLIST_RESULT_NO_SUCH_SONG
;
return
seekSongInPlaylist
(
playlist
,
song
,
seek_time
);
return
playlist_seek_song
(
playlist
,
song
,
seek_time
);
}
src/playlist_edit.c
View file @
7f865f72
...
...
@@ -44,7 +44,7 @@ static void playlist_increment_version(struct playlist *playlist)
void
playlist_clear
(
struct
playlist
*
playlist
)
{
stopPlaylist
(
playlist
);
playlist_stop
(
playlist
);
/* make sure there are no references to allocated songs
anymore */
...
...
@@ -238,11 +238,11 @@ playlist_delete(struct playlist *playlist, unsigned song)
if
(
playlist
->
current
>=
0
&&
!
paused
)
/* play the song after the deleted one */
play
PlaylistOrderNumb
er
(
playlist
,
playlist
->
current
);
play
list_play_ord
er
(
playlist
,
playlist
->
current
);
else
/* no songs left to play, stop playback
completely */
stopPlaylist
(
playlist
);
playlist_stop
(
playlist
);
queued
=
NULL
;
}
else
if
(
playlist
->
current
==
(
int
)
songOrder
)
...
...
src/playlist_global.c
View file @
7f865f72
...
...
@@ -37,7 +37,7 @@ playlist_tag_event(void)
static
void
playlist_event
(
void
)
{
syncPlayerAndPlaylist
(
&
g_playlist
);
playlist_sync
(
&
g_playlist
);
}
void
...
...
src/playlist_internal.h
View file @
7f865f72
...
...
@@ -47,6 +47,6 @@ playlist_update_queued_song(struct playlist *playlist,
const
struct
song
*
prev
);
void
play
PlaylistOrderNumb
er
(
struct
playlist
*
playlist
,
int
orderNum
);
play
list_play_ord
er
(
struct
playlist
*
playlist
,
int
orderNum
);
#endif
src/playlist_print.c
View file @
7f865f72
...
...
@@ -69,7 +69,7 @@ playlist_print_id(struct client *client, const struct playlist *playlist,
bool
playlist_print_current
(
struct
client
*
client
,
const
struct
playlist
*
playlist
)
{
int
current_position
=
getPlaylistCurrentS
ong
(
playlist
);
int
current_position
=
playlist_get_current_s
ong
(
playlist
);
if
(
current_position
<
0
)
return
false
;
...
...
src/playlist_state.c
View file @
7f865f72
...
...
@@ -144,23 +144,23 @@ playlist_state_restore(const char *line, FILE *fp, struct playlist *playlist)
if
(
strcmp
(
&
(
buffer
[
strlen
(
PLAYLIST_STATE_FILE_REPEAT
)]),
"1"
)
==
0
)
{
setPlaylistRepeatStatus
(
playlist
,
true
);
playlist_set_repeat
(
playlist
,
true
);
}
else
setPlaylistRepeatStatus
(
playlist
,
false
);
playlist_set_repeat
(
playlist
,
false
);
}
else
if
(
g_str_has_prefix
(
buffer
,
PLAYLIST_STATE_FILE_SINGLE
))
{
if
(
strcmp
(
&
(
buffer
[
strlen
(
PLAYLIST_STATE_FILE_SINGLE
)]),
"1"
)
==
0
)
{
setPlaylistSingleStatus
(
playlist
,
true
);
playlist_set_single
(
playlist
,
true
);
}
else
setPlaylistSingleStatus
(
playlist
,
false
);
playlist_set_single
(
playlist
,
false
);
}
else
if
(
g_str_has_prefix
(
buffer
,
PLAYLIST_STATE_FILE_CONSUME
))
{
if
(
strcmp
(
&
(
buffer
[
strlen
(
PLAYLIST_STATE_FILE_CONSUME
)]),
"1"
)
==
0
)
{
setPlaylistConsumeStatus
(
playlist
,
true
);
playlist_set_consume
(
playlist
,
true
);
}
else
setPlaylistConsumeStatus
(
playlist
,
false
);
playlist_set_consume
(
playlist
,
false
);
}
else
if
(
g_str_has_prefix
(
buffer
,
PLAYLIST_STATE_FILE_CROSSFADE
))
{
setPlayerCrossFade
(
atoi
(
&
...
...
@@ -181,7 +181,7 @@ playlist_state_restore(const char *line, FILE *fp, struct playlist *playlist)
}
}
setPlaylistRandomStatus
(
playlist
,
random_mode
);
playlist_set_random
(
playlist
,
random_mode
);
if
(
!
queue_is_empty
(
&
playlist
->
queue
))
{
if
(
!
queue_valid_position
(
&
playlist
->
queue
,
current
))
...
...
@@ -190,9 +190,9 @@ playlist_state_restore(const char *line, FILE *fp, struct playlist *playlist)
if
(
state
==
PLAYER_STATE_STOP
/* && config_option */
)
playlist
->
current
=
current
;
else
if
(
seek_time
==
0
)
play
Playlist
(
playlist
,
current
);
play
list_play
(
playlist
,
current
);
else
seekSongInPlaylist
(
playlist
,
current
,
seek_time
);
playlist_seek_song
(
playlist
,
current
,
seek_time
);
if
(
state
==
PLAYER_STATE_PAUSE
)
playerPause
();
...
...
src/update.c
View file @
7f865f72
...
...
@@ -868,7 +868,7 @@ static void update_finished_event(void)
if
(
modified
)
{
/* send "idle" events */
playlist
VersionChange
(
&
g_playlist
);
playlist
_increment_version_all
(
&
g_playlist
);
idle_add
(
IDLE_DATABASE
);
}
...
...
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