Commit Graph

4506 Commits

Author SHA1 Message Date
Max Kellermann ed4837662a playlist_state: fix playback restore in random mode
The functions playPlaylist() and seekSongInPlaylist() expect a song
position, not a song order number.  Don't convert the "current"
variable with queue_position_to_order().
2009-03-26 22:16:51 +01:00
Jeffrey Middleton 13208bf5a7 queue/playlist/command: move range
The move command now accepts a range for the first argument, in the same
form as other range commands, e.g. move 15:17 3.  The first song in the
range is placed at the destination position. Note that as with other
range commands, the range is inclusive on the left only; this example
would move only songs 15 and 16, not 17.

[mk: fixed signed/unsigned warnings; use G_MAXUINT instead of
UINT_MAX]
2009-03-26 22:02:56 +01:00
Jeffrey Middleton 7684c446c6 doc: updated ranged playlist commands
Clearly specified the format (song1:song2) for range argumentst, and
added the range capability of the playlistinfo command.
2009-03-26 14:57:17 -05:00
Jeffrey Middleton 272a7d081b doc: Fixed moveid description
moveid uses an index, not a songid, for its second argument
2009-03-26 14:57:17 -05:00
Max Kellermann 17d23614a8 updated valgrind.suppressions
Added g_strerror() and dlopen() suppressions.
2009-03-26 19:50:34 +01:00
Max Kellermann 4343c108b3 pulse_mixer: removed superfluous initializations
Don't initialize attributes which are only used in an open mixer.  As
long as nobody accesses them, their values are uninitialized and
undefined.
2009-03-26 19:50:31 +01:00
Max Kellermann 239e6da442 pulse_mixer: allocate "volume" statically
The pm->volume attribute was allocated in pulse_mixer_init(), but is
never freed.  This leaks memory.  Instead of adding the g_free() call
to pulse_mixer_finish(), let's just make "volume" a static attribute
of the pulse_mixer struct.  That is easier to deal with.
2009-03-26 19:50:27 +01:00
Max Kellermann 6c480d7db4 pulse_mixer: removed superfluous NULL checks in close()
When the MPD core knows that the pulse mixer is open, pm->mainloop and
pm->context must be non-NULL.
2009-03-26 19:50:23 +01:00
Max Kellermann 8cf206f2ee pulse_mixer: initialize "online" and "index" in open()
The attributes "online" and "index" were not properly reinitialized
after a close/open cycle.
2009-03-26 19:50:15 +01:00
Max Kellermann 52575d1b9d pulse: make configuration strings const
Nobody needs to modify these strings.  We can make them const, and
convert config_dup_block_string() to config_get_block_string().  This
also fixes memory leaks in the pulse mixer.
2009-03-26 19:50:10 +01:00
Max Kellermann cd4964cdee pulse: don't check config_param!=NULL
The conf.h functions deal well with config_param==NULL and will return
the specified default value then.
2009-03-26 19:50:02 +01:00
Max Kellermann 74273d419a pulse_mixer: free libpulse objects on failure
When the mixer initialization fails, we have to free the libpulse
objects we have already created, to prevent resource leaks.
2009-03-26 19:49:58 +01:00
Max Kellermann 3d2c8b001a pulse_mixer: unlock the mainloop on failure
It's illegal to return from pulse_mixer_setup() without unlocking the
main loop.  In the error handling, that unlock() call was missing.
2009-03-26 19:49:55 +01:00
Max Kellermann d113c07190 pulse_mixer: moved code to pulse_mixer_setup()
Prepare for adding proper error handling.
2009-03-26 19:49:39 +01:00
Max Kellermann 3be1850744 alsa_mixer: initialize "volume_set" in the open() method
"volume_set" is an attribute which becomes undefined when the mixer is
closed.  That means, it must be initialized each time the mixer is
opened.
2009-03-26 19:49:36 +01:00
Max Kellermann 0c9799babe alsa_mixer: removed superfluous checks
The MPD core guarantees that methods are always invoked in a
consistent state.  This means we can remove lots of checks from the
volume methods.
2009-03-26 19:49:31 +01:00
Max Kellermann 331b714a7a alsa_mixer: pass default device to config_get_block_string()
Instead of replacing NULL with the default device in the open()
method, pass the default device to config_get_block_string().
2009-03-26 19:49:26 +01:00
Max Kellermann f06f049cd8 alsa_mixer: make "device" and "control" const
Use config_get_block_string() instead of config_dup_block_string().
2009-03-26 19:48:55 +01:00
Max Kellermann c552d17c03 oss_mixer: call oss_find_mixer() in init() method
Detect misconfiguration during MPD startup.
2009-03-26 19:48:21 +01:00
Max Kellermann 881026623c oss_mixer: removed superfluous checks
The MPD core guarantees that methods are always invoked in a
consistent state.  This means we can remove lots of checks from the
volume methods.
2009-03-26 19:48:13 +01:00
Max Kellermann dd8c6d6738 oss_mixer: use g_ascii_strncasecmp() instead of strncasecmp()
strncasecmp() is locale dependent, but we only need ASCII here.
2009-03-26 19:47:52 +01:00
Max Kellermann 114d5982bb oss_mixer: pass default path to config_get_block_string()
Instead of replacing NULL with the default path in the open() method,
pass the default path to config_get_block_string().
2009-03-26 19:47:47 +01:00
Max Kellermann aec4fe06b5 oss_mixer: make "device" and "control" const
Use config_get_block_string() instead of config_dup_block_string().
2009-03-26 19:46:46 +01:00
Max Kellermann 69759b573f mixer: don't reopen failed mixer automatically
If a (global) mixer has been closed due to failure, don't reopen it
with every volume get/set.  Leave it closed until it is explicitly
opened.
2009-03-26 19:46:39 +01:00
Max Kellermann 1fcf09a816 mixer_control: close mixer on failure
When getting or setting the volume fails, the MPD core close the
mixer.  Moved the duplicated code from the mixer plugins.
2009-03-26 19:46:33 +01:00
Max Kellermann 617a4fd2d2 mixer: added flag "open"
Remember if a mixer object is open or closed.  Don't call open() again
if it is already open.  This guarantees that the mixer plugin is
always called in a consistent state, and we will be able to remove
lots of checks from the implementations.

