Commit Graph

2557 Commits

Author SHA1 Message Date
Max Kellermann befecb1d47 configure.ac: disable libtool
Since we're not building the local mp4ff library anymore, we can
remove AC_PROG_LIBTOOL.
2008-10-25 21:23:52 +02:00
Max Kellermann 1110a6d410 removed internal copy of libmp4ff
MPD shouldn't integrate sources of other libraries.  Since libmp4ff is
part of libfaad, we should remove the old copy from src/mp4ff and link
with the current version from libfaad instead.
2008-10-25 20:59:36 +02:00
Max Kellermann a02db57291 pulse: force 16 bit audio sample format
PA_SAMPLE_S16NE is the only sample format which is suported by both
MPD and pulseaudio.  Unfortunately, pulse does not accept 24 bit
samples.

Instead of bailing out with an error message, we should tell the MPD
core to convert all samples to 16 bit for pulse.
2008-10-25 20:41:28 +02:00
Eric Wong 0fd6fa9927 AUTHORS: Eric Wong is a former developer
Eric is too busy with other projects and will remain inactive
indefinitely.
2008-10-25 19:50:59 +02:00
Max Kellermann ee499cb42f player: don't clear command before do_play() returns
This bug caused the audio output devices to stay open, although MPD
wasn't playing: quitDecode() resetted player_control.command, assuming
that the command was STOP.  This way, player_task() didn't see the
CLOSE_AUDIO command, and the device was kept open.

Don't clear player_control.command in quitDecode().
2008-10-24 17:50:24 +02:00
Max Kellermann 18c6ebb023 remove unused sources
These are results from failed merges which I didn't notice.
2008-10-24 17:41:13 +02:00
Max Kellermann f4e6bb2815 jack: support for 24 bit samples
When the audio source provides 24 bit samples, don't bother to convert
(lossily) them to 16 bit before jack's floating point conversion - go
directly from 24 bit to float.
2008-10-24 17:36:11 +02:00
Max Kellermann b1adfaae43 jack: moved code to jack_write_samples_16()
Move sample format dependent code to a separate function.
2008-10-24 17:34:47 +02:00
Max Kellermann 03a077e8a4 jack: eliminated CamelCase
Renamed all variables and functions.  Add the prefix "mpd_jack_" to
function names.
2008-10-24 17:29:37 +02:00
Max Kellermann e19f0a8dbc jack: added assertions against partial frames
We must never pass partial frames.  Added assertions to debug this.
2008-10-24 16:56:10 +02:00
Max Kellermann e7cd237674 jack: optimize local variables
Merge the variables "avail_data" and "avail_frames" into "available".
Both variables are never used at the same time.
2008-10-24 16:56:08 +02:00
Max Kellermann 0a6704420b jack: lockless data transfer to jack thread
The JACK documentation postulates that the process() callback must not
block, therefore locking is forbidden.  Anyway, the old code was racy.

