Commit Graph

184 Commits

Author SHA1 Message Date
Max Kellermann c6cbcc2c25 copyright year 2011 2011-01-29 10:13:54 +01:00
Thomas Jansen 28bcb8bdf5 eliminate g_error() usage
Replaced all occurrences of g_error() with MPD_ERROR() located in a new header
file 'mpd_error.h'. This macro uses g_critical() to print the error message
and then exits gracefully in contrast to g_error() which would internally call
abort() to produce a core dump.

The macro name is distinctive and allows to find all places with dubious error
handling. The long-term goal is to get rid of MPD_ERROR() altogether. To
facilitate the eventual removal of this macro it was added in a new header
file rather than to an existing header file.

This fixes #2995 and #3007.
2010-09-25 15:00:43 +02:00
Avuton Olrich 9d3865cb95 Update copyright notices. 2009-12-31 20:58:43 -08:00
Max Kellermann 5b82ffc291 include config.h in all sources
After we've been hit by Large File Support problems several times in
the past week (which only occur on 32 bit platforms, which I don't
have), this is yet another attempt to fix the issue.
2009-11-12 09:17:03 +01:00
Max Kellermann a05d0d5d94 audio: removed function finishAudioConfig()
There's no point in clearing the audio format before exiting.
2009-10-22 17:12:32 +02:00
Max Kellermann 9526fdbe73 audio_format: wildcards allowed in audio_format configuration
An asterisk means that this attribute should not be enforced, and
stays whatever it used to be.  This way, some configuration values
work like masks.
2009-10-21 23:01:04 +02:00
Max Kellermann 8cb6854da4 audio: removed config_param.value NULL check
The value is always non-NULL.
2009-10-21 22:22:20 +02:00
Max Kellermann a5017a2d7c mixer_api: moved functions to mixer_control.c
mixer_control.h should provide the functions needed to manipulate a
mixer, without exposing the internal mixer API (which is provided by
mixer_api.h).
2009-03-14 11:36:50 +01:00
Avuton Olrich 0aee49bdf8 all: Update copyright header.
This updates the copyright header to all be the same, which is
pretty much an update of where to mail request for a copy of the GPL
and the years of the MPD project. This also puts all committers under
'The Music Player Project' umbrella. These entries should go
individually in the AUTHORS file, for consistancy.
2009-03-13 11:51:55 -07:00
Max Kellermann e9cbb6be3f audio: moved mixer functions to mixer_control.c 2009-03-12 18:34:37 +01:00
Max Kellermann 02c99d7716 mixer: include cleanup
Don't include conf.h in mixer_api.h.  Use a forward struct declaration
instead.
2009-02-16 18:40:04 +01:00
Max Kellermann 46c15e4ab3 output: include cleanup
Don't include output_api.h in output_internal.h.  This change requires
adding missing includes in several sources.
2009-02-16 01:51:50 +01:00
Max Kellermann 83ce0e5325 mixer_api: replaced method "control()" with "{get,set}_volume()"
The method control() is too complicated, and overengineered.  Replace
it with two trivial functions: get_volume() and set_volume().
2009-02-16 01:39:52 +01:00
Max Kellermann 37bc31d161 output_plugin: replaced method "control()" with "mixer()"
The output plugin shouldn't know any specifics of the mixer API.  Make
it return the mixer object, and let the caller deal with it.
2009-02-16 01:39:00 +01:00
Max Kellermann 9d447dda1d audio: moved code to output_command.c
The output_command library provides a command interface to the audio
outputs.  It assumes the input comes from an untrusted source
(i.e. the client) and verifies all parameters.
2009-02-11 18:02:45 +01:00
Max Kellermann 5090cf6484 audio: replaced parseAudioConfig() with audio_format_parse()
Added audio_format_parse() in a separate library, with a modern
interface: return a GError instead of logging errors.  This allows the
caller to deal with the error.
2009-02-11 18:00:41 +01:00
Max Kellermann a3a6eefcfe audio: moved code to output_all.c
Moved code which deals with all audio outputs at once into a separate
library.
2009-02-10 18:51:49 +01:00
Max Kellermann e7505381eb audio: moved protocol code to output_print.c 2009-02-10 18:51:42 +01:00
Max Kellermann 49ff2aceb5 audio: moved state file code to output_state.c 2009-02-10 18:51:39 +01:00
Max Kellermann f141d90533 audio: removed isCurrentAudioFormat()
This function isn't used anymore.
2009-02-10 18:51:38 +01:00
Max Kellermann e8787ac4a4 audio: added output enumeration functions
Added audio_output_get(), audio_output_find().
2009-02-10 17:21:19 +01:00
Max Kellermann 3e87033145 audio: added audio_output_config_count()
audio_output_config_count() returns the number of audio outputs in the
configuration file.  It is only used by initAudioDriver().  The public
function audio_output_count() now returns audioOutputArraySize.
2009-02-10 17:21:10 +01:00
Max Kellermann a45922cd66 use g_free() instead of free()
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.
2009-01-25 18:47:21 +01:00
Max Kellermann db2058a265 mixer: removed mixer_configure_legacy(), AC_MIXER_CONFIGURE
Those have been superseded by the new legacy configuration code.
2009-01-25 17:38:06 +01:00
Max Kellermann 5f77910097 conf: const pointers in block get functions
All config_get_block_*() functions should accept constant config_param
pointers.
2009-01-25 16:03:49 +01:00
Max Kellermann 4d472c265e conf: no CamelCase, part I
Renamed functions, types, variables.
2009-01-17 20:23:27 +01:00
Viliam Mateicka 1a04e57168 renaming mixer.h to mixer_api.h 2009-01-04 19:15:18 +01:00
Max Kellermann 6ce06a4863 audio: use GLib instead of utils.h 2009-01-03 13:36:20 +01:00
Viliam Mateicka 9a70c4d06d Moving mixers to audio outputs 2008-12-31 16:46:41 +01:00
Viliam Mateicka dd9af72a74 exporting functions 2008-12-31 15:10:53 +01:00
Max Kellermann 95b3430f52 removed os_compat.h
Only include headers which are really needed.  os_compat.h aimed to
make MPD easily portable, but was never actually made portable.
2008-12-29 17:28:32 +01:00
Max Kellermann 859aac7242 utils: removed myFgets()
Replaced myFgets() with fgets() + g_strchomp().
2008-12-28 19:54:49 +01:00
Max Kellermann e8c44782d0 output_control: no static "notify" initialization
Don't use NOTIFY_INITIALIZER to initialize audio_output_client_notify.
2008-12-27 20:53:52 +01:00
Max Kellermann 7918785c78 output: use GLib instead of log.h/util.h 2008-11-25 17:47:46 +01:00
Max Kellermann 79d70f124d output: don't allow length==0
Nobody should call playAudio() with an empty chunk.  Add some
assertions on that.
2008-11-02 20:16:56 +01:00
Max Kellermann f8722913cf output: removed audio_output.result
Since open() and play() close the device on error, we can simply check
audio_output.open instead of audio_output.result after a call.
2008-10-29 22:34:37 +01:00
Max Kellermann 7da0e005f3 output: delay reopen after device failure
When one of several output devices failed, MPD tried to reopen it
quite often, wasting a lot of resources.  This patch adds a delay:
wait 10 seconds before retrying.  This might be changed to exponential
delays later, but for now, it makes the problem go away.
2008-10-29 22:32:50 +01:00
Max Kellermann 0eae1c55ad output: moved code to audio_output_update()
Moved code from syncAudioDeviceStates() to audio_output_update().
2008-10-29 22:17:44 +01:00
Max Kellermann 678314534a output: always call cancel() before stop()
Stopping an audio output device without cancelling its buffer doesn't
make sense.  Combine the two operations, which saves several cancel
calls.
2008-10-29 22:17:42 +01:00
Max Kellermann cf376b4bc8 output: moved audioDeviceStates to audio_output.enabled 2008-10-29 20:49:51 +01:00
Max Kellermann 58c5bee9f0 output: use bool for return values and flags
Don't return 0/-1 on success/error, but true/false.  Instead of int,
use bool for storing flags.
2008-10-29 20:40:27 +01:00
Max Kellermann 03390d8be1 audio: call closeAudioDevice() on error
Instead of implementing another loop which calls audio_output_close()
on all configured devices, simply call closeAudioDevice().
2008-10-29 20:39:56 +01:00
Max Kellermann 030238bb10 audio: removed variable "audioOpened"
This variable is never read, and can be removed.
2008-10-29 20:39:48 +01:00
Max Kellermann 016d996131 utils: use g_str_has_prefix() instead of prefixcmp()
Remove duplicated code from MPD.
2008-10-28 20:33:56 +01:00
Max Kellermann 80603cf6f1 audio: allow 24 and 8 bit output
I added 24 bit support a while ago, but it wasn't possible to force 24
bit output.  Add 24 and 8 bit to the list of allowed sample sizes.
Although 8 bit audio isn't as widely used as 24 bit, there is no
reason to exclude it.
2008-10-23 16:57:58 +02:00
Max Kellermann 980f2ca56d output_buffer: don't split frames
Splitting a frame between two buffer chunks causes distortion in the
output.  MPD used to assume that the chunk size 1020 would never cause
splitted frames, but that isn't the case for 24 bit stereo (127.5
frames), and even less for files with even more channels.
2008-10-23 16:48:49 +02:00
Max Kellermann a3e3d2c950 command: added command "idle"
"idle" waits until something noteworthy happens on the server,
e.g. song change, playlist modified, database updated.  This allows
clients to keep up to date without polling.
2008-10-14 22:38:14 +02:00
Max Kellermann 07c9b62764 audio: don't clear input_audio_format on openAudioDevice(NULL)
Commit 80a2c937 broke resume after pause: it cleared the
input_audio_format when it attempted to simplify a complicated
expression.  Don't clear it, just assign input_audio_format if a new
format was specified.
2008-10-13 14:31:18 +02:00
Max Kellermann 80a2c937c4 audio: renamed the audio_format variables
Renamed audio_configFormat to configured_audio_format.  Renamed
audio_buffer.format to input_audio_format.  Simplified its
initialization in openAudioDevice().
2008-10-12 01:00:00 +02:00
Max Kellermann 336b193097 audio: removed enum ad_state
All what's left from ad_state is a simple boolean flag (ENABLE /
DISABLE).  Convert it to a C99 bool.
2008-10-12 00:48:59 +02:00