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