Commit Graph

3342 Commits

Author SHA1 Message Date
Max Kellermann
1452717459 song_save: check for colon and space when loading a tag
matchesAnMpdTagItemKey() broke when two tag items had the same prefix,
because it did not check if the tag name ended after the prefix.  Add
a check for the colon and the space after the tag name.
2009-01-13 23:43:16 +01:00
Joe Milbourn
45598d50e3 input_curl: honour http_proxy_* config directives
If http_proxy_{host, port, user, password} are provided in mpd.conf
they are not passed on to libcurl. As a result mpd cannot stream from
behind an http proxy.

The attached patch `http_proxy.patch` makes the relevant calls to
curl_easy_setopt(...) for all proxy configuration parameters, but is
only tested for host and port.
2009-01-13 22:57:05 +01:00
Max Kellermann
18cb34700e daemon: don't check the setsid() return value
There is only one valid error condition for setsid(): when the current
process is already the process group leader.  This is non-critical.
2009-01-13 21:45:44 +01:00
Max Kellermann
2532129755 daemon: don't fork twice to daemonize
To detach from the parent process, fork once and make the old process
exit.  No need to do that twice.
2009-01-13 21:44:42 +01:00
Max Kellermann
d8fc8ca7ba playlist: implement Fisher-Yates shuffle properly
MPD's shuffling algorithm was not implemented well: it considers songs
which were already swapped, making it somewhat non-random.

Fix the Fisher-Yates shuffle algorithm by passing the proper bounds to
the PRNG.
2009-01-13 21:25:19 +01:00
Max Kellermann
e7c7e652a3 input_curl: use select() to eliminate busy loop during connect
When decoder_run_song() (decoder_thread.c) waits for the input stream
to become ready, it did that in a busy loop.  Add a select() call to
input_curl_buffer() during connect/handshake (i.e. before the first
chunk of body data was received), to let the CPU relax.
2009-01-13 19:30:34 +01:00
Max Kellermann
d82061b7ff decoder_api: don't ignore DECODE_COMMAND_STOP
When the decoder thread is waiting for free chunks in the music pipe,
don't ignore the STOP command.  Just return dc.command without further
checks.
2009-01-13 18:15:25 +01:00
Max Kellermann
9069a244a4 configure.ac: added the --enable-sqlite option
MPD will (optionall) use sqlite databases in the future.  Add a
configure option to enable that.  There is no code yet to really use
sqlite, so the practical use of this patch is limited.
2009-01-12 09:56:14 +01:00
Max Kellermann
52cf7953ff Makefile.am: moved C/CPP/LDFLAGS up 2009-01-11 17:41:54 +01:00
Max Kellermann
c057af6cea configure.ac: removed duplicate PKG_PROG_PKG_CONFIG 2009-01-11 17:39:23 +01:00
Viliam Mateicka
d357f58542 removing mixer_reconfigure memmory leak, fixing configure of alsa and oss mixer (passing parameters) 2009-01-11 17:13:01 +01:00
Max Kellermann
983822ea52 command: restore the "playlistinfo -1" behavior
If a range is "-1", display the whole list.  This behavior is
undocumented, but some clients rely on it.
2009-01-11 17:11:11 +01:00
Max Kellermann
e33cd80f25 added valgrind suppressions file 2009-01-10 18:55:48 +01:00
Max Kellermann
63d9827c34 main: remove "save_state" timer event on exit 2009-01-10 18:55:43 +01:00
Max Kellermann
0366adddbd client: remove "expire" event on exit 2009-01-10 18:55:39 +01:00
Max Kellermann
e3c6ad515d event_pipe: remove the GLib source from the main context
Free memory before exiting.
2009-01-10 18:55:36 +01:00
Max Kellermann
ca5432a79b listen: remove the socket source from the main context
Free memory before exiting.
2009-01-10 18:55:33 +01:00
Max Kellermann
d60cf67d19 listen: added struct listen_socket
Make the listen socket an object, allowing us to add more fields
later.  Convert listenSockets into a simple linked list.
2009-01-10 18:55:29 +01:00
Max Kellermann
a673d6be98 main: deinitialize main_notify on exit 2009-01-10 18:55:28 +01:00
Max Kellermann
52f1671e8c updated .gitignore 2009-01-10 17:56:58 +01:00
Viliam Mateicka
11c29cccb3 Introducing mixer api
This patch tryes to introduce pluggable mixer (struct mixer_plugin) along with some basic infrastructure (mixer_* functions). Instance of mixer (struct mixer) is used in
alsa and oss output plugin
2009-01-10 17:55:38 +01:00
Max Kellermann
8ebe7bfb25 playlist: pass unsigned integers to playlistInfo()
A song index cannot be negative.  Also require the second parameter to
be valid.
2009-01-10 17:39:49 +01:00
Max Kellermann
b7c4b78846 playlist: exclude end of range
In a range "start:end", "end" itself should not be included.  Use the
same semantics as other languages implementing ranges, e.g. Python.
2009-01-10 17:05:03 +01:00
Thomas Jansen
6f0781f039 command: playlistinfo now uses a range argument rather than just a song id
Loosely based on a patch provided by lesion in bug #1766. The playlistinfo
command can now retrieve ranges of the playlist. The new argument indicates
which entry is the last one that will be displayed. The number of displayed
entries may be smaller than expected if the end of the playlist is reached.