Remove all locks, and don't wait for more data to become available -
just send to the port what is already in the buffer.
2008-10-24 16:55:51 +02:00
Max Kellermann 4ecdaabbb0 jack: partial writes to ring buffer
Don't wait until there is room for the full data chunk passed to
jack_playAudio().  Try to incrementally send as much as possible into
the ring buffer.
2008-10-24 16:39:43 +02:00
Max Kellermann 91ad576aad jack: added constant "frame_size"
Don't hard-code a frame size of "4" (16 bit stereo), calculate the
sample size from sizeof(*buffer), and create the constant
"frame_size".
2008-10-24 15:47:52 +02:00
Max Kellermann 9d6651d8b2 jack: fix indentation
Indent with tabs.
2008-10-24 08:44:40 +02:00
Max Kellermann 8b4829c2fe pcm_resample: support for libsamplerate < 0.1.3
libsamplerate 0.1.2 didn't have the 32 bit <-> float conversion
routines.  Emulate them in case they aren't supported.
2008-10-24 08:41:34 +02:00
Max Kellermann 5fefa954a3 player: don't send partial frames of silence
Another partial frame fix: the silence buffer was 1020 bytes, which
had room for 127.5 24 bit stereo frames.  Don't send the partial last
frame in this case.
2008-10-23 20:54:52 +02:00
Max Kellermann 4eadb0f7aa pcm_utils: added 24 bit conversion functions
24 bit output is as important as 16 bit output.  Provide a
pcm_convert() implementation which can convert to 24 bit with as
little quality loss as possible.
2008-10-23 20:11:37 +02:00
Max Kellermann ec37633f1c pcm_utils: generic pcm_convert_size() implementation
The old pcm_convert_size() ignored most of the destination format,
e.g. it did not check its sample size, and assumed it is 16 bit.
Simplify and universalize it by using audio_format_frame_size().
2008-10-23 20:11:28 +02:00
Max Kellermann 98e4817548 pcm_utils: moved code to pcm_convert_16()
pcm_convert() converted only to 16 bit.  To be able to support other
sample sizes, move that 16 bit specific code to a separate function.
2008-10-23 20:11:24 +02:00
Max Kellermann 8489e90c1e pcm_channels: added 24 bit implementations
The 24 bit implementation is mostly copy'n'paste of the 16 bit
version, except that the data type is int32_t instead of int16_t.
2008-10-23 20:04:37 +02:00
Max Kellermann a0bcbb37f4 pcm_utils: moved channel conversion functions to pcm_channels.c
Separate code from pcm_utils.c to keep it small and simple.
2008-10-23 20:03:14 +02:00
Max Kellermann af7cb932fb pcm_resample: implemented 24 bit resampling
Similar to pcm_resample_16(), implement pcm_resample_24().  The 24 bit
implementation is very similar, but it uses src_int_to_float_array()
instead of src_short_to_float_array() before sending data to
libsamplerate.
2008-10-23 20:02:51 +02:00
Max Kellermann 5bbcbfb7ce pcm_resample: moved code to pcm_resample_set()
A future patch will implement a 24 bit resampler.  To unify code, move
code which can be shared to a separate function.
2008-10-23 20:02:09 +02:00
Max Kellermann 1dcb946fb0 pcm_resample: eliminated "sample" local variables
Copy from source to destination buffer directly, don't use the
temporary variables "lsample" and "rsample".
2008-10-23 20:01:37 +02:00
Max Kellermann 124f79a2a6 pcm_resample: don't resample partial samples
Added assertions which ensure that there are no partial samples in the
source buffer.
2008-10-23 20:01:12 +02:00
Max Kellermann b13d656f81 pcm_resample: don't hard-code sample size
Use sizeof(sample) instead of hard-coding "2".  Although we're in 16
bit right now, this will make code sharing easier when we support
other sample sizes.
2008-10-23 20:01:08 +02:00
Max Kellermann 6b1c54ef96 pcm_utils: moved code to pcm_resample.c
Separate the resampling code from the rest of pcm_utils.c.  Create two
sub-libraries: pcm_resample_libsamplerate.c and
pcm_resample_fallback.c.
2008-10-23 20:00:51 +02:00
Max Kellermann 098991f8e8 command: fix boolean value parser
Due to a logic error, no value was valid for the boolean value
parser.  Replace "||" with "&&".
2008-10-23 18:06:05 +02:00
Max Kellermann 2cc2420f8c mp3: send 24 bit PCM data
libmad produces samples of more than 24 bit.  Rounding that down to 16
bits using dithering makes those people lose quality who have a 24 bit
capable sound device.  Send 24 bit PCM data, and let the receiver
decide whether to apply 16 bit dithering.
2008-10-23 16:58:38 +02:00
Max Kellermann bf5774edbd mp3: use sizeof(sample) instead of hard-coded "2"
We are going to convert the code to 24 bit; don't hard-code a sample
size of 2 bytes.
2008-10-23 16:58:14 +02:00
Max Kellermann 0078837a97 pcm_dither: added generic 24 to 16 bit dithering
Copied and adapted code from the mp3 decoder plugin.  This library now
replaces the old and low-quality function pcm_convert_24_to_16().
2008-10-23 16:58:07 +02:00
Max Kellermann 80603cf6f1 audio: allow 24 and 8 bit output
I added 24 bit support a while ago, but it wasn't possible to force 24
bit output.  Add 24 and 8 bit to the list of allowed sample sizes.
Although 8 bit audio isn't as widely used as 24 bit, there is no
reason to exclude it.
2008-10-23 16:57:58 +02:00
Max Kellermann 980f2ca56d output_buffer: don't split frames
Splitting a frame between two buffer chunks causes distortion in the
output.  MPD used to assume that the chunk size 1020 would never cause
splitted frames, but that isn't the case for 24 bit stereo (127.5
frames), and even less for files with even more channels.
2008-10-23 16:48:49 +02:00
Max Kellermann 4f807b3aaa stored_playlist: don't map files outside the database
Don't attempt to map paths which are already absolute with
map_song_fs(): check with song_in_database() instead of
song_is_file().
2008-10-23 09:54:42 +02:00
Max Kellermann fdc9a4cc5a stored_playlist: emit idle event on delete
The "rm" command did not send notifications to idle clients.  Add it.
2008-10-23 09:54:39 +02:00
Max Kellermann 93598e28f4 stored_playlist: renamed and moved spl_delete() to stored_playlist.c
The function deletePlaylist() shouldn't be in playlist.c.
2008-10-23 09:54:32 +02:00
Max Kellermann 39f0c41fbf stored_playlist: spl_load() returns GPtrArray
Don't use our deprecated linked list library, use GLib's GPtrArray
instead.
2008-10-23 09:54:28 +02:00
Max Kellermann e172874cc6 command: check over/underflows in check_int()
The "long" result of strtol() was implicitly casted down to a 32 bit
integer.  Add some range checking instead.
2008-10-23 09:54:10 +02:00
Max Kellermann 95ae1d9e9e command: added check_unsigned() / check_bool()
Many command arguments must not be negative; add a separate
parser/checker function for that.  For the same reason, add
check_bool().  This eliminates two strange special cases handlers from
check_int().
2008-10-23 09:53:35 +02:00
Max Kellermann 3958457256 stored_playlist: unsigned index arguments
Pass index arguments as unsigned integers.  They must not be negative,
and even if some caller accidently passes -1, it won't pass the bound
checks (since it's now 2**32-1).
2008-10-23 09:53:34 +02:00
Max Kellermann bc938603f6 playlist: unsigned integers
There are some integers which have a "magic" -1 value which means
"undefined" or "nothing".  All others can be converted to unsigned,
since they must not contain a negative number.
2008-10-23 07:19:46 +02:00
Max Kellermann 890b067346 command: use the bool datatype instead of int
Instead of returning 0 for success and -1 for failure, return true or
false.  This seems more natural.
2008-10-22 21:41:54 +02:00
Max Kellermann d4f3c09081 command: converted COMMAND_RETURN_* macros to enum
Also add names for "error" and "ok".  I don't like passing anonymous
integer codes around.

This is not yet complete: lots of functions (e.g. in playlist.c)
follow the same convention of -1/0, and these have to be adapted, too.
2008-10-22 21:41:49 +02:00
Max Kellermann d11ee6580c command: replaced "goto" with "break"
http://xkcd.com/292/
2008-10-22 21:40:58 +02:00
Max Kellermann 51a6ee88f7 command: no CamelCase
Eliminate CamelCase in all public and static functions.
2008-10-22 21:40:44 +02:00
Max Kellermann 69c563b511 command: removed CommandHandlerFunction typedef
The typedef CommandHandlerFunction is only used once.  Move its type
into the command struct.
2008-10-22 21:40:36 +02:00
Max Kellermann d0a9dcdcf5 ack: converted ACK_ERROR_* macros to enum 2008-10-22 21:40:32 +02:00
Max Kellermann 7aca4cd194 stored_playlist: send timestamps
Send last modification timestamps to the client.  This allows the
client to see when another client modifies a stored playlist.
2008-10-22 19:18:39 +02:00
Max Kellermann 9c983c442c command: added command "listplaylists"
"listplaylists" returns a list of all stored playlists.  This command
seems more elaborate than listing them below "lsinfo".
2008-10-22 19:16:56 +02:00