Max Kellermann
353ae5e558
osx: use OSStatus and GetMacOSStatusCommentString()
...
The return type of most OS X functions is OSStatus, not int. We can
get a nice error message from GetMacOSStatusCommentString(), log it.
2009-02-26 22:01:42 +01:00
Max Kellermann
9dc966041d
osx: start the audio device in the open() method
...
Don't call AudioOutputUnitStart() in the play() method, do it after
the device has been opened. We can eliminate the "started" property
now, because the device is always started when it's open.
2009-02-26 21:40:22 +01:00
Max Kellermann
fb5ca6aa29
osx: removed commented code
...
We don't need to keep commented code forever. If we want that
test_default_device() implementation back one day, we'll pick it from
the git history.
2009-02-26 21:33:13 +01:00
Max Kellermann
985ca094f2
osx: no CamelCase
...
Renamed types, functions, variables.
2009-02-26 21:03:06 +01:00
Max Kellermann
bcc3a9debf
shout: use config_get_block_unsigned()
...
Eliminated manual integer parsing.
2009-02-26 19:34:00 +01:00
Max Kellermann
710a61a3dc
pulse: removed pa_simple!=NULL checks
...
The MPD core guarantees that the audio_output object is always
consistent, and our pa_simple!=NULL checks are superfluous. Also
don't manually close the device on error in pulse_play(), since the
MPD core does this automatically when the play() method returns 0.
2009-02-26 19:29:06 +01:00
Max Kellermann
4f2ac7ec2c
oss: moved code from oss_open() to oss_setup()
...
Eliminate one label and a bunch of gotos.
2009-02-26 19:18:16 +01:00
Max Kellermann
749d6c7766
oss: convert OSS_STAT_* to an enum
...
Use C instead of CPP.
2009-02-26 19:18:13 +01:00
Max Kellermann
a0b3f35537
oss: return bool instead of int
...
Return type of oss_find_supported_param(), oss_can_convert() and
oss_find_unsupported_param() should be bool instead of int.
2009-02-26 19:17:56 +01:00
Max Kellermann
e1f58fdcf5
oss: use unsigned integers
...
Convert the num_supported and num_unsupported variables from signed to
unsigned.
2009-02-26 19:17:09 +01:00
Max Kellermann
4958a6f56f
oss: no CamelCase
...
Renamed types, functions and variables.
2009-02-26 19:16:33 +01:00
Max Kellermann
a4cf7b7dfd
alsa: fall back to 16 bit audio
...
When the sample format is unknown, fall back to 16 bit samples.
2009-02-25 22:01:32 +01:00
Max Kellermann
4c1fb8278b
alsa: moved code from alsa_open() to alsa_setup()
...
Simplify error handling a bit by moving some code into a separate
function. This eliminates a good bunch of gotos, but that's not
finished yet.
2009-02-25 22:01:30 +01:00
Max Kellermann
d3409a65b5
mvp: check for reopen errors
...
When the MVP device has been closed in the cancel() method, and the
play() method attempts to reopen it, check for errors.
2009-02-25 21:57:02 +01:00
Max Kellermann
883e31d55b
mvp: moved code to mvp_find_sample_rate()
...
Moved the table lookup code to a separate function.
2009-02-25 21:56:48 +01:00
Max Kellermann
b4c65cac8c
mvp: make the mvp_sample_rates array const
...
The array must never be modified, it's a constant lookup table.
2009-02-25 21:54:02 +01:00
Max Kellermann
99f535ad77
mvp: fall back to 16 bit audio samples
...
Looks like the MVP audio output only supports 16 and 24 bit audio
samples. If MPD generates any other sample formats, force it to use
16 bit.
2009-02-25 21:52:11 +01:00
Max Kellermann
8491f61d6c
mvp: fall back to stereo
...
When the channel count is greater than 2, fall back to stereo sound.
2009-02-25 21:51:39 +01:00
Max Kellermann
6722c508a1
mvp: mvp_set_pcm_params() returns bool
...
Return true/false instead of 0/-1. Also check its return value in
mvp_output_open().
2009-02-25 21:51:36 +01:00
Max Kellermann
84ed6d4701
mvp: pass audio_format struct to mvp_set_pcm_params()
...
Pass a pointer to the audio_format struct instead of 3 separate
integers.
2009-02-25 21:51:32 +01:00
Max Kellermann
57a9e5605b
mvp: removed big_endian parameter from mvp_set_pcm_params()
...
Don't pass the big_endian flag to mvp_set_pcm_params(), do a simple
"G_BYTE_ORDER==G_LITTLE_ENDIAN" instead.
2009-02-25 21:51:13 +01:00
Max Kellermann
d902465375
mvp: use G_N_ELEMENTS(mvp_sample_rates)
...
Instead of manually calculating the number of elements in the
mvp_sample_rates array, use GLib's convenience macro G_N_ELEMENTS().
2009-02-25 21:50:50 +01:00
Max Kellermann
fff52ac5b9
mvp: no CamelCase
...
Renamed types, functions and variables.
2009-02-25 21:49:59 +01:00
Max Kellermann
d56ae1e9c2
fifo: return bool values
...
Return true/false for success/failure instead of returning 0/-1.
2009-02-25 19:53:27 +01:00
Max Kellermann
74af4e4c3d
fifo: no CamelCase
...
Renamed types, functions and variables.
2009-02-25 19:53:24 +01:00
Max Kellermann
ee7cf9c9b8
fifo: removed timer!=NULL checks
...
The MPD core guarantees that the audio_output object is always
consistent, and our timer!=NULL checks are superfluous.
2009-02-25 19:09:38 +01:00
Max Kellermann
ba4dd651ef
ao: no CamelCase
...
Renamed functions and variables.
2009-02-25 19:08:49 +01:00
Max Kellermann
074d5ae13e
ao: removed AoData.device!=NULL checks
...
The MPD core guarantees that the audio_output object is always in a
consistent state: either open or closed. When open, it will not call
the open() method again, and when closed, it will not call play().
Removed several checks and the NULL initialization.
2009-02-25 18:48:27 +01:00
Max Kellermann
8a882209c3
ao: removed implementation of method cancel()
...
The method is empty, and we can simply set the method pointer to NULL
instead.
2009-02-25 18:45:09 +01:00
Max Kellermann
dcd84c19cd
output_plugin: don't pass audio_output object to method init()
...
audio_output_get_name() has been removed, which was the only function
left in output_api.h. The output plugin doesn't need the audio_output
object at all, remove the parameter from the init() method.
2009-02-25 18:34:02 +01:00
Max Kellermann
0cf4f09e4f
output_api: removed audio_output_get_name()
...
Use config_get_block_string("name") instead of audio_output_get_name().
2009-02-25 17:32:58 +01:00
Max Kellermann
e065c4db33
jack: initialize local variable "space"
...
Fix a gcc warning, initialize the "space" variable at the beginning of
mpd_jack_play().
2009-02-24 19:06:34 +01:00
Max Kellermann
a4dfab2aee
output: pass the music chunk pointer as void*, not char*
...
The meaning of the chunk depends on the audio format; don't suggest a
specific format by declaring the pointer as "char*", pass "void*"
instead.
2009-02-23 09:34:26 +01:00
Max Kellermann
5a898c15e7
output_api: play() returns a length
...
The old API required an output plugin to not return until all data
passed to the play() method is consumed. Some output plugins have to
loop to fulfill that requirement, and may block during that. Simplify
these, by letting them consume only part of the buffer: make play()
return the length of the consumed data.
2009-02-23 09:29:56 +01:00
Max Kellermann
d50a3d513e
shout: removed shout_plugin.h
...
There are no plugins left which require shout_plugin.h. Moved the
struct declaration to shout_plugin.c.
2009-02-22 17:52:37 +01:00
Max Kellermann
1c56edd1c8
shout: removed shout_encoder_plugins
...
This array is empty, and is not used anymore.
2009-02-22 17:51:12 +01:00
Max Kellermann
f6e5c00726
shout: use the new encoder API
...
Removed shout's encoder plugin API in favor of the new generic encoder
plugin API.
2009-02-22 17:18:28 +01:00
Max Kellermann
e79a82ba3a
shout: merged open_shout_conn() into my_shout_open_device()
...
The method implementation my_shout_open_device() consists of only one
line, the call to open_shout_conn(). Merge both functions into one.
2009-02-22 15:24:41 +01:00
Max Kellermann
cece6c00f4
shout: bool return values instead of int
...
Return true/false instead of 0/-1.
2009-02-22 15:18:58 +01:00
Max Kellermann
e7131b5da2
utils: use g_usleep() instead of my_usleep()
...
Now that I've found this nice function in the GLib docs, we can
finally remove our custom sleep function. Still all those callers of
g_usleep() have to be migrated one day to use events, instead of
regular polling.
2009-02-19 13:33:03 +01:00
Max Kellermann
585f81ece1
output_api: don't include config.h
...
If an output plugin requires config.h, it should include it directly.
2009-02-16 18:41:30 +01:00
Max Kellermann
37bc31d161
output_plugin: replaced method "control()" with "mixer()"
...
The output plugin shouldn't know any specifics of the mixer API. Make
it return the mixer object, and let the caller deal with it.
2009-02-16 01:39:00 +01:00
Max Kellermann
744702f266
shout_mp3: use audio_format_frame_size()
...
Use audio_format_frame_size() instead of
channels*audio_format_sample_size().
2009-02-10 21:30:28 +01:00
Max Kellermann
b27d9e055b
shout: pass void pointer to the encoder
...
Pass the music chunk as a "const void *" to the encoder, instead of a
"const char *". Actually, both encoders currently expect 16 bit
samples, passing a 8-bit character is rather pointless.
2009-02-10 21:28:25 +01:00
Max Kellermann
12756c1b55
shout_ogg: moved PCM conversion to a separate function
...
For simplification, moved the PCM conversion code to
pcm16_to_ogg_buffer(). Work with a int16_t pointer instead of a char
pointer.
2009-02-10 21:25:45 +01:00
Max Kellermann
54982f755f
ao: declare AoData.writeSize as size_t
...
writeSize is a memory size and its type should thus be size_t. This
allows us to remove two explicit casts.
2009-02-10 21:24:35 +01:00
Max Kellermann
fe142647a5
osx: removed disabled debug messages
...
Nobody needs these debug messages anymore.
2009-02-10 20:57:21 +01:00
Max Kellermann
1ac328b553
shout: clear buffer before calling the encoder
...
Always assume the buffer is empty before calling the encoder. Always
flush the buffer immediately after there has been added something.
This reduces the risk of buffer overruns, because there will never be
a "rest" in the current buffer.
2009-02-09 16:38:25 +01:00
Max Kellermann
7fc25ad567
shout: don't postpone metadata
...
Don't duplicate the tag received by the send_metadata() method - send
it to the shout server directly.
2009-02-09 16:38:22 +01:00
Max Kellermann
f5c43889c3
shout: use libshout's synchronization
...
Removed the manual timer synchronization from the shout plugin.
libshout's shout_sync() function does it for us.
2009-02-09 16:38:20 +01:00
Max Kellermann
f6455d5f79
shout: switch to blocking mode
...
The non-blocking mode of libshout is sparsely documented, and MPD's
implementation had several bugs. Also removed connect throttling
code, that is done by the MPD core since 0.14.
2009-02-09 16:38:03 +01:00
Max Kellermann
cf94008b27
shout: removed shout_data.tag_to_send
...
When shout_data.tag!=NULL, there is a "tag to send". The tag_to_send
flag is redundant.
2009-02-09 16:37:16 +01:00
Max Kellermann
044f2561ce
shout: removed shout_data.shout_error
...
That variable is set in handle_shout_error(), but is never read.
2009-02-09 16:37:12 +01:00
Max Kellermann
3b0a78fe0d
shout_mp3: call lame_close() in clear_encoder() method
...
The shout_mp3 encoder had two bugs: when no song was ever played, MPD
segfaulted during cleanup. Second bug: memory leak, each time the
shout device was opened, lame_init() was called again, and
lame_close() is only called once during shutdown.
Fix this by shutting down LAME each time the clear_encoder() method is
called.
2009-02-02 18:22:56 +01:00
Max Kellermann
1fdf25214f
shout_mp3: free the lame_data struct on exit
...
Make valgrind a little bit happier: free the global lame_data struct
in the finish() method.
2009-02-02 18:22:53 +01:00
Max Kellermann
231636b9eb
output_api: moved the command check out of method pause()
...
Move the "while" loop which checks for commands to the caller
ao_pause(). This simplifies the pause() method, and lets us remove
audio_output_is_pending().
2009-01-30 20:12:38 +01:00
Max Kellermann
a2e0b71aad
output_api: removed audio_output_closed()
...
The function is only used by the MVP output plugin, and this one call
is wrong.
2009-01-30 19:47:59 +01:00
Max Kellermann
eeec32feaa
jack: don't override output_ports in connect()
...
If no ports are configured, don't overwrite the (NULL) configuration
with the port names of the first JACK server. If the server changes
after a JACK reconnect, MPD won't attempt to auto-detect again.
2009-01-30 19:44:58 +01:00
Max Kellermann
a93e73bea8
jack: removed sample_rate callback
...
Currently, the JACK plugin manipulates the audio_format struct which
was passed to the open() method. This is very likely to break,
because the plugin must not permanently store this pointer. After
this patch, MPD ignores sample rate changes. It looks like other
software is doing the same, and I guess this is a non-issue.
This patch converts the audio_format pointer within jack_data into a
static audio_format struct.
2009-01-30 19:43:31 +01:00
Max Kellermann
5900827675
configure.ac: detect jack_set_info_function()
...
jack_set_info_function() is not provided by older libjack versions.
Attempt to detect if it is available.
2009-01-30 19:43:25 +01:00
Max Kellermann
0d3dff9512
jack: print info messages
...
Use jack_set_info_function() to install an info callback. Don't let
libjack print them to stderr.
2009-01-30 15:57:43 +01:00
Max Kellermann
27c5b90dc3
jack: don't manually close on shutdown
...
Return false from mpd_jack_play(), let the MPD core close the device.
2009-01-29 23:16:34 +01:00
Max Kellermann
846f126259
jack: initialize output_ports if not configured
...
Don't leave uninitialized bytes in the jack_data struct.
2009-01-29 23:16:30 +01:00
Max Kellermann
e959c8e084
jack: close JACK client on stop
...
When MPD stops playback, close the JACK client connection.
2009-01-29 23:16:21 +01:00
Max Kellermann
e68924435a
jack: removed "bps" attribute
...
The "bps" attribute is calculated, but never used.
2009-01-29 23:15:55 +01:00
Max Kellermann
5a2949552b
jack: make mpd_jack_connect() return bool
...
Return true/false instead of 1/-1.
2009-01-29 23:15:27 +01:00
Max Kellermann
eccc7c21bd
jack: use loops for allocating/freeing ports/buffers
...
Preparation for supporting other channel numbers than stereo: use
loops instead of duplicating code for the second channel. Most
likely, gcc will unroll these loops, so the binary won't be any
different.
2009-01-29 23:14:04 +01:00
Max Kellermann
3baeddbcae
jack: fail if jack_get_ports() returns NULL
...
When jack_get_ports() returns NULL, we cannot have any ports to
connect to, and the device cannot play anything.
2009-01-29 23:12:16 +01:00
Max Kellermann
5bcf415ad0
jack: use jack_port_name() instead of g_malloc()+sprintf()
...
libjack's jack_port_name() function returns the effective port name,
we don't need to do it manually.
2009-01-29 23:12:10 +01:00
Max Kellermann
67cf2ee6e4
jack: initialize libjack's error function in mpd_jack_init()
...
Do the global libjack initialization in the global plugin
initialization function.
2009-01-29 23:12:08 +01:00
Max Kellermann
a73266962f
jack: reduced sleep time to 1ms
...
When waiting for free space in the ring buffer, the JACK plugin
sleeped 10ms until there is enough space. This delay was too large
for low-latency setups (<10ms), and created a lot of xruns. Work
around that by reducing the sleep time to 1ms.
A proper solution for this would be to use an event based approach,
and we will do it, just not now.
2009-01-29 18:13:09 +01:00
Max Kellermann
1e0ceb3d88
jack: clear "shutdown" flag on reconnect
...
When the connection failed once, you had to restart MPD, because it
never cleared the jack_data.shutdown flag. Instead, it refused to
play anything "because there is no client thread" (which is wrong at
that point).
2009-01-29 18:13:03 +01:00
Max Kellermann
3a070d3d23
jack: allocate ring buffers before connecting
...
If the ring buffers are allocated after jack_activate(),
mpd_jack_process() might segfault because it attempts to access them.
2009-01-29 18:12:52 +01:00
Max Kellermann
bbf0453709
jack: register ports before activating clients
...
Call jack_port_register() before jack_activate().
2009-01-29 18:12:25 +01:00
Max Kellermann
a45922cd66
use g_free() instead of free()
...
On some platforms, g_free() must be used for memory allocated by
GLib. This patch intends to correct a lot of occurrences, but is
probably not complete.
2009-01-25 18:47:21 +01:00
Max Kellermann
8695b94232
mixer: removed mixer_configure(), configure mixer in mixer_new()
...
Allocate the mixer object when it is configured.
Merged mixer_configure() into mixer_new(). mixer_new() was quite
useless anyway.
2009-01-25 17:37:59 +01:00
Max Kellermann
763dd8c1dd
mixer: return a mixer struct pointer
...
Don't use statically allocated mixer objects.
2009-01-25 17:37:55 +01:00
Max Kellermann
3635c93acb
conf: allow param==NULL
...
Return the default value in the conf_get_block_*() functions when
param==NULL was passed.
This simplifies a lot of code, because all initialization can be done
in one code path, regardless whether configuration is present.
2009-01-25 16:04:03 +01:00
Max Kellermann
5f77910097
conf: const pointers in block get functions
...
All config_get_block_*() functions should accept constant config_param
pointers.
2009-01-25 16:03:49 +01:00
Max Kellermann
7cc15ffc08
alsa: added comments
...
Document alsa_data members.
2009-01-25 13:13:24 +01:00
Max Kellermann
fb3e43ed73
alsa: frame_size is size_t, not int
...
frame_size is a memory size and should be a size_t, not a signed integer.
2009-01-25 13:07:06 +01:00
Max Kellermann
d887b6353f
alsa: no CamelCase
...
Renamed types, functions, variables.
2009-01-25 13:05:16 +01:00
Dan McGee
27baf6913e
alsa: fix option parsing and restore default period_time
...
Two bugs here led to a large number of interrupts being generated on the
sound card when ALSA output is being used. Because we specify no default
period_time, the sound card gives us 3000 interrupts/sec rather than a more
sane 20 or 30. This completes the revert of dd7711 already started by
4ca24f.
The larger bug was in the change to config_get_block_unsigned() and using 0
as the default value for both 'buffer_time' and 'period_time'. This means
any pre-setting of these options in newAlsaData() gets wiped out. Add a new
default for period_time, and ensure default values for buffer_time and
period_time are used if none are provided by the user.
Signed-off-by: Dan McGee <dan@archlinux.org>
[mk: set defaults in newAlsaData() to fix auto-configuration; renamed
"_MS" back to "_US" because ALSA expects microseconds, not milliseconds]
Signed-off-by: Max Kellermann <max@duempel.org>
2009-01-25 12:52:37 +01:00
Max Kellermann
d47be76ce0
null: added option to disable timer synchronization
...
The null plugin synchronizes the playback so it will happen in real
time. This patch adds a configuration option which disables this: the
playback will then be as fast as possible. This can be useful to
profile MPD.
2009-01-22 16:06:47 +01:00
Max Kellermann
0122510f2c
null: implemented finish() method
...
Free memory in the finish() method to make valgrind happy.
2009-01-22 16:06:45 +01:00
Max Kellermann
e1707c7ba3
null: no CamelCase
...
Renamed functions and variables.
2009-01-22 16:06:43 +01:00
Max Kellermann
65f2386b39
conf: added config_get_block_unsigned()
...
Eliminate some more getBlockParam() invocations.
2009-01-18 19:45:51 +01:00
Max Kellermann
a531a1e650
conf: added config_get_block_string()
...
This replaces lots of getBlockParam() invocations.
2009-01-18 19:37:27 +01:00
Max Kellermann
73e466cfef
jack: parse "ports" setting with g_strsplit()
...
Don't modify the configured string.
2009-01-18 19:24:14 +01:00
Max Kellermann
86f6233f46
jack: use audio_output_get_name()
...
Determine the audio output name with audio_output_get_name() instead
of obtaining the name from the configuration again.
2009-01-18 19:17:52 +01:00
Max Kellermann
7acc62366c
conf: replaced getBoolBlockParam() with config_get_block_bool()
...
No "force" parameter, pass a default value instead.
2009-01-17 20:23:56 +01:00
Max Kellermann
4d472c265e
conf: no CamelCase, part I
...
Renamed functions, types, variables.
2009-01-17 20:23:27 +01:00
Max Kellermann
106bfaa726
oss: evaluate the oss_open() return value properly
...
It returns bool, not int.
2009-01-16 17:11:18 +01:00
Antoine Beaupré
b7fe09fa52
shout: enlarge buffer size to 32 kB
...
I was having problems with shoutcast stream outputs before applying
the attached patch, which enlarges the shoutcast output
buffer. Ideally, this should be configurable, but this resolves the
issue for my needs.
2009-01-14 23:28:26 +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
5e93d3682f
added missing explicit config.h includes
2009-01-08 21:37:02 +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
d9c2960a55
fix G_BYTE_ORDER check
...
"#ifdef G_BYTE_ORDER == G_BIG_ENDIAN" cannot work, of course.
2009-01-05 12:40:57 +01:00
Max Kellermann
ac0fe98ffb
use GLib byte order macros
2009-01-05 08:17:22 +01:00
Viliam Mateicka
1a04e57168
renaming mixer.h to mixer_api.h
2009-01-04 19:15:18 +01:00
Max Kellermann
2189796b96
null, fifo: use GLib instead of utils.h
2009-01-03 14:51:34 +01:00
Max Kellermann
59067e6a92
ao: use g_strsplit() instead of strtok_r()
...
g_strsplit() is more portable than strtok_r().
2009-01-03 13:20:12 +01:00
Max Kellermann
1183236797
alsa: use GLib instead of utils.h
2009-01-02 17:56:08 +01:00
Max Kellermann
051e906d85
jack: use GLib instead of utils.h
2009-01-02 17:23:10 +01:00
Max Kellermann
1fe129330e
jack: duplicate jack_get_ports() return values
...
JACK documentation states: "The caller is responsible for calling
free(3) any non-NULL returned value."
This does not seem to include the array elements. Duplicate them
after jack_get_ports(), and free only the array. Convert
JackData.output_ports to non-const.
2009-01-02 17:23:00 +01:00
Max Kellermann
7dfe301b54
output plugins: don't include gcc.h
...
Use GLib's G_GNUC_UNUSED instead of gcc.h's mpd_unused.
2009-01-01 18:08:29 +01:00
Max Kellermann
0734acf392
null: don't include gcc.h
...
Use GLib's G_GNUC_UNUSED instead of macros from gcc.h.
2009-01-01 18:00:46 +01:00
Viliam Mateicka
9a70c4d06d
Moving mixers to audio outputs
2008-12-31 16:46:41 +01:00
Max Kellermann
ef308d9644
alsa: use GLib logging
2008-12-29 17:29:42 +01:00
Max Kellermann
74d4ec7fbb
jack: use GLib logging
2008-12-29 17:29:36 +01:00
Max Kellermann
eddf5e1e5e
fifo: use GLib logging
2008-12-29 17:29:31 +01:00
Thomas Jansen
c15ac57271
osx_plugin: migrate from pthread to glib threads
2008-12-28 22:09:42 +01:00
Viliam Mateicka
d96cda95a1
shout: fixed bad error message printout
2008-12-23 18:05:25 +01:00
Emanuele Giaquinta
213c021eac
Remove useless statement.
2008-12-17 16:49:33 +01:00
Emanuele Giaquinta
25c04a97d3
Remove useless computation. After the pthread_cond_wait loop there are at least MIN(od->bufferSize, size) free bytes in the buffer. Thus MIN(od->bufferSize - od->len, size) is always equal to MIN(od->bufferSize, size).
2008-12-17 15:56:43 +01:00
Emanuele Giaquinta
c584d6b087
Remove useless statement, curpos is initialized at the beginning of the loop.
2008-12-17 15:56:43 +01:00
Emanuele Giaquinta
c36a6b0aee
Factor computation.
2008-12-17 15:56:43 +01:00
Emanuele Giaquinta
a4f0c7b457
Use MIN.
2008-12-17 15:56:43 +01:00
Emanuele Giaquinta
df80ae86ee
Call CloseComponent after AudioUnitUninitialize.
2008-12-17 15:56:43 +01:00
Max Kellermann
0dab2c5bc1
ao: use 16 bit sample format
...
There have been bug reports on MPD regarding 24 bit output via
libao/esd. The "ao" plugin does not attempt fall back to 16 bit
currently, and thus fails to play 24 bit audio (i.e. all mp3 files).
Make it always use 16 bit samples for now, until more bits are
well-tested.
2008-12-09 07:39:24 +01:00
Max Kellermann
4288cc069a
osx: use 16 bit sample format
...
The OS X output does not seem to support 24 bit audio in the way MPD
implements it currently. Fall back to 16 bit for now, and schedule
24 bit support on OS X for MPD 0.15.
2008-12-08 23:23:37 +01:00
Max Kellermann
a4512d3b9a
osx: use GLib instead of utils.h/log.h
...
One my_usleep() invocation remains, until we find out if we can delete
it.
2008-12-08 23:23:30 +01:00
Max Kellermann
b0f46c2076
osx: don't use void pointer in arithmetic
...
Cast AudioBuffer.mData to a "unsigned char*" before adding "curpos".
This fixes a gcc warning.
2008-12-08 23:23:28 +01:00
Max Kellermann
4ca24f22f1
alsa: reverted the default buffer_time to 500 ms
...
Commit dd7711d8
removed MPD's default ALSA buffer_time. The result
was a buffer size which was way too small for playing streams on some
sound hardware, and caused skips and distorted sound. Revert the
default to 500 ms.
2008-12-01 22:37:05 +01:00
Max Kellermann
f600f4a256
shout: fixed the lame input buffer allocation
...
"float (*lamebuf)[2] = g_malloc()" does NOT allocate two float*
buffers. The formula is even wrong: it should be applied to LAME's
output buffer, not its input buffer.
Converted "lamebuf" to the two variables "left" and "right", and
allocate them independently with the exact buffer size. Set
right=left if mono output is configured.
2008-11-30 14:25:56 +01:00
Max Kellermann
a7b692a1df
shout_mp3: cast input buffer to int16_t*
...
It's easier to work with an int16_t* pointer here.
2008-11-30 14:21:40 +01:00
Max Kellermann
0277921e6a
oss: use GLib instead of utils.h/log.h
2008-11-25 17:43:28 +01:00
Max Kellermann
b76f7b769c
mvp: use GLib instead of utils.h/log.h
2008-11-25 17:37:12 +01:00
Max Kellermann
be60ff83f7
shout: use GLib instead of utils.h/log.h
2008-11-25 17:25:41 +01:00
Max Kellermann
125dad7119
shout: don't check HAVE_SHOUT
...
If the shout plugin is disabled, shout_plugin.c isn't compiled at all,
no need to check the macro definition.
2008-11-25 17:19:42 +01:00
Max Kellermann
c570aa20fa
ao: print error message when ao_open_live() fails
...
When ao_open_live() failed, MPD would ignore the error code in
"errno". Make it print a meaningful error message.
2008-11-25 16:18:06 +01:00
Max Kellermann
423276a384
ao: support all libao error codes
...
The function audioOutputAo_error() did not implement all possible
libao error codes. Support the rest of them, and fall back to
strerror().
2008-11-25 16:17:48 +01:00
Max Kellermann
ffc604498e
ao: use GLib instead of utils.h/log.h
2008-11-25 16:10:01 +01:00
Max Kellermann
5d6e96e986
pulse: removed reconnect interval
...
The output thread automatically waits some time before retrying to
open the device. Don't duplicate this check in the pulse plugin.
2008-11-05 08:10:13 +01:00
Max Kellermann
3defcef5f3
pulse: check if connection is open in pulse_cancel()
...
The pulse plugin crashed with a segmentation fault when the pulse
server was killed.
2008-11-05 08:06:39 +01:00
Max Kellermann
d7b2d93ccc
osx: fix gcc warnings
...
Fix prototypes and unused variables.
2008-11-04 11:26:04 +01:00
Max Kellermann
37696dcbbf
osx: adapt to new output plugin API
...
The OS X output plugin wasn't adapted to the new output plugin yet,
because I had no Mac to test...
2008-11-04 11:19:37 +01:00
Max Kellermann
9074f924e9
alsa: initialize "device" with NULL
...
When using autodetection, AlsaData.device wasn't properly initialized
with NULL. This broke autodetection randomly.
2008-11-03 07:40:54 +01:00
Max Kellermann
aa33422de6
alsa, jack: no const pointers for allocated strings
...
Make the pointers "device" and "name" non-const, so we don't need the
xfree() hack. The default value is expressed as NULL.
2008-11-01 14:04:14 +01:00
Alam Arias
78f60c9c6d
removed unneed check for protocol in shout plugin, will assume icecast2 protocol if not exist in config
2008-10-31 12:20:49 +01:00
Max Kellermann
ea515494cb
added prefix to header macros
...
"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.
2008-10-31 09:19:53 +01:00
Max Kellermann
9ec695559f
pulse: fix segfault without sink name
...
Commit d692e9 broke configurations without explicit server or sink
configuration. Check for getBlockParam()==NULL.
2008-10-30 17:46:56 +01:00
Max Kellermann
2f76db4c78
output: close device on play error
...
When an output plugin fails to play a chunk, close it. This replaces
various manual close() calls in nearly all plugins.
2008-10-29 20:40:33 +01:00
Max Kellermann
58c5bee9f0
output: use bool for return values and flags
...
Don't return 0/-1 on success/error, but true/false. Instead of int,
use bool for storing flags.
2008-10-29 20:40:27 +01:00
Max Kellermann
b967702059
pulse: clear pa_simple pointer in pulse_close()
...
The pointer becomes invalid due to pa_simple_free(), which may lead to
segmentation faults when the output is reopened later.
2008-10-29 20:38:20 +01:00
Max Kellermann
d692e925a4
pulse: use GLib instead of util.h/log.h
...
Use GLib allocation and logging functions.
2008-10-29 20:37:36 +01:00
Max Kellermann
38df17546a
pulse: no CamelCase
2008-10-29 20:37:15 +01:00
Max Kellermann
5c4dc8d03c
oss: check and override audio_format properly
...
Don't accept 24 bit audio. Force MPD to use 16 bit if anything other
than 8 or 16 bit is selected.
2008-10-29 18:35:03 +01:00
Max Kellermann
0800c6f4ca
output: don't compile plugins which are disabled
...
Don't compile the sources of disabled output plugins at all.
2008-10-26 21:58:37 +01:00
Max Kellermann
ece8c1347c
renamed src/audioOutputs/ to src/output/
...
Again, no CamelCase in the directory name.
2008-10-26 11:29:44 +01:00