Commit Graph

4555 Commits

Author SHA1 Message Date
Max Kellermann 442d2e74e3 decoder/mad: fix buffer variable name on !HAVE_ID3TAG 2010-05-30 17:27:03 +02:00
Daniel Seuthe e8310211e2 filter/replay_gain: added option "replaygain_limit" 2010-05-30 17:06:08 +02:00
Avuton Olrich 894573657d cmdline: Add default config paths for win32. 2010-05-20 06:56:43 -07:00
Max Kellermann 9cce1d749a output/win32: new output plugin for Windows Wave 2010-05-20 09:33:05 +02:00
Max Kellermann ed0b48040c pcm_buffer: 8 kB alignment instead of 64 kB
Reduce the overhead.  Most buffers used by MPD are around 2 to 4 kB.
8 kB seems large enough to keep heap fragmentation low.

Additionally, this patch fixes an off-by-one error in the alignment
formula.
2010-05-20 09:31:51 +02:00
Max Kellermann eda46bc07f tag_{id3,ape}: explicitly open files in binary mode
Add the flag "b" to fopen().  Windows compatibility.
2010-05-20 09:14:11 +02:00
Max Kellermann c727e86980 input/file, output/{fifo,recorder}: add O_BINARY to open() flags
Windows compatibility.
2010-05-20 09:13:39 +02:00
Max Kellermann 57b4013306 client: use sprintf() on WIN32
On mingw32, snprintf() expects a 64 bit integer instead of a "long
int" for "%li" - this is not consistent with our expectation, so we're
using plain sprintf().
2010-05-19 13:12:37 +02:00
Max Kellermann 8248f498b2 event_pipe: use g_io_channel_read_chars() to drain the pipe
For some unknown reason, read() blocks on WIN32, even though it was
invoked inside the G_IO_IN callback.  By switching to GIOChannel
functions, this problem is solved, and it works on both Linux and
Windows.
2010-05-19 11:37:39 +02:00
Max Kellermann 22f3ffb099 event_pipe: call g_io_channel_win32_new_fd()
On WIN32, use g_io_channel_win32_new_fd() instead of
g_io_channel_unix_new().  There doesn't seem to be a practical
difference, but it seems more correct.
2010-05-19 11:37:22 +02:00
Max Kellermann 81bd8ef73c update_walk: don't check recursive symlinks on WIN32
inode numbers don't work on WIN32, and very few WIN32 users actually
use symlinks - seems ok to disable that check.
2010-05-19 11:36:07 +02:00
Max Kellermann bedc172eab crossfade: emulate strtok_r() on WIN32 with a function
Not a CPP macro.  This adds the "unused" attribute to "saveptr", which
eliminates one gcc warning.
2010-05-18 23:56:53 +02:00
Max Kellermann 0a9b0dd070 command: fallback strftime() formats on WIN32
On WIN32, "%F" and "%T" are not implemented.
2010-05-18 23:54:12 +02:00
Max Kellermann 6aa0f61e15 socket_util: fix setsockopt() argument type on WIN32
In the winsock headers, the setsockopt() argument is declared as
"const char *", not "const void *".
2010-05-18 23:13:05 +02:00
Max Kellermann 4461c3d5d1 daemon: include glib.h on WIN32 for g_error() 2010-05-18 23:13:05 +02:00
Max Kellermann fef46bcf49 fd_util: fd_set_cloexec() returns a value on WIN32
This function is empty on WIN32, but we need to return a value.
2010-05-18 23:09:07 +02:00
Max Kellermann fa2ff849c5 input/ffmpeg: new input plugin using libavformat's "avio" library 2010-05-18 21:20:31 +02:00
Max Kellermann 6b2b91ff01 input/mms: removed empty method buffer()
input_stream_buffer() has a check for "buffer==NULL", so we don't need
an explicit empty implementation.
2010-05-18 21:20:31 +02:00
Max Kellermann 28736414a8 input/mms: initialize the "eof" attribute 2010-05-18 21:11:00 +02:00
Max Kellermann e98bd55cbf input/mms: fix memory leak in error handler 2010-05-18 20:57:57 +02:00
Daniel Seuthe 733962db2f decoder_api: return effective replay gain
Pay attention to the ReplayGain mode "auto" and the
replay_gain_missing_preamp parameter inside of decoder_replay_gain().
2010-05-18 20:39:32 +02:00
Daniel Seuthe f824ecdfa1 replay_gain_config: added function replay_gain_get_real_mode() 2010-05-18 20:30:03 +02:00
Max Kellermann 6c831e04a2 output/oss: 24 bit support via OSS4
Added #ifdefs on the macros AFMT_S24_NE and other OSS4 extensions.
2010-05-14 09:48:02 +02:00
Max Kellermann 67c48f66a6 output/oss: rewrite of the audio format detection
Removed the "supported" / "unsupported" arrays, and auto-detect on
every open() call, just like the ALSA output plugin.
2010-05-13 14:42:09 +02:00
Max Kellermann 5fa1c703de output/oss: use the *_NE macros
Removed the macro AFMT_S16_MPD.
2010-05-13 14:34:22 +02:00
Avuton Olrich bead892e21 AudioCompress: include stdint.h for int16_t definition.
In mingw32, int16_t is not defined by sys/types.h, but it is by stdint.h,
and it is in the int16_t man page as being defined in stdint.h. Thanks to
mithi for help debugging.
2010-05-11 18:48:22 -07:00
Avuton Olrich 8341daca4a client_new: Send greeting using send() rather than write().
This is portable for win32 and fixes client logins there.
2010-05-08 16:48:01 -07:00
Tim Phipps 136759a298 mixramp: Remove maths from pcm_mix when using MixRamp overlaps. 2010-05-08 09:28:06 +02:00
Tim Phipps 0ac5b6e613 mixramp: Adjust MixRamp threshold to account for ReplayGain. 2010-05-08 00:19:44 -07:00
Avuton Olrich eb5208c4f9 log: /dev/null doesn't exist on win32. 2010-05-08 00:17:34 -07:00
Max Kellermann d88c3c8462 output_thread: call replay gain filter manually
Don't add it to the filter chain, because we need to apply replay gain
before cross-fading with the next song.  Add a second replay_gain
filter which is used for the song being faded in (chunk->other).
2010-05-02 18:21:16 +02:00
Max Kellermann 5399a72ec1 player_thread: move cross-fading to output thread
Remove cross_fade_apply(), and call pcm_mix() in the output thread,
mixing the chunk and chunk->other together.
2010-05-02 17:46:07 +02:00
Max Kellermann d093fb2441 chunk: added attribute "other"
Preparation for cross-fading support in the output thread.
2010-05-02 17:46:06 +02:00
Max Kellermann 0140804ef9 output_thread: moved code to ao_filter_open(), ao_filter_close() 2010-05-02 17:38:16 +02:00
Max Kellermann ecb5f68ba8 output_thread: moved filter invocation to ao_filter_chunk() 2010-05-02 17:34:35 +02:00
Max Kellermann 55bf242635 filter/replay_gain: removed duplicate *dest_size_r assignment 2010-05-02 17:34:27 +02:00
Daniel Seuthe 92e66e5ab2 replay_gain: added mode "auto" 2010-04-25 13:51:58 +02:00
Max Kellermann cf3ada3d04 Merge branch 'master' of git://github.com/mcfiredrill/mpd 2010-04-20 21:16:39 +02:00
Max Kellermann 8d631b346a inotify_update: start update when directory is created
This is useful at the maximum depth level, to update newly created
directories.  It is however questionable if the hard-coded 5 seconds
delay is enough to create new directory trees with all of their files,
but we might make that delay configurable in the future.
2010-04-13 23:37:44 +02:00
Max Kellermann 393bcd961a inotify: added setting "auto_update_depth"
Limits the depth of the watched directories.  This is useful to keep
resource usage down and speed up MPD startup.
2010-04-13 21:31:57 +02:00
Max Kellermann 4d1eedbaa2 conf: added function config_get_unsigned() 2010-04-13 21:19:07 +02:00
Max Kellermann a1a03deed2 decoder/mad: properly calculate ID3 size without libid3tag
Without libid3tag, we were trying to skip the ID3 frame (since
0.15.2).  Its length however was not calculated at all, we were just
dropping everything from the current input buffer.  This lead to the
first few seconds of the file being skipped.  This patch attempts to
calculate the ID3v2 frame size with the formula from:

 http://www.id3.org/id3v2.4.0-structure 3.1 and 6.2
