Commit Graph

4886 Commits

Author SHA1 Message Date
Max Kellermann 5f06999686 output_thread: fix double lock
During the whole output thread, the audio_output object is locked, and
it is only unlocked while waiting for the GCond and while running a
plugin method.  The error handler in ao_play_chunk() attempted to lock
the object again, which was code from MPD 0.15.x which should have
been removed a long time ago.
2011-01-07 23:08:18 +01:00
Max Kellermann 4c09aeb5a1 player_thread: fix assertion failure due to early seek
Until the decoder plugin has called decoder_initialized(), the player
may not submit seek commands.  This however could occur with a slow
decoder and a CUE file with a virtual song offset.  This patch adds
another check.
2011-01-07 22:52:50 +01:00
Max Kellermann af892e7e80 player_thread: make variables more local 2011-01-07 22:33:10 +01:00
Max Kellermann 0022fb100b encoder/lame: explicitly configure the output sample rate
When you don't explicitly set an output sample rate, liblame tries to
guess an output sample rate from the input sample rate.  You would
think that this "guessing" consists of just setting both equal, but
that is not the case.  For 44.1kHz at 96kbit/s, liblame chooses
32kHz.  This patch explicitly configures the output sample rate, to
stop the bad guessing.
2011-01-07 19:37:39 +01:00
Max Kellermann 4f2d67dfb0 output/httpd: define G_LOG_DOMAIN in httpd_client.c 2011-01-07 18:00:12 +01:00
Max Kellermann b5645ab29f output/osx: fix up audio format first, then apply it to device
This is a MPD 0.16 regression: when playing a 24 bit file, the switch
to 16 bit was made only partially, after mBytesPerPacket and
mBytesPerFrame had already been applied.

That means mBytesPerFrame referred to 24 bit, and mBitsPerChannel
referred to 16 bits.  Of course, that cannot work.
2011-01-07 17:31:36 +01:00
Ben Kibbey ff4534613a Build fix for Linux. Define _GNU_SOURCE in src/server_socket.c. 2010-12-27 04:36:23 +01:00
Max Kellermann be3b5199b0 stored_playlist: remove database lookups from spl_load()
Don't look up songs in the database, no caller needs this.
2010-12-23 16:25:37 +01:00
Max Kellermann d849a40af6 stored_playlist: ignore empty lines 2010-12-23 16:25:22 +01:00
Max Kellermann 4f48c10312 stored_playlist: use the text_file library to read lines 2010-12-23 16:25:05 +01:00
Max Kellermann 5274fee8a7 playlist_song: add flag "secure"
Optionally allow all local files.

"Insecure" mode is used for printing playlists.
2010-12-23 16:24:00 +01:00
Max Kellermann 5462f34ed0 string_util: add function strchug_fast()
Replace g_strchug() calls with a cheaper implementation.
2010-12-23 16:23:20 +01:00
Max Kellermann 0958ed5844 utils: move string_array_contains() to string_util.c 2010-12-23 16:23:04 +01:00
Max Kellermann e3cba18532 decoder: new "pcm" decoder plugin
Just there to support the "cdio_paranoia" input plugin.
2010-12-22 09:48:48 +01:00
Max Kellermann 9bf7fde49f configure.ac: hook the cdio_paranoia input plugin 2010-12-22 09:44:02 +01:00
Max Kellermann 4783ebc918 input/cdda: rename plugin to "cdio_paranoia" 2010-12-22 09:43:57 +01:00
Max Kellermann 8bda52783b input/cdda: support reading the whole disc 2010-12-22 09:43:53 +01:00
Max Kellermann 07feec7ea6 input/cdda: remove unused function input_cdda_archive_extract_trackno() 2010-12-22 09:43:49 +01:00
Max Kellermann e7471f589a input/cdda: import missing pcm16_to_wave() from the wave encoder 2010-12-22 09:43:47 +01:00
Max Kellermann 24208be5cf input/cdda: implement parse_cdda_uri()
Was missing.
2010-12-22 09:43:41 +01:00
Max Kellermann 8db5f66498 input/cdda: call input_cdda_close() with an input_stream pointer
Another build fix.
2010-12-22 09:43:27 +01:00
Max Kellermann be670bfd1f input/cdda: move code to cdda_detect_drive() 2010-12-22 09:43:20 +01:00
Max Kellermann 19acf090ed input/cdda: remove newlines from error messages 2010-12-22 09:43:16 +01:00
Max Kellermann 2de7f6b457 input/cdda: remove debug code 2010-12-22 09:42:10 +01:00
Max Kellermann a2e265e9a2 input/cdda: some general build failure fixes 2010-12-22 07:44:56 +01:00
Viliam Mateicka 28d7b29d72 input_cdda_plugin: new plugin to handle cdda:// protocol to access CD-DA audio CD's 2010-12-22 07:36:14 +01:00
Max Kellermann 60b4f6b3eb directory: fix warning "comparison between signed and unsigned"
Cast the constant to dev_t, not to unsigned.
2010-12-21 20:21:22 +01:00
Max Kellermann 546232b1c0 zeroconf-bonjour: use g_htons() instead of htons()
Fixes the gcc warning "implicit declaration of function 'htons'".
2010-12-21 20:21:20 +01:00
Max Kellermann fb00e7fddc add void casts to suppress "result unused" warnings (clang) 2010-12-21 08:06:02 +01:00
Alex Viskovatoff 41fdcf328c decoder/mad: work around build failure on Solaris
Rename the "version" struct, because it seems to be a reserved name on
Solaris:

 "src/decoder/mad_decoder_plugin.c", line 550: (enum) tag redeclared: version
 cc: acomp failed for src/decoder/mad_decoder_plugin.c
