aboutsummaryrefslogtreecommitdiffstats
path: root/src/player_control.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2009-11-09player_control: removed the "volatile" attributeMax Kellermann1-2/+2
Our use of the "volatile" keyword was wrong from the start, and now that we have proper locking, we can safely remove all of them.
2009-11-03decoder_control: make the song objects constMax Kellermann1-1/+1
They are just informational.
2009-10-31decoder_control: removed the global variable "dc"Max Kellermann1-1/+3
Allocate a decoder_control object where needed, and pass it around. This will allow more than one decoder thread one day.
2009-10-31player_control: protect command, state, error with a mutexMax Kellermann1-4/+74
Use GMutex/GCond instead of the notify library. Manually lock the player_control object before accessing the protected attributes. Use the GCond object to notify the player thread and the main thread.
2009-10-23output_plugin: added methods enable() and disable()Max Kellermann1-0/+9
With these methods, an output plugin can allocate some global resources only if it is actually enabled. The method enable() is called after daemonization, which allows for more sophisticated resource allocation during that method.
2009-10-08player_thread: get "elapsed" from audio outputsMax Kellermann1-0/+6
Tracking the "elapsed" time from the chunks which we have sent to the output pipe is very imprecise: since we have implemented the music pipe, we're sending large number of chunks at once, giving the "elapsed" time stamp a resolution of usually more than a second. This patch changes the source of this information to the outputs. If a chunk has been played by all outputs, the "elapsed" time stamp is updated. The new command PLAYER_COMMAND_REFRESH makes the player thread update its status information: it tells the outputs to update the chunk time stamp. After that, player_control.elapsed_time is current.
2009-10-08player_control: eliminate PLAYER_COMMAND_PLAYMax Kellermann1-1/+0
Sending PLAYER_COMMAND_STOP followed by PLAYER_COMMAND_QUEUE does the same. PLAYER_COMMAND_PLAY is redundant.
2009-10-08player_control: no CamelCaseMax Kellermann1-15/+24
2009-10-08player_control: bundle "get" functions in pc_get_status()Max Kellermann1-11/+10
The new player_status struct replaces a bunch of playerGetX() functions. When we add proper locking to the player_control struct, we will only need to lock once for the "status" command.
2009-10-08player_control: allocate getPlayerErrorStr() resultMax Kellermann1-0/+5
This lets us eliminate the static fixed-size buffer.
2009-07-06output: use the software mixer pluginMax Kellermann1-3/+0
Do all the software volume stuff inside each output thread, not in the player thread. This allows one software mixer per output device, and also allows the user to configure the mixer type (hardware or software) for each audio output. This moves the global "mixer_type" setting into the "audio_output" section, deprecating the "mixer_enabled" flag.
2009-05-06player_control: renamed playerSeek(), return boolMax Kellermann1-2/+8
Renamed playerSeek() to pc_seek() to get rid of CamelCase. Convert the return value to bool.
2009-03-30player_control: remove unused function playerCurrentDecodeSong().Avuton Olrich1-3/+0
2009-03-13all: Update copyright header.Avuton Olrich1-6/+7
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-06pipe: added music_buffer, rewrite music_pipeMax Kellermann1-1/+3
Turn the music_pipe into a simple music_chunk queue. The music_chunk allocation code is moved to music_buffer, and is now managed with a linked list instead of a ring buffer. Two separate music_pipe objects are used by the decoder for the "current" and the "next" song, which greatly simplifies the cross-fading code.
2009-01-25player_control: added player_control.threadMax Kellermann1-0/+4
player_control.thread contains the handle of the player thread, or NULL if the player thread isn't running.
2009-01-16player_control: fix shadow warning with older gccMax Kellermann1-1/+1
Older gcc versions complained about shadowed parameters in prototypes.
2008-12-17playlist: clear pc.errored_song on deleteMax Kellermann1-0/+8
When a (remote) song is deleted from the playlist, there may still be a reference to it in pc.errored_song. Clear this reference.
2008-11-03player: converted PLAYER_ERROR_* to enumMax Kellermann1-8/+10
2008-11-03player: removed "volatile" attributesMax Kellermann1-6/+6
Removed the "volatile" attributes from several variables which are not important for synchronization.
2008-11-03player: no CamelCaseMax Kellermann1-7/+7
Renamed variables and internal functions. Most of the player_control.h API remains in CamelCase for now.
2008-10-31added prefix to header macrosMax Kellermann1-2/+2
"LOG_H" is a macro which is also used by ffmpeg/log.h. This is ffmpeg's fault, because short macros should be reserved for applications, but since it's always a good idea to choose prefixed macro names, even for applications, we are going to do that in MPD.
2008-10-12player: added commands QUEUE and CANCELMax Kellermann1-42/+15
QUEUE adds a new song to the player's queue. CANCEL clears the queue. These two commands replace the old and complex queueState and queueLockState code.
2008-10-11player: removed player_control.fileTimeMax Kellermann1-1/+0
This variable is superfluous, it is only used to copy its value to player_control.totalTime. Since the original source of this value (song->tag->time) will still be available at this point, we can safely remove fileTime.
2008-10-10player: added player_get_audio_format()Max Kellermann1-5/+5
player_get_audio_format() replaces getPlayerSampleRate(), getPlayerBits(), getPlayerChannels().
2008-10-10player: added player_control.audio_formatMax Kellermann1-5/+4
This replaces the attributes bits, channels, sampleRate.
2008-10-08don't include os_compat.hMax Kellermann1-1/+2
When there are standardized headers, use these instead of the bloated os_compat.h.
2008-10-08notify: removed the "Notify" typedefMax Kellermann1-1/+1
Typedefs shouldn't be used, use the bare struct names instead.
2008-10-08song: converted typedef Song to struct songMax Kellermann1-7/+10
Again, a data type which can be forward-declared.
2008-09-29assume stdint.h and stddef.h are availableMax Kellermann1-1/+0
Since we use a C99 compiler now, we can assert that the C99 standard headers are available, no need for complicated compile time checks. Kill mpd_types.h.
2008-09-29switch to C99 types, part IIMax Kellermann1-7/+7
Do full C99 integer type conversion in all modules which were not touched by Eric's merged patch.
2008-09-24notify: added notify_deinit()Max Kellermann1-0/+2
Destroy the mutex when it is not used anymore.
2008-08-26moved player_command_finished() to player_thread.cMax Kellermann1-2/+0
2008-08-26moved code to pc_init(), dc_init()Max Kellermann1-0/+4
2008-08-26renamed player.c to player_control.cMax Kellermann1-0/+0
Give player.c a better name, meaning that the code is used to control the player thread.
2008-08-26no commandError() in playerSeek()Max Kellermann1-1/+1
We should avoid having protocol specific code in player.c. Just return success or failure, and let the caller send the error code to the MPD client.
2008-08-26moved global variable "pc" to player.hMax Kellermann1-2/+4
This is the last of the three variables. Now we don't need playerData.h anymore in most sources.
2008-08-26don't call playerStop() before playerPlay()Max Kellermann1-2/+0
Since playerPlay() already calls playerStop(), we can remove its invocation of playerStop() from playPlaylistOrderNumber(). We can also make playerStop a static function.
2008-08-26queueSong() cannot failMax Kellermann1-1/+1
All (indirect) callers of queueSong() ensure that the queue state is BLANK, so there is no need to check it in queueSong() again. As a side effect, queueSong() cannot fail anymore, and can return void. Also, playlist_queueError and all its error handling can go away.
2008-08-26document the PLAYER_QUEUE_ constantsMax Kellermann1-0/+15
2008-08-26added enum player_queue_stateMax Kellermann1-9/+11
2008-08-26rewrote playerKill()Max Kellermann1-0/+1
playerKill() was marked as deprecated, but it seems like a good idea to do proper cleanup in all threads (e.g. for usable valgrind results). Introduce the command "EXIT" which makes the player thread exit cleanly.
2008-08-26player: no "fd" and no return valueMax Kellermann1-5/+5
Most player*() functions do not actually use the file descriptor, and always return 0 (success). Eliminate them to get a leaner interface.
2008-08-26converted PlayerControl.state to enumMax Kellermann1-5/+7
Don't write CPP when you can express the same in C... macros vs enum is a good example for that.
2008-08-26added PlayerControl.commandMax Kellermann1-7/+14
PlayerControl.command replaces the old attributes play, stop, pause, closeAudio, lockQueue, unlockQueue, seek. The main thread waits for each command synchronously, so there can only be one command enabled at a time anyway.
2008-08-26invoke the notify API directlyMax Kellermann1-4/+0
Don't use wrappers like player_wakeup_decoder_nb(). These have been wrappers calling notify.c functions, for compatibility with the existing code when we migrated to notify.c.
2008-08-26added dc.next_song, renamed pc.current_songMax Kellermann1-1/+1
Since pc->current_song denotes the song which the decoder should use next, we should move it to DecoderControl. This removes one internal PlayerControl struct access from the decoder code. Also add pc.next_song, which is manipulated by the playlist code, and gets copied to dc.next_song as soon as the decoder is started.
2008-08-26clean up CPP includesMax Kellermann1-1/+1
Include only headers which are really required. This speeds up compilation and helps detect cross-layer accesses.
2008-04-13Get rid of PlayerControl inside the PlayerData structEric Wong1-3/+3
It actually increases our image size a small bit and may even hurt performance a very small bit, but makes the code less verbose and easier to manage. I don't see a reason for mpd to ever support playing multiple files at the same time (users can run multiple instances of mpd if they really want to play Zaireeka, but that's such an edge case it's not worth ever supporting in our code). git-svn-id: https://svn.musicpd.org/mpd/trunk@7352 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12Fix the problem of songs not advancing without client activityEric Wong1-4/+0
The select() in the main event loop blocks now (saving us many unnecessary wakeups). This interacted badly with the threads that were trying to wakeup the main task via pthread_cond_signal() since the main task was not blocked on a condition variable, but on select(). So now if we detect a need to wakeup the player, we write to a pipe which select() is watching instead of blindly calling pthread_cond_signal(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7347 09075e82-0dd4-0310-85a5-a0d7c8717e4f