Commit Graph

184 Commits

Author SHA1 Message Date
Max Kellermann c297c8555f audio: removed audio_buffer.buffer
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.
2008-10-12 00:42:33 +02:00
Max Kellermann 96155a3376 audio_format: added audio_format_frame_size()
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).
2008-10-10 14:41:37 +02:00
Max Kellermann de2cb3f375 audio_format: renamed sampleRate to sample_rate
The last bit of CamelCase in audio_format.h.  Additionally, rename a
bunch of local variables.
2008-10-10 14:40:54 +02:00
Max Kellermann 6101dc6c76 audio_format: unsigned integers
"bits" and "channels" cannot be negative.
2008-10-10 14:03:33 +02:00
Max Kellermann b084bc28ed use the "bool" data type instead of "int"
"bool" should be used in C99 programs for boolean values.
2008-10-08 11:03:39 +02:00
Max Kellermann 6e21e24cae audio_output: added method pause()
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.
2008-09-29 16:43:55 +02:00
Eric Wong 0352766dca Switch to C99 types (retaining compat with old compilers)
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.
2008-09-29 13:29:33 +02:00
Max Kellermann 75cba9343e output: fix the "outputenabled" value
Patch 9a5b5998 broke the "outputenabled" value of the "outputs"
response.  Make it print "1" if the output is enabled, "0" otherwise.
2008-09-28 18:34:10 +02:00
Max Kellermann e2a12deead audio_output: workaround for deadlock
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.
2008-09-26 07:12:29 +02:00
Max Kellermann 9a5b599883 output: removed DEVICE_ON, DEVICE_OFF
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.
2008-09-24 07:25:07 +02:00
Max Kellermann 2b782b82ea output: semi-asynchronous playback
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.
2008-09-24 07:23:19 +02:00
Max Kellermann 6bbea44e91 output: call send_tag() only if device is on
Why send tags to a device which isn't enabled?
2008-09-24 07:21:58 +02:00
Max Kellermann acc4a0ba2d output: make "struct audio_output" opaque for output plugins
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.
2008-09-24 07:20:55 +02:00
Eric Wong 27fad52c6b start using prefixcmp()
LOC reduction and less noise makes things easier for
tired old folks to follow.
2008-09-23 20:48:12 +02:00
Max Kellermann a751011e8c audio: removed commented code
We have git..
2008-09-10 11:47:28 +02:00
Max Kellermann 52ed06cbd8 audio: added assertions 2008-09-10 11:46:54 +02:00
Max Kellermann 688298e265 audio: make audio_configFormat a static variable
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.
2008-09-10 11:44:06 +02:00
Max Kellermann 5d0a8ce3af audio: don't free uninitialized audio_buffer
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().
2008-09-10 11:44:02 +02:00
Max Kellermann 8d1801c59d audio: added function audio_buffer_resize()
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().
2008-09-10 11:43:56 +02:00
Max Kellermann cdbb9627a7 audio: moved static variables into struct audio_buffer
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.
2008-09-10 11:43:49 +02:00
Max Kellermann 9f16a34d76 audio: don't allow isCurrentAudioFormat(NULL)
Passing NULL to this function doesn't make sense, and complicates its
implementation.  The one caller which might pass NULL should rather
check this.
2008-09-10 11:43:40 +02:00
Max Kellermann a53047af7d audio: removed isAudioDeviceOpen()
The function isAudioDeviceOpen() is never used.
2008-09-10 11:43:29 +02:00
Max Kellermann d92543698c audio_format: added audio_format_clear() and audio_format_defined()
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.
2008-09-10 11:43:27 +02:00
Max Kellermann be9212ba84 audio: moved cmpAudioFormat() to audio_format.h
Rename it to audio_format_equals() and return "true" if they are
equal.
2008-09-09 10:05:15 +02:00
Max Kellermann 7f1cccb3ea audio: replaced copyAudioFormat() with simple assignment
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.
2008-09-09 10:04:42 +02:00
Max Kellermann f9316fbbbe output: renamed the functions in output_control.c
Getting rid of CamcelCase, again.
2008-09-09 10:03:24 +02:00
Max Kellermann e2c916e6ca output: moved code from audioOutput.c to output_control.c
Similar to decoder_control.c, output_control.c will provide functions
for controlling the output thread (which will be implemented later).
2008-09-09 10:02:34 +02:00
Max Kellermann be046b25a4 output: static audio_output_plugin list as array
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.
2008-09-08 11:43:13 +02:00
Max Kellermann 3b09c54b67 output: renamed typedef AudioOutput to struct audio_output
Also rename AudioOutputPlugin to struct audio_output_plugin, and use
forward declarations to reduce include dependencies.
2008-09-07 22:41:22 +02:00
Max Kellermann bed2a49fe9 output: added output_api.h
Just like decoder_api.h, output_api.h provides the audio output API
which is used by the plugins.
2008-09-07 22:41:17 +02:00
Max Kellermann f1dd9c209c audio_format: converted typedef AudioFormat to struct audio_format
Get rid of CamelCase, and don't use a typedef, so we can
forward-declare it, and unclutter the include dependencies.
2008-09-07 19:19:55 +02:00
Max Kellermann 4d8438e63d audio: don't pass "fd" to printAudioDevices()
Pass the client struct instead.
2008-09-07 14:04:16 +02:00
Max Kellermann 4ddc0a48e2 audio: don't pass "fd" to {en,dis}ableAudioDevice()
No protocol code in the audio output library.
2008-09-07 13:51:50 +02:00
Max Kellermann d0556dc983 tag: renamed MpdTag and MpdTagItem to struct tag, struct mpd_tag_item
Getting rid of CamelCase; not having typedefs also allows us to
forward-declare the structures.
2008-08-29 09:38:11 +02:00
Max Kellermann 12bcba8b89 pass constant pointers
And again, convert arguments to const.
2008-08-29 09:01:53 +02:00
Max Kellermann b6909da758 clean up CPP includes
Include only headers which are really required.  This speeds up
compilation and helps detect cross-layer accesses.
2008-08-26 08:27:03 +02:00
Eric Wong 29df78fe1e audio.c: avoid magic numbers even if they have comments :)
git-svn-id: https://svn.musicpd.org/mpd/trunk@7373 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-06-02 10:10:32 +00:00
Eric Wong f57be50d73 remove audioDeviceStates from playerData and getPlayerData
git-svn-id: https://svn.musicpd.org/mpd/trunk@7372 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-06-02 10:10:26 +00:00
Max Kellermann b4ea6e52b2 const pointers in audio.c
git-svn-id: https://svn.musicpd.org/mpd/trunk@7344 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12 04:21:39 +00:00
Max Kellermann c89b358c8a clean up CPP includes
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
2008-04-12 04:19:26 +00:00
Max Kellermann 1ad2f07a39 use size_t in audio.c
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
2008-04-12 04:16:08 +00:00
Eric Wong 9ba7264362 audio.c: unsigned int functions return unsigned ints, not size_t
git-svn-id: https://svn.musicpd.org/mpd/trunk@7208 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-03-26 10:38:21 +00:00
Max Kellermann c0787cc984 audio: use a machine word for array sizes
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
2008-03-26 10:37:54 +00:00
Max Kellermann 66fe580642 explicitly downcast
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
2008-03-26 10:37:17 +00:00
Max Kellermann 07adb14e3c fixed -Wshadow warnings
Signed-off-by: Eric Wong <normalperson@yhbt.net>