2010-12-21 07:57:07 +01:00
Greg Ward 9cb4aaf3c2 osx_output: always pass OS X result code to g_set_error().
Should be safe on OS X 10.4 (32-bit), since Apple's OSStatus boils
down to "signed long", and g_set_error() takes gint, which is really
just "int".  Assigning "signed long" to "int" on 32-bit Unix should be
just fine, since both are signed 32-bit ints.

No idea if this is safe on 64-bit OS X.
2010-12-21 07:37:54 +01:00
Greg Ward 80dc602193 osx_output: allow user to specify other audio devices.
Add new config parameter 'device' to audio_output type "osx":
- if not supplied or set to "default", open default device
- if set to "system", open system device
- otherwise 'device' should be an audio device name: mpd will find and
  open the specified audio device, falling back to the default
  device if it's not found
2010-12-21 07:36:28 +01:00
Alex Viskovatoff 144ad7992e output/solaris: add missing parameter to open_cloexec() call 2010-12-21 07:31:08 +01:00
Alex Viskovatoff a0dd1a1b8b audio_check: fix parameter in prototype 2010-12-21 07:29:58 +01:00
Max Kellermann 748a8a6f42 tag_id3: support multiple values
Loop over all frames with a specific id, and import all of them - not
just the first one (index 0).
2010-12-07 18:05:44 +01:00
Anton Khirnov cb9965bab5 command: don't error when sticker list is run on song with no stickers
this is inconsistent with other commands (e.g. find) and seems wrong --
a song with no stickers attached is a perfectly valid state and an empty
list of stickers is also perfectly valid.
2010-12-07 17:32:52 +01:00
Max Kellermann 429ed24c99 tag_ape: support multiple values
One APE tag may contain more than one value, separated by null bytes.
2010-11-24 08:59:04 +01:00
Max Kellermann 1ab46472ab decoder_thread: load APE replay gain from music files 2010-11-18 23:02:30 +01:00
Max Kellermann f6bbe1332f replay_gain_ape: parse replay gain from APE tags
Based on the APE reader.
2010-11-18 22:26:06 +01:00
Max Kellermann 11613347be tag_ape: move code to ape.c
Generic library for scanning APE tags.  Eliminated one "goto"!
2010-11-18 21:44:24 +01:00
Max Kellermann 8f46f1520c timer: fix integer overflow in timer_delay()
Fixes a regression: for output_plugin.delay(), we added a method to
the timer class which returns the delay in milliseconds.  This fails
to detect negative values, because the unsigned integer is divided by
1000, and then casted to signed.
2010-11-18 21:29:03 +01:00
Max Kellermann 46ab8d18e2 playlist_song: calculate duration of last CUE track 2010-11-08 20:16:26 +01:00
Max Kellermann f384f8da93 Merge release 0.15.15 from branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
2010-11-08 18:50:22 +01:00
Max Kellermann cc1debc948 output/shout: artist comes first in stream title
After popular demand, I've switched the order of "artist" and "title"
in the stream title.  There is no standard, and there is no reliable
way to parse those from the stream title.
2010-11-08 18:46:14 +01:00
Max Kellermann 5a3aa1262a update_walk: explicitly check for permission problems
Call access() and print an extra error message when EACCES is
returned.  Hopefully this will reduce the number of support requests
due to wrong file permissions.
2010-11-08 18:24:19 +01:00
Max Kellermann ad52eb236d input/rewind: fix assertion failure
The assertion added in MPD 0.15.14 was too much, it failed when the
MIME type of a stream was NULL.
2010-11-08 10:37:09 +01:00
Max Kellermann 4478b3ef74 Merge release 0.15.14 from branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
	src/decoder_control.c
	src/decoder_control.h
	src/input/rewind_input_plugin.c
	src/output_control.c
	src/output_thread.c
	src/player_thread.c
