Commit Graph

297 Commits

Author SHA1 Message Date
Max Kellermann c6cbcc2c25 copyright year 2011 2011-01-29 10:13:54 +01:00
Max Kellermann b6995ca011 player_control: removed the global variable "pc"
Allocate a player_control object where needed, and pass it around.
Each "client" object is associated with a "player_control" instance.

This prepares multi-player support.
2011-01-10 19:46:23 +01:00
Andrew Morgan a59ab3e2ee playlist: make single mode 'sticky' 2010-09-28 12:52:52 +02:00
Max Kellermann a14cd97f56 playlist: fix "queued" check in playlist_sync()
The check was meant to fix an assertion failure, but it was the wrong
way around.  This broke cross-fading most of the time.
2010-09-23 23:29:36 +02:00
Max Kellermann 9fb26b5617 playlist: check "queued" before calling playlist_update_queued_song()
Workaround for an assertion failure.
2010-06-19 13:45:15 +02:00
Max Kellermann 442b327582 playlist: protect acess to player state in playlist_sync() 2010-06-19 13:33:39 +02:00
Max Kellermann cff727644d playlist: move checks out of playlist_sync_with_queue()
Rename the function to playlist_song_started(), which gets only called
if the song has actually started.
2010-06-19 13:33:32 +02:00
Max Kellermann 067d7212bf playlist: emit IDLE_OPTIONS when resetting single mode 2010-06-01 09:59:46 +02:00
Romain Bignon 867b93a5b2 single mode: at the end of the song, pause on the next song instead of stop 2010-05-31 23:36:16 +02:00
Max Kellermann e9beea072d Merge release 0.15.9 from branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
	src/cue/cue_tag.c
	src/decoder/mpcdec_decoder_plugin.c
	src/player_thread.c
2010-03-28 19:31:47 +02:00
Max Kellermann 9134169e37 playlist: fix single+repeat in random mode
With single+repeat enabled, it is expected that MPD repeats the
current song over andd over.  With random mode also enabled, this
didn't work, because the song order was shuffled internally.  This
patch adds a special check for this case.
2010-03-07 18:58:44 +01:00
Avuton Olrich 9d3865cb95 Update copyright notices. 2009-12-31 20:58:43 -08:00
Max Kellermann 5b82ffc291 include config.h in all sources
After we've been hit by Large File Support problems several times in
the past week (which only occur on 32 bit platforms, which I don't
have), this is yet another attempt to fix the issue.
2009-11-12 09:17:03 +01:00
Max Kellermann e5857cb722 player_control: no CamelCase 2009-10-08 21:12:57 +02:00
Max Kellermann a5960c20cc playlist_control: "previous" really plays the previous song
No more CD player emulation.  The current behaviour of "previous" is
difficult for a client to predict, because it does not definitely know
the current position within the song.  If a client wants to restart
the current song, it can always send "playid".
2009-10-08 20:33:50 +02:00
Courtney Cavin 7f865f722c playlist: CamelCaseIsBad
Renamed all playlist functions to non-CamelCase.
2009-07-28 18:07:01 -04:00
Max Kellermann d897170455 playlist: no CamelCase 2009-07-14 21:28:36 +02:00
Max Kellermann 616dc9d465 playlist_control: use GTimer in previousSongInPlaylist()
To determine whether to rewind the current song or to go to the
previous song, use a GTimer instead of manually diffing time(NULL).
2009-04-25 14:08:31 +02:00
Romain Bignon e81f683a18 implemented the 'consume' mode
Consume mode removes each song played
2009-03-30 17:37:55 +02:00
Romain Bignon e7519829ac renamed smartstop to single and changed behavior
When single mode is enabled, after current song it stops playback,
or it replay same song if repeat mode is activated.
2009-03-27 15:28:49 +01:00
Romain Bignon e46722b2eb implements the smartstop feature
The smartstop feature is a way to tell mpd to stop playing after
current song.
This patche provides:
- 'state' command returns 'smartstop' state (1 or 0)
- 'smartstop' can activate or not the smartstop state
- when song is terminated, mpd stops playing and smartstop is set to 0
2009-03-27 14:58:31 +01:00
Avuton Olrich 0aee49bdf8 all: Update copyright header.
This updates the copyright header to all be the same, which is
pretty much an update of where to mail request for a copy of the GPL
and the years of the MPD project. This also puts all committers under
'The Music Player Project' umbrella. These entries should go
individually in the AUTHORS file, for consistancy.
2009-03-13 11:51:55 -07:00
Max Kellermann 58a5d30826 playlist: don't preserve "current" song after "random" toggle
When MPD is not playing, it may still remember which is the "current"
song.  When you switch to "random" mode, MPD will always start playing
exactly this song.  This defies the goal of "random" mode a little.
Clear the "current" song when MPD is not playing during the "random"
mode switch.
2009-02-11 18:02:50 +01:00
Vladimir S Eremin d9ce8d8342 playlist: fixed "next song" check
Check if the "current+1" position is actually valid.
2009-02-09 21:14:38 +01:00
Vladimir S Eremin cde4cb944e playlist: provide information about "next song"
In random mode, this patch allows clients to see the "next song" in
the queue.
2009-02-09 10:38:03 +01:00
Max Kellermann 19397a84cc playlist: added G_LOG_DOMAIN
Removed the explicit "playlist:" prefix from all log messages.
2009-02-04 22:15:31 +01:00
Max Kellermann cbea8a2a00 playlist: pass const playlist pointers
Pass constant playlist objects to functions which do not modify it.
2009-02-04 22:08:39 +01:00
Max Kellermann 15f914a74a playlist: moved code to playlist_edit.c
Moved functions for playlist editing (append, delete, shuffle, move)
to playlist_edit.c.
2009-02-04 20:31:53 +01:00
Max Kellermann f3d6d536f6 playlist: moved code to playlist_control.c
Moved handlers for control commands (play, stop, next, prev) to
playlist_control.c.
2009-02-04 20:31:22 +01:00
Max Kellermann 4db51eeccd playlist: call syncPlaylistWithQueue() only in the event handler
Don't call syncPlaylistWithQueue() in nextSongInPlaylist() and
previousSongInPlaylist().  This is a relic from the time when there
was no event, and was a workaround to the timing problem.
2009-02-04 19:44:32 +01:00
Max Kellermann 8d3205871c playlist: renamed global "playlist" variable to "g_playlist"
Export the "g_playlist" variable, and pass it to all playlist
functions.  This way, we can split playlist.c easier into separate
parts.  The code which initializes the singleton variable is moved to
playlist_global.c.
2009-02-04 18:56:41 +01:00
Max Kellermann 1720c7090d playlist: moved code to playlist_state.c
Moved everything related to saving or loading the playlist from/to the
state file to playlist_state.c.
2009-02-04 18:52:39 +01:00
Max Kellermann e27a665b89 playlist: simplified playlist.queued updates
Before every operation which modifies the playlist, remember a pointer
to the song struct.  After the modification, determine the "next song"
again, and if it differs, dequeue and queue the new song.

