| Commit message (Collapse) | Author | Files | Lines |
|
Adds mixrampdb and mixrampdelay commands. Reads MIXRAP_START and
MIXRAMP_END tags from FLAC files and overlaps instead of crossfading.
|
|
|
|
Don't access decoder_control attributes directly.
|
|
Asynchronous decoder startup is gone, and we don't need to check
command==DECODE_COMMAND_START anymore.
|
|
These two variables are redundant, we need only one of them.
|
|
The START command returns without blocking; we don't need the
asynchronous decoder start anymore.
|
|
They are just informational.
|
|
Allocate a decoder_control object where needed, and pass it around.
This will allow more than one decoder thread one day.
|
|
|
|
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.
|
|
Replace decoder_control.notify with decoder_control.mutex and
decoder_control.cond. Lock the mutex on all accesses to
decoder_control.command and decoder_control.state.
|
|
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.
|
|
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.
|
|
Minimize header dependencies, again.
|
|
decoder_control.thread contains the handle of the decoder thread, or
NULL if the decoder thread isn't running.
|
|
When MPD exits, it should manually free all resources in use, to allow
easy memory leak debugging. Make the decoder thread terminate during
that.
|
|
The player did not care about the exact error value, it only checked
whether an error has occured. This could fit well into
decoder_control.state - introduce a new state "DECODE_STATE_ERROR".
|
|
|
|
The variable "next_song" is already protected by a memory barrier.
"total_time" is not important for synchronization, and we don't need
"volatile" here.
|
|
Renamed variables and functions.
|
|
.. and rename dc.audioFormat to dc.in_audio_format. The music pipe
does not need to know the audio format, and its former "audioFormat"
property indicated the format of the most recently added chunk, which
might be confusing when you are reading the oldest chunks.
|
|
"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.
|
|
Don't return 0/-1 on success/error, but true/false. Instead of int,
use bool for storing flags.
|
|
Typedefs shouldn't be used, use the bare struct names instead.
|
|
Again, a data type which can be forward-declared.
|
|
Do full C99 integer type conversion in all modules which were not
touched by Eric's merged patch.
|
|
Destroy the mutex when it is not used anymore.
|
|
Get rid of CamelCase, and don't use a typedef, so we can
forward-declare it, and unclutter the include dependencies.
|
|
|
|
|
|
It should be obvious in which thread or context a function is being
executed at runtime. The code which was left in decode.c is for the
decoder thread itself; give the file a better name.
|
|
The decoder plugins need this type, so export it in the public API.
This allows is to remove "decode.h" from "decoder_api.h", uncluttering
the API namespace some more.
|
|
Now that "dc" is available here, we don't have to pass it to
decoder_is_idle() and decoder_is_starting() anymore.
|
|
Unfortunately, we have to pass the DecoderControl pointer to these
inline functions, because the global variable "dc" may not be
available here. This will be fixed later.
|
|
The source "decoder_control.c" provides an API for controlling the
decoder. This replaces various direct accesses to the DecoderControl
struct.
|
|
Move code which runs in the player thread to player_thread.c. Having
a lot of player thread code in decode.c isn't easy to understand.
|
|
Some decoder commands are implemented in the decoder plugins, thus
they need to have an API call to signal that their current command has
been finished. Let them use the new decoder_command_finished()
instead of the internal dc_command_finished().
|
|
We want to expose the AudioFormat structure to plugins; remove some
clutter by moving its declaration to a separate header file.
|
|
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.
|
|
dc_command_finished() is invoked by the decoder thread when it has
finished a command (sent by the player thread). It resets dc.command
and wakes up the player thread. This combination was used at a lot of
places, and by introducing this function, the code will be more
readable.
|
|
Much of the existing code queries all three variables sequentially.
Since only one of them can be set at a time, this can be optimized and
unified by merging all of them into one enum variable. Later, the
"command" checks can be expressed in a "switch" statement.
|
|
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.
|
|
git-svn-id: https://svn.musicpd.org/mpd/trunk@7369 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
This at least makes the argument list to a lot of our plugin
functions shorter and removes a good amount of line nois^W^Wcode,
hopefully making things easier to read and follow.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7353 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
git-svn-id: https://svn.musicpd.org/mpd/trunk@7323 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
Try to only include headers which are really needed. We should
particularly check all "headers including other headers". The
long-term goal is to have a manageable, small API for plugins
(decoders, output) without so many mpd internals cluttering the
namespace.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7319 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
Less global variables: at any invocation of decoder_sleep(), we have a
reference to the DecoderControl anyway, so we should pass it. This
costs less than having to call getPlayerData() in every tiny
function. Maybe some day we will be able to have multiple decoders at
the same time...
git-svn-id: https://svn.musicpd.org/mpd/trunk@7316 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
git-svn-id: https://svn.musicpd.org/mpd/trunk@7281 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
Instead of copying URLs everywhere...
[merged r7186 from branches/ew]
git-svn-id: https://svn.musicpd.org/mpd/trunk@7244 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
I initially started to do a heavy rewrite that changed the way processes
communicated, but that was too much to do at once. So this change only
focuses on replacing the player and decode processes with threads and
using condition variables instead of polling in loops; so the changeset
itself is quiet small.
* The shared output buffer variables will still need locking
to guard against race conditions. So in this effect, we're probably
just as buggy as before. The reduced context-switching overhead of
using threads instead of processes may even make bugs show up more or
less often...
* Basic functionality appears to be working for playing local (and NFS)
audio, including:
play, pause, stop, seek, previous, next, and main playlist editing
* I haven't tested HTTP streams yet, they should work.
* I've only tested ALSA and Icecast. ALSA works fine, Icecast
metadata seems to get screwy at times and breaks song
advancement in the playlist at times.
* state file loading works, too (after some last-minute hacks with
non-blocking wakeup functions)
* The non-blocking (*_nb) variants of the task management functions are
probably overused. They're more lenient and easier to use because
much of our code is still based on our previous polling-based system.
* It currently segfaults on exit. I haven't paid much attention
to the exit/signal-handling routines other than ensuring it
compiles. At least the state file seems to work. We don't
do any cleanups of the threads on exit, yet.
* Update is still done in a child process and not in a thread.
To do this in a thread, we'll need to ensure it does proper
locking and communication with the main thread; but should
require less memory in the end because we'll be updating
the database "in-place" rather than updating a copy and
then bulk-loading when done.
* We're more sensitive to bugs in 3rd party libraries now.
My plan is to eventually use a master process which forks()
and restarts the child when it dies:
locking and communication with the main thread; but should
require less memory in the end because we'll be updating
the database "in-place" rather than updating a copy and
then bulk-loading when done.
* We're more sensitive to bugs in 3rd party libraries now.
My plan is to eventually use a master process which forks()
and restarts the child when it dies:
master - just does waitpid() + fork() in a loop
\- main thread
\- decoder thread
\- player thread
At the beginning of every song, the main thread will set
a dirty flag and update the state file. This way, if we
encounter a song that triggers a segfault killing the
main thread, the master will start the replacement main
on the next song.
* The main thread still wakes up every second on select()
to check for signals; which affects power management.
[merged r7138 from branches/ew]
git-svn-id: https://svn.musicpd.org/mpd/trunk@7240 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|