2010-11-07 15:30:18 +01:00
Max Kellermann 83ec0e5552 player_thread: fix assertion failure due to wrong music pipe on seek
When one song is played twice, and the decoder is working on the
second "instance", but the first should be seeked, the check in
player_seek_decoder() may assume that it can reuse the decoder without
exchanging pipes.  The last thing was the mistake: the pipe pointer
was different, which led to an assertion failure.  This patch adds
another check which exchanges the player pipe.
2010-11-05 19:24:42 +01:00
Max Kellermann cc261872c2 decoder_control: pass music_pipe to dc_start()
More abstraction for decoder_control.pipe.
2010-11-05 19:18:44 +01:00
Max Kellermann 5223261f19 player_thread: add helper function player_dc_at_next_song()
Some abstraction for decoder_control.pipe access.
2010-11-05 19:08:59 +01:00
Max Kellermann c594afeee7 pipe: add helper function music_pipe_empty() 2010-11-05 18:40:23 +01:00
Max Kellermann 32d10eedbd input/rewind: remove redundant NULL check before g_free() call 2010-11-05 18:40:14 +01:00
Max Kellermann dfd98eede7 input/rewind: add two assertions 2010-11-05 18:40:07 +01:00
Max Kellermann a728d7a026 input/rewind: fix double free bug
Duplicate the "mime" attribute of the inner input_stream object,
instead of copying the pointer.
2010-11-05 18:39:40 +01:00
Max Kellermann 5a26320680 output/alsa: dump buffer and period limits 2010-11-05 10:35:46 +01:00
Max Kellermann 90dc880e67 output/httpd: implement delay() 2010-11-05 09:49:22 +01:00
Max Kellermann e11ff967d0 output/shout: implement delay()
This makes the plugin more responsive to control commands, because it
will listen to control events while waiting.
2010-11-05 09:49:20 +01:00
Max Kellermann 2dc6ed7b3a output_plugin: add method delay()
This method is used to reduce the delay of commands issued to the
shout plugin.
2010-11-05 09:47:43 +01:00
Max Kellermann ad430c6617 timer: add function timer_delay() 2010-11-05 09:39:56 +01:00
Max Kellermann e8d8bd4c0d decoder/{mp4ff,ffmpeg}: add extension ".m4b" (audio book)
Same as ".m4a".
2010-11-05 02:01:35 +01:00
Max Kellermann 8d5fa754e8 output_thread: fix assertion failure due to race condition in OPEN
Change the assertion on "fail_timer==NULL" in OPEN to a runtime check.
This assertion crashed when the output thread failed while the player
thread was calling audio_output_open().
2010-11-04 23:44:23 +01:00
Max Kellermann 2ee047a1dd output_internal: protect attribute "fail_timer" with mutex 2010-11-04 23:40:43 +01:00
Max Kellermann 9562f66741 output_control: lock object in audio_output_open()
Protect the attributes "open" and "fail_timer".
2010-11-04 23:28:18 +01:00
Max Kellermann 21223154aa output_control: lock object in audio_output_close()
Protect the attributes "open" and "fail_timer".
2010-11-04 21:51:02 +01:00
Mantas Mikulenas ec48b5ea3a server_socket: remove AI_ADDRCONFIG
When you pass the flag AI_ADDRCONFIG to getaddrinfo(), it does not
consider address families on the loopback device.  When run on a
machine without an external network card, just with "lo", it was
unable to look up any address.
2010-11-04 20:17:45 +01:00
Max Kellermann 754015544f output/ffado: transfer_playback_buffers() returns a boolean
libffado documentation says this function returns -1 on error, but
that is a lie - it returns a boolean value, and "false" means error.
2010-11-04 20:08:04 +01:00
Max Kellermann 3f89f77429 decoder/ffmpeg: check AVCodecContext.sample_fmt value
.. instead of av_get_bits_per_sample_format().  The SampleFormat enum
value is authoritative.
2010-11-04 20:04:15 +01:00
Denis Krjuchkov 9dee419b7c winmm_output: handle empty string case when parsing device id 2010-11-04 11:09:50 +05:00
Denis Krjuchkov 7612bf1bfa winmm_output: added "device" configuration option
Device can be specified either by magic index (starting with 0)
or by device name.
2010-11-04 00:51:18 +05:00
Denis Krjuchkov ad56e10e5b winmm_output: improved test_default_device
If no device is available test_default_device returns false.
2010-11-03 23:31:49 +05:00
Max Kellermann 75f4772ba2 output: new output plugin "ffado"
Using libffado, to play on firewire audio devices.

Warning: this plugin was not tested successfully.  I just couldn't
keep libffado2 from crashing.  Use at your own risk.

For details, see my Debian bug reports:

  http://bugs.debian.org/601657
  http://bugs.debian.org/601659
2010-10-27 21:25:41 +02:00
Alder Hornbridge fe1b626f76 decoder/sidplay: play mus, str, prg, x00 files 2010-10-27 21:18:43 +02:00
Alder Hornbridge 4e94516912 decoder/sidplay: play monaural SID tunes in mono 2010-10-27 21:16:24 +02:00
Tony Miller dadb6747ad Container support for gme decoder. 2010-10-14 17:11:59 +02:00
Max Kellermann 188e1b440e playlist/rss: new playlist plugin for RSS feeds 2010-10-11 20:33:41 +02:00
Max Kellermann a57f9e712d Merge release 0.15.13 from branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
	src/input/rewind_input_plugin.c
	src/output/httpd_output_plugin.c
2010-10-11 20:33:17 +02:00
Denis Krjuchkov e6fc88a758 mixer: winmm_mixer implemented 2010-10-09 02:45:08 +06:00
Denis Krjuchkov 20004b7ee0 win32_output: renamed win32 output plugin to winmm
Win32 has many audio APIs. New name is slightly more correct.
2010-10-08 23:55:14 +06:00
Max Kellermann 84e037631d output/httpd: use the new server_socket library 2010-10-05 21:18:54 +02:00
Max Kellermann 18e3d0b504 listen: move generic code to server_socket.c 2010-10-05 21:18:54 +02:00
Max Kellermann 04c4398bfc output/httpd: don't close socket in open() failure
This cleanup call is obsolete, since we moved the binding code to
enable()/disable().
2010-10-05 21:18:54 +02:00
Max Kellermann 39e42394bd output_all: disable outputs on shutdown
Call output_plugin.disable() before output_plugin.finish().  This
ensures that all outputs are properly cleaned up, to make valgrind
happy.
2010-10-05 21:18:54 +02:00
Max Kellermann 5923cfcde3 output/httpd: MIME type audio/ogg for Ogg Vorbis
RFC 5334 10.3 defines the MIME type "audio/ogg".  We could use
"application/ogg" as well, but we know for sure that we only emit
audio data.
2010-10-03 16:22:03 +02:00
Denis Krjuchkov e10b872fc3 main_win: replaced g_error usages with MPD_ERROR 2010-09-28 22:38:57 +06:00
Denis Krjuchkov 2b78358af5 mpd_error: more correct MPD_ERROR implementation
Original implementation does not handle
	if (...)
		MPD_ERROR("die");
	else
		...
case well. This change fixes handling of such cases.
2010-09-28 18:12:14 +02:00
Thomas Jansen e3f4c7b91c input/rewind: enable for MMS 2010-09-28 12:56:47 +02:00
Andrew Morgan a59ab3e2ee playlist: make single mode 'sticky' 2010-09-28 12:52:52 +02: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
Thomas Jansen 9af9fd1400 output/httpd: bind_to_address support (including IPv6)
Added support for a new optional configuration setting for the httpd output
named "bind_to_address". Setting it to a specific IP address (v4 or v6) will
cause the httpd output to bind to that address exclusively. Supporting
multiple addresses in parallel is future work.