git-svn-id: https://svn.musicpd.org/mpd/trunk@7143 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-26 12:46:21 +00:00
Eric Wong cb8f1af3bd Cleanup #includes of standard system headers and put them in one place
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
2008-01-03 07:29:49 +00:00
Eric Wong 4c88ef34bb silence is constant, as is the buffer we pass to playAudio
git-svn-id: https://svn.musicpd.org/mpd/trunk@7123 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-01 10:10:02 +00:00
Eric Wong b79f6b882a Merge branches/ew r7104
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
2007-12-28 02:56:25 +00:00
J. Alexander Treuman b496239e76 Adding FIFO audio output. This is pretty much identical to the old one,
except that it now uses a timer for throttling.

git-svn-id: https://svn.musicpd.org/mpd/trunk@6621 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-13 14:15:30 +00:00
J. Alexander Treuman bd0620ff72 Load shout first instead of last. This makes it more likely to block other
outputs, which is actually desired behaviour.  This way if the shout server
takes a while to respond, the shout output can block until connected
without messing up other audio outputs.

git-svn-id: https://svn.musicpd.org/mpd/trunk@6554 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-12 17:49:31 +00:00
J. Alexander Treuman 2d8f36cefb Load the shout plugin last. This will make sure it's played to last,
reducing the likelyhood of it blocking other outputs.

