Commit Graph

3645 Commits

Author SHA1 Message Date
Max Kellermann a7685780ed configure.ac: renamed --enable-mod to --enable-mikmod 2009-04-01 22:48:06 +02:00
Max Kellermann cd6182862a httpd: don't pass uninitialized page to httpd_client_check_queue()
The httpd_client_check_queue() callback function does not use its
"user_data" argument.  Don't pass any, and fix the gcc warning.
2009-04-01 22:45:21 +02:00
Max Kellermann 5242305a90 configure.ac: renamed --enable-oggvorbis to --enable-vorbis 2009-04-01 22:45:17 +02:00
Max Kellermann e720b5bdf8 command: added command "sticker find"
This command allows clients to search for stickers with a specified
name.
2009-04-01 18:53:02 +02:00
Eric Wollesen c95fa4b441 Move db_get_song into sub-handlers. (FReq 2112)
db_get_song was being called once for all sub-handlers, but with the
addition of the find command, we don't have a URI coming in, so doing
db_get_song once won't work anymore.

[mk: fixed initialization order]
2009-04-01 18:44:39 +02:00
Max Kellermann c51e1bf1c0 song_sticker: added song_sticker_find()
This is a wrapper for sticker_find(), which looks up the song object.
2009-04-01 18:44:26 +02:00
Max Kellermann 3a4d20faa2 sticker: added sticker_find()
sticker_find() finds stickers with the specified name.
2009-04-01 18:42:06 +02:00
Max Kellermann 7f38c3fc78 directory: added directory_lookup_song()
Moved code from db_get_song().
2009-04-01 18:41:37 +02:00
Max Kellermann 36ec2edacf directory: renamed directory_get_directory()
Renamed directory_get_directory() to directory_lookup_directory().
Added API documentation.
2009-04-01 18:41:33 +02:00
Max Kellermann cb35d6e687 sticker_print: new library for sending stickers to a client 2009-04-01 17:30:56 +02:00
Max Kellermann efcf40f55b sticker: pass const sticker to sticker_foreach() 2009-04-01 17:27:59 +02:00
Max Kellermann 8ce2ec7aed client, event_pipe: explicitly ignore the write() result
On both locations, the result of write() can be ignored safely.  In
event_pipe_emit_fast(), that can only be "EAGAIN", which means that
the pipe buffer is full - no further notification required.  In
client_init(), that would be a fatal connection error, which would be
caught by the next event.

