| Commit message (Collapse) | Author | Files | Lines |
|
Return false from mpd_jack_play(), let the MPD core close the device.
|
|
Don't leave uninitialized bytes in the jack_data struct.
|
|
When MPD stops playback, close the JACK client connection.
|
|
The "bps" attribute is calculated, but never used.
|
|
Return true/false instead of 1/-1.
|
|
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.
|
|
When jack_get_ports() returns NULL, we cannot have any ports to
connect to, and the device cannot play anything.
|
|
libjack's jack_port_name() function returns the effective port name,
we don't need to do it manually.
|
|
Do the global libjack initialization in the global plugin
initialization function.
|
|
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.
|
|
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).
|
|
If the ring buffers are allocated after jack_activate(),
mpd_jack_process() might segfault because it attempts to access them.
|
|
Call jack_port_register() before jack_activate().
|
|
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.
|
|
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.
|
|
All config_get_block_*() functions should accept constant config_param
pointers.
|
|
Eliminate some more getBlockParam() invocations.
|
|
This replaces lots of getBlockParam() invocations.
|
|
Don't modify the configured string.
|
|
Determine the audio output name with audio_output_get_name() instead
of obtaining the name from the configuration again.
|
|
Renamed functions, types, variables.
|
|
|
|
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.
|
|
Use GLib's G_GNUC_UNUSED instead of gcc.h's mpd_unused.
|
|
|
|
Make the pointers "device" and "name" non-const, so we don't need the
xfree() hack. The default value is expressed as NULL.
|
|
Don't return 0/-1 on success/error, but true/false. Instead of int,
use bool for storing flags.
|
|
Don't compile the sources of disabled output plugins at all.
|
|
Again, no CamelCase in the directory name.
|
|
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.
|
|
Move sample format dependent code to a separate function.
|
|
Renamed all variables and functions. Add the prefix "mpd_jack_" to
function names.
|
|
We must never pass partial frames. Added assertions to debug this.
|
|
Merge the variables "avail_data" and "avail_frames" into "available".
Both variables are never used at the same time.
|
|
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.
|
|
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.
|
|
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".
|
|
Indent with tabs.
|
|
The last bit of CamelCase in audio_format.h. Additionally, rename a
bunch of local variables.
|
|
When there are standardized headers, use these instead of the bloated
os_compat.h.
|
|
The old struct initializers are error prone and don't allow moving
elements around. Since we are going to overhaul some of the APIs
soon, it's easier to have all implementations use C99 initializers.
|
|
We have eliminated direct accesses to the audio_output struct from
the all output plugins. Make it opaque for them, and move its real
declaration to output_internal.h, similar to decoder_internal.h.
Pass the opaque structure to plugin.init() only, which will return the
plugin's data pointer on success, and NULL on failure. This data
pointer will be passed to all other methods instead of the
audio_output struct.
|
|
The JACK output plugin needs to reset its "opened" flag when the JACK
server fails. To prevent it from accessing the audio_output struct
directly introduce the API function audio_output_closed().
|
|
Since the output plugin returns a value indicating success or error,
we can have the output core code assign the "open" flag.
|
|
Pass the globally configured audio_format as a const pointer to
plugin.init(). plugin.open() gets a writable pointer which contains
the audio_format requested by the plugin. Its initial value is either
the configured audio_format or the input file's audio_format.
|
|
Since the plugin struct is never modified, we should store it in
constant locations.
|
|
Also rename AudioOutputPlugin to struct audio_output_plugin, and use
forward declarations to reduce include dependencies.
|
|
Just like decoder_api.h, output_api.h provides the audio output API
which is used by the plugins.
|
|
Get rid of CamelCase, and don't use a typedef, so we can
forward-declare it, and unclutter the include dependencies.
|
|
The previous patch enabled these warnings. In Eric's branch, they
were worked around with a generic deconst_ptr() function. There are
several places where we can add "const" to pointers, and in others,
libraries want non-const strings. In the latter, convert string
literals to "static char[]" variables - this takes the same space, and
seems safer than deconsting a string literal.
|