git-svn-id: https://svn.musicpd.org/mpd/trunk@6543 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-10 22:58:56 +00:00
J. Alexander Treuman 4e5cffaa7b If an audio output is in state DEVICE_ENABLE, and openAudioOutput fails,
leave it in that state.  Likewise, if an audio output is in state
DEVICE_ON, and reopening the device due to a format change fails, change it
to state DEVICE_ENABLE.  This will prevent flushAudioBuffer from even
attempting to play audio on a closed device (even though it would fail
anyway).

git-svn-id: https://svn.musicpd.org/mpd/trunk@6529 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-09 21:40:56 +00:00
J. Alexander Treuman 0f8ab01c3e Adding a null output plugin.
git-svn-id: https://svn.musicpd.org/mpd/trunk@6393 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-30 16:52:56 +00:00
J. Alexander Treuman bba444524e Changing all calls to ERROR() followed by exit(EXIT_FAILURE) with a single
call to FATAL().

git-svn-id: https://svn.musicpd.org/mpd/trunk@6276 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-26 18:15:54 +00:00
Avuton Olrich a061da8fb5 The massive copyright update
git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-05 03:22:33 +00:00
Eric Wong 53427fb3d4 sparse: move extern declarations for plugins into header files
git-svn-id: https://svn.musicpd.org/mpd/trunk@5261 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-14 04:33:13 +00:00
Eric Wong b443363aa6 Don't initialize globals to zero (or NULL)
Some compilers and linkers aren't smart enough to optimize this,
as global variables are implictly initialized to zero.  As a
result, binaries are a bit smaller as more goes in the .bss and
less in the text section.

git-svn-id: https://svn.musicpd.org/mpd/trunk@5254 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-14 03:07:53 +00:00
Warren Dukes 29c7681ca4 jack patch from anarch (and some type fixes for mp4 and acc plugins)
git-svn-id: https://svn.musicpd.org/mpd/trunk@4912 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-10-18 02:49:13 +00:00
Warren Dukes 00719544eb add a sanity check assert
git-svn-id: https://svn.musicpd.org/mpd/trunk@4869 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-10-03 03:06:30 +00:00
Warren Dukes d3040d1eb5 fix the segfault for when no audio_output is found and none is detected (bug found by normalperson!!!)
git-svn-id: https://svn.musicpd.org/mpd/trunk@4868 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-10-03 02:57:01 +00:00
Warren Dukes 347a33b009 cleanup flushWarningBuffer() and make some for() loops in audio.c look and do something sane.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4867 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-10-03 02:22:37 +00:00
Eric Wong 90847fc881 Replace strdup and {c,re,m}alloc with x* variants to check for OOM errors
I'm checking for zero-size allocations and assert()-ing them,
so we can more easily get backtraces and debug problems, but we'll
also allow -DNDEBUG people to live on the edge if they wish.

