| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
| |
All what's left from ad_state is a simple boolean flag (ENABLE /
DISABLE). Convert it to a C99 bool.
|
|
|
|
|
|
| |
audio.c maintained one of MPD's many layers of audio buffers. It was
without any benefit, since playAudio() can simply send the source
buffer directly to the audio output plugin.
|
|
|
|
|
|
|
| |
A frame contains one sample per channel, thus it is sample_size *
channels. This patch includes some cleanup for various locations
where the sample size for 24 bit audio was still 3 bytes (instead of
4).
|
|
|
|
|
| |
The last bit of CamelCase in audio_format.h. Additionally, rename a
bunch of local variables.
|
|
|
|
| |
"bits" and "channels" cannot be negative.
|
|
|
|
| |
"bool" should be used in C99 programs for boolean values.
|
|
|
|
|
|
|
|
|
|
|
|
| |
pause() puts the audio output into pause mode: if supported, it may
perform a special action, which keeps the device open, but does not
play anything. Output plugins like "shout" might want to play silence
during pause, so their clients won't be disconnected. Plugins which
do not support pausing will simply be closed, and have to be reopened
when unpaused.
This pach includes an implementation for the shout plugin, which
sends silence chunks.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Seeing the "mpd_" prefix _everywhere_ is mind-numbing as the
mind needs to retrain itself to skip over the first 4 tokens of
a type to get to its meaning. So avoid having extra characters
on my terminal to make it easier to follow code at 2:30 am in
the morning.
Please report any new issues you may come across on Free
toolchains. I realize how difficult it can be to build/maintain
cross-compiling toolchains and I have no intention of forcing
people to upgrade their toolchains to build mpd.
Tested with gcc 2.95.4 and and gcc 4.3.1 on x86-32.
|
|
|
|
|
| |
Patch 9a5b5998 broke the "outputenabled" value of the "outputs"
response. Make it print "1" if the output is enabled, "0" otherwise.
|
|
|
|
|
|
|
|
| |
During debugging, I found a deadlock between flushAudioBuffer() and
the audio_output_task(): audio_output_task() didn't notice that there
is a command, and flushAudioBuffer() waited forever in notify_wait().
I am not sure yet what is the real cause; work around this for now by
waking up non-finished audio outputs in every iteration.
|
|
|
|
|
|
|
| |
To check whether a device is really on or off, we should rather check
audio_output.open, instead of managing another variable. Wrap
audio_output.open in the inline function audio_output_is_open() and
use it instead of DEVICE_ON and DEVICE_OFF.
|
|
|
|
|
|
|
| |
Send an output buffer to all output plugins at the same time, instead
of waiting for each of them separately. Make several functions
non-blocking, and introduce the new function audio_output_wait_all()
to synchronize with all audio output threads.
|
|
|
|
| |
Why send tags to a device which isn't enabled?
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
LOC reduction and less noise makes things easier for
tired old folks to follow.
|
|
|
|
| |
We have git..
|
| |
|
|
|
|
|
|
| |
Save one allocation, since the whole audio_format struct is nearly the
same size as the pointer to it. Check audio_format_defined(af)
instead of af!=NULL.
|
|
|
|
|
|
|
| |
free(NULL) isn't explicitly forbidden, but isn't exactly good style.
Check the rare case that the audio buffer isn't initialized yet in
closeAudioDevice(). In this case, we also don't have to call
flushAudioBuffer().
|
|
|
|
|
|
| |
To make openAudioDevice() smaller and more readable, move code to a
static function. Also don't use realloc(), since the old value of the
buffer isn't needed anymore, saving a memcpy().
|
|
|
|
|
|
|
| |
There are too many static variables in audio.c - organize all
properties of the audio buffer in a struct. The current audio format
is also a property of the buffer, since it describes the buffer's
data format.
|
|
|
|
|
|
| |
Passing NULL to this function doesn't make sense, and complicates its
implementation. The one caller which might pass NULL should rather
check this.
|
|
|
|
| |
The function isAudioDeviceOpen() is never used.
|
|
|
|
|
|
|
|
|
| |
audio_format_clear() sets an audio_format struct to an cleared
(undefined) state, which is both faster and smaller than memset(0).
audio_format_defined() checks if the audio_format struct actually has
a defined value (i.e. non-zero). Both can be used to avoid pointers
to audio_format, replacing the "NULL" value with an "undefined"
audio_format.
|
|
|
|
|
| |
Rename it to audio_format_equals() and return "true" if they are
equal.
|
|
|
|
|
|
|
|
|
| |
The "!src" check in copyAudioFormat() used to hide bugs - one should
never pass NULL to it. There is one caller which might pass NULL, add
a check in this caller.
Instead of doing mempcy(), we can simply assign the structures, which
looks more natural.
|
|
|
|
| |
Getting rid of CamcelCase, again.
|
|
|
|
|
| |
Similar to decoder_control.c, output_control.c will provide functions
for controlling the output thread (which will be implemented later).
|
|
|
|
|
|
| |
Instead of having to register each output plugin, store them
statically in an array. This eliminates the need for the List library
here, and saves some small allocations during startup.
|
|
|
|
|
| |
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.
|
|
|
|
| |
Pass the client struct instead.
|
|
|
|
| |
No protocol code in the audio output library.
|
|
|
|
|
| |
Getting rid of CamelCase; not having typedefs also allows us to
forward-declare the structures.
|
|
|
|
| |
And again, convert arguments to const.
|
|
|
|
|
| |
Include only headers which are really required. This speeds up
compilation and helps detect cross-layer accesses.
|
|
|
| |
git-svn-id: https://svn.musicpd.org/mpd/trunk@7373 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
| |
git-svn-id: https://svn.musicpd.org/mpd/trunk@7372 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
| |
git-svn-id: https://svn.musicpd.org/mpd/trunk@7344 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
|
|
| |
Try to only include headers which are really needed. We should
particularly check all "headers including other headers". The
long-term goal is to have a manageable, small API for plugins
(decoders, output) without so many mpd internals cluttering the
namespace.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7319 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
| |
Buffer sizes should be size_t. This is safe here, at least not
unsafer than without the patch. I have no idea why audioBufferSize
and audioBufferPos were explicitly declared as signed integer.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7296 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
| |
git-svn-id: https://svn.musicpd.org/mpd/trunk@7208 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
|
| |
we do not save anything by limiting a variable to an unsigned char,
since the compiler aligns it at machine word size anyway. however by
using the full machine word, we save one instruction, and we remove
the useless artificial limitation to 255.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7203 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
|
| |
Tools like "sparse" check for missing downcasts, since implicit cast
may be dangerous. Although that does not change the compiler result,
it may make the code more readable (IMHO), because you always see when
there may be data cut off.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7196 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
| |
Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn-id: https://svn.musicpd.org/mpd/trunk@7143 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This will make refactoring features easier, especially now that
pthreads support and larger refactorings are on the horizon.
Hopefully, this will make porting to other platforms (even
non-UNIX-like ones for masochists) easier, too.
os_compat.h will house all the #includes for system headers
considered to be the "core" of MPD. Headers for optional
features will be left to individual source files.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7130 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
| |
git-svn-id: https://svn.musicpd.org/mpd/trunk@7123 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
thread-safety work in preparation for rewrite to use pthreads
Expect no regressions against trunk (r7078), possibly minor
performance improvements in update (due to fewer heap
allocations), but increased stack usage.
Applied the following patches:
* maxpath_str for reentrancy (temporary fix, reverted)
* path: start working on thread-safe variants of these methods
* Re-entrancy work on path/character-set conversions
* directory.c: exploreDirectory() use reentrant functions here
* directory/update: more use of reentrant functions + cleanups
* string_toupper: a strdup-less version of strDupToUpper
* get_song_url: a static-variable-free version of getSongUrl()
* Use reentrant/thread-safe get_song_url everywhere
* replace rmp2amp with the reentrant version, rmp2amp_r
* Get rid of the non-reentrant/non-thread-safe rpp2app, too.
* buffer2array: assert strdup() returns a usable value in unit tests
* replace utf8ToFsCharset and fsCharsetToUtf8 with thread-safe variants
* fix storing playlists w/o absolute paths
* parent_path(), a reentrant version of parentPath()
* parentPath => parent_path for reentrancy and thread-safety
* allow "make test" to automatically run embedded unit tests
* remove convStrDup() and maxpath_str()
* use MPD_PATH_MAX everywhere instead of MAXPATHLEN
* path: get rid of appendSlash, pfx_path and just use pfx_dir
* get_song_url: fix the ability to play songs in the top-level music_directory
git-svn-id: https://svn.musicpd.org/mpd/trunk@7106 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
| |
except that it now uses a timer for throttling.
git-svn-id: https://svn.musicpd.org/mpd/trunk@6621 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|