aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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()]
* directory: don't leak file handles if we get a corrupt dbEric Wong2008-09-231-1/+1
|
* songvec: remove songvec_pruneEric Wong2008-09-233-28/+0
| | | | | | Any pruned files will be noticed during update and pruned from the live database, so this inefficient function can go away and never come back.
* directory: update do its work inside a threadEric Wong2008-09-235-150/+58
| | | | | | | | | A lot of the preparation was needed (and done in previous months) in making update thread-safe, but here it is. This was the first thing I made work inside a thread when I started mpd-uclinux many years ago, and also the last thing I've done in mainline mpd to work inside a thread, go figure.
* directory: use enum update_return for return values IIMax Kellermann2008-09-231-16/+21
| | | | Converted some more functions and their callers to enum update_return.
* directory: use enum update_return for return valuesEric Wong2008-09-231-72/+49
| | | | This way we avoid having to document -1, 0, 1
* Don't try to prune unless we're updatingEric Wong2008-09-231-1/+2
| | | | | | Pruning is very expensive and we won't need it in the future anyways. This brings startup back to previous speeds (before songvec changes).
* workaround race condition on updates with broken signal blockingEric Wong2008-09-231-39/+50
| | | | | | | | | pthreads with our existing signal blocking/handling is broken, for now just sleep a bit in the child to prevent the CHLD handler from being called too early. Also, improve error reporting when handling SIGCHLD by storing the status to be called in the main task (which can be logged, since we can't do logging inside the sig handler).
* Replace SongList with struct songvecEric Wong2008-09-2311-113/+212
| | | | | | | Our linked-list implementation is wasteful and the SongList isn't modified enough to benefit from being a linked list. So use a more compact array of song pointers which saves ~200K on a library with ~9K songs (on x86-32).
* directory: remove unused updateMp3Directory() functionEric Wong2008-09-232-20/+0
| | | | | | | | | | | | It hasn't been used in many years commit 3a89afdd80f228139554372a83a9d74486acf691 Author: Warren Dukes <warren.dukes@gmail.com> Date: Sat Nov 20 20:28:32 2004 +0000 remove --update-db option (SVN r2719)
* start using prefixcmp()Eric Wong2008-09-237-52/+24
| | | | | LOC reduction and less noise makes things easier for tired old folks to follow.
* Add prefixcmp() (stol^H^H^H^Hborrowed from git)Eric Wong2008-09-232-0/+12
| | | | | | | This allows us to avoid the nasty repetition in strncmp(foo, bar, strlen(foo)). We'll miss out on the compiler optimizing strlen() into sizeof() - 1 for string literals for this; but we don't use this it for performance-critical functions anyways...
* volume: oops, only #include <alloca.h> if OSS is enabledEric Wong2008-09-231-1/+0
|
* oss: avoid heap allocations when configuring mixerEric Wong2008-09-231-13/+13
| | | | Noticed-by: Courtney Cavin
* Directory: don't allocate stat information dynamicallyEric Wong2008-09-232-50/+22
| | | | | | | This should save a few thousand ops. Not worth it to malloc for such a small (3-words on 32-bit ARM and x86) structures. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* mp3: fix long line, I can't read past 80 colsEric Wong2008-09-231-1/+2
|
* main_notify: removed assertion in wakeup_main_task()Max Kellermann2008-09-231-2/+0
| | | | | It is legal to call wakeup_main_task() from within the main thread, e.g. from within a signal handler. Remove the assertion.
* main_notify: use init_async_pipe()Max Kellermann2008-09-231-8/+1
| | | | Remove duplicated code.
* mp3: fix buffer overflow when max_frames is too largeMax Kellermann2008-09-171-0/+5
| | | | | | | The function decodeFirstFrame() allocates memory based on data from the mp3 header. This can make the buffer size allocation overflow, or lead to a DoS attack with a very large buffer. Cap this buffer at 8 million frames, which should really be enough for reasonable files.
* client: check expired after client_process_line()Max Kellermann2008-09-171-1/+3
| | | | | | The assertion on "!client_is_expired(client)" was wrong, because writing the command response may cause the client to become expired. Replace that assertion with a check.
* mp4: fix potential integer overflow bug in the mp4_decode() functionTerry2008-09-121-0/+7
| | | | | | | | | | A crafted mp4 file could cause an integer overflow in mp4_decode function in src/inputPlugins/mp4_plugin.c. mp4ff_num_samples() function returns some tainted value. sizeof(float) * numSamples is an integer overflow operation if numSamples is too huge, so xmalloc will allocate a small memory region. I constructe a mp4 file, and use faad2 to open the file. mp4ff_num_samples() returns -1. So I think mpd bears from the same problem.
* shout: don't write empty buffersMax Kellermann2008-09-121-2/+4
| | | | | Add a check to write_page() which checks if there is actually data. Don't bother to call shout_send() if there is not.
* shout: removed clear_shout_buffer()Max Kellermann2008-09-121-8/+2
| | | | | The function is trivial, without a benefit. Also don't initialize buf.data[0], this is not a null terminated string.
* shout: make the shout_buffer staticMax Kellermann2008-09-124-12/+4
| | | | | | | Since the buffer size is known at compile time, we can save an indirection by declaring it as a char array instead of a pointer. That saves an extra allocation, and we can calculate with the compile-time constant sizeof(data) instead of the attribute "max_len".
* shout: constant plugin declarationsMax Kellermann2008-09-124-7/+7
| | | | | Declare both shout plugins "const", since they will never change, once initialized at compile time.
* shout: static encoder plugin listMax Kellermann2008-09-121-35/+15
| | | | | | Shout encoder plugins are known at compile time. There is no reason to use a complex data structure as "List" to manage them at runtime - just put the pointers into a static array.
* shout: removed typedefs on structs and plugin methodsMax Kellermann2008-09-124-73/+65
| | | | | | | Don't typedef the structs at all. It is easier to forward-declare this way. Don't typedef methods. They are used exactly once, a few lines below.