We do not rely on errno when checking for OOM errors because
some implementations of malloc do not set it, and malloc
is commonly overridden by userspace wrappers.

I've spent some time looking through the source and didn't find any
obvious places where we would explicitly allocate 0 bytes, so we
shouldn't trip any of those assertions.

We also avoid allocating zero bytes because C libraries don't
handle this consistently (some return NULL, some not); and it's
dangerous either way.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4690 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-26 06:25:57 +00:00
Eric Wong f3981eab58 audio.c: [trivial] remove unnecessary include
git-svn-id: https://svn.musicpd.org/mpd/trunk@4688 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-26 06:25:49 +00:00
Warren Dukes 25346cb38c labels should be on the left most column, no tabbing
git-svn-id: https://svn.musicpd.org/mpd/trunk@4605 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-09 22:18:06 +00:00
J. Alexander Treuman 5f827ac126 Ok, don't use memcmp for comparing audio formats!
git-svn-id: https://svn.musicpd.org/mpd/trunk@4591 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 20:00:00 +00:00
J. Alexander Treuman 7cf28560e1 Eliminate unnecessary use of a variable
git-svn-id: https://svn.musicpd.org/mpd/trunk@4586 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 17:55:15 +00:00
J. Alexander Treuman 8e8fd7f1d7 Use memcmp to compare audio formats
git-svn-id: https://svn.musicpd.org/mpd/trunk@4585 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 17:53:53 +00:00
J. Alexander Treuman ff0a2543a6 Reopen the audio device if the audio format has changed
git-svn-id: https://svn.musicpd.org/mpd/trunk@4584 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 17:51:15 +00:00
Eric Wong 468c9900ca audio: pause/resume-from-statefile bugfixes,
Oops, I broke pause/resuming from a statefile r4514
Everything should be fixed out.

Also we now avoid opening the audio device until we have a
playable audio_format set.  This is a long-standing bug that got
exposed more blatantly with the single array.

Thanks to MattD in #mpd for reporting my breakage.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4516 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 12:00:17 +00:00
Eric Wong eb537f84f1 audio: malloc reductions
Just malloc all of the audioOutput array in one shot
to avoid fragmentation and to improve cache locality
when iterating through the array.

We also know name and type members of the AudioOutput
struct won't change in the config, so there's no
need to strdup them.

newAudioOutput => initAudioOutput