This implements the feature requests #2998 and #2646.
2010-09-25 15:00:43 +02:00
Thomas Jansen 0c80bd5fc0 conf: Whitespace cosmetics 2010-09-25 15:00:43 +02:00
Max Kellermann a14cd97f56 playlist: fix "queued" check in playlist_sync()
The check was meant to fix an assertion failure, but it was the wrong
way around.  This broke cross-fading most of the time.
2010-09-23 23:29:36 +02:00
Max Kellermann 0955f33a86 decoder/mp4ff: support more variations of "album artist"
According to the mantis bug report 2847, there are several possible
variations of the "album artist" tag:

- "album artist"
- "album_artist"
- "albumartist"

This patch adds support for the latter two.
2010-09-23 21:19:41 +02:00
Max Kellermann a016fb4048 listen: fix "unused parameter" warning on WIN32 2010-09-23 20:51:23 +02:00
Denis Krjuchkov e8ebb1af91 main: Add Windows Service support
I've added PIPE_EVENT_SHUTDOWN because calling g_main_loop_quit() do not work when called from another thread.
Main thread was sleeping in g_poll() so I needed some way to wake it up.

By some strange reason call close(event_pipe[0]) in event_pipe_deinit() hangs.
In current implementation that code never reached so that was not a problem :-)
I've added a conditional to leave event_pipe[0] open on Win32.
2010-09-23 20:42:33 +02:00
Thomas Jansen 9fa3d7c4fa playlist_state: Fix the "state" line in the output
An '\n' was erroneously inserted in the line containing the state, e.g.
"state: \nplay" instead of "state: play".

Fix for bug #2992.
2010-09-23 20:41:23 +02:00
Thomas Jansen 54294366d5 rewind_input_plugin: Update MIME not only once
The assumption that MIME type is set only once is not valid with CURL,
as URL redirections may update the MIME type.

This fixes bug #3044.
2010-09-23 20:39:13 +02:00
Max Kellermann 9423b456a1 zeroconf-bonjour: use g_htons() instead of htons()
htons() is not available if netinet/in.h is not included.
2010-09-23 09:01:37 +02:00
Max Kellermann 64209749fb directory: cast DEVICE_INARCHIVE, DEVICE_CONTAINER to dev_t
Fix gcc warning.
2010-09-23 09:01:25 +02:00
Max Kellermann 586b7601c6 playlist_database: initialize pm.mtime 2010-09-23 09:01:23 +02:00
Max Kellermann 4425989898 fd_util: work around aliasing warning in recvmsg_cloexec() 2010-09-23 09:01:20 +02:00
Max Kellermann 5b996ab880 output/httpd: access sockaddr_storage object directly
Work around aliasing warning.
2010-09-23 09:01:17 +02:00
Max Kellermann 635cfbae13 decoder_control: use g_free() to manage mixramp allocations
Be consistent with the rest of MPD, and don't use the non-portable
header "malloc.h".
2010-09-23 08:49:21 +02:00
Qball Cow 4a7abc9d44 Correctly terminate stream_title.
This caused random data to be send via icy-server if the played
song had no tags.
2010-09-08 13:19:59 +02:00
Max Kellermann 589bb54111 input/curl: fix version check for curl_multi_timeout()
According to the CURL web site, curl_multi_timeout() was added in
version 7.15.4:

 http://curl.haxx.se/libcurl/c/curl_multi_timeout.html