Previous usage:
playlistinfo [start]

New usage:
playlistinfo [start[:end]]
2009-01-10 16:50:34 +01:00
Thomas Jansen
8ed3cf3e6b command: add a parser for range arguments
A range argument looks like start[:end] and is used to specify the entries
of a list that should be returned (rather than the whole list).
2009-01-10 16:48:12 +01:00
Max Kellermann
5e93d3682f added missing explicit config.h includes 2009-01-08 21:37:02 +01:00
Max Kellermann
1c2f24dfc6 mapper: use directory_is_root() instead of isRootDirectory() 2009-01-08 21:29:30 +01:00
Max Kellermann
f0b865b4ca path: include cleanup 2009-01-08 21:29:29 +01:00
Max Kellermann
c232ea10ed update: removed one more stack buffer 2009-01-08 21:29:21 +01:00
Max Kellermann
5ed5aa99ac path: allocate buffer in fs_charset conversion functions
Don't use fixed static buffers.  GLib allocates a new string for us
anyway, let's just return this one instead of copying it.
2009-01-08 21:20:46 +01:00
Max Kellermann
f0980283bc update: include config.h, fix archive code
The archive code was disabled, because config.h was not included and
thus ENABLE_ARCHIVE was not defined.
2009-01-08 21:20:41 +01:00
Stepan Pologov
7a9a1e3e31 mapper: re-add character set conversion in map_uri_fs() 2009-01-08 17:29:08 +01:00
Max Kellermann
628866a065 update: save the database even if it is empty
Save an empty database, even if the music directory is empty.
2009-01-08 07:36:40 +01:00
Max Kellermann
bb08679a70 pcm_resample: use pcm_buffer (2/2)
Use the PCM buffer library for the libsamplerate output buffer.
2009-01-08 00:47:04 +01:00
Max Kellermann
2a83138913 pcm_resample: use pcm_buffer (1/2)
Return a temporary buffer from pcm_resample_*() and pcm_convert().
2009-01-08 00:46:38 +01:00
Max Kellermann
aab85577bf pcm_channels: use pcm_buffer
Replace a "static" buffer with the PCM buffer library.
2009-01-07 23:56:35 +01:00
Max Kellermann
5fe7e3bc14 pcm_format: use the pcm_buffer library
Replace a "static" buffer with the PCM buffer library.
2009-01-07 23:56:34 +01:00
Max Kellermann
954c2b5a25 pcm_buffer: new library for temporary buffers
This library allocates temporary buffers for storing PCM conversion
results.  It should replace all those "static" buffer variables which
are racy and never freed.
2009-01-07 23:56:30 +01:00
Max Kellermann
bf058f978a output: join the output thread after sending the KILL command
Be sure that the output thread has quite before we start destructing
the output object.
2009-01-07 23:55:13 +01:00
Max Kellermann
405c102c17 output: deinitialize notify object
Free memory allocated by the notify object (GMutex, GCond) when it's
not used by the output object anymore.
2009-01-07 23:53:28 +01:00
Max Kellermann
97ae4a499a mapper: don't allocate music_dir twice 2009-01-07 23:53:28 +01:00
Max Kellermann
7f34e9410e pcm: added pcm_convert_deinit(), pcm_resample_deinit()
Free memory allocated by libsamplerate when the output or the decoder
is closed.
2009-01-07 22:20:30 +01:00
Max Kellermann
97b844ec72 pcm_volume: changed PCM_VOLUME_1 to 1024
1024 is 2^10, and allows gcc to use bit shift operations instead of
multiplication / division.
2009-01-07 21:40:35 +01:00
Max Kellermann
04a2138b33 pcm: pass void pointers to PCM functions
In generic PCM functions allowing all sample formats, pass a void
pointer instead of a char pointer.
2009-01-07 19:00:02 +01:00
Max Kellermann
bb01016400 Makefile.am: added mixer_api.h to mpd_headers 2009-01-07 18:55:26 +01:00
Max Kellermann
b40428b3fd pcm_utils: moved conversion code to pcm_convert.c
All what's left in pcm_utils.h is the pcm_range() utility function,
which is only used internally by pcm_volume and pcm_mix.
2009-01-07 18:53:36 +01:00
Max Kellermann
8b19c74e8e pcm_format: pass struct pcm_dither_24 to pcm_convert_to_16()
The function does not need the full pcm_convert_state struct.
2009-01-07 18:19:22 +01:00
Max Kellermann
df30a29391 pcm_utils: moved code to pcm_format.c
Moved all code which converts the sample format to a separate library.
2009-01-07 18:19:09 +01:00
Max Kellermann
6768581c41 pcm_volume: rename pcm_dither() to pcm_volume_dither() 2009-01-07 18:08:26 +01:00
Max Kellermann
b7b5e3f9c3 pcm_prng: renamed prng() to pcm_prng() 2009-01-07 18:07:19 +01:00