To support mixers which are automatically opened even if the audio
output is still closed (to set the volume before playback starts),
this patch also adds the "global" flag to the mixer_plugin struct.
Both ALSA and OSS set this flag, while PULSE does not.
2009-03-26 19:43:18 +01:00
Max Kellermann 7475ded935 mixer_control: don't allow mixer==NULL
As a side effect, the previous patch added the mixer==NULL checks.  It
is now illegal to call mixer functions with a NULL argument.  Convert
the runtime checks to assertions.
2009-03-26 19:43:15 +01:00
Max Kellermann 66a2c5669e output_plugin: replaced output_plugin.get_mixer() with mixer_plugin
The mixer core library is now responsible for creating and managing
the mixer object.  This removes duplicated code from the output
plugins.
2009-03-26 18:23:23 +01:00
Max Kellermann 209c8a540c player_thread: wait for decoder before seeking
When the decoder initialization has not been completed yet, all calls
to dc_seek() will fail, because dc.seekable is not initialized yet.
Wait for the decoder to complete its initialization, i.e. until it has
called decoder_initialized().
2009-03-25 19:48:14 +01:00
Max Kellermann 1e9659bf1f playlist_state: start playing after restore is complete
Don't start playback as soon as the "current" song is being loaded
from the state file.  That is unclean, and leads to an obscure bug: in
repeat mode, when the song is started (which is yet the last song in
the list), the playlist code marked the very first song in the
playlist as "next" song, because the end of the playlist was wrapped.

