aboutsummaryrefslogtreecommitdiffstats
path: root/src/audio.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* audio_format: added audio_format_clear() and audio_format_defined()Max Kellermann2008-09-101-1/+1
| | | | | | | | | 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.
* audio: moved cmpAudioFormat() to audio_format.hMax Kellermann2008-09-091-15/+2
| | | | | Rename it to audio_format_equals() and return "true" if they are equal.
* audio: replaced copyAudioFormat() with simple assignmentMax Kellermann2008-09-091-13/+5
| | | | | | | | | 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.
* output: renamed the functions in output_control.cMax Kellermann2008-09-091-12/+12
| | | | Getting rid of CamcelCase, again.
* output: moved code from audioOutput.c to output_control.cMax Kellermann2008-09-091-1/+1
| | | | | Similar to decoder_control.c, output_control.c will provide functions for controlling the output thread (which will be implemented later).
* output: static audio_output_plugin list as arrayMax Kellermann2008-09-081-17/+0
| | | | | | 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.
* output: renamed typedef AudioOutput to struct audio_outputMax Kellermann2008-09-071-4/+5
| | | | | Also rename AudioOutputPlugin to struct audio_output_plugin, and use forward declarations to reduce include dependencies.
* output: added output_api.hMax Kellermann2008-09-071-0/+1
| | | | | Just like decoder_api.h, output_api.h provides the audio output API which is used by the plugins.
* audio_format: converted typedef AudioFormat to struct audio_formatMax Kellermann2008-09-071-12/+13
| | | | | Get rid of CamelCase, and don't use a typedef, so we can forward-declare it, and unclutter the include dependencies.
* audio: don't pass "fd" to printAudioDevices()Max Kellermann2008-09-071-7/+9
| | | | Pass the client struct instead.
* audio: don't pass "fd" to {en,dis}ableAudioDevice()Max Kellermann2008-09-071-12/+5
| | | | No protocol code in the audio output library.
* tag: renamed MpdTag and MpdTagItem to struct tag, struct mpd_tag_itemMax Kellermann2008-08-291-1/+1
| | | | | Getting rid of CamelCase; not having typedefs also allows us to forward-declare the structures.
* pass constant pointersMax Kellermann2008-08-291-1/+1
| | | | And again, convert arguments to const.
* clean up CPP includesMax Kellermann2008-08-261-1/+0
| | | | | Include only headers which are really required. This speeds up compilation and helps detect cross-layer accesses.
* audio.c: avoid magic numbers even if they have comments :)Eric Wong2008-06-021-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7373 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* remove audioDeviceStates from playerData and getPlayerDataEric Wong2008-06-021-9/+13
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7372 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* const pointers in audio.cMax Kellermann2008-04-121-5/+5
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7344 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* clean up CPP includesMax Kellermann2008-04-121-4/+3
| | | | | | | | | 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
* use size_t in audio.cMax Kellermann2008-04-121-4/+4
| | | | | | | 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
* audio.c: unsigned int functions return unsigned ints, not size_tEric Wong2008-03-261-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7208 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* audio: use a machine word for array sizesMax Kellermann2008-03-261-17/+17
| | | | | | | | 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
* explicitly downcastMax Kellermann2008-03-261-4/+4
| | | | | | | | 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
* fixed -Wshadow warningsMax Kellermann2008-01-261-7/+7
| | | | | Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7143 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Cleanup #includes of standard system headers and put them in one placeEric Wong2008-01-031-9/+1
| | | | | | | | | | | | | 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
* silence is constant, as is the buffer we pass to playAudioEric Wong2008-01-011-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7123 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Merge branches/ew r7104Eric Wong2007-12-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Adding FIFO audio output. This is pretty much identical to the old one,J. Alexander Treuman2007-06-131-0/+1
| | | | | except that it now uses a timer for throttling. git-svn-id: https://svn.musicpd.org/mpd/trunk@6621 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Load shout first instead of last. This makes it more likely to block otherJ. Alexander Treuman2007-06-121-1/+1
| | | | | | | 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
* Load the shout plugin last. This will make sure it's played to last,J. Alexander Treuman2007-06-101-1/+1
| | | | | reducing the likelyhood of it blocking other outputs. git-svn-id: https://svn.musicpd.org/mpd/trunk@6543 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* If an audio output is in state DEVICE_ENABLE, and openAudioOutput fails,J. Alexander Treuman2007-06-091-6/+10
| | | | | | | | | 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
* Adding a null output plugin.J. Alexander Treuman2007-05-301-0/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6393 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Changing all calls to ERROR() followed by exit(EXIT_FAILURE) with a singleJ. Alexander Treuman2007-05-261-7/+4
| | | | | call to FATAL(). git-svn-id: https://svn.musicpd.org/mpd/trunk@6276 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* The massive copyright updateAvuton Olrich2007-04-051-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* sparse: move extern declarations for plugins into header filesEric Wong2007-01-141-9/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5261 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Don't initialize globals to zero (or NULL)Eric Wong2007-01-141-9/+9
| | | | | | | | 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
* jack patch from anarch (and some type fixes for mp4 and acc plugins)Warren Dukes2006-10-181-0/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4912 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* add a sanity check assertWarren Dukes2006-10-031-0/+3
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4869 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix the segfault for when no audio_output is found and none is detected (bug ↵Warren Dukes2006-10-031-10/+18
| | | | | found by normalperson!!!) git-svn-id: https://svn.musicpd.org/mpd/trunk@4868 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* cleanup flushWarningBuffer() and make some for() loops in audio.c look and ↵Warren Dukes2006-10-031-8/+8
| | | | | do something sane. git-svn-id: https://svn.musicpd.org/mpd/trunk@4867 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Replace strdup and {c,re,m}alloc with x* variants to check for OOM errorsEric Wong2006-08-261-3/+3
| | | | | | | | | | | | | | | | | | | 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
* audio.c: [trivial] remove unnecessary includeEric Wong2006-08-261-1/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4688 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* labels should be on the left most column, no tabbingWarren Dukes2006-08-091-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4605 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Ok, don't use memcmp for comparing audio formats!J. Alexander Treuman2006-08-071-1/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4591 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Eliminate unnecessary use of a variableJ. Alexander Treuman2006-08-071-2/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4586 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Use memcmp to compare audio formatsJ. Alexander Treuman2006-08-071-2/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4585 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Reopen the audio device if the audio format has changedJ. Alexander Treuman2006-08-071-0/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4584 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* audio: pause/resume-from-statefile bugfixes,Eric Wong2006-08-011-45/+37
| | | | | | | | | | | | 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
* audio: malloc reductionsEric Wong2006-08-011-28/+25
| | | | | | | | | | | | | 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
* audio: get rid of the myAudioDevicesEnabled arrayEric Wong2006-08-011-63/+75
| | | | | | | 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
* audio: remove AUDIO_MAX_DEVICES limitEric Wong2006-08-011-21/+24
| | | | | | | 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