2010-09-07 21:40:56 +02:00
Max Kellermann d953225531 update_walk: update existing playlist entry
Fixes duplicate playlist entries.
2010-09-07 20:22:05 +02:00
Max Kellermann 663815ead8 playlist_vector: update_or_add() returns bool
False if the vector was not modified.
2010-09-07 20:21:19 +02:00
Max Kellermann 917434269c output/httpd: implement "pause"
Send silence to all connected clients while paused, to avoid
connection interruption.
2010-08-31 06:50:14 +02:00
Max Kellermann a77506ae21 output/httpd: forced flush after 32 kB of input data
Avoid buffer underruns on the streaming client, if the encoder is "too
efficient" (e.g. when encoding silence while paused).
2010-08-31 06:49:06 +02:00
Johan Kiviniemi ed5d297301 ReplayGain filter: allow gain > 100 %
The ReplayGain filter clamped the gain to max. 100 % even if the
algorithm determined the signal needed a boost. That would result in any
such tracks being played with too low volume, effectively defeating the
purpose of the filter.
2010-08-23 16:34:11 +03:00
Max Kellermann 64dacd175a output_thread: fix race condition after CANCEL command
Clear the notification before finishing the CANCEL command, so the
notify_wait() after that will always wait for the right notification,
sent by audio_output_all_cancel().
2010-08-19 11:05:24 +02:00
Max Kellermann 625e4755d1 notify: add function notify_clear() 2010-08-19 11:03:53 +02:00
Max Kellermann 68c02fc95a fd_util: add function dup_cloexec()
Unfortunately, there's no "optimized" implementation here.  We can't
use Linux's proprietary system call dup3(), because it would require
us to specify the new descriptor.
2010-08-03 18:03:55 +02:00
Max Kellermann d18c1b1a0a fd_util: add function recvmsg_cloexec() 2010-08-03 17:51:35 +02:00
Max Kellermann c980fc653d fd_util: add function socketpair_cloexec() 2010-08-03 17:51:35 +02:00
Max Kellermann 013ebb638a playlist_song: fix memory leak
Free the temporary path string in apply_song_metadata().
2010-07-25 13:35:59 +02:00
Max Kellermann bedb82bf4d directory: free playlist vector in directory_free() 2010-07-25 13:31:39 +02:00
Max Kellermann cbb1ab58cd queue_save: save tags and range of non-database songs
Use the functions song_save() and song_load() to use the same format
as in the database file for those songs which need the tags.
2010-07-25 13:28:54 +02:00
Max Kellermann b01235e330 song_save: save start_ms and end_ms
While this is not useful for the database, it may become useful for
reusing this code for the state file.
2010-07-25 13:28:52 +02:00
Max Kellermann 8341a9f7b2 queue_save: simplify get_song()
Don't try db_get_song() if the URI has a scheme.
2010-07-25 13:28:48 +02:00
Max Kellermann b233c145fa {queue,song}_print: print relative paths if possible
If a song with an absolute path points inside the music directory,
print only the relative part.  This happens when partial songs from a
playlist file were loaded.
2010-07-25 13:28:39 +02:00
Max Kellermann 9de5bb9e23 queue_print: hide HTTP password in the "playlist" command
I've already changed the "playlistinfo" command to hide HTTP
passwords, but forgot to do the same for the simpler "playlist"
command.  This patch changes queue_print_uris() to use the code from
song_print_uri().
2010-07-25 13:24:19 +02:00
Max Kellermann 0c5305c51f queue_save: move code to queue_save_song() 2010-07-25 12:43:54 +02:00
Max Kellermann 63c9a20f96 queue_save: queue_load_song() returns void
The only caller doesn't use its return value, and the value isn't
useful anyway.
2010-07-25 12:43:18 +02:00
Max Kellermann b40c0811f4 song_save: song_load() returns NULL instead of false 2010-07-25 12:23:52 +02:00
Max Kellermann 838790fc2d state_file: use the text_file library
Don't use a large stack buffer.
2010-07-25 12:01:59 +02:00
Max Kellermann 1ff2d5b689 playlist_state: simplify printf() calls
Let the C compiler concatenate string constants.
2010-07-25 12:01:59 +02:00
Max Kellermann e4b7a113fd database, ...: remove EINTR checks after stdio calls
MPD doesn't have child processes anymore, and thus we're not expecting
to receive SIGCHLD very often.  Since hard disk access isn't
interrupted by signals anyway, we don't need those excessive checks.
2010-07-25 12:01:59 +02:00
Max Kellermann 7820ebb82e directory_save: duplicate the playlist name
The function playlist_metadata_load() will overwrite the input buffer
before using the "name" parameter; since "name" points to the same
buffer, we'll get a corrupted string.
2010-07-25 12:01:59 +02:00
Rasi 31ab0b3df1 Added album tag support for libgme decoder 2010-07-23 23:13:03 +02:00
Max Kellermann e598922133 update: store playlist files in database
Don't open the music directory for each "lsinfo" call.  Get the list
of playlist files from the memory database.
2010-07-21 09:26:50 +02:00
Max Kellermann e21ad70f3f song_save: pass const songvec to songvec_save() 2010-07-21 09:26:50 +02:00
Max Kellermann a81cb932c2 song_save: include cleanup 2010-07-21 09:26:46 +02:00
Max Kellermann 3d66a4fee8 database: remove outdated comment 2010-07-21 09:20:14 +02:00
Max Kellermann dea5601e79 tag_rva2: move code to rva2_apply_data() 2010-07-20 23:05:24 +02:00
Max Kellermann 43a840552f tag_rva2: add struct rva2_data
.. and several accessor inline functions, to simplify the calling
code.
2010-07-20 23:05:06 +02:00
Max Kellermann 2f16f8e9f7 tag_rva2: name the CHANNEL_* enum 2010-07-20 23:05:01 +02:00
Max Kellermann 4364b30c42 decoder/mad: move RVA2 code to tag_rva2.c 2010-07-20 23:03:54 +02:00
Max Kellermann c0da938d4f Merge release 0.15.12 from branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
2010-07-20 23:03:06 +02:00
Max Kellermann fb19aa355e replay_gain_info: fix indentation 2010-07-20 22:59:04 +02:00
Max Kellermann 1f976d6e54 input/curl: remove assertion after curl_multi_fdset()
Some users reported that MPD crashes when using a new CURL version
with the threaded DNS resolver enabled.  It seems that
curl_multi_fdset() returns no file descriptor when the DNS resolver
runs in another thread, so MPD does not have any event to wait for.

On the CURL mailing list, somebody suggested to sleep for a fixed
amount of time.  This is not an elegant solution, because daemons
should never have to sleep without waiting for an event.  I hope the
CURL developers will review the API and remove the threaded DNS
resolver.

Meanwhile, I'm removing the assertion in question, to allow those
unfortunate users running the latest CURL version to continue using
MPD.
2010-07-20 22:55:13 +02:00
Max Kellermann a4908dca42 input/curl: query timeout from CURL
Use curl_multi_timeout() to determine the select() timeout, instead of
hard-coding one second.
2010-07-20 22:37:34 +02:00
Max Kellermann 8b055c3127 tag_rva2: set "gain", not "peak"
RVA2 tags only store the "gain" value, there is no "peak" attribute.
2010-07-20 22:32:55 +02:00
Max Kellermann 172182b18f decoder/mad: parse_rva2() returns bool 2010-07-20 18:27:11 +02:00
Max Kellermann 898a13f196 decoder/wildmidi: support version 0.2.3
In libwildmidi 0.2.3, the function WildMidi_SampledSeek() was removed,
without changing the SO name.  This patch adds an autoconf check for
that function.  Fall back to WildMidi_FastSeek() if
WildMidi_SampledSeek() is not available anymore.
2010-07-20 18:23:56 +02:00
Max Kellermann 2bc5161e95 Merge release 0.15.11 from branch 'v0.15.x
Conflicts:
	NEWS
	configure.ac
	src/decoder/ffmpeg_decoder_plugin.c
	src/decoder/mikmod_decoder_plugin.c
	src/decoder/mp4ff_decoder_plugin.c
	src/decoder/vorbis_decoder_plugin.c
	src/directory_print.c
	src/playlist_control.c
	src/tag_ape.c
2010-07-19 23:49:15 +02:00
Max Kellermann e2e8d0d2f3 decoder/ffmpeg: fix libavformat 0.6 by using av_open_input_stream()
libavformat 0.6 does not pass the original URI pointer to the "open"
method, which leads to a crash because MPD was using a dirty hack to
pass a pointer to that method.

