aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* songvec: songvec_delete takes a const Song pointerEric Wong2008-09-292-2/+2
| | | | We don't modify the Song when we delete it
* directory: remove shortname arguments everywhereEric Wong2008-09-291-80/+41
| | | | | | It was a huge confusing mess of parameter passing around and around. Add a few extra assertions to ensure we're handling parent/child relationships properly.
* path: add mpd_basename() functionEric Wong2008-09-292-0/+20
| | | | | | | This is like basename(3) but with predictable semantics independent of C library or build options used. This is also much more strict and does not account for trailing slashes (mpd should never deal with trailing slashes on internal functions).
* directory.h: remove directory_sigChldHandler declEric Wong2008-09-291-2/+0
| | | | | We no longer fork for directory updates, so we no longer have children to reap.
* directory: replace DirectoryList with dirvecEric Wong2008-09-294-197/+175
| | | | | Small memory reduction compared to songvec since most users have much fewer dirs than songs, but still nice to have.
* directory: remove unused CPP definesEric Wong2008-09-291-4/+0
| | | | We no longer for for updates
* songvec_free => songvec_destroyEric Wong2008-09-293-3/+3
| | | | | "free" implies the songvec structure itself is freed, which is not the case.
* directory.c: kill unnecessary includesEric Wong2008-09-291-4/+1
|
* directory: update playlist version if updatedEric Wong2008-09-291-1/+6
| | | | | | | | | | | | If we updated the mpd metadata database; then there's a chance some of those songs in the playlist will have updated metadata. So be on the safe side and increment the playlist version number if _any_ song changed (this is how all released versions of mpd did it, too). This bug was introduced recently when making "update" threaded. Thanks to stonecrest for the bug report.
* pcm_utils: added pcm_range()Max Kellermann2008-09-281-10/+18
| | | | | | | Make the code more readable by moving the range checks to pcm_range(). gcc does quite a good job at optimizing it: the resulting binary is exactly the same, although it contains a parametrized shift instead of hard-coded boundaries.
* pcm_utils: added inline function pcm_dither()Max Kellermann2008-09-281-8/+10
| | | | | Merge some code into an inline function, so we can optimize it later only once.
* output: fix the "outputenabled" valueMax Kellermann2008-09-281-1/+1
| | | | | Patch 9a5b5998 broke the "outputenabled" value of the "outputs" response. Make it print "1" if the output is enabled, "0" otherwise.
* COMMANDS: assorted formatting fixesEric Wong2008-09-281-21/+22
| | | | | | * spaces => tabs * long lines wrapped * trailing whitespace killed
* COMMANDS: document moveid with negative _to_ argument, tooEric Wong2008-09-281-1/+3
|
* COMMANDS: document addid with optional position argumentEric Wong2008-09-281-1/+4
|
* notify: protect notify->pending with the mutexMax Kellermann2008-09-266-41/+4
| | | | | | | | | | There was a known deadlocking bug in the notify library: when the other thread set notify->pending after the according check in notify_wait(), the latter thread was deadlocked. Resolve this by synchronizing all accesses to notify->pending with the notify object's mutex. Since notify_signal_sync() was never used, we can remove it. As a consequence, we don't need notify_enter() and notify_leave() anymore; eliminate them, too.
* song: removed type SongListMax Kellermann2008-09-264-46/+2
| | | | SongList has been superseded by struct songvec.
* audio_output: workaround for deadlockMax Kellermann2008-09-263-2/+19
| | | | | | | | 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.
* update: send proper response to the clientMax Kellermann2008-09-251-5/+8
| | | | | | Due to a merge error, I broke the function handleUpdate(). It did not do anything for the global update, and it did not send a proper response to the client. This patch fixes both bugs.
* output: removed DEVICE_ON, DEVICE_OFFMax Kellermann2008-09-242-29/+20
| | | | | | | 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.
* output: semi-asynchronous playbackMax Kellermann2008-09-244-23/+91
| | | | | | | 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.
* output: call send_tag() only if device is onMax Kellermann2008-09-241-3/+3
| | | | Why send tags to a device which isn't enabled?
* output: document the audio_output_plugin methodsMax Kellermann2008-09-241-0/+44
|
* output: document the audio_output elementsMax Kellermann2008-09-241-4/+58
|
* output: make "struct audio_output" opaque for output pluginsMax Kellermann2008-09-2416-226/+267
| | | | | | | | | | | 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.
* output: added audio_output_closed()Max Kellermann2008-09-243-1/+11
| | | | | | The JACK output plugin needs to reset its "opened" flag when the JACK server fails. To prevent it from accessing the audio_output struct directly introduce the API function audio_output_closed().
* output: added audio_output_get_name()Max Kellermann2008-09-244-1/+28
| | | | | | Reduce direct accesses to the audio_output struct from the plugins: this time, eliminate all accesses to audio_output.name. The name is required by some plugins for log messages.
* output: set audio_output->open=1 in audio_output_task()Max Kellermann2008-09-2411-39/+8
| | | | | Since the output plugin returns a value indicating success or error, we can have the output core code assign the "open" flag.
* output: pass audio_format to plugin.init() and plugin.open()Max Kellermann2008-09-2413-34/+61
| | | | | | | 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.
* output: one thread per audio outputMax Kellermann2008-09-246-38/+218
| | | | | | To keep I/O nastiness and latencies away from the core, move the audio output code to a separate thread, one per output. The thread is created on demand, and currently runs until mpd exits.
* notify: added macro NOTIFY_INITIALIZERMax Kellermann2008-09-241-0/+5
| | | | | With the macro NOTIFY_INITIALIZER, you can statically initialize a notify object.
* notify: added notify_deinit()Max Kellermann2008-09-249-0/+36
| | | | Destroy the mutex when it is not used anymore.
* notify: make notify_init() failures fatalMax Kellermann2008-09-242-9/+6
| | | | | When a mutex cannot be created, there must be something very wrong. Induce panic and abort MPD in this case.
* notify: declare "struct notify"Max Kellermann2008-09-242-13/+13
| | | | | "struct notify" is the same as the "Notify" typedef. It can be forward-declared and has a lower case name.
* doc/COMMANDS: document "addid"Max Kellermann2008-09-231-0/+8
|
* command: fix command "addid"Max Kellermann2008-09-231-1/+1
| | | | | | With patch 8d2830b3, I broke "addid": it did not return the id of the new song, because of a typo in the return condition (== instead of !=).
* flac: removed FlacData.chunk_lengthMax Kellermann2008-09-232-8/+2
| | | | | chunk_length can be converted to a local variable, because it is always reset to 0 after it was used.
* flac: merged flacSendChunk() into flac_common_write()Max Kellermann2008-09-231-17/+16
| | | | | | | Since flacSendChunk() is a trivial function and is only used in one location, move the code there. The advantage is that calling decoder_data() directly returns the decoder_command value, so we can eliminate one decoder_get_command() call.
* flac: removed generic sample size supportMax Kellermann2008-09-231-32/+26
| | | | | | | | Support for bit rates except 16 bits (and 8 bits on little endian) has always been broken. Since we added optimized functions for 8, 16, 24/32 bits, we can remove the generic flac_convert() function. Instead of removing it, convert it to a wrapper function for flac_convert_*().
* flac: added special functions for 8 and 32 bitMax Kellermann2008-09-231-0/+37
| | | | | Same optimization for 8 and 32 bit files, like the previous patch for 16 bit. Along the way, this patch adds 24 bit FLAC support!
* flac: added optimized converter for 16 bitMax Kellermann2008-09-231-0/+17
| | | | | | flac_convert_16() runs a lot faster than the generic (and quite buggy) function flac_convert(). flac_convert_16() is only used for non-stereo files, since there is already flac_convert_stereo16().
* flac: use signed integers in flac_convert_stereo16()Max Kellermann2008-09-231-6/+4
| | | | | | By mistake, I casted the sample value to uint16_t, which is wrong. This patch simplifies the code by using a int16_t pointer instead of casting to int16_t* every time.
* flac: moved code from flacWrite() to _flac_common.cMax Kellermann2008-09-234-129/+97
| | | | | | | There is still a lot of duplicated code in flac_plugin.c and oggflac_plugin.c. Move code from flac_plugin.c to _flac_common.c, and use the new function flac_common_write() also in oggflac_plugin.c, porting lots of optimizations over to it.
* flac: assume the buffer is empty in flacWrite() IIMax Kellermann2008-09-231-7/+2
| | | | | The previous patch on this topic was incomplete: it still added data->chunk_length when calling flac_convert(). Remove this, too.
* audio_format: added audio_format_sample_size()Max Kellermann2008-09-237-9/+23
| | | | | | 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.
* alsa: re-enable-nonblocking, but sleep if busyEric Wong2008-09-231-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).
* properly configure the M4 macro directoryMax Kellermann2008-09-232-0/+2
| | | | | Add information about the M4 macro dir ./m4/ to both configure.ac and Makefile.am.
* songvec: avoid free(NULL)Eric Wong2008-09-231-2/+4
| | | | Potentially broken free() implementations don't like it
* directory: fix leak introduced with threaded updateEric Wong2008-09-231-1/+1
| | | | | Use freeList() instead of free() to free all elements in the list.
* Remove EINTR checking for open(2)Eric Wong2008-09-232-3/+2
| | | | | | open(2) should only interrupt on "slow" devices, afaik... [mk: still using fopen()]