git-svn-id: https://svn.musicpd.org/mpd/trunk@4515 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 10:07:16 +00:00
Eric Wong b0965c317b audio: get rid of the myAudioDevicesEnabled array
It just made things more confusing.  We'll just store
the states in playerData_pd->audioDevicesStates and be
done with it (it's a unsigned byte now).

git-svn-id: https://svn.musicpd.org/mpd/trunk@4514 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 10:07:12 +00:00
Eric Wong c22a53d373 audio: remove AUDIO_MAX_DEVICES limit
Some people have more than 8 devices (the old limit).  It's
pretty easy to support as many as our hardware and OS allows
so we might as well.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4513 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 10:07:07 +00:00
Eric Wong 12aec5738b Standardize state_file handling routines.
This way it's easier to manage and extend.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4494 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 23:32:47 +00:00
Eric Wong 381d7232a0 remove deprecated myfprintf wrapper
This shaves another 5-6k because we've removed the paranoid
fflush() calls after every fprintf.  Now we only fflush()
when we need to

git-svn-id: https://svn.musicpd.org/mpd/trunk@4493 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 23:32:39 +00:00
Eric Wong 4cf5d04ca1 interface/connection malloc reductions from mpd-ke
This patch massively reduces the amount of heap allocations at
the interface/command layer.  Most commands with minimal output
should not allocate memory from the heap at all.  Things like
repeatedly polling status, currentsong, and volume changes
should be faster as a result, and more importantly, not a source
of memory fragmentation.

These changes should be safe in that there's no way for a
remote-client to corrupt memory or otherwise do bad stuff to
MPD, but an extra set of eyes to review would be good.  Of
course there's never any warranty :)

No longer do we use FILE * structures in the interface, which means
we don't have to allocate any new memory for most connections.

Now, before you go on about losing the buffering that FILE *
+implies+, remember that myfprintf() never took advantage of
any of the stdio buffering features.

To reduce the diff and make bugs easier to spot in the diff,
I've kept myfprintf in places where we write to files (and not
network interfaces).  Expect myfprintf to go away entirely soon
(we'll use fprintf for writing regular files).

git-svn-id: https://svn.musicpd.org/mpd/trunk@4483 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 03:43:38 +00:00
J. Alexander Treuman 8dcc3d31ac Remove the fifo plugin. It's currently useless for the average user, and making it more presentable isn't something I'm willing to do before 0.12. It will likely be added back after 0.12, along with some very experimental stuff to make it more usable.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4472 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 20:51:50 +00:00
J. Alexander Treuman c4d1344f8c Adding fifo output plugin
git-svn-id: https://svn.musicpd.org/mpd/trunk@4423 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-22 00:25:46 +00:00
Avuton Olrich 29a25b9933 Add mpd-indent.sh
Indent the entire tree, hopefully we can keep
it indented.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4410 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-20 16:02:40 +00:00
Eric Wong a234780aab sparse: ANSI-fy function declarations
These are just warnings from sparse, but it makes the output
easier to read.  I ran this through a quick perl script, but
of course verified the output by looking at the diff and making
sure the thing still compiles.

here's the quick perl script I wrote to generate this patch:
----------- 8< -----------
use Tie::File;
defined(my $pid = open my $fh, '-|') or die $!;
if (!$pid) {
open STDERR, '>&STDOUT' or die $!;
exec 'sparse', @ARGV or die $!;
}
my $na = 'warning: non-ANSI function declaration of function';
while (<$fh>) {
print STDERR $_;
if (/^(.+?\.[ch]):(\d+):(\d+): $na '(\w+)'/o) {
my ($f, $l, $pos, $func) = ($1, $2, $3, $4);
$l--;
tie my @x, 'Tie::File', $f or die "$!: $f";
print '-', $x[$l], "\n";
$x[$l] =~ s/\b($func\s*)\(\s*\)/$1(void)/;
print '+', $x[$l], "\n";
untie @x;
}
}

git-svn-id: https://svn.musicpd.org/mpd/trunk@4378 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-17 00:15:34 +00:00
Eric Wong 6b2167a444 audio: attempt to gracefully handle disconnected/reconnected devices
Currently only ALSA is supported/tested, and only if the mixer
device is not on the audio device being disconnected (software
mixer).

This patch allows me to disconnect my Headroom Total Airhead USB
sound card, and resume playback (skips to the next song, which
should be fixed) when the device is plugged back in.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4364 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-16 16:52:29 +00:00
J. Alexander Treuman b38157fc76 Committing qball's patch to list supported audio outputs in --version
git-svn-id: https://svn.musicpd.org/mpd/trunk@4357 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-16 14:57:26 +00:00
Eric Wong b4df8b8f88 De-inline non-trivial, non-performance-critical functions
Functions that should stay inlined should have an explanation
attached to them.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4355 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-15 13:42:57 +00:00
J. Alexander Treuman 2fa7125cce Change shank's email address
git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14 19:37:45 +00:00
Avuton Olrich a37348a74f Huge header update, update the copyright and add
the GPL header where necessary

git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-13 19:20:34 +00:00
J. Alexander Treuman 09698f917c Add PulseAudio support
git-svn-id: https://svn.musicpd.org/mpd/trunk@4316 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-13 19:03:49 +00:00
J. Alexander Treuman acc620bbda Save audio output state in correct order.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4207 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-05-20 19:56:29 +00:00
Qball Cow 37c9265357 Commit Jat's patch for bug 1281
git-svn-id: https://svn.musicpd.org/mpd/trunk@4136 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-05-08 08:14:37 +00:00
Eric Wong c208b05a0e Don't rely on memcmp() for structs, padding bits are random
git-svn-id: https://svn.musicpd.org/mpd/trunk@4016 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-04-05 09:54:43 +00:00
Eric Wong a25acbc94f rewrite statefile code for audio devices
In the words of the original author, it was 'crappy'.  I tend to
agree :)