This patch fixes gcc warnings.
2009-04-01 17:14:25 +02:00
Max Kellermann a96bec3655 socket_util: fixed format warning
g_set_error() is a printf-like function, and expects a format string.
Using the return value of gai_strerror() is unsafe.
2009-04-01 16:45:03 +02:00
Max Kellermann 6419cc54ac flac: fixed "unused variable" warning without libcue
Move the declaration of "i" into the "for" loop.
2009-04-01 16:44:27 +02:00
Jochen Keil 4bfbdfe5c5 Tag subtracks according to "cuesheet" vorbis comment value
Cuesheets are often saved as vorbis comment
flac files (CUESHEET=.. case doesn't matter).
We can parse this now and use the information to
tag the subtracks (from the embedded cuesheets).
2009-03-31 22:17:56 +02:00
Jochen Keil d7b0c768b0 track length is computed correctly now 2009-03-31 22:17:56 +02:00
Jochen Keil 6720a0a940 free previously allocated flac metadata object 2009-03-31 22:17:56 +02:00
Jochen Keil a1bde6b99d remove old commented code 2009-03-31 22:17:56 +02:00
Jochen Keil d41e7f7cec Build tags from information in cue sheets
With these methods a tag struct can be created
from the cdtext information in a cue sheet.
The methods depend on a cue parsing library.
Reading from strings (char*) as well as from
a file (FILE*) is supported.
2009-03-31 22:17:56 +02:00
Romain Bignon 62a72a5e4d do not consider single mode with "next" command
This is a little ugly, but as nextSongInPlaylist is both called when
queued is update (in case playlist ended) and for user "next" command,
there isn't any other (simple) solution
2009-03-31 14:15:33 +02:00
Avuton Olrich 98e81287e3 client: group static function declarations together. 2009-03-30 19:21:42 +02:00
Avuton Olrich ee7369a8f1 queue_print: queue_print_song_info() is not necessry for export. 2009-03-30 19:21:41 +02:00
Avuton Olrich 68a4bb90da queue: queue_generate_id() is not necessary for export. 2009-03-30 19:21:41 +02:00
Avuton Olrich ed96db3fae player_control: remove unused function playerCurrentDecodeSong(). 2009-03-30 19:21:41 +02:00
Avuton Olrich 6405db931b conf: config_param_free() not necessary for export. 2009-03-30 19:21:41 +02:00
Avuton Olrich 96ab110b44 command: command_error() is not necessary for export. 2009-03-30 19:21:41 +02:00
Avuton Olrich 215cdda08d client: client_write() does not necessary for export. 2009-03-30 19:21:41 +02:00
Romain Bignon e81f683a18 implemented the 'consume' mode
Consume mode removes each song played
2009-03-30 17:37:55 +02:00
Jochen Keil 80e2aaf379 Bugfix for time/offset in flac plugin
Previous cast to float didn't have any effect because one value is uint
and the other is a floating type but the number itself is even..
This caused some tracks to end before they were really at an end.
2009-03-28 10:13:44 +01:00
Max Kellermann 43864762ee mixer: assert that the new volume value is valid
Added an assertion in mixer_set_volume().  Removed the range checks
from the ALSA and OSS plugins.
2009-03-27 20:10:39 +01:00
Max Kellermann 49e548e773 mpcdec: changed plugin name to "mpcdec"
The "mpcdec" plugin is based on the libmpcdec library.
2009-03-27 19:58:50 +01:00
Max Kellermann f5548a8654 mpcdec: support the new libmpcdec SV8 API 2009-03-27 19:51:59 +01:00
Max Kellermann 0e18fab655 mpcdec: no CamelCase
Renamed variables and functions.
2009-03-27 19:37:08 +01:00
Max Kellermann 86827fc63e tag_pool: use memcmp() instead of strcmp() for non-terminated string
The strings passed to tag_pool_get_item() are not null-terminated, and
the caller passes the string length.  Don't assume it is
null-terminated anyway by using strcmp().
2009-03-27 19:36:24 +01:00
Max Kellermann 51894725ec tag_pool: use size_t for string length 2009-03-27 19:36:03 +01:00
Sean McNamara 94479ca40f event_pipe can only be non-blocking if !WIN32 2009-03-27 18:03:46 +01:00
Sean McNamara f5ff243a8b More debugging for Win32 ioctlsocket: complain if it's not a Winsock
socket, because there is no ioctl for non-sockets on Windows
2009-03-27 18:03:10 +01:00
Sean McNamara 37531f6f1e Add winsock2 headers for curl's use of select() on sockets 2009-03-27 18:03:03 +01:00
Sean McNamara b1e0bde529 Uniform getaddrinfo() on WIN32 or POSIX, because MinGW now supports it 2009-03-27 18:02:56 +01:00
Sean McNamara 9c63ffa546 Winsock2 is needed on MinGW (or other pure Win32 toolchains) for
networking, select(), ntohl(), etc.
2009-03-27 18:02:31 +01:00
Max Kellermann b91517e761 sticker: move SQLite statements into an array
Simplify initialization and finalization.
2009-03-27 17:05:04 +01:00
Max Kellermann 7d3921bb88 pulse_mixer: protect the struct with a mutex
There are numerous race conditions between the libpulse thread
(pulse_mixer.c callbacks) and the rest of MPD.  Protect the volatile
attributes of the pulse_mixer struct with a mutex to fix that.
2009-03-27 16:55:17 +01:00
Max Kellermann 7f762a5cec pulse_mixer: return if mixer is offline
Eliminate one indent level.  Also remove several debug useless debug
messages.
2009-03-27 16:44:37 +01:00
Max Kellermann 13319e0b70 pulse_mixer: removed superfluous G_GNUC_UNUSED attributes
Those parameters are used after all.
2009-03-27 16:44:36 +01:00
Max Kellermann d448392f25 pulse_mixer: use local pa_cvolume variable for set_volume()
Don't mess with pulse_mixer.volume for setting the volume.  This
variable should only be used to transfer the current volume from
sink_input_vol() to pulse_mixer_get_volume().
2009-03-27 16:44:36 +01:00
Max Kellermann 8258457b43 pulse_mixer: wait for get_volume() operation to complete
The pa_context_get_sink_input_info() function is asynchronous, and
after it returns, libpulse does not guarantee that the operation has
completed yet; in fact, it is not likely.  Explicitly wait for the
operation to complete.

The code for the new pulse_wait_for_operation() function was inspired
by mplayer and xine code.
2009-03-27 16:44:36 +01:00
Max Kellermann 1a411b1ced mixer_control: don't lock the mutex twice in mixer_failed()
The function mixer_failed() expects the mixer mutex to be already
locked, yet it calls mixer_close(), which attempts to lock the mutex
again, deadlocking itself.
2009-03-27 16:44:31 +01: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
Max Kellermann 929c200c38 pulse_mixer: adapted code style
Use the same code style as the rest of MPD.
2009-03-27 00:43:47 +01:00
Max Kellermann 207786ffb1 output_all: synchronize playback with player_control.notify
This patch fixes a longer delay when moving around songs in the
playlist.  The main thread wants to enqueue a new "next" song into the
player thread, but the player thread is waiting inside
audio_output_all_wait() for the output threads.  Use
player_control.notify there, so audio_output_all_wait() gets woken up
by the main thread, too.
2009-03-26 23:40:50 +01:00
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
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
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
Max Kellermann 870706519a httpd_output: check client->write_source_id in handler
Due to a race condition, httpd_client_out_event() could be called even
when its GLib event source was already removed.  Check that case.
2009-03-15 19:06:14 +01:00
Max Kellermann 58844aabac httpd_output: clear the client's page queue on cancel
When the httpd output is cancelled, it freed all pages, but didn't
remove them from the queue.  Call g_queue_clear() and remove the
write source id.
2009-03-15 19:06:10 +01:00
Max Kellermann ae1a7fc84a vorbis_encoder: added support for all MPD tag types
Copy all tags know to MPD to the vorbis_comment.
2009-03-15 18:36:29 +01:00
Max Kellermann 4bb84c05d7 vorbis_encoder: removed vorbis_encoder.vc
Allocate the vorbis_comment object when it's used.  It is not used
anymore in vorbis_encoder_tag().
2009-03-15 18:36:26 +01:00
Max Kellermann 3333502edb vorbis_encoder: use vorbis_commentheader_out() in the tag() method
Don't reinitialize the encoder with every tag.
2009-03-15 18:36:25 +01:00
Max Kellermann 2b74311b0a vorbis_encoder: pass vorbis_comment to tag helper functions
Prepare the removal of vorbis_encoder.vc.
2009-03-15 18:23:04 +01:00
Max Kellermann a899c210b9 log: removed DEBUG() and FATAL()
Use GLib the logging functions g_debug(), g_error() instead.
2009-03-15 18:23:00 +01:00
Max Kellermann 9e30dfb9c1 dbUtils: removed printSavedMemoryFromFilenames()
The function is unused.
2009-03-15 18:21:53 +01:00
Max Kellermann 1308f5f669 sig_handlers: include signal.h instead of sys/signal.h 2009-03-15 17:32:30 +01:00
Max Kellermann e62580db0b httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup!  MPD can do better if it's doing the HTTP server
stuff on its own.  This new plugin has several advantages:

- easier to set up - only one daemon, no password settings, no mount
  settings
- MPD controls the encoder and thus already knows the packet
  boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening

This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...).  It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server.  Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
Max Kellermann 565afefc66 page: new library for reference counted buffers 2009-03-15 02:29:12 +01:00
Max Kellermann eb34bd2eff vorbis_encoder: make ogg_page a local variable
Converted the ogg_page attribute from the vorbis_encoder struct to a
local function of vorbis_encoder_read().  This simplifies some code,
because we don't need to check the page anymore before using it.
2009-03-15 02:26:16 +01:00
Max Kellermann 65cc280e1a vorbis_encoder: fill the ogg_page in the read() method
Add the "flush" flag, and defer the ogg_stream_flush() call.  Call
ogg_stream_pageout() or ogg_stream_flush() (depending on the "flush"
flag) in vorbis_encoder_read().  This prevents the ogg_page from
getting overwritten by consecutive ogg_stream_pageout() calls.
2009-03-15 02:23:36 +01:00
Max Kellermann c8c3920500 socket_util: added socket_bind_listen()
Moved code from listen_add_address() (listen.c) to socket_util.c.
2009-03-14 18:29:38 +01:00
Max Kellermann dccb973cfe client: use the new fifo_buffer library 2009-03-14 17:46:01 +01:00
Max Kellermann c76d35969b fifo_buffer: added buffering library
It is a library which I have written years ago for other projects.
This library is licensed under BSD 2-clause, because it is very
generic.
2009-03-14 17:30:00 +01:00
Max Kellermann e12140cfce pcm_resample: choose the fallback resampler at runtime
Even if libsamplerate support is enabled, compile the fallback
resampler.  When the user specifies the option
"samplerate_converter=internal", it is chosen in favor of
libsamplerate.  This may help users with a weak FPU who don't want to
compile a custom MPD from source, because the fallback resampler does
not use floating point operations.
2009-03-14 15:26:36 +01:00
Max Kellermann 456201fa22 pcm_resample: renamed implementation functions
Added diversion functions to pcm_resample.c.  These check which
resampler is enabled at compile time (libsamplerate or fallback).
This prepares the following patch.
2009-03-14 15:26:28 +01:00
Max Kellermann f1eed721d2 output_all: added missing "unused" attribute
In NDEBUG, clear_tail_chunk() does not use its "chunk" parameter.
2009-03-14 15:26:27 +01:00
Max Kellermann 975ca2dae5 output_all: include chunk.h
The source output_all.c accesses music_chunk struct members, but did
not include chunk.h directly.
2009-03-14 15:26:27 +01:00
Max Kellermann d56aa88660 pcm_volume: use #ifdef instead of #if __i386__ 2009-03-14 14:39:48 +01:00
Max Kellermann 35a04ccf07 tag_pool: make "slots" static
The variable is private.
2009-03-14 14:38:48 +01:00
Max Kellermann f711198ab3 pcm_resample: return NULL on failure
Changed "0" to "NULL".
2009-03-14 14:37:31 +01:00
Max Kellermann 8df0a29cbc pcm_convert: return NULL on failure
Changed "0" to "NULL".
2009-03-14 14:36:44 +01:00
Max Kellermann e5767d6da8 command: return COMMAND_RETURN_OK in handle_addid()
At the last line of handle_addid(), the playlist_result value has
already been evaluated.  Don't return this variable, it's the wrong
type.
2009-03-14 14:36:07 +01:00
Max Kellermann 7b53504a41 command: handle the addToPlaylist() result properly
addToPlaylist() has a "enum playlist_result" return value.  Convert
that to "enum command_return" properly.
2009-03-14 14:33:19 +01:00
Max Kellermann 0007d84d95 faad: faad_decoder_decode() returns NULL, not false
On failure, the function should return NULL, not a boolean.
2009-03-14 14:31:38 +01:00
Max Kellermann d70591b652 sticker: sticker_load_value() returns NULL on error, not false
Turn the "return false" error handlers into "return NULL".
2009-03-14 14:29:54 +01:00
Max Kellermann 77eaab55a3 sticker: initialize hash table in sticker_new()
Moved the hash table initialization from sticker_list_values() to the
new function sticker_new().  This fixes a memory leak in
sticker_list_values().
2009-03-14 14:21:11 +01:00
Max Kellermann be38ad5b93 sticker: don't export sticker_list_values()
sticker_list_values() is only used internally in sticker.c.  Remove
sticker_song_list_values() completely, it is superseded by
sticker_song_get().
2009-03-14 14:20:08 +01:00
Max Kellermann 24da9410fa command: use sticker_song_get() instead of sticker_song_list_values() 2009-03-14 14:20:04 +01:00
Max Kellermann dd67992a0c sticker: added "struct sticker"
The sticker struct can be used for enumerating values.  This will
replace the sticker_list_values() function.
2009-03-14 14:20:01 +01:00
Max Kellermann 5b687795c4 mixer_all: removed debug message
Don't dump the volume of all mixers.
2009-03-14 11:54:39 +01:00
Max Kellermann 7deade8577 mixer: protect the mixer struct with a mutex
In some rare cases, there was a race condition between the output
thread and the main thread: when you disable/enable an output device
in the main thread, this caused a crash in the output thread.  Protect
the whole mixer struct with a GMutex to prevent that.
2009-03-14 11:53:28 +01:00
Max Kellermann 82963ee023 mixer_api: moved mixer_init() to mixer_api.c 2009-03-14 11:47:54 +01:00
Max Kellermann b488355df8 mixer_api: moved mixer_plugin imports to mixer_list.h
This patch allows the output plugins to import only mixer_list.h,
instead of the full mixer_api.h (which would expose internal
structures).
2009-03-14 11:36:59 +01:00
Max Kellermann a5017a2d7c mixer_api: moved functions to mixer_control.c
mixer_control.h should provide the functions needed to manipulate a
mixer, without exposing the internal mixer API (which is provided by
mixer_api.h).
2009-03-14 11:36:50 +01:00
Max Kellermann 8d01110c84 mixer_control: moved functions to mixer_all.c 2009-03-14 11:35:54 +01:00
Max Kellermann 88af35c0ab volume: moved code to mixer_all.c 2009-03-14 11:35:40 +01:00
Max Kellermann e7c3f469c3 mixer_api: moved struct mixer_plugin to mixer_plugin.h 2009-03-14 11:33:51 +01:00
Max Kellermann f15d879e37 volume: use bool instead of int
Return true/false on success/failure, instead of 0/-1.  Pass
true/false instead of 1/0 for the "rel" boolean parameter.
2009-03-14 11:10:21 +01:00
Jochen Keil f31c371fbd Removed superfluous if statement in update.c:453
Check for NULL not necessary here
2009-03-14 09:33:55 +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
Jeffrey Middleton 6e72755204 crossfade: added missing '&' 2009-03-12 20:23:46 +01:00
Max Kellermann 6352e75910 crossfade: copy chunk.audio_format in !NDEBUG
When the destination chunk was empty in cross_fade_apply(), it had no
audio_format attached (an attribute which is only used for assertion
in the debug build).  cross_fade_apply() should assign it the
audio_format of the second chunk (if available), otherwise MPD will
crash.
2009-03-12 19:49:15 +01:00
Max Kellermann e3b9b57ecd output_all: fix off-by-one error in audio_output_all_check()
When there are chunks which are not yet finished,
audio_output_all_check() returned the size of its music pipe minus
one.  I can't remember exactly why I subtracted 1 from the return
value, it must have had something to do with a former meaning of this
function.  Now it induces assertion failures.
2009-03-12 19:49:10 +01:00
Max Kellermann 0bc7f584f4 mixer_control: don't touch mixers of disabled outputs
When an audio output device is disabled, also disable its mixer.
2009-03-12 18:40:03 +01:00
Max Kellermann c37567a14f audio: converted device number check to assertion
No caller must ever pass an invalid device number to
mixer_control_setvol() or mixer_control_getvol().
2009-03-12 18:34:38 +01:00
Max Kellermann e9cbb6be3f audio: moved mixer functions to mixer_control.c 2009-03-12 18:34:37 +01:00
Max Kellermann 9feaedd799 volume: removed unused variable "default_mixer" 2009-03-12 18:24:13 +01:00
Eric Wollesen e2dc3c948f Move from the opaque GPtrArray to GHashTable for sticker lists. 2009-03-11 17:03:01 -06:00
Max Kellermann bc3702a4fd player_thread: added comments 2009-03-11 09:35:16 +01:00
Max Kellermann 13cd6b2834 player_thread: removed player_stop_decoder()
Replaced both player_stop_decoder() invocations with player_dc_stop(),
which also cleans up the pipe.
2009-03-11 09:20:34 +01:00
Max Kellermann 903a07b80e player_thread: don't call dc_stop() twice
In the "CANCEL" command handler, the decoder is stopped twice: first
by player_dc_stop(), then by dc_stop().  Remove the latter.
2009-03-11 09:20:33 +01:00
Max Kellermann 923ac213b5 output_control: removed audio_output_signal()
This function was part of a workaround which we don't need anymore.
2009-03-10 22:48:12 +01:00
Jochen Keil 756b0022da Cleaned up update_regular_file() method in update.c
After adding the container_scan() method the update_regular_file() method was quite hard to read.
Now there's update_container_file() which deals with container files.
That way normal container files (i.e. without embedded tracks) are handled by the old code like a regular file.
This will fix some of the odd behaviour observed.
2009-03-10 22:09:51 +01:00