aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Drop metadata updates from HTTP for now (input HTTP, and shout)Eric Wong2008-04-122-6/+0
| | | | | | | | It is way more complicated than it should be; and locking it for thread-safety is too difficult. [merged r7183 from branches/ew] git-svn-id: https://svn.musicpd.org/mpd/trunk@7241 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Initial cut of fork() => pthreads() for decoder and playerEric Wong2008-04-1210-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I initially started to do a heavy rewrite that changed the way processes communicated, but that was too much to do at once. So this change only focuses on replacing the player and decode processes with threads and using condition variables instead of polling in loops; so the changeset itself is quiet small. * The shared output buffer variables will still need locking to guard against race conditions. So in this effect, we're probably just as buggy as before. The reduced context-switching overhead of using threads instead of processes may even make bugs show up more or less often... * Basic functionality appears to be working for playing local (and NFS) audio, including: play, pause, stop, seek, previous, next, and main playlist editing * I haven't tested HTTP streams yet, they should work. * I've only tested ALSA and Icecast. ALSA works fine, Icecast metadata seems to get screwy at times and breaks song advancement in the playlist at times. * state file loading works, too (after some last-minute hacks with non-blocking wakeup functions) * The non-blocking (*_nb) variants of the task management functions are probably overused. They're more lenient and easier to use because much of our code is still based on our previous polling-based system. * It currently segfaults on exit. I haven't paid much attention to the exit/signal-handling routines other than ensuring it compiles. At least the state file seems to work. We don't do any cleanups of the threads on exit, yet. * Update is still done in a child process and not in a thread. To do this in a thread, we'll need to ensure it does proper locking and communication with the main thread; but should require less memory in the end because we'll be updating the database "in-place" rather than updating a copy and then bulk-loading when done. * We're more sensitive to bugs in 3rd party libraries now. My plan is to eventually use a master process which forks() and restarts the child when it dies: locking and communication with the main thread; but should require less memory in the end because we'll be updating the database "in-place" rather than updating a copy and then bulk-loading when done. * We're more sensitive to bugs in 3rd party libraries now. My plan is to eventually use a master process which forks() and restarts the child when it dies: master - just does waitpid() + fork() in a loop \- main thread \- decoder thread \- player thread At the beginning of every song, the main thread will set a dirty flag and update the state file. This way, if we encounter a song that triggers a segfault killing the main thread, the master will start the replacement main on the next song. * The main thread still wakes up every second on select() to check for signals; which affects power management. [merged r7138 from branches/ew] git-svn-id: https://svn.musicpd.org/mpd/trunk@7240 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use unsigned integers in the flac pluginMax Kellermann2008-04-122-2/+2
| | | | | | The counter variables c_samp and c_chan begin at zero and can never be negative. git-svn-id: https://svn.musicpd.org/mpd/trunk@7228 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* removed unused variableMax Kellermann2008-04-122-6/+6
| | | | | The local variable d_samp is initialized, but never actually used. git-svn-id: https://svn.musicpd.org/mpd/trunk@7227 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* wavpack_plugin: cleanups after the last commitEric Wong2008-03-261-2/+2
| | | | | | | | * malloc() => xmalloc() for error checking * strncpy() replaced with memcpy(), memcpy appears perfectly safe here and mpd does not ever use strncpy() (see r4491) git-svn-id: https://svn.musicpd.org/mpd/trunk@7211 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* WavPack improvementsLaszlo Ashin2008-03-261-29/+130
| | | | | | | | | | This patch does the following: -enables WVC support for streams as well, -improves MPD inputStream <=> WavPack stream connector, -fixes two compile warnings (which were caused by MPD API change). Mantis #1660 <http://musicpd.org/mantis/view.php?id=1660> git-svn-id: https://svn.musicpd.org/mpd/trunk@7210 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* audiofile_plugin: fix nasty long lines introduced in previous commitEric Wong2008-03-261-2/+4
| | | | | Terminals are 80 columns and that's a hard limit, no exceptions git-svn-id: https://svn.musicpd.org/mpd/trunk@7207 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* inputPlugins/oggvorbis: removed unused variablesMax Kellermann2008-03-261-7/+6
| | | | | | | | | | | The local variable eof can actually be replaced with a simple "break". With a negative ret, the value of chunkpos can be invalidated, I am not sure if this might have been a bug. [ew: no, a negative ret will correspond to ret == OV_HOLE and ret will be reset to zero leaving chunkpos untouched (code cleaned up to make this more obvious] git-svn-id: https://svn.musicpd.org/mpd/trunk@7202 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* eliminated duplicate initializationMax Kellermann2008-03-261-2/+2
| | | | | | | Local variables which are never read before the first assignment don't need initialization. Saves a few bytes of text. Also don't reset variables which are never read until function return. git-svn-id: https://svn.musicpd.org/mpd/trunk@7199 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* explicitly downcastMax Kellermann2008-03-262-7/+7
| | | | | | | | 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
* inputPlugins: add .oga suffix support for Ogg containersEric Wong2008-03-202-2/+2
| | | | | | | | | | | | | | | | | | | From <http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions>: > .oga - audio/ogg > > * Ogg Audio Profile (audio in Ogg container) > * Applications supporting .oga, .ogv SHOULD support decoding > from muxed Ogg streams > * Covers Ogg FLAC, Ghost, and OggPCM > * Although they share the same MIME type, Vorbis and Speex > use different file extensions. > * SHOULD contain a Skeleton logical bitstream. > * Vorbis and Speex may use .oga, but it is not the > prefered(sic) method of distributing these files because of > backwards-compatibility issues. Thanks to Qball and Rasi for the patch. git-svn-id: https://svn.musicpd.org/mpd/trunk@7191 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix -Wconst warningsMax Kellermann2008-02-057-29/+29
| | | | | | [ew: cleaned up the dirty union hack a bit] Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7180 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fixed "comparison between signed and unsigned"Max Kellermann2008-01-261-2/+2
| | | | | Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7146 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* assume old flac api when FLAC_API_VERSION_CURRENT is not definedMax Kellermann2008-01-261-1/+1
| | | | | | | | | the code is inconsistent when FLAC_API_VERSION_CURRENT is not defined: sometimes version > 7 is assumed, and sometimes version <= 7. solve this by assuming the version is old when FLAC_API_VERSION_CURRENT is not defined. Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7144 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fixed -Wshadow warningsMax Kellermann2008-01-265-35/+35
| | | | | 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-0312-64/+12
| | | | | | | | | | | | | 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
* Simplify decode cleanup logic a bitEric Wong2008-01-0110-100/+6
| | | | | | | | | | | DECODE_STATE_STOP is always set as dc->state, and dc->stop is always cleared. So handle it in decodeStart once rather than doing it in every plugin. While we're at it, fix a long-standing (but difficult to trigger) bug in mpc_decode where we failed to return if mpc_decoder_initialize() fails. git-svn-id: https://svn.musicpd.org/mpd/trunk@7122 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* mpc_plugin: break out if a missed error branchEric Wong2008-01-011-0/+2
| | | | | We shouldn't try to continue if mpc_decoder_initialize() fails. git-svn-id: https://svn.musicpd.org/mpd/trunk@7113 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* ogg_common: fix indent screwupEric Wong2007-12-311-14/+5
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7109 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix builds that only have FLAC >= 1.1.3 but not Ogg-VorbisEric Wong2007-12-313-9/+9
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7108 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix possible wrong 'addition'Qball Cow2007-12-101-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7076 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix replaygain for latest flac version.Qball Cow2007-12-061-0/+9
| | | | | | The updated initialize method did not tell the libFLAC to look for the tag containing the replay information. git-svn-id: https://svn.musicpd.org/mpd/trunk@7075 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Re-enable seeking in http streams.Qball Cow2007-11-281-6/+3
| | | | | | Fixing stopping mpd from block when trying to stop a ogg stream that is buffering. git-svn-id: https://svn.musicpd.org/mpd/trunk@7053 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix wavpack endian issues, tested to work for 16bit. (after blowing my ears ↵Qball Cow2007-10-031-1/+18
| | | | | off with white noise) git-svn-id: https://svn.musicpd.org/mpd/trunk@6952 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* inputPlugins/_ogg_common.c: fixup includes for new (1.1.4+ FLAC)Eric Wong2007-09-171-1/+3
| | | | | | ogg_stream_type_detect may not be compiled correctly when compiling FLAC (1.1.4+) without Vorbis git-svn-id: https://svn.musicpd.org/mpd/trunk@6896 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Add oga extension for flac-1.2.1Avuton Olrich2007-09-141-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6888 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* buffer input while waiting for outputBuffer space in mp4 and (ogg)flacEric Wong2007-09-102-2/+3
| | | | | | | | Both mp4 and (ogg)flac inputPlugins got HTTP inputStream support later in the game, so their calls to sendDataToOutputBuffer() didn't get updated to support buffering while the outputBuffer was full. This fixes it. git-svn-id: https://svn.musicpd.org/mpd/trunk@6873 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* conf: improved boolean config parameter handling from -keEric Wong2007-09-051-4/+3
| | | | | | the force flag will issue FATAL() if an invalid value is specified git-svn-id: https://svn.musicpd.org/mpd/trunk@6857 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* inputPlugins/flac: improve error messagesEric Wong2007-08-281-12/+13
| | | | | | | | | For the default: case, just use the error message that libFLAC provides instead of using something ambiguous. Also, this gets rid of long lines in the code, making it easier to digest. Of course, we save ~100 bytes of text space in the process :) git-svn-id: https://svn.musicpd.org/mpd/trunk@6830 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* adding \n to a bunch of error message stringsJ. Alexander Treuman2007-08-271-2/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6826 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* inputPlugins/mp3_plugin: parse LAME tags for ReplayGain infoJ. Alexander Treuman2007-08-221-46/+104
| | | | | | | | | | | | Parse ReplayGain info in LAME tags and use it if no ID3v2 ReplayGain tags are found. This is currently a bit unsafe, as apparently some LAME tags have bogus ReplayGain values. But I'm finding a lot of MP3s with valid LAME tags that fail the LAME tag CRC check. So until I figure out why that's happening, it's an unreliable method for checking if the LAME tag is valid. A big thanks to tmz for writing the original patch. git-svn-id: https://svn.musicpd.org/mpd/trunk@6798 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Cleanup a outcommented debug statementQball Cow2007-08-111-5/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6736 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* inputPlugins/wavpack_plugin: enable ReplayGain codeJ. Alexander Treuman2007-06-251-14/+3
| | | | | | Turns out the fix was as simple as specifying the OPEN_TAGS flag when opening the file. Thanks again to Kodest for figuring this one out. git-svn-id: https://svn.musicpd.org/mpd/trunk@6657 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* inputPlugins/wavpack_plugin: adding dummy code for ReplayGain supportJ. Alexander Treuman2007-06-251-4/+84
| | | | | | | | | This ReplayGain code is currently disabled because WavpackGetTagItem can't seem to find replaygain_* fields in APEv2 tags (which is how wvgain stores ReplayGain values). Additionally, because APEv2 tags are stored at the end of the file, this code is only implemented for regular files and not HTTP streams. Using HTTP seeking it *may* be possible to implement it for both. git-svn-id: https://svn.musicpd.org/mpd/trunk@6656 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Updating Kodest's name/email.J. Alexander Treuman2007-06-251-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6654 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Adding WavPack support. Patch courtesy Kodest.J. Alexander Treuman2007-06-241-0/+422
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6651 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Adding very experimental streaming support for mp4.J. Alexander Treuman2007-06-041-16/+10
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6483 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Add MIME types for the aac and mp4 input plugins. Note that these won'tJ. Alexander Treuman2007-06-042-6/+8
| | | | | | have any effect until the aac and mp4 input plugins actually support a stream decoding API. git-svn-id: https://svn.musicpd.org/mpd/trunk@6481 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Making some bool options more consistent.J. Alexander Treuman2007-06-031-5/+7
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6468 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Just specify mimeType as NULL in mpc's InputPlugin struct.J. Alexander Treuman2007-05-221-2/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6225 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Cleaning up some comments.J. Alexander Treuman2007-04-093-3/+3
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5894 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* The massive copyright updateAvuton Olrich2007-04-0513-13/+13
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Set totalTime to 0 for MODs. If this isn't done, the totalTime of theJ. Alexander Treuman2007-03-311-0/+1
| | | | | previous song played will be reused. git-svn-id: https://svn.musicpd.org/mpd/trunk@5791 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Disable looping MOD files played with libmikmod. Many MODs will loopJ. Alexander Treuman2007-03-311-0/+3
| | | | | forever without this. git-svn-id: https://svn.musicpd.org/mpd/trunk@5790 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Support for libmikmod 3.2.0 betas.J. Alexander Treuman2007-03-021-2/+7
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5492 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* flac: workaround for type inconsistency between new/old read callbackEric Wong2007-01-142-1/+3
| | | | | | size_t (1.1.3) makes a lot more sense, but older flac used unsigned here... git-svn-id: https://svn.musicpd.org/mpd/trunk@5258 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Don't initialize globals to zero (or NULL)Eric Wong2007-01-149-110/+11
| | | | | | | | 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
* flac/ogg/oggflac: keep old mime-types in addition to the new onesEric Wong2007-01-143-4/+15
| | | | | | We'll be dealing with legacy server configurations for a long time to come. git-svn-id: https://svn.musicpd.org/mpd/trunk@5253 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* mp3: sparse: fix warnings reported with -WshadowEric Wong2007-01-141-8/+7
| | | | | | sendDataToOutputBuffer returns an int (and always has), and using the existing 'ret' is fine in mp3Read(). git-svn-id: https://svn.musicpd.org/mpd/trunk@5246 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* flac: sparse: mismatched enum type for seekEric Wong2007-01-141-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5244 09075e82-0dd4-0310-85a5-a0d7c8717e4f