This patch switches to av_open_input_stream() with a custom
ByteIOContext class, instead of doing the URI string hack with
av_open_input_file().

Loosely based on a patch from Jasper St. Pierre.
2010-07-19 23:03:06 +02:00
Max Kellermann b2e3c0757b decoder/ffmpeg: manual format probing
Use the libavformat function av_probe_input_format() to probe the
AVInputFormat, instead of letting av_open_input_file() do it
implicitly.  We will switch to av_open_input_stream() very soon, which
does not have the probing code.

Loosely based on a patch from Jasper St. Pierre.
2010-07-19 22:59:59 +02:00
Anton Khirnov 0fc0196dba ffmpeg: read the audio stream metadata in addition to global
in some formats, e.g. vorbis, the metadata is stored per-stream.
2010-07-12 11:36:55 +02:00
Anton Khirnov 1492324c76 ffmpeg: factor tag_type <-> ffmpeg tag name maps into a table. 2010-07-12 11:36:55 +02:00
Max Kellermann 49bc317fb8 decoder/ffmpeg: fix libavformat 0.6 by using av_open_input_stream()
libavformat 0.6 does not pass the original URI pointer to the "open"
method, which leads to a crash because MPD was using a dirty hack to
pass a pointer to that method.

This patch switches to av_open_input_stream() with a custom
ByteIOContext class, instead of doing the URI string hack with
av_open_input_file().

Loosely based on a patch from Jasper St. Pierre.
2010-06-30 23:41:32 +02:00
Max Kellermann 375a09d6f6 decoder/ffmpeg: manual format probing
Use the libavformat function av_probe_input_format() to probe the
AVInputFormat, instead of letting av_open_input_file() do it
implicitly.  We will switch to av_open_input_stream() very soon, which
does not have the probing code.

Loosely based on a patch from Jasper St. Pierre.
2010-06-30 23:40:31 +02:00
Max Kellermann 0265c34bed decoder/ffmpeg: free URI, fix memory leak
Free the string allocated by decoder_get_uri().
2010-06-30 23:40:04 +02:00
Max Kellermann a1882f48be decoder/vorbis: handle uri==NULL
This fixes a theoretical crash, which has never occurred in practice.
2010-06-30 23:38:49 +02:00
Anton Khirnov c3569814bd ffmpeg: read more metadata. 2010-06-30 23:18:45 +02:00
Max Kellermann 814daac5ba decoder/ffmpeg: free AVFormatContext on error
Fix a memory leak in some code paths.
2010-06-30 23:14:43 +02:00
Max Kellermann 768be22f7c pcm_buffer: make the buffer pointer "void" 2010-06-30 21:55:46 +02:00
Max Kellermann ec89ce5a8a decoder/mp4ff: support tag "album artist"
We already supported "albumartist", but it seems some folks also use
"album artist" (with a space).
2010-06-30 21:55:03 +02:00
Andreas Vögele 34415bf0b6 Make get_remote_uid() work on BSD
I've attached a patch that will make file URIs work on operating systems
that provide the getpeereid() function call to check the user ID of the
peer connected to a UNIX domain socket.
2010-06-30 21:42:01 +02:00
Max Kellermann 0a0c78674f playlist: emit IDLE_OPTIONS when resetting single mode 2010-06-30 21:40:33 +02:00
Max Kellermann 1bffdabe41 directory_print: return void
There is no useful return value here.
2010-06-30 21:39:34 +02:00
Max Kellermann 77e6810c14 decoder/mikmod: fix memory leak
The return value of Player_LoadTitle() is allocated with malloc(), and
must be freed by the caller.
2010-06-30 19:37:36 +00:00
Max Kellermann 5ebe33653c decoder/mp4ff: remove duplicate entries in the tag name table
Reuse the function tag_name_parse_i().
2010-06-30 21:36:15 +02:00
Max Kellermann 8e3eace289 decoder/mp4ff: moved code to mp4ff_tag_name_parse() 2010-06-30 21:36:00 +02:00
Max Kellermann 284659034d tag_ape: remove duplicate entries in the tag name table
Reuse the function tag_name_parse_i().
2010-06-30 21:33:19 +02:00
Max Kellermann 9550c87327 tag: added function tag_name_parse()
Convert a string into a tag_type enum.
2010-06-30 21:31:45 +02:00
Max Kellermann e223e8a5b5 tag_ape: move code to tag_ape_name_parse() 2010-06-30 21:30:21 +02:00
Max Kellermann 4d6d372a5b decoder/vorbis: use single global ov_callbacks constant
Initialize the ov_callbacks struct at compile time.
2010-06-30 19:24:41 +00:00
Max Kellermann 0aeec90590 decoder/mp4ff: support tags "albumartist", "band"
I'm not sure if mapping "band" to TAG_PERFORMER is correct, but it
might be better than nothing.
2010-06-30 21:22:13 +02:00
Max Kellermann cfcd84655c decoder/mp4ff: use tag_table.h to parse tag names
Convert if/else/else/... to a loop.
2010-06-30 21:19:30 +02:00
Max Kellermann 5092eaf1cc tag_ape: move table lookup to tag_table.h
Allow code sharing.
2010-06-30 21:18:27 +02:00
Max Kellermann 9328558fc7 tag_ape: support album artist
I took this tag name from a MusePack sample file I got from a user.
It is not documented in the APE specification:

 http://wiki.hydrogenaudio.org/index.php?title=APE_key