It's easier to set up the playback after all songs have been loaded,
and after the random/repeat mode has been set.
2009-03-25 19:45:57 +01:00
Max Kellermann 3be1cdf8e0 output_all: synchronize playback with a notify object
Use audio_output_client_notify instead of g_usleep(1ms) in
audio_output_all_wait() to synchronize with the output_thread.  Signal
the audio_output_client_notify object in ao_play().
2009-03-25 18:04:41 +01:00
Max Kellermann 933fcf4232 output_all: moved code to audio_output_all_wait()
Synchronization with the output thread will be implemented in
output_all.c, not in player_thread.c.  Currently, that's just a simple
g_usleep(1ms).
2009-03-25 18:00:31 +01:00
Max Kellermann 4dbf73d88b output: protect audio_output.open with the mutex
There was a deadlock between the output thread and the player thread:
when the output thread failed (and closed itself) while the player
thread worked with the audio_output object, MPD could crash.
2009-03-25 17:07:15 +01:00
Viliam Mateicka 71cd24954a move printAllOutputPluginTypes to output_list.c 2009-03-21 09:45:42 +01:00
Max Kellermann 3d202e4609 output_control: close earlier on format mismatch
To prevent a race condition, close the output thread before assigning
the new audio format.
2009-03-20 16:21:49 +01:00
Max Kellermann e6c753a474 output: convert audio_output.config_audio_format to boolean
The config_audio_format used to contain the configured audio format,
which is copied to out_audio_format.  Let's convert the former to a
boolean, which indicates whether out_audio_format was already set.
This simplifies some code and saves a few bytes.
2009-03-20 15:47:50 +01:00
Max Kellermann 67e65a7959 page: added page_new_concat() 2009-03-17 20:51:33 +01:00
Max Kellermann 47bbb73ee1 player_thread: ignore time stamp on empty chunks
If a music_chunk does not contain any PCM data, then the "times" and
"bit_rate" attributes are undefined.
2009-03-17 20:28:37 +01:00
Mario Lenz 7ba7e67323 flac/cue: added support for TITLE[n] comments
On 2009/03/17 Max Kellermann<max@duempel.org> wrote:

> There doesn't seem to be an "official" standard.  I'd say: search for
> TITLE[1] first (the most explicit form), then TITLE1, and finally fall
> back to TITLE.  This makes sure MPD supports every possible standard,
> without breaking.

I've also added some additional checks to make sure entry is long
enough.
2009-03-17 12:41:46 +01:00
David Guibert 2a52d49536 pulse_mixer: keep mixer attached when another pulse sink is closed.
The mixer state is defined as offline only if the associated stream is removed.

Signed-off-by: David Guibert <david.guibert@gmail.com>
2009-03-17 08:40:50 +01:00
David Guibert 0ad56e0f8e pulse_mixer: close
when the mixer is closed,
- the mainloop is stopped.
- the context is disconnected.
- then the mainloop is freed.

Signed-off-by: David Guibert <david.guibert@gmail.com>
2009-03-17 08:40:50 +01:00
Jeffrey Middleton 91f3370913 httpd: fixed encoder plugin check
Check if encoder_plugin!=NULL, not encoder_plugin_get (which is a
function).
2009-03-17 06:52:23 +01:00
Jeffrey Middleton 3980245d1d httpd: correct the encoder name in the example mpd.conf
It's called "vorbis", not "ogg".
2009-03-17 06:51:31 +01:00
Mario Lenz 36dab871f1 flac: get CUE track titles from additional FLAC comments
The cue sheet embedded in a flac file doen't contain any information
about track titles and similar.  There are three possibilities: Use an
external cue sheet that includes these information, use a tag CUESHEET
with a cue sheet including these information or use tags.  I think the
latter is the best option and is already used by other projects.
2009-03-16 19:38:34 +01:00
Max Kellermann d47ef51cb3 socket_util: use g_strerror() instead of strerror()
g_strerror() is more portable, and guarantees that the returned string
is UTF-8 encoded.
2009-03-16 11:59:26 +01:00
Max Kellermann bba127a392 solaris: new audio output plugin for Solaris /dev/audio 2009-03-16 09:55:10 +01:00
Max Kellermann 18cb4fa277 output_all: check param!=NULL before accessing it
When printing the error message, MPD dereferences the NULL pointer to
print an error message if no audio_output section is present.
2009-03-16 08:44:49 +01:00
Avuton Olrich f35432af5a configure: Merge lame*encoder to lame 2009-03-16 08:44:48 +01:00
Avuton Olrich b356bcf6fa configure: don't warn just because we don't have an optional library. 2009-03-16 08:44:46 +01:00
Avuton Olrich e773cfa32b configure: error out against streaming output, not encoder. 2009-03-16 08:44:44 +01:00