2010-04-13 08:51:29 +02:00
Charles Kerr 6a95898038 decoder/ffmpeg: fix crash on startup in mpd_ffmpeg_log_callback()
What's happening is the `ptr' argument to that function is NULL for me
every time. `ptr' is unconditionally dereferenced to generate a log
message, and this is where mpd crashes.

Attached is a simple patch that tests for NULL and omits the log. With
this patch the crash disappeared and mpd went back to working well.
2010-04-11 19:18:30 +02:00
Tony Miller 9d55b16998 Decoder for game music emulation library.
Supports a number of videogame music formats, more info here:
http://www.fly.net/~ant/libs/audio.html

I wrote this plugin for the latest svn, get it here:
http://code.google.com/p/game-music-emu/source/checkout
2010-04-10 01:05:16 -07:00
James Pike c52f469c9c output/httpd: added name/genre/website configuration 2010-04-05 13:11:10 +02:00
Orivej Desh 50c0c4b701 cue: fix code style 2010-04-01 08:12:25 +02:00
Max Kellermann 8446b70ddc decoder/ffmpeg: print item name in log callback 2010-03-28 19:48:57 +02:00
Orivej Desh 635791d1cd cue: prepend pregap to the beginning of the track
.. rather then append to the end of the previous one

Cuebreakpoints from the cuetools package has three modes of operation,
and the default is to append pregap (INDEX 00) to the end of the
previous track. This is the behavior most compliant to the existing
cue files.

Here is the patch which fixes the issue. I borrowed bits of
implementation from cuebreakpoints. I assumed that the whole audio
file must be covered by head-to-head going tracks, which is how
hardware CD players probably work. In cue_tag I changed rounding from
rounding up to rounding down because the thing in mpd which calculates
actual track duration (and current position) rounds it down, and I
didn't want to see in my playlist values different from whose in a
now-playing progress bar.

I've compared the resultant mpd behaviour with "mplayer -ss MM:SS.MS"
where the time was supplied by cuebreakpoints and noticed that mplayer
started each track a bit earlier then mpd, though this was the same
before the patch.
2010-03-28 19:34:16 +02:00
Max Kellermann e9beea072d Merge release 0.15.9 from branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
	src/cue/cue_tag.c
	src/decoder/mpcdec_decoder_plugin.c
	src/player_thread.c
2010-03-28 19:31:47 +02:00
Avuton Olrich 06f86b4532 Add support for building httpd_output plugin for win32 2010-03-22 07:15:39 -07:00
Avuton Olrich 68ece2fef3 Define winnt or greater on mingw32 to take advantage of get*info(). 2010-03-21 18:45:32 -07:00
Avuton Olrich 4953ea90c2 strtok() is recursive by default on win32. 2010-03-21 18:24:24 -07:00
Tim Phipps e7a515c8b1 Add support for MixRamp tags
Adds mixrampdb and mixrampdelay commands.  Reads MIXRAP_START and
MIXRAMP_END tags from FLAC files and overlaps instead of crossfading.
2010-03-21 18:21:47 +01:00
Aleksei Kaveshnikov 73ba4ea3da decoder/mpcdec: fix replay gain formula with v8
"When playing musepack files with mpd v0.15.8, rg seems to have no effect.

Using sample file below, mpd says 'computing ReplayGain album scale with gain 122.879997, peak 0.549150'.

One thing though, if I build mpd against old libmpcdec-1.2.6, rg works
as expected: 'computing ReplayGain album scale with gain 16.820000,
peak 0.099765'"
2010-03-19 10:26:08 +01:00
Max Kellermann cbfaa4a266 player_thread: postpone song tags during cross-fade
Previously, tags of the new song being cross-faded in were sent
immediately.  That can cause wrong information being displayed,
because the "previous" song might send its tag at the end again,
overriding the "next" song's tag.  This patch saves & merges the tag
of the next song, and sends it when cross-fading is finished, and the
next song really starts.
2010-03-17 23:14:54 +01:00
Max Kellermann 2e72a9b262 tag: added function tag_merge_replace()
Like tag_merge(), but can deal with NULL parameters, and frees both
tag objects.
2010-03-17 23:12:21 +01:00
Max Kellermann e9b75d462c AudioCompress: explicitly include stdint.h
For int16_t.
2010-03-17 18:29:56 +01:00
Max Kellermann 68017b1254 decoder_api: use the correct format to calculate elapsed time
When decoder->timestamp is calculated, the PCM data is already
converted to out_audio_format; using in_audio_format may cause funny
speedups/slowdowns.
2010-03-17 18:26:36 +01:00
Piotr Gozdur 96033e4b4e decoder/mpcdec: fix negative shift on fixed-point samples
"There is a bug in fixed-point musepack (musepack_src_r435) playback.
In floating-point audio is OK but in fixed audio is distorted.  I have
made a patch for this"
2010-03-17 17:54:21 +01:00
Max Kellermann 469c9b5def command: allow "update" with slash or empty path
When handle_update() was modified to use uri_safe_local(), suddently
"mpc update ''" and "mpc update '/'" stopped working, because both are
not a "safe" local URI.  This patch adds a special case for these, to
retain backwards compatibility.
2010-03-12 17:58:16 +01:00
Max Kellermann e686d19154 output: added option "always_on" for radio stations
Did you ever accidently click "stop" while feeding a radio station?
This option sets the output device to "pause" to disable the "close"
method.  It falls back to "pause" then, which is specific to the
plugin.  Some plugins implement it by feeding silence.
2010-03-10 19:49:31 +01:00
Max Kellermann 762565e9d1 output/jack: drain the ring buffers during pause
If we're not doing this, and a new song is played after pause ends,
then you will hear the rest of the previous song.
2010-03-10 19:48:49 +01:00
Max Kellermann 41a4662c8c output/jack: synchronize all channels
Always use the same number of samples from each channel's ring
buffer.  This ensures that all channels are kept in sync.
2010-03-10 19:48:34 +01:00
Max Kellermann 5842015b90 decoder/ffmpeg: fix indentation 2010-03-07 19:20:34 +01:00
Max Kellermann 9134169e37 playlist: fix single+repeat in random mode
With single+repeat enabled, it is expected that MPD repeats the
current song over andd over.  With random mode also enabled, this
didn't work, because the song order was shuffled internally.  This
patch adds a special check for this case.
2010-03-07 18:58:44 +01:00
Max Kellermann ae56901863 decoder/ffmpeg: implement the libavutil log callback
Pass everything to the GLib logging library.  No direct stderr access.
2010-02-27 19:32:59 +01:00
Max Kellermann 4e364854ab decoder/ffmpeg: don't close the AVFormatContext after open failure
The pointer is invalid if av_open_input_file() fails.
2010-02-27 19:25:56 +01:00
Max Kellermann a3645984cd command: "update" checks if the path is malformed
This is a very basic check, which only ensures that the path does not
begin with a slash, doesn't have double slashes and the special names
"." and ".." are forbidden.
2010-02-27 19:01:17 +01:00
Max Kellermann 43cf4e97b9 uri: allow leading dots, but explicitly exclude "." and ".."
Dots at the beginning of an URI segment are ok, as long as the special
names "." and ".." are not used.
2010-02-27 18:56:47 +01:00
Max Kellermann 35c5a371ea decoder/mad: fix crash when seeking at end of song
Removed the decoder_command_finished() call at the end of
mp3_decode().  This is invalid, because decoder_command_finished() has
already been called in mp3_read().
2010-02-27 18:35:31 +01:00
Max Kellermann 795578ef95 update: log start/finish of the update thread 2010-02-27 16:41:54 +01:00
Max Kellermann 96493e0333 replay_gain: optionally use hardware mixer to apply replay gain
Add an option for each audio output which enables the use of the
hardware mixer, instead of the software volume code.

This is hardware specific, and assumes linear volume control.  This is
not the case for hardware mixers which were tested, making this patch
somewhat useless, but we will use it to experiment with the settings,
to find a good solution.
2010-02-17 08:14:07 +01:00
Max Kellermann 48b49e2303 replay_gain: fall back to track gain if album gain is unavailable 2010-02-17 08:13:34 +01:00
Max Kellermann 752dfb3d95 replay_gain: reimplement as a filter plugin
Apply the replay gain in the output thread.  This means a new setting
will be active instantly, without going through the whole music pipe.
And we might have different replay gain settings for each audio output
device.
2010-02-17 07:23:13 +01:00
Max Kellermann 5e0117b444 replay_gain_info: allocate the struct statically
Don't allocate each replay_gain_info object on the heap.  Those
objects who held a pointer now store a full replay_gain_info object.
This reduces the number of allocations and heap fragmentation.
2010-02-17 07:22:44 +01:00
Max Kellermann c05e6a1275 replay_gain_info: use INFINITY to mark undefined values
The previous patch not only moved code, it also changed the check.
Negative gain values seem to be valid after all, there just was the
"magic" value 0.0 which means "not available".  This patch changes the
"magic" value to "INFINITY", and uses the C99 function isinf() to
check.  It might have been a better idea to use "NAN", but the "NAN"
macro is a GNU extension.
2010-02-17 07:07:00 +01:00
Max Kellermann b21e4d9a58 replay_gain_state: moved code to replay_gain_tuple_scale()
Moved (and renamed) the function calc_replay_gain_scale() to
replay_gain_info.c.
2010-02-15 21:23:24 +01:00
Max Kellermann eeef501ed8 replay_gain: added function defined()
This function determines whether replay gain data is available.
2010-02-15 19:09:24 +01:00
Max Kellermann f4e9275f7c filter/volume: assign dest_size_r early, eliminate one 2010-02-15 19:09:09 +01:00
Max Kellermann 059d1dc7f2 command: "listplaylist" dumps playlist files
Same for "listplaylistinfo".
2010-02-08 11:11:43 +01:00
Max Kellermann 7fbb856eee playlist_queue: moved code to playlist_mapper.c 2010-02-08 10:56:28 +01:00
Max Kellermann bb2aa70ec6 playlist_queue: moved check_translate_song() to playlist_song.c 2010-02-08 10:28:12 +01:00
Max Kellermann 8e34c59c82 song_print: song_print() returns void
The only "return" statement always returns 0.
2010-02-08 10:21:15 +01:00
Anton Khirnov 766b9fd453 ffmpeg: read more metadata. 2010-02-02 17:55:58 +01:00
Tim Phipps 891dab7b91 decoder/flac: fix replay gain (short-circuiting "or") 2010-01-28 20:54:04 +01:00
Davide Camurri 7a62818ffd client: optionally use libwrap 2010-01-20 21:04:07 +01:00
Max Kellermann acb0ff1ea8 decoder/wavpack: fixed WVC URI
Pass the current URI to wavpack_open_wvc().
2010-01-20 12:08:44 +01:00
Max Kellermann 2acad9fe1e decoder/ffmpeg: call decoder_timestamp() once per packet 2010-01-18 13:11:04 +01:00
Max Kellermann 8914ebc964 decoder/ffmpeg: merged ffmpeg_helper() into ffmpeg_decode() 2010-01-18 11:06:09 +01:00
Max Kellermann 5477c31160 decoder/ffmpeg: optimized the stream_tag() method
Don't use the function ffmpeg_helper(), don't initialize the codec.
2010-01-18 11:06:04 +01:00
Max Kellermann acd3f8cd91 decoder/ffmpeg: free AVFormatContext on error
Fix a memory leak in some code paths.
2010-01-18 11:05:15 +01:00
Max Kellermann ca1fc13116 decoder_api: removed function decoder_get_uri()
Use input_stream.uri.
2010-01-18 10:21:57 +01:00
Max Kellermann 9cb7760c5e input_stream: added attribute "uri" 2010-01-18 10:18:41 +01:00
Max Kellermann fb9bd53328 input_stream: added function input_stream_deinit()
All close() implementations must call this method.
2010-01-18 09:57:53 +01:00
Max Kellermann a0a26d3341 Merge release 0.15.8 from branch 'v0.15.x
Conflicts:
	Makefile.am
	NEWS
	configure.ac
	src/decoder/ffmpeg_decoder_plugin.c
	src/decoder_thread.c
2010-01-18 07:52:58 +01:00
Max Kellermann 9d4b7ab113 decoder_thread: don't fall back to "mad" unless no plugin matches
When all plugins have failed, MPD used to fall back to the "mad"
decoder plugin, to handle those radio streams without a Content-Type
response header.  This however leads to unexpected results (garbage
being played) when the stream isn't really mp3.  Since we care little
about "bad" streams, we shouldn't have hacks which have bad side
effects.

Let's get rid of this hack now!  Only try to "mad" plugin if there was
no match at all (Content-Type, path suffix) and no other plugin has
been tried.
2010-01-17 17:09:10 +01:00
Max Kellermann 8ac776c58b decoder_thread: don't try a plugin twice (MIME type & suffix)
Manage a linked list of plugins which were already tried.
2010-01-17 16:47:04 +01:00
Max Kellermann 2579a2f924 decoder/ffmpeg: added more MIME types
Taken from the ffmpeg sources.
2010-01-17 16:00:14 +01:00
Max Kellermann 006f4be71c fd_util: include ws2tcpip.h for socklen_t 2010-01-17 14:48:52 +01:00
Max Kellermann 163e05f5a0 fd_util: fixed WIN32 versions of pipe()
Use the correct parameter name.
2010-01-17 14:43:15 +01:00
Max Kellermann 02526eda86 text_file: don't strip trailing whitespace
Only delete the newline characters (\n and optionally \r).  This
allows the database file to store file names with trailing whitespace.
2010-01-17 12:52:11 +01:00
Max Kellermann 828a5f552f output/pulse: clear the "mainloop" attribute on error
When enabling the pulse device fails, clear po->mainloop after
pa_threaded_mainloop_free() has finished.  This is important for the
assertions.

Two wrong g_free() calls were also removed.
2010-01-17 12:03:22 +01:00
Max Kellermann 1b441837f1 decoder/ffmpeg: append file name suffix to virtual stream URL
To allow libavformat to detect the format of the input file, append
the suffix of the input file to the URL of the virtual stream.  This
specifically enables the "shorten" codec, which is supported by
libavformat/raw.c, detected only by the suffix.
2010-01-17 02:36:07 +01:00
Max Kellermann 26841b6058 output/alsa: support packed 24 bit samples 2010-01-17 00:43:24 +01:00
Max Kellermann 1abfcc56af audio_format: support packed 24 bit samples 2010-01-16 23:44:54 +01:00
Max Kellermann da47afe7d1 output/alsa: probe all sample formats in a loop
More code simplification.  Probe all formats, no matter which input
format.
2010-01-16 23:44:52 +01:00
Max Kellermann 96546c1a8a output/alsa: merged code into alsa_output_try_format()
Remove the debug log messages, because they are duplicate (see
ao_open() in output_thread.c).
2010-01-16 23:44:50 +01:00
Max Kellermann 579a8a96ea output/alsa: pass sample_format to get_bitformat() 2010-01-16 23:44:48 +01:00
Max Kellermann 79848e3414 output/alsa: moved code to alsa_output_setup_format() 2010-01-16 23:44:42 +01:00
Max Kellermann 8ba08edd0e queue: don't repeat current song in consume mode
Check consume mode in queue_next_order(), because the current song
would be deleted as soon as it's finished; it cannot be played again.
2010-01-16 20:58:24 +01:00
Max Kellermann 90d16af66a decoder_thread: fix CUE track playback
The patch "input/file: don't fall back to parent directory" introduced
a regression: when trying to play a CUE track, decoder_run_song()
tries to open the file as a stream first, but this fails, because the
path is virtual.

This patch fixes decoder_run_song() (instead of reverting the previous
patch) to accept input_stream_open() failures if the song is a local
file.  It passes the responsibility to handle non-existing files to
the decoder's file_decode() method.
2010-01-16 19:20:11 +01:00
Max Kellermann a942384fbf decoder/flac: support streams without STREAMINFO block 2010-01-06 10:17:16 +01:00
Max Kellermann de0cdee4aa decoder/flac: pass bits_per_sample to flac_sample_format()
Easier to reuse the function.
2010-01-06 09:55:20 +01:00
Max Kellermann 550c9319e9 decoder/flac: moved decoder initialization to _flac_common.c
Invoke decoder_initialized() in the libFLAC metadata callback.  This
merges code from the FLAC and the OggFLAC decoder plugin into the
common library.
2010-01-06 09:50:34 +01:00
Max Kellermann ae9c02b3a8 decoder/flac: remember audio_format, not stream_info 2010-01-06 09:00:32 +01:00
Max Kellermann 6f6d47dd20 decoder/flac: removed CUE sheet support
This feature has been moved to the "flac" playlist plugin.
2010-01-06 08:52:35 +01:00
Max Kellermann 030e61115c playlist: added a FLAC playlist plugin
This playlist plugin handles FLAC files with embedded CUE sheets.
2010-01-06 08:50:52 +01:00
Max Kellermann d6d5caae23 decoder/flac: moved flac_tag_load() to flac_metadata.c
Make this code is reusable.
2010-01-06 08:50:35 +01:00
Max Kellermann 382691179f tag: fixed memmove() size argument in tag_delete_item()
This function has always been broken, but fortunately nobody used it.
2010-01-06 08:48:23 +01:00
Max Kellermann 01c5cb985c playlist_queue: convert absolute paths
Accept absolute paths if they point into the music directory.
2010-01-06 08:00:35 +01:00
Max Kellermann 8a5d2c3c83 playlist_queue: use the "uri" variable earlier
Preparation for the next patch.
2010-01-06 08:00:02 +01:00
Max Kellermann 2f8135ef8b input/rewind: enable the "rewind" wrapper for all non-seekable streams
Don't limit the "rewind" input plugin to CURL streams.
2010-01-04 21:45:32 +01:00
Max Kellermann 9b9abff972 renamed decoder plugin sources
Make it X_decoder_plugin.c.
2010-01-04 21:45:32 +01:00
Max Kellermann c69cc31de0 decoder/mad: fix build error without libid3tag 2010-01-04 21:45:32 +01:00
Max Kellermann 241e94936f replay_gain: moved code to replay_gain_config.c 2010-01-04 21:02:47 +01:00
Max Kellermann 1330274ffc replay_gain: moved code to replay_gain_info.c 2010-01-04 21:02:36 +01:00
Max Kellermann 0e183d3fa1 replay_gain: refactor API, move code to replay_gain_state.c
The replay_gain_state struct holds the precalculated scale factor,
which is removed from struct replay_gain_info.
2010-01-04 20:54:01 +01:00
Max Kellermann cd8f92c928 decoder_api: added function decoder_replay_gain()
This function replaces the replay_gain_info parameter for
decoder_data().  This allows the decoder to announce replay gain
changes, instead of having to pass the same object over and over.
2010-01-04 20:42:49 +01:00
Max Kellermann e58b4f773f replay_gain: added function replay_gain_info_dup() 2010-01-04 20:42:49 +01:00
Max Kellermann 537e353546 replay_gain: removed overly verbose debug message
Don't log "ReplayGain is missing".
2010-01-02 23:46:44 +01:00
Max Kellermann 915182bcb8 output_all: reset elapsed_time at song border
Another quirk fixed: after the last chunk of a song has been played,
the "elapsed_time" variable is set to the chunk's time stamp.  When
the client receives the PLAYER idle event and asks MPD for the current
time stamp, MPD will return the last time stamp of the previous song
when it hasn't played the first chunk of the current song yet.
2010-01-02 21:16:51 +01:00
Max Kellermann 959f94b06c dbUtils: return empty tag value only if no value was found
This fixes a regression in the patch "return multiple tag values per
song": even when the song has values for the specified tag type, the
empty string gets added to the set, because the "return" was removed.
This patch adds a flag which remembers whether at least one value was
found.
2010-01-02 19:24:31 +01:00
Max Kellermann d3b763a48c input_stream: return allocated input_stream objects
Major API redesign: don't let the caller allocate the input_stream
object.  Let each input plugin allocate its own (derived/extended)
input_stream pointer.  The "data" attribute can now be removed, and
all input plugins simply cast the input_stream pointer to their own
structure (with an "struct input_stream base" as the first attribute).
2010-01-01 17:25:07 +01:00
Avuton Olrich 9d3865cb95 Update copyright notices. 2009-12-31 20:58:43 -08:00
Max Kellermann 05cde5810a decoder: switch a bunch of plugins to stream_tag()
This patch changes the following decoder plugins to implement
stream_tag() instead of tag_dup():

 faad, ffmpeg, mad, modplug, mp4ff, mpcdec, oggflac

This simplifies their code, because they do not need to take care of
opening/closing the stream.
2009-12-31 18:32:09 +01:00
Max Kellermann 6b96f5d566 decoder_plugin: added method stream_tag()
This is like tag_dup(), but works with an input_stream object instead
of a file path.
2009-12-31 18:27:48 +01:00
Max Kellermann 7a2e07e124 song_update: use decoder_plugin_tag_dup()
Minor code simplification.
2009-12-31 18:27:40 +01:00
Max Kellermann aad05fd138 archive: use reference counting for archive+input
Make the input_stream implementation hold a reference on the
archive_file object.  Allow the caller to "close" the archive_file
object immediately, no matter if the open_stream() method has
succeeded or not.
2009-12-31 18:27:35 +01:00
Max Kellermann 032c5376ad refcount: library for reference counting 2009-12-31 16:26:39 +01:00
Max Kellermann 0cc3b98bd9 input/archive: don't initialize input_stream.ready
The archive plugin should decide this.
2009-12-31 16:26:34 +01:00
Max Kellermann c157711eaf archive/bz2: allocate buffer statically
Reduce the number of malloc()/free() calls.
2009-12-31 16:26:14 +01:00
Max Kellermann 2632794578 archive/bz2: added struct bz2_input_stream
Don't use the bz2_archive_file object for the input_stream.
2009-12-31 16:25:21 +01:00
Max Kellermann 3ddf7b620c archive/iso9660: added struct iso9660_input_stream
Don't use the iso9660_archive_file object for the input_stream.
2009-12-31 16:13:09 +01:00
Max Kellermann 131cb0598a archive/iso9660: set input_stream.{size,offset} 2009-12-31 16:13:09 +01:00
Max Kellermann 9862521aec archive/zzip: added struct zzip_input_stream
Don't use the zzip_archive object for the input_stream.
2009-12-31 16:00:12 +01:00
Max Kellermann 55fbb67cfb archive/zzip: set input_stream.{size,offset} 2009-12-31 15:59:43 +01:00
Max Kellermann efc885a9dc Merge vorbis+icy fixes from branch 'v0.15.x'
Conflicts:
	Makefile.am
	NEWS
	configure.ac
	src/input/curl_input_plugin.c
	src/input_stream.c
2009-12-30 23:24:11 +01:00
Max Kellermann 4419e5b90d input/curl: removed the built-in rewinding code
This has been reimplemented in the "rewind" input plugin.
2009-12-30 22:52:24 +01:00
Max Kellermann c88f95a2ea input/rewind: new input_stream wrapper to allow stream rewinding
This replaces the rewinding buffer code from the CURL input plugin.
It is more generic, and allows rewinding even when the server sends
Icy-Metadata (which would have been too difficult to implement within
the CURL plugin).

This is a rather complex patch for the stable branch (v0.15.x), but it
fixes a serious problem: the "vorbis" decoder plugin was unable to
play streams with Icy-Metadata, because it couldn't rewind the stream
after detecting the codec (Vorbis vs. FLAC).
2009-12-29 23:55:40 +01:00
Max Kellermann c7d099c757 decoder/{ffmpeg,flac,vorbis}: added more flac/vorbis MIME types
Support deprecated MIME types such as "audio/x-ogg".  Support new
types such as "audio/flac".
2009-12-29 22:33:46 +01:00
Max Kellermann 333e11d0eb Merged release 0.15.7 from branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
	src/decoder_api.c
2009-12-27 20:10:45 +01:00
Max Kellermann 58da24b1cb playlist_list: wait for the input stream to become ready
Without this, seeking may cause MPD to crash.
2009-12-27 16:53:47 +01:00
Max Kellermann d66c055fec dbUtils: return multiple tag values per song
When collecting tag values for the result set, add all of a song's tag
values of the searched type.  This affects the "list" command.
Previously, "list" only considered the first tag value of a song.
2009-12-27 16:49:04 +01:00
Max Kellermann bb4cef6a93 playlist/cue: fill song.start_ms, .end_ms
This patch adds practical usefulness to the CUE playlist plugin.
2009-12-27 16:08:53 +01:00
Max Kellermann 5787f73704 decoder, player: support song ranges
Seek the decoder to the start of the range before beginning with
playback.  Stop the decoder when the end of the range has been
reached.  Add the start position to the seek position.  Expose the
duration of the range, not the full song file.
2009-12-27 16:08:53 +01:00
Max Kellermann 201316cd67 playlist_queue: resolve relative URIs, database lookup
Prepend the playlist's base URI to relative song URIs.  Look up songs
in the database (if the URI refers to a local song file).  Merge
existing database metadata with metadata from the playlist plugin.
2009-12-27 16:08:53 +01:00
Max Kellermann a038bca745 song: added support for selecting a time range
Added attributes start_ms, end_ms.  This allows us to address a
portion of a song file (important for CUE support).  There is no
support yet for storing these attributes in the state file.
2009-12-27 14:46:04 +01:00
Max Kellermann cf38505d8f playlist_queue: load playlists from music directory
Try the playlist directory first, and if that file does not exist, try
the same relative path within the music directory.
2009-12-27 14:17:26 +01:00
Max Kellermann af964e8929 uri: added function uri_safe_local() 2009-12-27 14:17:25 +01:00
Max Kellermann 554b2b0ed9 playlist/cue: return the original song URI
The caller should be responsible for building the absolute URI.
2009-12-27 14:17:21 +01:00
Max Kellermann 627975e897 playlist_queue: pass const string to playlist_open_path_into_queue() 2009-12-27 14:17:13 +01:00
Max Kellermann 6622d69fda song: added function song_get_duration() 2009-12-26 13:56:35 +01:00
Max Kellermann 216dff98d2 playlist_queue: try open by URI first
If that fails, try opening the file as a stream.
2009-12-26 03:01:52 +01:00
Max Kellermann 032354e65c playlist_list: use uri_get_suffix() 2009-12-26 03:01:50 +01:00
Max Kellermann 115d26608b uri: check presence of slash in suffix
If there's a slash in the uri_get_suffix() return value, then it's
malformed.  Return NULL in this case.
2009-12-26 03:01:48 +01:00
Max Kellermann bad350bc18 decoder_api: added function decoder_timestamp()
Remove the data_time parameter from decoder_data().  This patch
eliminates the timestamp counting in most decoder plugins, because the
MPD core will do it automatically by default.
2009-12-26 03:01:43 +01:00
Max Kellermann 915d1d0738 decoder_thread: eliminate jitter after seek failure
Don't clear the music pipe when seeking has failed - check the
"seeking" flag instead of "command==SEEK".  Clear the "seeking" flag
in decoder_seek_error().
2009-12-26 02:58:30 +01:00
Max Kellermann 8a6d448aaf decoder/wavpack: allow fine-grained seeking
First multiply the floating point return value of
decoder_seek_where(), then cast to integer.
2009-12-26 02:58:30 +01:00
Max Kellermann 870436a592 output_init: use the normalize filter plugin
Use the plugin instead of the glue code in normalize.c.  This is used
wrapped inside a "autoconv" filter, to enable normalization for all
input file formats.
2009-12-25 17:51:08 +01:00
Max Kellermann 6a17233f78 filter: added the "autoconvert" filter plugin 2009-12-25 17:51:05 +01:00
Max Kellermann b54bde6f2b filter_plugin: allow open() to force an input format
Make the audio_format argument non-const.  Allow the open() method to
modify it, to indicate that it wants a different input audio format
than the one specified.  Check that condition in chain_filter_open(),
and fail.
2009-12-25 17:29:41 +01:00
Max Kellermann d2051c7f50 filter/volume: support 32 bit samples
The pcm_volume library supports 32 bit samples, there's no reason to
disallow it in the filter plugin.
2009-12-25 17:29:27 +01:00
Max Kellermann bd29f7e3c8 filter/route: check configured channel count in method init()
Detect misconfiguration during MPD startup, not when playback begins.
2009-12-25 16:39:47 +01:00
Max Kellermann c3bb81abec filter/route: route_filter_parse() returns bool
Indicate success and error.
2009-12-25 16:39:45 +01:00
Max Kellermann d469c8137f filter_registry: removed the "chain" plugin from filter_plugins
This plugin cannot be configured.
2009-12-25 16:39:41 +01:00
Max Kellermann c374a7d3f4 filter/chain: return NULL if a filter() method has failed
Don't close child filters in the filter() method.
2009-12-25 16:28:17 +01:00
Max Kellermann 3679d5bd7a playlist: added CUE playlist plugin
This plugin is the groundwork for MPD's future generic CUE sheet
support.  That's not complete yet, e.g. there is no way for a playlist
plugin to address an arbitrary position within a music file.
2009-12-16 22:19:01 +01:00
Max Kellermann c128f2dd7e playlist_list: support URI suffix match
When no plugin matches the URI scheme, try the file name suffix.
2009-12-16 22:17:16 +01:00
Max Kellermann 843717d25c playlist_list: check if open method is present
Use open_uri() / open_stream() only after checking that they are
implemented.
2009-12-16 22:16:47 +01:00
Max Kellermann 50ea6a4b5c cue_tag: added song duration support
Get duration from track_get_length().
2009-12-16 22:15:27 +01:00
Max Kellermann 5649f22322 cue_tag: check cd_get_track()!=NULL 2009-12-16 20:55:19 +01:00
Max Kellermann b89281411f cue_tag: added function cue_tag()
Merge code from cue_tag_file() and cue_tag_string().
2009-12-16 20:49:03 +01:00
Max Kellermann 67c41033c1 cue_tag: merged code into cue_tag_merge() 2009-12-16 17:27:52 +01:00
Max Kellermann 59534b92d2 cue_tag: pass "const" string to cue_tag_string() 2009-12-16 17:26:20 +01:00
Max Kellermann 41a48b14e3 cue_tag: changed runtime checks to assertions
It's illegal to pass NULL here.  This should not be ignored silently.
2009-12-16 17:26:20 +01:00
Max Kellermann 5821bd1a21 cue_tag: fixed indent and code style 2009-12-16 17:18:56 +01:00
Max Kellermann c5cdac9609 cue_tag: tag_new() cannot fail
Removed the NULL check.
2009-12-16 17:18:23 +01:00
Max Kellermann b7f55ad392 cue_tag: include cleanup 2009-12-16 17:13:26 +01:00
Max Kellermann 71fee09744 archive_plugin: use GError in the open() method 2009-12-16 17:10:19 +01:00
Max Kellermann f9af1a445e input/archive: check for archive_file_open() errors
This fixes a NULL pointer dereference in case of archive plugin
failure.
2009-12-16 17:10:15 +01:00
Max Kellermann 0bc8c0c1da archive_plugin: wrap method calls
Make archive_file a "real" struct, extended by all plugins.  Add the
plugin pointer to it.  Wrap all method calls in functions.
2009-12-16 17:09:58 +01:00
Max Kellermann 74156d5bed archive_plugin: pass const string to method open() 2009-12-16 17:09:29 +01:00
Max Kellermann b04adde7ab archive: added a C header for each plugin
Moved the archive plugin "extern" declarations into each plugin
header.
2009-12-16 15:57:16 +01:00
Max Kellermann 3f64ac04b8 archive/bz2: removed the bz2_context typedef
Use the raw struct name instead.
2009-12-16 15:56:42 +01:00
Max Kellermann b009970af7 archive/bz2: renamed archive sources and plugin variables 2009-12-16 15:55:48 +01:00
Max Kellermann bd97586cc4 archive/iso: renamed plugin to "iso9660"
Based on libiso9660.
2009-12-16 15:55:37 +01:00
Max Kellermann c3e0fbd9e4 archive/bz2: use g_path_get_basename()
Use g_path_get_basename() instead of manually filtering the path
name.  Big advantage: g_path_get_basename() cannot fail.
2009-12-16 15:53:57 +01:00
Alam Arias b05ba0286e updated mp4ff decoder about input_stream_seek 2009-12-16 06:47:15 +01:00
Max Kellermann 228b03edf8 input_stream: return errors with GError 2009-12-15 23:12:11 +01:00
Max Kellermann d000d31355 encoder/flac: fix write callback prototype for libFLAC 1.1.2 2009-12-15 23:12:06 +01:00
Max Kellermann 3d95226f2b decoder_internal: decoder_input_buffer() returns bool
This fixes a regression: a boolean value was returned from
decoder_input_buffer(), but the caller chose to do a "<= 0"
comparison.
2009-12-15 22:24:00 +01:00
Max Kellermann b12072e6d9 input/archive: use g_path_is_absolute()
.. instead of manually checking pathname[0]=='/'.
g_path_is_absolute() is portable.
2009-12-15 21:26:16 +01:00
Max Kellermann 03427d4eff archive/bz2: simplified error handling, short read
Don't attempt to fill the whole buffer in the read() method, return
whatever libbz2 provides with the first successful BZ2_bzDecompress().
2009-12-15 21:09:13 +01:00
Max Kellermann a627a703ca archive/bz2: no CamelCase 2009-12-15 20:53:29 +01:00
Max Kellermann 440cfc8052 archive/zzip: removed the "zip_context" typedef
Use the raw struct name.
2009-12-15 20:49:38 +01:00
Max Kellermann c959148ed1 archive/zip: renamed plugin to "zzip"
This plugin is based on libzzip.
2009-12-15 20:29:44 +01:00
Max Kellermann 530e480748 Merge branch 'v0.15.x'
Conflicts:
	src/archive/bz2_plugin.c
	src/archive_api.h
	src/input/file_input_plugin.c
	test/run_input.c
2009-12-15 20:26:38 +01:00
Max Kellermann 9179f108a5 iso, zip: fixed memory leak in destructor
Free the "context" pointer in the method archive_plugin.close().
2009-12-15 19:57:00 +01:00
Max Kellermann 3411f6cffd archive: close archive when stream is closed
Fixes a memory leak: the "archive" input plugin opens the archive, but
never closes it.  This patch moves the responsibility for doing that
to archive_plugin.open_stream().  This is an slight internal API
change, but it is the simplest and least intrusive fix for the memory
leak.
2009-12-15 19:45:50 +01:00
Max Kellermann 6c0f50efb5 archive/bz2: removed NULL check before g_free()
g_free(NULL) is allowed.
2009-12-15 19:42:54 +01:00
Max Kellermann 2234d491b7 input/archive: close the archive file on error
Fixed memory leak in error handler.
2009-12-15 19:41:00 +01:00
Max Kellermann f01d7d230b input/file: don't fall back to parent directory
This code has never made any sense, and has broken some of the archive
plugin.
2009-12-15 19:16:28 +01:00
Max Kellermann 95c3f283ea input/file: don't fall back to parent directory
This code has never made any sense, and has broken some of the archive
plugin.
2009-12-15 19:03:11 +01:00
Max Kellermann aef6609f4f archive_api.h: moved struct archive_plugin to archive_plugin.h 2009-12-15 19:02:24 +01:00
Max Kellermann 6b728e4756 archive_list: don't include archive_api.h
Use struct forward declarations.
2009-12-15 19:02:17 +01:00
Max Kellermann f1ecd9eac8 archive_list: iterate with NULL check
Don't use num_archive_plugins.
2009-12-15 15:31:00 +01:00
Max Kellermann 243c96304b archive/bz2: bz2_fillbuffer() returns bool 2009-12-15 09:08:30 +01:00
Max Kellermann e3597e648c archive/bz2: fixed indentation 2009-12-15 09:00:34 +01:00
Max Kellermann 357037f7ab archive/bz2: g_malloc() cannot fail 2009-12-15 09:00:18 +01:00
Max Kellermann 51d0687377 fixed several gcc warnings on unused debug variables 2009-12-14 23:22:51 +01:00
Max Kellermann 849d7895dc decoder/mikmod: fixed gcc uninitialized warning
Removed local variable "sample_rate".
2009-12-14 23:20:14 +01:00
Max Kellermann 786c1f035f input_plugin: method init() returns errors with GError
Not used by any plugin currently, but this eliminates the g_error()
call in input_plugin_config(), so it's worth it.
2009-12-14 23:16:18 +01:00
Max Kellermann f70d2f58a1 input_stream: moved input_stream_global_init() to input_init.c 2009-12-14 22:53:13 +01:00
Max Kellermann 67b0ab717e input_stream: moved plugin list to input_registry.c 2009-12-14 22:49:46 +01:00
Max Kellermann f7420dbfe1 input_stream: make input_plugins NULL terminated
This is easier to traverse.
2009-12-14 22:43:00 +01:00
Max Kellermann 400600ffff filter: added normalize filter plugin
Wrap the AudioCompress library in a filter plugin.
2009-12-14 22:24:00 +01:00
Albin Eldstål-Damlin 940e66bb89 Fix and use filter_configured_new() 2009-12-14 22:23:05 +01:00
Albin Eldstål-Damlin 69391dadda Proper error reporting from filter_config 2009-12-14 22:18:28 +01:00
Albin Eldstål-Damlin ff3393ebf1 Fixed memory leak on incorrect route configuration 2009-12-14 22:18:28 +01:00
Albin Eldstål-Damlin 0ac0bd26e7 Split filter_config into its own module 2009-12-14 22:12:58 +01:00
Albin Eldstål-Damlin 8587fcbb93 Error reporting, pcm_buffer, performance tweaks 2009-12-14 20:41:09 +01:00
Albin Eldstål-Damlin a4fbf772c1 Initial filter chain and filter configuration for outputs. 2009-12-14 17:56:31 +01:00
Albin Eldstål-Damlin e28c5a0beb Initial (statically configured) route filter plugin 2009-12-14 17:41:28 +01:00
Albin Eldstål-Damlin c38b9490a8 Minor documentation fix 2009-12-14 17:41:10 +01:00
Max Kellermann c3085d7b61 Merge branch 'v0.15.x'
Conflicts:
	src/decoder/ffmpeg_plugin.c
2009-12-14 17:40:50 +01:00
Max Kellermann 8f7bc70bf5 decoder/wavpack: don't use the nonstandard "uchar" type
Use the signed C99 type int8_t instead.
2009-12-11 12:45:57 +01:00
Max Kellermann 5a354a1ed4 mixer: explicitly close all mixers on shutdown
Mixers with the "global" flag set aren't closed automatically when the
output device is closed.  Thus, they might still be open when MPD
shuts down.
2009-12-08 08:47:47 +01:00
Max Kellermann f4b707b4ca mapper: apply filesystem_charset to playlists
This fixes an inconsistency in the stored playlist subsystem: when
obtaining the list of playlists (listplaylist, listplaylistinfo), the
file names in the playlist directory are converted to UTF-8 (according
to filesystem_charset), but when saving or loading playlists, the
filesystem_charset setting was ignored.
2009-12-08 08:33:14 +01:00
Max Kellermann cd69fee0a4 command: verify playlist name in the "rm" command
Call spl_valid_name() in spl_delete().
2009-12-08 08:32:26 +01:00
Max Kellermann 23e46b38ca mapper: fix memory leak when playlist_directory is not set
Don't allocate the file name before the playlist_dir==NULL check.
2009-12-08 08:06:10 +01:00
Thomas Jansen 179502fe93 decoder_api: prefer stream_tag over decoder_tag
If both tags (stream and decoder) are present, we prefer the stream tag.
Fixes #2698, where ICY tag contained useful information, but was
overwritten with bogus decoder tag data.
2009-12-07 14:52:48 +01:00
Viliam Mateicka b6b377edd1 pcm_volume: change old code to use format instead of bits 2009-12-03 20:56:57 +01:00
Viliam Mateicka a76097210f encoders: remove unnessesary pointers to const strings 2009-12-03 20:43:13 +01:00
Viliam Mateicka ac0bf1a445 httpd: use get_mime_type to determine encoder content 2009-12-03 20:27:08 +01:00
Viliam Mateicka 7b80e73810 encoders: implement new get_mime_types method 2009-12-03 20:11:32 +01:00
Viliam Mateicka 6d11711a01 encoder: add get_mime_type() method to determine content type by httpd output plugin 2009-12-03 19:39:34 +01:00
Viliam Mateicka bae03e173e pcm_mix: change old code to use format instead of bits 2009-12-03 17:03:21 +01:00
Viliam Mateicka 07b388f8d4 null_encoder: use pcm_buffer 2009-12-03 17:03:20 +01:00
Viliam Mateicka 4809213676 flac_encoder: add support for libFLAC < 1.1.3 2009-12-03 14:53:30 +01:00
Jeffrey Middleton c77fa296bc compress: add config.h
This includes some default values of #defined constants used in the
code; it won't compile without it.
2009-12-02 21:14:35 -06:00