People seem to be using undocumented extensions to the specification
anyway, and the best we can do is attempt to support them.
2010-06-30 21:16:28 +02:00
Max Kellermann 026bd15872 tag_ape: simplified the apeItems array
Make "enum tag_type" the array index, and convert apeItems to a sparse
array.
2010-06-30 21:15:52 +02:00
Max Kellermann 7cca55549b tag_ape: moved code to tag_ape_import_item()
Improve code readability.
2010-06-30 21:15:39 +02:00
Max Kellermann c7e89ea3a3 tag_ape: converted apeItems and tagItems to global vars
Don't initialize those arrays each time tag_ape_load() is called.
2010-06-30 21:15:14 +02:00
Max Kellermann 5a2820ca3d pcm_buffer: make the buffer pointer "void" 2010-06-30 08:21:48 +02:00
Max Kellermann 9eb292c1e5 decoder/mp4ff: support tag "album artist"
We already supported "albumartist", but it seems some folks also use
"album artist" (with a space).
2010-06-25 22:54:18 +02:00
Max Kellermann 5216cfb3c8 playlist_print: use playlist_open_any()
Allow printing remote playlists with the commands "listplaylist" and
"listplaylistinfo".
2010-06-25 22:43:52 +02:00
Max Kellermann 373d1843a8 playlist_queue: use playlist_open_any() 2010-06-25 22:43:52 +02:00
Max Kellermann 82ee278f53 playlist_any: new library to simplify opening playlist files
The new function playlist_open_any() combines playlist_mapper_open(),
playlist_list_open_uri() and playlist_list_open_stream(), providing an
easy API for all of them.
2010-06-25 22:43:52 +02:00
Max Kellermann c27fc26ecd playlist_list: probe plugin without MIME attributes
If the MIME type of a stream contains a semicolon, remove it and the
text after it to probe for a playlist plugin.
2010-06-25 22:43:52 +02:00
Max Kellermann fba13bd5d2 playlist_queue: simplify error handler
Return early on error, save one level of indent.
2010-06-25 22:37:34 +02:00
Max Kellermann 68f75955d8 playlist_list: moved input_stream.ready loop to calling function
Merged both loops into playlist_list_open_stream().  This is needed
because playlist_list_open_stream() needs to know the MIME type, which
is only known after the stream has become "ready".
2010-06-25 22:37:34 +02:00
Max Kellermann cd21cfc115 uri: really count dots in verify_uri_segment()
This buggy implementation failed to allow "..." sequences, because the
dot count was always zero.  The usefulness of allowing "..." (or more
dots) is debatable, but since it's a valid file name, we allow it.
2010-06-25 21:56:12 +02:00
Max Kellermann 1ea10db953 playlist/cue: last track ends at end of file
libcue's track_get_length() returns 0 for the last track, because that
information is not available in the CUE sheet.  This makes MPD quit
playing the last track immediately.  If we set "song.end_ms=0", MPD
will play the track until the end of the song file, which is what we
want.
2010-06-25 20:02:55 +02:00
Max Kellermann 6bb7a7439d song_print: simplified start_ms/end_ms check 2010-06-25 20:02:55 +02:00
Aaron Griffith ca6110d92f playlist_list: wait for input stream to become ready
Fixes an assertion failure in the input_stream_seek() call.
2010-06-25 19:20:20 +02:00
Andreas Vögele dda5415def Make get_remote_uid() work on BSD
I've attached a patch that will make file URIs work on operating systems
that provide the getpeereid() function call to check the user ID of the
peer connected to a UNIX domain socket.
2010-06-19 13:47:10 +02:00
Andrzej Rybczak 4347114455 client: increase send_buf from 4kB to 16kB
this greatly improves performance of commands that return a lot
of data, e.g. search results or recursive content of a directory,
while being connected to local mpd via tcp/ip socket.
2010-06-19 13:45:54 +02:00
Max Kellermann 9fb26b5617 playlist: check "queued" before calling playlist_update_queued_song()
Workaround for an assertion failure.
2010-06-19 13:45:15 +02:00
Max Kellermann 442b327582 playlist: protect acess to player state in playlist_sync() 2010-06-19 13:33:39 +02:00
Max Kellermann cff727644d playlist: move checks out of playlist_sync_with_queue()
Rename the function to playlist_song_started(), which gets only called
if the song has actually started.
2010-06-19 13:33:32 +02:00
Max Kellermann 7f80349494 player_control: hold mutex in pc_play(), pc_pause()
Race condition fix.
2010-06-19 13:19:30 +02:00
Max Kellermann d0d2d6ed1b filter/route: fixed unsigned/signed comparison
Fixes a clang warning.
2010-06-06 21:56:30 +02:00
Tim Phipps 4e83b79d2b output/httpd: add libwrap support
libwrap support is in MPD but only for the control port.  This patch
adds support for the http port.  The code is copied from
src/client_new.c
2010-06-06 21:53:24 +02:00
Max Kellermann 37e69a89b9 directory_print: print a list of playlist files in "lsinfo"
Print those files which can be handled by a playlist plugin.
2010-06-01 10:00:01 +02:00
Max Kellermann 6f28eb4c0a playlist_list: export playlist_suffix_supported() 2010-06-01 09:59:56 +02:00
Max Kellermann caf93d9a2c playlist_list: playlist_list_open_path() returns input_stream
Memory leak fix.  The input_stream object passed to
playlist_list_open_stream_suffix() must be closed by the caller - this
however never happens in playlist_list_open_path(), because it does
not return it to the caller.
2010-06-01 09:59:54 +02:00
Max Kellermann 747e945d29 playlist_list: move fallback g_uri_parse_scheme() to glib_compat.h 2010-06-01 09:59:52 +02:00
Max Kellermann 067d7212bf playlist: emit IDLE_OPTIONS when resetting single mode 2010-06-01 09:59:46 +02:00
Romain Bignon 867b93a5b2 single mode: at the end of the song, pause on the next song instead of stop 2010-05-31 23:36:16 +02:00
Max Kellermann 53647c8ba1 directory_print: return void
There is no useful return value here.
2010-05-31 22:16:03 +02:00
Romain Bignon b571ba27a4 fix crash when decoder is NULL 2010-05-31 22:11:59 +02:00
Max Kellermann de8f2739c2 decoder/mikmod: fix memory leak
The return value of Player_LoadTitle() is allocated with malloc(), and
must be freed by the caller.
2010-05-31 10:24:08 +02:00
Max Kellermann 2c1c588868 decoder/mikmod: duplicate the path only once 2010-05-31 10:22:08 +02:00
Max Kellermann e271f69a34 decoder/mikdmod: moved local variable declarations in tag_dup() 2010-05-31 10:16:09 +02:00
Max Kellermann 39105f2119 decoder/wildmidi: moved local variable declarations in tag_dup() 2010-05-31 10:14:48 +02:00
Max Kellermann 4e080a9b06 decoder/gme: replace macro GME_BUF_SIZE
Added macros with better names: GME_BUFFER_FRAMES, GME_BUFFER_SAMPLES
(the former only used to calculate the latter).
2010-05-31 10:03:43 +02:00
Max Kellermann d55740808d decoder/gme: added constants for sample rate and channels
Move into enums.
2010-05-31 10:02:43 +02:00
Max Kellermann 6566038df9 decoder/gme: pass the whole buffer to decoder_data()
Pass sizeof(buf) to decoder_data(), not the number of samples (which
is half the size).  At the same time, pass GME_BUF_SIZE to gme_play()
- libgme really wants to get the number of samples, not the number of
stereo frames.  Previously, this plugin had been using only the first
half of the buffer.
2010-05-31 09:57:15 +02:00
Max Kellermann f0faf00320 decoder/gme: allocate tag later, fixes memory leak
Allocate the "tag" object after the file has been opened successfully.
2010-05-31 09:43:25 +02:00
Max Kellermann 51c7577c8f decoder/mp4ff: rename and move local variable
Allocate the "tag" object after the file has been checked.  That
removes one tag_free() call in an error handler.
2010-05-31 09:35:49 +02:00
Max Kellermann be308c6657 decoder/mp4ff: merge code into mp4ff_input_stream_open() 2010-05-31 09:29:45 +02:00
Max Kellermann 1729a0b437 decoder/mp4ff: move mp4ff_callback_t into mp4ff_input_stream
Allocate only one item on the stack.
2010-05-31 09:23:27 +02:00
Max Kellermann 1b2fc2ae19 decoder/mp4ff: rename mp4_context to mp4ff_input_stream 2010-05-31 09:22:42 +02:00
Max Kellermann 58a75f0b78 decoder/mp4ff: remove duplicate entries in the tag name table
Reuse the function tag_name_parse_i().
2010-05-31 08:48:41 +02:00
Max Kellermann daf6e2b5da decoder/mp4ff: moved code to mp4ff_tag_name_parse() 2010-05-31 08:47:59 +02:00
Max Kellermann 71da5b026c tag_ape: remove duplicate entries in the tag name table
Reuse the function tag_name_parse_i().
2010-05-31 08:24:05 +02:00
Max Kellermann 2f68ea635b tag_ape: move code to tag_ape_name_parse() 2010-05-31 08:22:53 +02:00
Max Kellermann ca08c4dbf4 decoder/vorbis: rename local variable "ret" 2010-05-31 00:06:37 +02:00
Max Kellermann 8af52fa205 decoder/vorbis: implement method stream_tag()
This allows tags in archive files.
2010-05-31 00:02:57 +02:00
Max Kellermann 3b0bf856c4 decoder/vorbis: move code to vorbis_open_stream() 2010-05-31 00:00:04 +02:00
Max Kellermann 28f5803d34 decoder/vorbis: use single global ov_callbacks constant
Initialize the ov_callbacks struct at compile time.
2010-05-30 23:59:36 +02:00
Max Kellermann 0b72299857 decoder/vorbis: rename struct vorbis_decoder_data to vorbis_is 2010-05-30 23:57:58 +02:00
Max Kellermann 4a2302c2ed inotify_update: follow symlinks
This is probably unsafe, and doesn't protect against symlink loops,
but we will eventually add this when we bring update*.c and inotify*.c
closer together.
2010-05-30 23:45:47 +02:00
Max Kellermann 980201a665 inotify_update: fix assertion failure when music dir is deleted
This shouldn't really happen, but insane users might delete/rename the
music directory while MPD runs.  What was even more insane was that
MPD crashed due to this.  This is a workaround - there is currently
nothing useful we can do in this case; except maybe poll for the music
directory to reappear, but that's too much trouble for a user error.
2010-05-30 23:45:46 +02:00
Max Kellermann 017d61a1aa decoder/mp4ff: support tags "albumartist", "band"
I'm not sure if mapping "band" to TAG_PERFORMER is correct, but it
might be better than nothing.
2010-05-30 22:55:02 +02:00
Max Kellermann 4028d03a6e decoder/mp4ff: use tag_table.h to parse tag names
Convert if/else/else/... to a loop.
2010-05-30 22:52:45 +02:00
Max Kellermann 44b771aca1 decoder/mp4ff: rename plugin "mp4" to "mp4ff"
The underlying library is named "libmp4ff".  To reduce confusion,
rename the plugin to a more specific name.
2010-05-30 22:52:44 +02:00
Max Kellermann 8c581eca4d tag_ape: move table lookup to tag_table.h
Allow code sharing.
2010-05-30 22:52:19 +02:00
Max Kellermann 8e815bec9f tag_ape: support album artist, MusicBrainz tags
I took these tag names from a MusePack sample file I got from a user.
These are not documented in the APE specification:

 http://wiki.hydrogenaudio.org/index.php?title=APE_key

People seem to be using undocumented extensions to the specification
anyway, and the best we can do is attempt to support them.
2010-05-30 22:29:48 +02:00
Max Kellermann 9dda53e1d2 Merge release 0.15.10 from branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
	src/input/mms_input_plugin.c
2010-05-30 18:26:33 +02:00
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