aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/alsa_plugin.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2009-01-10Introducing mixer apiViliam Mateicka1-7/+8
This patch tryes to introduce pluggable mixer (struct mixer_plugin) along with some basic infrastructure (mixer_* functions). Instance of mixer (struct mixer) is used in alsa and oss output plugin
2009-01-07pcm_utils: moved conversion code to pcm_convert.cMax Kellermann1-1/+1
All what's left in pcm_utils.h is the pcm_range() utility function, which is only used internally by pcm_volume and pcm_mix.
2009-01-04renaming mixer.h to mixer_api.hViliam Mateicka1-1/+1
2009-01-02alsa: use GLib instead of utils.hMax Kellermann1-3/+2
2009-01-01output plugins: don't include gcc.hMax Kellermann1-2/+2
Use GLib's G_GNUC_UNUSED instead of gcc.h's mpd_unused.
2008-12-31Moving mixers to audio outputsViliam Mateicka1-1/+21
2008-12-29alsa: use GLib loggingMax Kellermann1-29/+30
2008-12-01alsa: reverted the default buffer_time to 500 msMax Kellermann1-1/+5
Commit dd7711d8 removed MPD's default ALSA buffer_time. The result was a buffer size which was way too small for playing streams on some sound hardware, and caused skips and distorted sound. Revert the default to 500 ms.
2008-11-03alsa: initialize "device" with NULLMax Kellermann1-2/+1
When using autodetection, AlsaData.device wasn't properly initialized with NULL. This broke autodetection randomly.
2008-11-01alsa, jack: no const pointers for allocated stringsMax Kellermann1-17/+25
Make the pointers "device" and "name" non-const, so we don't need the xfree() hack. The default value is expressed as NULL.
2008-10-29output: close device on play errorMax Kellermann1-1/+0
When an output plugin fails to play a chunk, close it. This replaces various manual close() calls in nearly all plugins.
2008-10-29output: use bool for return values and flagsMax Kellermann1-9/+10
Don't return 0/-1 on success/error, but true/false. Instead of int, use bool for storing flags.
2008-10-26output: don't compile plugins which are disabledMax Kellermann1-11/+3
Don't compile the sources of disabled output plugins at all.
2008-10-26renamed src/audioOutputs/ to src/output/Max Kellermann1-0/+0
Again, no CamelCase in the directory name.
2008-10-14alsa: added #ifdefs around SND_PCM_NO_AUTO_xxxMax Kellermann1-0/+6
These macros are not available in older libasound versions (1.0.13 fails, 1.0.16 is ok). Ignore the configuration if the constants are not defined.
2008-10-14alsa: optionally disable resampling and othersMax Kellermann1-1/+15
Added mpd.conf options for disabling automatic resamling, sample format and channel conversion. This way, users may choose to override ALSA's automatic resampling, and use libsamplerate instead.
2008-10-12alsa: fall back to 16 bit outputMax Kellermann1-0/+11
If the sample format isn't supported by the device (i.e. 24 bit on low-end sound chips), fall back to 16 bit output. There is code in pcm_utils.c which converts PCM data to 16 bit.
2008-10-12alsa: moved code to alsa_configure()Max Kellermann1-13/+18
Move code which loads configuration to alsa_configure(). This removes one indent level.
2008-10-11alsa: don't override libasound's buffer_time and period_timeMax Kellermann1-20/+19
ALSA does a good job measuring its buffer_time and period_time. Don't override its defaults, unless the user demands it.
2008-10-11alsa: re-enable blocking modeMax Kellermann1-15/+2
Revert e4f5d6bd "re-enable-nonblocking, but sleep if busy". Non-blocking mode with manual sleeping doesn't help at all (by the way, the patch should have used snd_pcm_wait() instead of my_usleep()). ALSA knows much more about the hardware quirks, so we just let it do the job.
2008-10-10audio_format: added audio_format_frame_size()Max Kellermann1-1/+1
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-10audio_format: renamed sampleRate to sample_rateMax Kellermann1-8/+8
The last bit of CamelCase in audio_format.h. Additionally, rename a bunch of local variables.
2008-10-10audio_format: unsigned integersMax Kellermann1-4/+4
"bits" and "channels" cannot be negative.
2008-09-29use C99 struct initializersMax Kellermann1-9/+8
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.
2008-09-29Switch to C99 types (retaining compat with old compilers)Eric Wong1-1/+1
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-24output: make "struct audio_output" opaque for output pluginsMax Kellermann1-18/+15
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-24output: set audio_output->open=1 in audio_output_task()Max Kellermann1-5/+0
Since the output plugin returns a value indicating success or error, we can have the output core code assign the "open" flag.
2008-09-24output: pass audio_format to plugin.init() and plugin.open()Max Kellermann1-2/+3
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.
2008-09-23audio_format: added audio_format_sample_size()Max Kellermann1-1/+1
The inline function audio_format_sample_size() calculates how many bytes each sample consumes. This function already takes into account that 24 bit samples are 4 bytes long, not 3.
2008-09-23alsa: re-enable-nonblocking, but sleep if busyEric Wong1-7/+10
Instead of letting ALSA block for us (and potentially allowing something stupid on certain hardware or drivers), we do the sleeping ourselves. We calculate the sleep to be a fraction of period_time to avoid oversleeping (and thus audible skipping).
2008-09-09alsa: use blocking instead of non-blocking writeEric Wong1-1/+6
The way we used non-blocking mode was HORRIBLE. It was non-blocking to ALSA, but we end up blocking in a busy loop that does absolutely NOTHING but retry. We don't check for playback cancellation (like we do in decoders) or anything. This is seriously broken and I can imagine it affects people on fast CPUs more because we do asynchronous output buffering and our ALSA device will always have data ready.
2008-09-08alsa: snd_pcm_sw_params_set_xfer_align is deprecatedEric Wong1-5/+0
Lets not use deprecated functions. It's apparently possible to not care about the sw_params stuff at all!
2008-09-08alsa: only run snd_config_update_free_global once atexitEric Wong1-3/+7
This is safer than the patch in http://www.musicpd.org/mantis/view.php?id=1542 with multiple audio outputs enabled. Sadly, I only noticed that patch/problem when I googled for "snd_config_update_free_global"
2008-09-08alsa: move bitformat reading code out of the wayEric Wong1-16/+12
2008-09-08alsa: avoid unnecessary heap usage if we don't set a device nameEric Wong1-11/+12
2008-09-08alsa: get rid of the needless canPause flagEric Wong1-3/+0
We never use it for anything anyways as we release the device entirely on pause.
2008-09-08alsa: capitalize "ALSA" consistently in messagesEric Wong1-8/+8
That's the name of this project.
2008-09-08alsa: optimistically try resuming from suspendEric Wong1-6/+4
Apparently snd_pcm_hw_params_can_resume() can return false even though my hardware does in fact support resuming. So stop carrying that value in the canResume flag and just try to resume when we're in the suspended state; falling back to snd_pcm_prepare only if resuming fails. libao does something similar on resume, too. While we're at it, use the E() macro which will enable us to have better error reporting. [mk: remove the E() macro stuff]
2008-09-08output: const plugin structuresMax Kellermann1-1/+1
Since the plugin struct is never modified, we should store it in constant locations.
2008-09-07output: renamed typedef AudioOutput to struct audio_outputMax Kellermann1-7/+8
Also rename AudioOutputPlugin to struct audio_output_plugin, and use forward declarations to reduce include dependencies.
2008-09-07output: added output_api.hMax Kellermann1-3/+2
Just like decoder_api.h, output_api.h provides the audio output API which is used by the plugins.
2008-09-07audio_format: converted typedef AudioFormat to struct audio_formatMax Kellermann1-1/+1
Get rid of CamelCase, and don't use a typedef, so we can forward-declare it, and unclutter the include dependencies.
2008-04-12use size_t and constant pointer in ao pluginsMax Kellermann1-1/+2
The audio output plugins should get a constant pointer, because they must not modify the buffer. Since the size is a non-negative buffer size in bytes, we should change its type to size_t. git-svn-id: https://svn.musicpd.org/mpd/trunk@7293 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12whitespace cleanupMax Kellermann1-7/+7
Clean up some space indentations, replace with tabs. git-svn-id: https://svn.musicpd.org/mpd/trunk@7239 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-03-26explicitly downcastMax Kellermann1-1/+1
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-01-03Cleanup #includes of standard system headers and put them in one placeEric Wong1-4/+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
2007-12-16Know about SND_PCM_STATE_RUNNING, might fix some bugsQball Cow1-0/+4
git-svn-id: https://svn.musicpd.org/mpd/trunk@7077 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-09-05conf: use getBoolBlockParam for block params, tooEric Wong1-3/+3
git-svn-id: https://svn.musicpd.org/mpd/trunk@6858 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-08dmix fix, don't call snd_pcm_drain unless we're already in the RUNNINGWarren Dukes1-1/+3
state (when users press stop, previous snd_pcm_drop(), then snd_pcm_drain() was called. this would lockup dmix) git-svn-id: https://svn.musicpd.org/mpd/trunk@6517 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-09Don't allow "true" as a value for use_mmap for consistency with other "yesJ. Alexander Treuman1-2/+1
or no" parameters. git-svn-id: https://svn.musicpd.org/mpd/trunk@5896 09075e82-0dd4-0310-85a5-a0d7c8717e4f