The code has also been broken for at least the past few months,
and nobody bothered fixing it

The previous format it was overly complex: 5 lines to describe
each device.  The new format is one-line per-device:

audio_device_state:%d:%s

%d - 0 for disabled, any integer for enabled
%s - name of the device as specified in the config file,
whitespace and all

Incompatibilities:

* Output names are now _required_ to be unique.

This is required because the new format relies solely on the
name of the audio device.

Relying on the device IDs internal to MPD was a bad idea
anyways since the user usually has none or very little idea
how they're generated, and adding a new device or removing
one from a config would throw things off completely.

This is also just a Good Idea(TM) because it makes things
less confusing to users when they see it in their clients.

* Output states are not preserved from the previous format.

Not a big deal, since the previous code was never officially
released.  Also, it's been broken for months now, so I doubt
anybody would notice :)

git-svn-id: https://svn.musicpd.org/mpd/trunk@3928 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-03-18 03:58:31 +00:00
Qball Cow 2aba0437a6 Saving state of output-device in state-file. (This is a temporary solution, rewrite of state-file is planned for 0.13)
git-svn-id: https://svn.musicpd.org/mpd/trunk@3449 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-08-23 12:01:37 +00:00
Warren Dukes dee9ab5ecd patch from Oliver Logghe for Hauppage Media MVP support
git-svn-id: https://svn.musicpd.org/mpd/trunk@3432 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-08-11 12:34:38 +00:00
Warren Dukes 8936789631 add OS X configure stuff and added a skeleton audioOutput plugin for OS X
git-svn-id: https://svn.musicpd.org/mpd/trunk@3074 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-13 19:23:09 +00:00
Warren Dukes 8583a3bc4e if no audioOutput specified, we no attempt to detect if there exists a usable oss or alsa device
git-svn-id: https://svn.musicpd.org/mpd/trunk@3057 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-12 03:10:09 +00:00
Warren Dukes 92653f8474 implemented dropping of current buffered audio, works for oss, but there seems
to be a "blip" for alsa devices, needs more work

git-svn-id: https://svn.musicpd.org/mpd/trunk@3011 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-05 14:01:13 +00:00
Warren Dukes d1a4bb382f implemented alsa audioOutput plugin, now it needs testing
git-svn-id: https://svn.musicpd.org/mpd/trunk@3008 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-05 05:22:30 +00:00
Warren Dukes d5a9925d1f s/device/output/
git-svn-id: https://svn.musicpd.org/mpd/trunk@2678 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-15 20:18:21 +00:00
Warren Dukes fb7de941c3 don't set granulepos, that's pad, mmmkay?
git-svn-id: https://svn.musicpd.org/mpd/trunk@2555 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-09 03:10:14 +00:00
Warren Dukes b7315f8391 add a buffer to audio layer, so we only send data to audio devices 32 times per second
git-svn-id: https://svn.musicpd.org/mpd/trunk@2553 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-09 00:13:42 +00:00
Warren Dukes 78c5d884d2 new command "devices", prints devices and their states
git-svn-id: https://svn.musicpd.org/mpd/trunk@2486 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-02 23:08:00 +00:00
Warren Dukes 69176148bf enabling and disabling individual audioOutputs is mostly done, just need
to add the command hooks

git-svn-id: https://svn.musicpd.org/mpd/trunk@2484 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-02 21:48:53 +00:00