This removes a lot of complexity from the playlist update code, and
makes it more robust.
2009-02-04 18:52:37 +01:00
Max Kellermann 6aa734dc35 playlist: clear playlist.playing when deleting current song
This fixes an assertion failure: when the last song in the playlist
was playing, and you deleted it, MPD aborted.
2009-01-30 19:54:19 +01:00
Max Kellermann bdfb6c239a playlist: moved is_valid_playlist_name() to stored_playlist.c 2009-01-25 14:19:28 +01:00
Max Kellermann 98cb8f3969 playlist: moved savePlaylist() and loadPlaylsit() to playlist_save.c 2009-01-25 14:11:47 +01:00
Max Kellermann 69c74afa25 playlist: removed g_rand, PLAYLIST_HASH_MULT
Both are unused.
2009-01-25 14:01:27 +01:00
Max Kellermann 688880bc0b queue: added queue_shuffle_order_last()
This function shuffles the last song of a range.  This is used by
addSongToPlaylist().
2009-01-25 14:00:51 +01:00
Max Kellermann 1a59afa388 stored_playlist: moved configuration variables from playlist.c
Don't declare and export variables specific to stored playlists in
playlist.c/playlist.h.
2009-01-25 13:53:16 +01:00
Max Kellermann cf9595df18 playlist: removed locate functions to queue_print.c
Now playlist.c does not contain any protocol specific code anymore.
2009-01-24 14:55:28 +01:00
Max Kellermann 53e712aca4 locate: renamed LocateTagItem to "struct locate_item"
No CamelCase and no typedefs.
2009-01-24 14:52:05 +01:00
Max Kellermann 627d590ce5 command: use queue_print_*()
Replaced several wrapper functions from playlist.c, and make command.c
use the queue print functions directly.
2009-01-24 14:52:04 +01:00
Max Kellermann d449d6abab playlist: added playlist_get_queue()
To allow code outside playlist.c to access the "queue" object,
provide a function which returns a const pointer.
2009-01-24 14:51:35 +01:00
Max Kellermann 6cfe032b94 playlist: renamed the Playlist typedef to "struct playlist"
No typedefs.
2009-01-24 13:34:53 +01:00
Max Kellermann ae2d13ac3e playlist: moved stopOnError and errorCount into struct playlist
Moved the 2 remaining global variables into the playlist struct.
2009-01-24 13:20:07 +01:00
Max Kellermann 0e5af7d0f6 playlist: restore random mode after playlist is loaded
When the playlist was loaded from the state file, the order numbers
were the same as the positions.  In random mode, we need to shuffle
the queue order.  To accomplish that, call setPlaylistRandomStatus()
at the end of readPlaylistState(), and do a fresh shuffle.
2009-01-23 18:41:12 +01:00
Max Kellermann 62159e8875 playlist: removed song_id_to_position()
song_id_to_position() is only a wrapper for queue_id_to_position().
2009-01-23 18:16:21 +01:00
Max Kellermann a6ad0cdecc playlist: fix "clear" crash in random mode
When MPD is not playing while in random mode, and the client issues
the "clear" command, MPD crashes in stopPlaylist(), or more exactly,
in queue_order_to_position(-1).  Exit from stopPlaylist() if MPD isn't
playing.
2009-01-23 18:15:25 +01:00
Max Kellermann 349d249867 playlist: moved saving/loading code to queue_save.c
Create a new library which saves/loads the queue to/from the state
file.
2009-01-23 16:35:04 +01:00
Max Kellermann 8afe24c1de playlist: moved PlaylistInfo() to playlist_print.c
PlaylistInfo() (notice the capital 'P') sends a stored playlist to the
client.  Move it to a separate library, where all the code which glues
the playlist and the MPD protocol together will live.
2009-01-23 16:34:27 +01:00