Commit Graph

910 Commits

Author SHA1 Message Date
Max Kellermann
328131b7aa output/roar: use const_cast instead of g_strdup() 2013-10-15 23:14:34 +02:00
Max Kellermann
85003429af output/roar: use std::string 2013-10-15 23:11:32 +02:00
Max Kellermann
6db77dcf75 output/roar: move code into the RoarOutput class 2013-10-15 22:58:38 +02:00
Max Kellermann
1cde86823d output/pipe: use std::string 2013-10-15 22:52:04 +02:00
Max Kellermann
12ab556477 event/BufferedSocket: pass writable pointer to OnSocketInput()
Remove the const_cast from HttpdClient.cxx, and avoid one allocation
in ClientRead.cxx.
2013-10-15 22:47:46 +02:00
Max Kellermann
509f8dab89 Util/Macros: replacement for GLib's G_N_ELEMENTS() 2013-10-15 22:47:39 +02:00
Max Kellermann
77429b6dd3 output/winmm: use delete instead of g_free() 2013-10-15 22:47:25 +02:00
Max Kellermann
be2951b45f gcc.h: rename to Compiler.h 2013-10-15 09:21:59 +02:00
Max Kellermann
6fd481df97 Mapper, ...: use memcmp() instead of strncmp() where appropriate
Micro-optimization.
2013-10-14 22:00:21 +02:00
Max Kellermann
86316b1828 output/httpd: don't include glib.h in header 2013-10-02 12:20:36 +02:00
Max Kellermann
060814daa8 Log: new logging library API
Prepare to migrate away from GLib.  Currently, we're still using GLib
as a backend.
2013-10-02 08:57:55 +02:00
Max Kellermann
ccd7f0825a DecoderControl: use GLib forward declarations 2013-09-27 23:00:23 +02:00
Max Kellermann
5bc4ab899f *Plugin: remove redundant "line %i" from error messages
The MPD core will add this as a prefeix.
2013-09-26 20:59:40 +02:00
Max Kellermann
7a4c9f5f4c mpd_error.h: remove obsolete header
Migrate the remaining callers to FatalError().
2013-09-05 18:26:46 +02:00
Max Kellermann
fccba1af2a use standard snprintf() instead of GLib g_snprintf() 2013-09-05 09:21:53 +02:00
Max Kellermann
29030b54c9 util/Error: new error passing library
Replaces GLib's GError.
2013-09-04 18:14:22 +02:00
Max Kellermann
c9fcc7f148 system/resolver: convert to C++ 2013-09-04 18:02:09 +02:00
Max Kellermann
d1f4a31b5e output/pulse: require libpulse 0.9.16
Remove all #ifdefs.  Old versions of libpulse are not being tested,
and thus I'm removing support.
2013-09-04 16:55:03 +02:00
Max Kellermann
0005221533 output/httpd: use "unsigned" instead of "guint" 2013-08-08 00:18:59 +02:00
Max Kellermann
b76a29a69a ConfigPath: return a Path object
Migrate all callers to use Path directly, instead of doing the
conversion in each caller.
2013-08-07 19:59:09 +02:00
Max Kellermann
abe090ec1f *: remove remaining __cplusplus checks 2013-08-07 19:58:52 +02:00
Max Kellermann
b70d38dc10 Makefile.am: move sources to libsystem.a 2013-08-07 10:31:31 +02:00
Max Kellermann
85b77b81ca *: use gcc.h macros instead of GLib 2013-08-04 23:48:01 +02:00
Max Kellermann
ca0d09c50f EncoderPlugin: pass config_param reference 2013-08-04 14:07:50 +02:00
Max Kellermann
81c3224076 OutputPlugin: pass config_param reference 2013-08-04 14:07:49 +02:00
Max Kellermann
d1e7b4e381 audio_format: convert to C++ 2013-08-03 21:37:56 +02:00
Max Kellermann
67f591a9ce gcc.h: add macro gcc_unreachable() 2013-08-03 21:34:17 +02:00
Max Kellermann
44621f7326 output/winmm: adapt to PcmBuffer API changes 2013-07-31 00:57:52 +02:00
Max Kellermann
06f898cc12 tag: convert to C++ 2013-07-30 20:19:53 +02:00
Max Kellermann
9a0061c511 encoder_api: convert to C++ 2013-07-30 09:04:05 +02:00
Max Kellermann
28030d7edb include cleanup 2013-07-30 08:39:21 +02:00
Max Kellermann
648196319f output_api: convert to C++ 2013-07-30 08:34:10 +02:00
Denis Krjuchkov
49a3845135 timer: convert to class 2013-05-12 19:03:42 +06:00
Max Kellermann
9e5d2c5bb7 encoder_list: convert to C++ 2013-04-17 22:22:37 +02:00
Max Kellermann
0954f580fa output/oss,null: use new/delete 2013-04-17 01:21:33 +02:00
Max Kellermann
3a2254c91f output: convert to C++ 2013-04-17 01:12:05 +02:00
Max Kellermann
4aeec4bb60 output/solaris: convert to C++ 2013-04-17 01:08:35 +02:00
Max Kellermann
750b2ad6a8 output/openal: convert to C++ 2013-04-17 01:04:27 +02:00
Max Kellermann
86c276f538 output/ao: convert to C++ 2013-04-17 00:56:09 +02:00
Max Kellermann
166569200a output/shout: convert to C++ 2013-04-17 00:47:20 +02:00
Max Kellermann
e903d00968 output/ffado: remove broken plugin
This plugin has been in MPD for three years, and it has never worked.
Enough!
2013-04-17 00:44:02 +02:00
Max Kellermann
cc6c452854 output/mvp: remove obsolete plugin
The hardware is obsolete, and the product does not exist anymore on
the Hauppauge web site.  Let's see if anybody complains about the
removal.
2013-04-17 00:37:30 +02:00
Max Kellermann
f492c78e2e output/jack: convert to C++ 2013-04-17 00:37:30 +02:00
Max Kellermann
6b83d08228 output/fifo: convert to C++ 2013-04-17 00:37:30 +02:00
Max Kellermann
dc415b761e output/pipe: convert to C++ 2013-04-17 00:37:30 +02:00
Max Kellermann
f1034eb657 output/recorder: convert to C++ 2013-04-17 00:37:30 +02:00
Max Kellermann
9f625b0a0d mixer/Pulse: convert to a class 2013-04-16 21:18:54 +02:00
Max Kellermann
e63420a8c2 output/Pulse: convert to C++ 2013-04-16 20:51:21 +02:00
Max Kellermann
e02d8ad8d2 output/roar: work around libroar's use of "new" 2013-04-16 20:04:11 +02:00
Max Kellermann
1729388634 pcm_export: convert to C++ 2013-04-09 01:31:05 +02:00
Max Kellermann
c654c7630a pcm_*: move to src/pcm/ 2013-04-09 01:24:52 +02:00
Max Kellermann
496f70fc0d mixer_plugin: convert to C++ 2013-02-22 20:51:23 +01:00
Max Kellermann
9ede4c5f3c {output,mixer}/winmm: convert to C++ 2013-02-22 20:29:03 +01:00
Max Kellermann
af99176581 output/alsa: workaround for noise after manual song change
Workaround for driver bug observed on the Raspberry Pi, see code
comment for details.
2013-02-04 15:51:32 +01:00
Max Kellermann
57e825dfe7 output/alsa: pre-allocate the silence buffer 2013-02-04 15:30:31 +01:00
Max Kellermann
e06dd129dd output/alsa: move code to alsa_write_silence() 2013-02-04 14:30:16 +01:00
Max Kellermann
7e92820c50 output/alsa: default "device" is an empty string
Fixes nullptr dereference in std::string::operator=().  Also fixes a
memory leak by using config_get_block_string() instead of
config_dup_block_string().
2013-02-04 11:46:49 +01:00
Max Kellermann
7bb5a960fd output/null: convert to C++ 2013-02-02 09:30:29 +01:00
Max Kellermann
5ed9f02c4d TagPool, ...: include cleanup 2013-01-30 22:53:12 +01:00
Max Kellermann
5e8f51a963 output/httpd: use the BufferedSocket class for HttpdClient 2013-01-30 15:08:09 +01:00
Max Kellermann
fa51db449f ServerSocket: replace callback with virtual method 2013-01-30 14:16:04 +01:00
Max Kellermann
cb9a05ac77 output/httpd: safer cast, consider offset 2013-01-30 14:14:42 +01:00
Max Kellermann
f1f22019f5 output/httpd: forward-declare class HttpdClient 2013-01-30 13:42:16 +01:00
Max Kellermann
6d79a1cdfc output/httpd: add constructor, destructor, Configure() 2013-01-30 13:41:27 +01:00
Max Kellermann
ad5eb2f8d6 ServerSocket: expose the class
Eliminate the C wrappers.
2013-01-30 13:40:56 +01:00
Max Kellermann
39d56d6b65 ServerSocket: move to libevent.a 2013-01-30 13:39:12 +01:00
Max Kellermann
fe3f0332f7 page: convert to C++ 2013-01-30 09:18:52 +01:00
Max Kellermann
718fd97612 icy_server: convert to C++ 2013-01-30 09:17:03 +01:00
Max Kellermann
f8ff45b212 icy_server: pass pointer to _metadata_page()
Don't use va_list.
2013-01-30 09:13:46 +01:00
Max Kellermann
20f85745e7 require GLib 2.24 2013-01-29 18:33:37 +01:00
Max Kellermann
84eb95466b output/osx: convert to C++ 2013-01-29 16:59:21 +01:00
Max Kellermann
26a9ce7b29 output/{alsa,oss}: convert to C++ 2013-01-29 14:32:32 +01:00
Max Kellermann
2aa34882b7 output/httpd: move functions into the HttpdOutput class 2013-01-27 23:23:46 +01:00
Max Kellermann
27f8ef2f33 output/httpd: rename struct httpd_output 2013-01-27 23:21:39 +01:00
Max Kellermann
e22ef6c481 output/roar: convert to C++ 2013-01-16 23:29:56 +01:00
Max Kellermann
0dd5f2915a ServerSocket: use the SocketMonitor class 2013-01-15 22:56:06 +01:00
Max Kellermann
bc66dc45e6 server_socket: convert to C++ 2013-01-15 21:42:55 +01:00
Max Kellermann
7087935656 output/httpd: convert to C++ 2013-01-15 20:20:51 +01:00
Max Kellermann
f9fc3a42cc fifo_buffer: move to util/ 2013-01-15 01:02:13 +01:00
Max Kellermann
49f3855407 configure.ac: enable WIN32_LEAN_AND_MEAN on Windows 2013-01-11 11:06:16 +01:00
Max Kellermann
ed8798e82f output/shout: refactor check_block_param() to a function
Don't use macro magic, don't dereference the block_param.
2013-01-10 18:46:33 +01:00
Max Kellermann
38474961fd Log, ...: include cleanup 2013-01-10 18:34:40 +01:00
Max Kellermann
d3e1b72d38 mixer/{alsa,pulse}: convert to C++ 2013-01-09 22:25:24 +01:00
Max Kellermann
ade0483641 Merge branch 'v0.17.x' 2012-10-02 17:34:03 +02:00
Gregory Smith
03a401e477 OSX: Set mDataByteSize correctly on AudioBuffers during render. 2012-10-02 17:27:52 +02:00
Max Kellermann
9a715267ad output/shout: move code to my_shout_configure()
Eliminate the evil goto.
2012-10-02 00:39:21 +02:00
Max Kellermann
d95e538020 Merge branch 'v0.17.x' 2012-10-02 00:36:05 +02:00
Max Kellermann
adbe8c409a output/{recorder,shout}: call encoder_read() in a loop
This is necessary for Ogg packets that span more than one page.
2012-10-02 00:26:40 +02:00
Max Kellermann
58e600f408 output/recorder: move code to _write_to_file() 2012-10-02 00:26:40 +02:00
Max Kellermann
d34e55c370 output/recorder: fix write() error check
We can only check for negative values if the variable is signed.
2012-10-02 00:20:42 +02:00
Max Kellermann
fbcbcdc001 output/recorder: make variables more local 2012-10-02 00:20:32 +02:00
Max Kellermann
4227a325a5 output/httpd: make variables more local 2012-10-02 00:20:13 +02:00
Max Kellermann
43d8252050 output/recorder, test/*: invoke encoder_read() after _open()
Make sure the file header gets written at the beginning, before
_write() gets called.
2012-10-02 00:18:18 +02:00
Max Kellermann
674b4ab647 output/shout: eliminate struct shout_buffer
Move the raw buffer to struct shout_data.
2012-10-02 00:18:04 +02:00
Max Kellermann
fe8fc1081a output/shout: remove shout_buffer.len
Make it a local variable instead.
2012-10-02 00:17:53 +02:00
Max Kellermann
c7748fedab output/shout: fix memory leak in error handler 2012-10-02 00:17:27 +02:00
Max Kellermann
c392efb481 output/shout: make variables more local 2012-10-02 00:17:17 +02:00
Max Kellermann
7d27d2ea5e Merge branch 'v0.17.x' 2012-08-14 23:58:54 +02:00
Max Kellermann
c9aaabb5d4 output/jack: implement method delay()
Eliminate the g_usleep() call.
2012-08-14 22:47:25 +02:00
Max Kellermann
335d5d5d72 output/pulse: implement method delay()
Reduce command latency while paused.
2012-08-14 22:30:46 +02:00
Max Kellermann
51d793bec1 output/pulse: simplify _wait_stream()
One large loop and only one pa_stream_get_state() call.
2012-08-14 22:22:55 +02:00
Max Kellermann
249dcd967e output/httpd: move delay from _pause() to _delay() 2012-08-14 21:54:47 +02:00
Max Kellermann
302972e9fc output/httpd: fix throttling bug after resuming playback
Reset the timer when paused and no client is connected.

This fixes Mantis ticket 0003527.
2012-08-14 21:39:33 +02:00
Max Kellermann
31b380b266 output/httpd: move code to _has_clients() 2012-08-14 20:22:32 +02:00
Max Kellermann
8e331cfc65 gcc.h: re-add gcc_const and gcc_pure
Remove GLib dependency from some headers.
2012-08-02 19:12:18 +02:00
Max Kellermann
edf811fa02 DatabaseVisitor, ...: use GError forward declaration 2012-08-02 19:12:06 +02:00
Max Kellermann
5dfc0918c3 require GLib 2.16
GLib 2.16 was released more than 4 years ago.  Let's remove some cruft
from the glib_compat.h header, and avoid new cruft to it.
2012-07-10 01:28:52 +02:00
Max Kellermann
457d98c860 output/raop: delete the RAOP plugin
This plugin is horrible code, I mean it.  Last year, I tried hard to
fix it, but I figured would take less time to do a full rewrite.
Given that I don't even have any device that supports RAOP, I can't do
that properly.  After 16 months, nobody volunteered for fixing it.
Hereby, I delete it, because having no RAOP plugin is better than
having this mess.  Sorry.
2012-05-29 23:15:41 +02:00
Max Kellermann
89377556cd output/alsa: multiply writei() result with out_frame_size
.. and not in_frame_size, because this relates to the frame size being
sent to ALSA.  pcm_export_source_size() will then turn it back into
the in_frame_size scale.
2012-04-23 21:54:09 +02:00
Max Kellermann
df1c5ce314 pcm_export: add _frame_size()
Move code from the ALSA output plugin.
2012-04-23 21:54:09 +02:00
Max Kellermann
a0e4b6e266 output/alsa: fix out_frame_size formula, multiply with channels
The hard-coded "3 bytes" was wrong because it ignored the number of
channels.
2012-04-23 21:54:08 +02:00
Max Kellermann
c22cbbf828 Merge branch 'v0.16.x'
Conflicts:
	src/output/osx_plugin.c
	src/text_input_stream.c
2012-04-05 00:45:39 +02:00
Max Kellermann
5acee73fc8 encoder/vorbis: generate end-of-stream packet when playback ends
Add the encoder_plugin method end().  This is important for the
recorder plugin.
2012-04-05 00:21:53 +02:00
Max Kellermann
a9edf85a69 output/jack: check for connection failure before starting playback 2012-04-04 21:40:56 +02:00
Max Kellermann
e7a1862517 output/jack: workaround for libjack1 crash bug 2012-04-04 21:38:29 +02:00
Max Kellermann
8ff0197a43 output/osx: use the fifo_buffer library instead of rolling own
The existing buffer implementation has a major flaw: it is unable to
re-fill the buffer until it has been consumed completely, leading to
many occasions where the render callback needs to generate silence,
just because the play() implementation was unable to append more
data.  The fifo_buffer library handles that well.
2012-03-28 21:51:17 +02:00
Max Kellermann
a2b5db0003 audio_format: remove SAMPLE_FORMAT_DSD_OVER_USB
DSD-over-USB should not be a MPD core format, because it is not a
"natural" format; it is just a temnporary over-the-wire format.  This
format has been implemented in pcm_export, and does not need to be
supported by pcm_convert.
2012-03-27 01:22:50 +02:00
Max Kellermann
2803ec2e96 output/alsa: support 32 bit DSD-over-USB 2012-03-27 01:22:50 +02:00
Max Kellermann
ddd4f675a2 pcm_export: implement 24 to 32 bit conversion
For 32 bit DSD-over-USB support.
2012-03-27 01:22:50 +02:00
Max Kellermann
d271dd2cce output/alsa: use pcm_export for the DSD-over-USB conversion 2012-03-27 01:22:50 +02:00
Max Kellermann
ebfdd37451 pcm_export: support DSD to DSD-over-USB conversion
Prepare for removing SAMPLE_FORMAT_DSD_OVER_USB.
2012-03-27 01:17:11 +02:00
Max Kellermann
f6d6110aaa output/alsa: move pcm_export_open() to caller
Give the caller more control, prepare for DSD-over-USB improvements.
2012-03-27 01:17:11 +02:00
Max Kellermann
2f0674807c output/alsa: more debug output 2012-03-27 00:14:37 +02:00
Max Kellermann
167242fec0 output/alsa: add option to enable DSD over USB 2012-03-22 01:30:16 +01:00
Max Kellermann
725fbe946b output/alsa: split the frame_size attribute
Make it in_frame_size and out_frame_size, to account for packing.
2012-03-22 01:01:11 +01:00
Max Kellermann
b99ecb4dc9 audio_format: remove the packed S24 format
For simplicity, the MPD core should not have to deal with packing.  It
is rarely used, and those plugins that need it should use the
pcm_export library instead.
2012-03-22 00:42:12 +01:00
Max Kellermann
208a96b211 output/alsa: use pcm_export to pack 24 bit samples 2012-03-22 00:33:59 +01:00
Max Kellermann
43774455cc output/oss: use pcm_export to pack 24 bit samples 2012-03-22 00:33:40 +01:00
Max Kellermann
5b61e077e0 pcm_export: add option "pack"
Converts padded 24 bit samples to packed 24 bit samples.  Will replace
the packed S24 sample format, which is not used internally.
2012-03-22 00:33:40 +01:00
Max Kellermann
921cc3e5db output/oss: remember the real OSS format
Improving oss_reopen() by using the very same value that was used
initially.
2012-03-22 00:33:40 +01:00
Max Kellermann
51dce3d161 output/alsa: simplify setup_format() 2012-03-22 00:29:56 +01:00
Max Kellermann
c10f013fc2 output/alsa: don't pass audio_format to _try_format()
Let the caller configure the audio_format object.
2012-03-22 00:24:56 +01:00
Max Kellermann
2874d68bdb output/alsa: simplify alsa_output_try_format_both()
Merge three functions into one and call get_bitformat() only once.
2012-03-22 00:23:07 +01:00
Max Kellermann
11e83eb7e7 output/oss: move code to oss_probe_sample_format() 2012-03-21 22:28:18 +01:00
Max Kellermann
170635e3a6 output/{alsa,oss}: move endian code to new library pcm_export 2012-03-21 21:16:50 +01:00
Max Kellermann
8c5ebdff36 audio_format: remove the reverse_endian attribute
Eliminate support for reverse endian samples from the MPD core.  This
moves a lot of complexity to the plugins that really need it (only
ALSA and CDIO currently).
2012-03-21 19:31:04 +01:00
Max Kellermann
1c84f324a1 output/oss: always receive host byte order samples
Don't use audio_format.reverse_endian.
2012-03-21 19:25:59 +01:00
Max Kellermann
3dba09f339 output/alsa: always receive host byte order samples
Don't use audio_format.reverse_endian.
2012-03-21 19:14:05 +01:00
Max Kellermann
766905ba9f output/alsa: merge alsa_data_free() into destructor 2012-03-21 18:58:11 +01:00
Rich Healey
396e97fc94 Fix the build on OSX 2012-03-21 10:32:54 +01:00
Max Kellermann
9c6a4505c8 audio_format: remove the format SAMPLE_FORMAT_DSD_LSBFIRST
This format is unused since the DSDIFF decoder plugin now reverses the
bit order.
2012-03-21 09:06:48 +01:00
Max Kellermann
08ce24ec3f audio_format: basic support for DSD-over-USB 2012-03-19 23:49:29 +01:00
Max Kellermann
5016839b90 use g_strerror() instead of strerror()
Make sure we get a UTF-8 encoded string.
2012-03-06 22:06:08 +01:00
Kurt Van Dijck
c551c8b31b raop_output: fix raop_session inbalance
raop_session_free must be called from raop_output_finish,
not from raop_output_remove.
In raop_output_remove, do close the ntp_server & control port.

Signed-off-by: Kurt Van Dijck <kurt.van.dijck@skynet.be>
2012-03-01 09:51:37 +01:00
Max Kellermann
2516496993 audio_format: add DSD sample format
Basic support for Direct Stream Digital.  No conversion yet, and no
decoder/output plugin support.
2012-03-01 01:15:22 +01:00
Max Kellermann
c616165f81 Merge branch 'v0.16.x'
Conflicts:
	NEWS
	configure.ac
	src/decoder/ffmpeg_decoder_plugin.c
	test/read_tags.c
2012-02-13 19:15:18 +01:00
Max Kellermann
9c92afa5fe output/winmm: remove pointless NULL check
pcm_buffer_get() cannot ever return NULL.
2012-02-13 18:10:36 +01:00
Max Kellermann
95b2df8261 output/osx: fix memory leak after AudioUnitSetProperty() failure 2012-01-04 20:47:41 +01:00
Max Kellermann
1ebadf8620 output/osx: implement 32 bit playback 2011-12-24 18:18:42 +01:00
Max Kellermann
9179d9592d output/osx: allocate the device in enable()
Keep the device open as long as the output is enabled, but initialize
it only when playback starts.
2011-12-24 18:15:24 +01:00
Max Kellermann
43c5058682 Merge branch 'v0.16.x' 2011-12-24 18:15:17 +01:00
Max Kellermann
97b4a6b51f output/osx: clear render buffer when there's not enough data
When we don't have enough data, generate some silence, hoping the
input buffer will fill soon.  Reducing the render buffer size is not
legal.
2011-12-24 17:59:36 +01:00
Max Kellermann
f405d27c56 output/osx: remove sleep call from render callback
Blocking inside the render callback is forbidden, and this sleep call
didn't make any sense.
2011-12-24 17:56:10 +01:00
Max Kellermann
78c4351e04 output/openal: improve synchronization
This plugin's use of the "Timer" library was wrong; it added the same
amount of virtual data in every iteration in _play(), but did not
actually play something.  This created an artificial, but useless,
delay.  This patch implements the method _cancel(), and implements
hard-coded sleep values.  This is only slightly better, but does not
attempt to look sane.
2011-12-13 22:02:05 +01:00
Max Kellermann
0a427890fe output/openal: move code to inline functions 2011-12-13 22:00:18 +01:00
Max Kellermann
e735abe334 output/openal: use alGetSourcei(AL_BUFFER) to force-unqueue buffers
The implementation of cancel() did not work well: you cannot use
alSourceUnqueueBuffers() to unqueue queued buffers, and our function
openal_unqueue_buffers() left the OpenAL library in a rather undefined
state; nothing was supposed to be queued, but the "filled" variable
was not reset.
2011-12-13 21:59:10 +01:00
Max Kellermann
c0070b2f13 output/openal: make attribute "filled" unsigned 2011-12-13 21:58:13 +01:00
Max Kellermann
cfedc6e9b4 output/openal: remove bogus format check from _open()
The expression "!format" does not make sense, and cannot occur.
2011-12-13 21:58:09 +01:00
Max Kellermann
b66d7f7e0b output/fifo: implement output_plugin method delay() 2011-12-13 21:58:07 +01:00
Max Kellermann
e01df06cd7 output/null: implement output_plugin method delay() 2011-12-13 21:58:02 +01:00
Max Kellermann
6584897b69 output/null: don't initialize the "timer" attribute in _init()
Unnecessary overhead.
2011-12-13 21:57:59 +01:00
Max Kellermann
aa4f45b9a5 Merge branch 'v0.16.x'
Conflicts:
	NEWS
	configure.ac
2011-12-13 21:57:44 +01:00
Max Kellermann
96ad5b8444 output/openal: force 16 bit playback, as 8 bit doesn't work
The OpenAL specification says that AL_FORMAT_MONO8 and
AL_FORMAT_STEREO8 expect unsigned 8 bit samples, but MPD uses unsigned
samples.
2011-12-13 21:32:19 +01:00
Denis Krjuchkov
33232face9 winmm_output_plugin: fail if wrong device specified instead of using fallback.
Silently choosing default is misleading and can cause hours of investigation.
It's better to fail immediately telling user what is wrong with config.
2011-12-13 19:12:33 +01:00
Max Kellermann
545685bc32 audio_format: basic support for floating point samples
Support for conversion from float to 16, 24 and 32 bit integer
samples.
2011-10-20 02:32:39 +02:00
Max Kellermann
8dd83a2cf3 output/roar: move code to _use_audio_format() 2011-10-08 14:51:19 +02:00
Max Kellermann
b43bf4dd74 Merge branch 'v0.16.x' 2011-10-08 14:50:44 +02:00
Max Kellermann
5ed0eb51d1 output/openal: auto-fallback to mono if channel count is unsupported
.. instead of failing playback completely.
2011-10-08 14:41:22 +02:00
Max Kellermann
72a1ca3b99 output/alsa: remove "default" case from switch
Allow gcc to warn when a new format isn't supported.
2011-10-08 14:41:11 +02:00
Steven Blackburn
21851c0673 Add support for streaming to a DLNA client
The Naim Uniti does not appear to support icecast-style streaming of FLAC
music but does support the codec from a DLNA server. This change looks for
"transferMode.dlna.org: Streaming" in the HTTP request header and responds
with something the Uniti (and hopefully other DLNA clients) accepts.

The only difference in the DLNA streaming mode is the reponse header and
that icecast metadata is disabled. If a client request indicates both modes
are supported, the DLNA mode is preferred (as the Uniti says it supports
both but then rejects a FLAC ICY stream).

Note: This change may be specific to Naim equipment (the only device it was
tested on). E.g. the hardcoding of Content-Length which works but is not a
logically correct value. The change should be backwards-compatible, so
only those clients requesting a DLNA stream will see any difference.
2011-09-30 08:53:09 +02:00
Dan McGee
8176880173 Simplify setsockopt() casting workaround
On Win32, the third setsockopt parameter has type (char *) while on POSIX
systems it is (void *). However, given that it is a no-op cast to go from a
char pointer to a void pointer, we can cast to a char pointer (with a
possible const modifier) on all platforms and satisfy the compiler.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-21 17:54:44 +02:00
Max Kellermann
3ea1073809 socket_util: move sockaddr_to_string() to resolver.c 2011-09-20 08:49:36 +02:00
Max Kellermann
76a959a578 rtsp_client, output/raop: use close_socket() instead of close() 2011-09-20 08:48:48 +02:00
Max Kellermann
921553d7bb Merge branch 'v0.16.x' 2011-09-20 08:47:06 +02:00
Max Kellermann
c476819cb1 fd_util: add function close_socket()
Wrap close(), use closesocket() on WIN32/WinSock.
2011-09-20 08:38:58 +02:00
Max Kellermann
b03f9ece05 glib_socket.h: wrap g_io_channel_*_new() calls portably
The server_socket library (used by the httpd output plugin) didn't
check for WIN32, that's fixed now.
2011-09-20 08:35:25 +02:00
Max Kellermann
74617389c8 output_plugin: the plugin allocates the audio_output object
Pass audio_output objects around instead of void pointers.  This will
give some more control to the plugin, and prepares for non-blocking
audio outputs.
2011-09-19 09:41:21 +02:00
Max Kellermann
1d8840412f configure.ac: add option --enable-solaris-output
Allow enabling the plugin explicitly without running Solaris, to test
the build.
2011-09-19 09:39:35 +02:00
Max Kellermann
ffa9f4b47f output/roar: check return values
Fixes gcc warnings.
2011-09-18 12:07:06 +02:00
Max Kellermann
667e22bbc7 output/roar: unknown volume is -1, not 0 2011-09-18 12:06:46 +02:00
Max Kellermann
d4d838c8bb output/roar: move code to roar_cancel_locked() and others
Wrap the locking code.
2011-09-18 11:51:18 +02:00
Max Kellermann
c61a889c86 output/roar: use GLib memory allocation functions
GLib has a built-in OOM handler.
2011-09-17 20:12:45 +02:00
Max Kellermann
567fe89a77 output/roar: use config_get_block_string() for temporary 2011-09-17 20:11:51 +02:00
Max Kellermann
950772ab8a output/roar: reorder methods 2011-09-17 20:10:26 +02:00
Max Kellermann
0bd0e2a3ec output: rename plugin variables
Consistent naming.
2011-09-17 20:04:18 +02:00
Max Kellermann
47774ce882 Merge branch 'v0.16.x' 2011-09-17 19:59:52 +02:00
Max Kellermann
3c9bcdd347 output: per-plugin header
Move the "extern" declarations from output_list.c, for more type
safety.
2011-09-17 19:51:41 +02:00
Max Kellermann
3934d2d30c output/pulse: don't expose internal struct in public header
Provide _lock() and _unlock() to wrap all accesses from the mixer
plugin.
2011-09-17 19:50:36 +02:00
Max Kellermann
423ce9557a output/raop: don't expose internal structs in public header 2011-09-17 19:44:30 +02:00
Max Kellermann
947848ebf6 output/roar: export volume methods
Use these instead of exposing the internal roar_t struct.
2011-09-17 19:33:51 +02:00
Max Kellermann
5e22fe488e output: rename plugin source files 2011-09-17 08:54:50 +02:00
Max Kellermann
c666cf1c44 output/pulse: move code to _setup_stream() 2011-09-17 08:53:53 +02:00
Max Kellermann
27206368da output/pulse: improve locking
Always lock the main loop when operating on PULSE objects.  Document
this.
2011-09-17 07:30:59 +02:00
Max Kellermann
87b624f5d5 Merge branch 'v0.16.x' 2011-09-16 07:52:39 +02:00
Max Kellermann
1cbba4fc59 input/curl, output/pulse: fix "unused local variable" warnings 2011-09-16 07:41:41 +02:00
Max Kellermann
9f5c938ff3 conf: add config_dup_block_path() 2011-09-09 23:01:22 +02:00
Max Kellermann
b42a8d2364 utils: parsePath() returns GError on failure
Better error messages.
2011-09-09 22:55:57 +02:00
Max Kellermann
35af940166 conf: get_block_param() returns a const pointer
No caller needs to write.
2011-09-09 21:36:41 +02:00
Max Kellermann
6a3008d7ff Merge branch 'v0.16.x'
Conflicts:
	configure.ac
	src/output_control.c
2011-09-01 19:19:42 +02:00
Max Kellermann
596f36bb78 output/osx: don't drain the buffer when closing
Eliminate an unnecessary source of deadlocks.
2011-09-01 18:21:46 +02:00
Max Kellermann
e7abdab58d output/osx: signal the GCond while mutex is locked 2011-09-01 18:21:46 +02:00
Max Kellermann
60f7ff3de5 output/pulse: reset callbacks before closing stream/context
Fixes assertion failure when a stream callback is invoked too late
after a format change.
2011-08-31 21:01:34 +02:00
Max Kellermann
e76c752987 output/pulse: add function _delete_stream()
Merge common code.
2011-08-31 21:01:22 +02:00
Max Kellermann
042c1abc6e output/pulse: use _delete_context()
Eliminate duplicate code.
2011-08-31 20:58:36 +02:00
Max Kellermann
1401621913 output/raop: remove Audio-Jack-Status check
The value of this is not used, the code is commented out - let's get
rid of it.
2011-08-31 20:19:36 +02:00
Max Kellermann
3c034b0a0c output/raop: remove empty function raopcl_stream_connect() 2011-08-31 20:17:24 +02:00
Max Kellermann
7f3dc5f040 output/raop: cast sendto() parameter to void pointer
Fix compilation on mingw32.
2011-08-31 08:30:26 +02:00
Max Kellermann
9209ccfa40 rtsp_client: allow parameter "kd" to be NULL
When the caller isn't interested in the values.
2011-08-31 08:16:55 +02:00
Max Kellermann
2525d32e17 rtsp_client: don't wait if packet is over due
Check if the time difference is negative.  That would have caused
sleeping forever.
2011-08-31 07:47:01 +02:00
Max Kellermann
57526067f5 output/raop: move code to raop_session_new()
.. and fix a few memory leaks.
2011-08-30 22:36:54 +02:00
Max Kellermann
34d9d8abd4 output/raop: merge raopcl_close() into _finish()
.. and fix a double free bug.
2011-08-30 22:20:32 +02:00
Max Kellermann
bd67e986f4 output/raop: free the raop_data object in finish() 2011-08-30 22:02:55 +02:00
Max Kellermann
e587518d85 output/raop: remove from the session when opening fails 2011-08-30 22:00:19 +02:00
Max Kellermann
210b6c38bd output/raop: move code to raop_output_remove() 2011-08-30 21:56:57 +02:00
Max Kellermann
74a39c715b ntp_server: move code to udp_server.c 2011-08-30 07:39:05 +02:00
Max Kellermann
195496333b output/raop: move RTSP client code to rtsp_client.c
Restore some of the original file structure from from raop_play.
2011-08-29 11:27:08 +02:00
Max Kellermann
9ccaa90439 ntp_server: use the I/O thread 2011-08-29 11:23:51 +02:00
Max Kellermann
a769352a74 output/raop: fallback for g_set_error_literal()
This function was added in GLib 2.18.  Make the plugin compatible with
older GLib versions.
2011-08-29 09:39:03 +02:00
Max Kellermann
8a63c27925 output/raop: move NTP code to separate library 2011-08-28 16:44:12 +02:00
Jonathan Neuschäfer
310895f060 rename 'Timer' to 'struct timer' 2011-08-27 11:30:34 +02:00
Max Kellermann
0575a6d652 output/raop: use GLib byte order macros 2011-08-24 02:19:40 +02:00
Max Kellermann
08b88714e0 output/raop: use fill_int() in fill_time_...()
Eliminate duplicate code.
2011-08-24 02:18:51 +02:00
Max Kellermann
bcaff4b844 output/raop: check if the "host" option is present
Better than dereferencing NULL.
2011-08-24 01:47:31 +02:00
Max Kellermann
82f336a78f output/raop: remove excessive debug messages 2011-08-24 01:47:27 +02:00
Max Kellermann
350aa33022 output/raop: consistently use GError 2011-08-24 01:47:26 +02:00
Max Kellermann
d6290a2f1a output/raop: use GLib heap functions 2011-08-24 01:47:25 +02:00
Max Kellermann
71e9d08863 output/raop: functions that always succeed return void
No point in returning true, and checking that.
2011-08-24 01:47:23 +02:00
Max Kellermann
9729dc7594 output/raop: rtspcl_connect() returns false on error
.. and not -1, which is "true".
2011-08-24 01:47:22 +02:00
Max Kellermann
92c1b8f31e output/raop: error checking in send_control_command() 2011-08-24 01:47:21 +02:00
Max Kellermann
9ffa2604f8 output/raop: make some allocations static
Allocate objects on the stack to reduce heap overhead.
2011-08-24 01:47:20 +02:00
Max Kellermann
03b1fad4d4 output/raop: remove unused local variables 2011-08-24 01:47:18 +02:00
Max Kellermann
72eb4c534f output/raop: make some exec_request parameters const 2011-08-24 01:47:17 +02:00
Max Kellermann
47d936e9cc output/raop: use "char*" for string buffers
Not unsigned char.  Eliminate useless casts.
2011-08-24 01:47:15 +02:00
Max Kellermann
8e08407090 output/raop: make send_control_command() static
Only used internally.
2011-08-24 01:47:14 +02:00
Max Kellermann
c0a4558c62 output/raop: remove useless test_default_device() implementation
This defaults to "false" when the method pointer is NULL.
2011-08-24 01:47:13 +02:00
Max Kellermann
5ecb6fecc4 Merge branch 'v0.16.x' 2011-08-24 01:47:10 +02:00
Max Kellermann
b3df4dc2c9 output/pulse: fix deadlock when the stream was suspended
Check if the stream is suspended; wake up the main loop when it
becomes suspended.
2011-08-23 23:02:13 +02:00
Max Kellermann
3db9ab82ea output/pulse: add assertions 2011-08-23 22:48:22 +02:00
Max Kellermann
2dc3acc5f0 output/pulse: return 0 on error
Not a bool.
2011-08-23 22:48:22 +02:00
Max Kellermann
25686e5bce pulse/output: fix deadlock when resuming the stream
Unlock the mainloop in all code paths.
2011-08-23 22:45:47 +02:00
Max Kellermann
7c887af1ea output/httpd: add assertions 2011-08-23 18:14:39 +02:00
Max Kellermann
b7f435b50e output/httpd: don't warn on client disconnect
This warning should only be logged when we really received something.
When the client disconnects, G_IO_IN is triggered, and the read
returns G_IO_STATUS_EOF.
2011-08-23 18:02:56 +02:00
Jonathan Neuschäfer
eea726740b output/raop: rewrite remove_char_from_string 2011-07-25 11:23:22 +02:00
Max Kellermann
0ea4c970d7 Merge branch 'v0.16.x'
Conflicts:
	src/player_thread.c
	src/playlist_control.c
2011-07-20 21:46:05 +02:00
Max Kellermann
57936a1374 output/raop: use memset() instead of bzero()
There's no bzero() on WIN32.
2011-07-20 21:20:23 +02:00
Max Kellermann
9242fde6b8 output/raop: include winsock.h on WIN32 2011-07-20 21:18:55 +02:00
Max Kellermann
d1f653be65 output/raop: use GMutex instead of pthread_mutex_t
Be portable on WIN32.
2011-07-20 21:11:06 +02:00
Max Kellermann
0035dceb0a output/raop: add missing mutex unlock call in error handler 2011-07-20 21:09:39 +02:00
Max Kellermann
838f7cd210 encoder_plugin: add method pre_tag()
In the "vorbis" plugin, this is a copy of the old flush() method,
while flush() gets a lot of code remove, it just sets the "flush" flag
and nothing else.  It doesn't start a new stream now, which should fix
a few problems in some players.
2011-07-20 20:54:34 +02:00
Max Kellermann
13539961b2 output/httpd: explicitly convert size_t to bool in pause() 2011-07-20 19:16:47 +02:00
Max Kellermann
d1eeed6a5b output/alsa: fix SIGFPE when alsa announces a period size of 0 2011-07-20 06:54:51 +02:00
Jonathan Neuschäfer
a222c4879c output/shout: fix a memory leak 2011-07-19 00:24:48 +02:00
Max Kellermann
eb2f413cf0 Merge branch 'v0.16.x'
Conflicts:
	NEWS
	configure.ac
2011-07-19 00:24:20 +02:00
Jonathan Neuschäfer
7d6a605a85 output/shout: fix a memory leak 2011-07-18 22:04:48 +02:00
Jonathan Neuschäfer
a6a8bdffc3 output/recorder: fix a memory leak 2011-07-18 22:04:10 +02:00
Jonathan Neuschäfer
296085ff23 output/httpd: add missing g_free in error path 2011-07-18 22:04:06 +02:00
Jonathan Neuschäfer
36aa8ce3c9 output/ao: add missing g_free in error path 2011-07-18 22:03:48 +02:00
Hans-Kristian Arntzen
d9353c4fd3 Remove unused headers in Roar plugin.
Should fix build errors for Win32.
2011-03-23 21:59:22 +01:00
Max Kellermann
0c9fc2f809 Merge commit 'release-0.16.2'
Conflicts:
	Makefile.am
	NEWS
	configure.ac
2011-03-19 09:58:07 +01:00
Max Kellermann
8d83914f05 output/httpd: include sys/socket.h only when building with libwrap
Fixes build failure on WIN32.
2011-03-18 19:44:12 +01:00
Max Kellermann
6dcec36621 Merge release 0.15.16 into v0.16.x
Conflicts:
	NEWS
	configure.ac
	src/output/jack_plugin.c
	src/update.c
2011-03-16 18:08:54 +01:00
Hans-Kristian Arntzen
1a954748a0 RoarAudio output plugin 2011-03-16 17:57:47 +01:00
Ulrich Spörlein
e2aea6bce5 output/httpd: include sys/socket.h for AF_UNIX 2011-03-09 19:53:48 +01:00
Max Kellermann
a1d1c2beaa output/oss: disable 24 bit playback on FreeBSD
See code comment.
2011-02-28 00:09:45 +01:00
Max Kellermann
ee9c60fad4 output/oss: AFMT_S24_PACKED is little-endian
According to the Solaris dsp manpage, AFMT_S24_PACKED is
little-endian:

 http://download.oracle.com/docs/cd/E19963-01/821-1475/6nmf5baot/index.html

The Minix soundcard.h header says the same.
2011-02-28 00:00:41 +01:00
Max Kellermann
1674a4ec82 output/jack: fix crash with mono playback
With mono sound, jack_sample_size is smaller than frame_size (4 vs 2
bytes), and "space/jack_sample_size==0".  That means mpd_jack_play()
will return 0, although no error has occurred.
2011-02-27 23:26:50 +01:00
Max Kellermann
ce370bee60 output/jack: rename variable sample_size to jack_sample_size 2011-02-25 10:46:44 +01:00
Christopher Brannon
2a1f4539f6 Insure proper initialization of stack-allocated struct.
Version 1.0.0 of the libao library added a new field to the
ao_sample_format struct.  It is a char * named matrix.  When
an ao_sample_format is allocated on the stack, this field contains
garbage.  The proper course is to insure that is initialized to NULL.
NULL indicates that we do not want any mapping.
The struct is now initialized using a static initializer, and this
technique is compatible with all known versions of libao.
2011-02-15 12:16:25 +01:00
Thomas Jansen
144d092637 output/shout: add possibility to set url
Added a new optional parameter for the shout plugin called "url".
2011-02-09 22:42:51 +01:00
Thomas Jansen
948b8f35e6 general: whitespace cleanup
Remove trailing whitespace found by this command:
find -name '*.[ch]' | xargs grep "[[:space:]]$"
2011-02-09 22:42:31 +01:00
Thomas Jansen
e776c605ad output/httpd: initialize unflushed_input
This fixes the following valgrind warning occuring on the first call of
httpd_output_read_page:
==20124== Conditional jump or move depends on uninitialised value(s)
==20124==    at 0x425E65: httpd_output_read_page (httpd_output_plugin.c:240)
==20124==    by 0x426087: httpd_output_open (httpd_output_plugin.c:279)
==20124==    by 0x41D862: ao_open (output_plugin.h:206)
==20124==    by 0x41E133: audio_output_task (output_thread.c:590)
2011-02-09 22:41:36 +01:00
Max Kellermann
c6cbcc2c25 copyright year 2011 2011-01-29 10:13:54 +01:00
Dustin Puckett
79e0db4ca0 output/raop: new output plugin
Remote Audio Output Protocol (RAOP), for Apple devices.
2011-01-28 21:17:09 +01:00
Max Kellermann
1a2ea4c06c Merge branch 'v0.16.x'
Conflicts:
	NEWS
	configure.ac
2011-01-07 23:52:23 +01:00
Max Kellermann
8c0afd8557 Merge branch 'v0.15.x' into v0.16.x
Conflicts:
	NEWS
	configure.ac
	src/directory.h
2011-01-07 23:50:23 +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
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
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
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
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
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
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
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
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
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
Max Kellermann
5b996ab880 output/httpd: access sockaddr_storage object directly
Work around aliasing warning.
2010-09-23 09:01:17 +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
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
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
9cce1d749a output/win32: new output plugin for Windows Wave 2010-05-20 09:33:05 +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
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
James Pike
c52f469c9c output/httpd: added name/genre/website configuration 2010-04-05 13:11:10 +02:00
Avuton Olrich
06f86b4532 Add support for building httpd_output plugin for win32 2010-03-22 07:15:39 -07: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
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
26841b6058 output/alsa: support packed 24 bit samples 2010-01-17 00:43:24 +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
Avuton Olrich
9d3865cb95 Update copyright notices. 2009-12-31 20:58:43 -08:00
Viliam Mateicka
ac0bf1a445 httpd: use get_mime_type to determine encoder content 2009-12-03 20:27:08 +01:00
Max Kellermann
c412d6251e audio_format: changed "bits" to "enum sample_format"
This patch prepares support for floating point samples (and probably
other formats).  It changes the meaning of the "bits" attribute from a
bit count to a symbolic value.
2009-12-02 22:29:50 +01:00
Max Kellermann
39404725f0 output/openal: use audio_format_to_string() 2009-11-15 16:20:20 +01:00
Max Kellermann
5b82ffc291 include config.h in all sources
After we've been hit by Large File Support problems several times in
the past week (which only occur on 32 bit platforms, which I don't
have), this is yet another attempt to fix the issue.
2009-11-12 09:17:03 +01:00
Max Kellermann
b722d3d7f3 configure.ac: require GLib 2.12
Drop the required GLib version from 2.16 to 2.12, because many current
systems still don't have GLib 2.16.  This requires several new
compatibility functions in glib_compat.h.
2009-11-10 21:14:22 +01:00
Max Kellermann
e0e6813a1d fd_util: removed creat_cloexec()
Add a "mode" argument to open_cloexec() instead.
2009-11-10 16:53:24 +01:00
Max Kellermann
54033c74e4 output/alsa: fill period buffer with silence before draining
ALSA passes full period buffers to the hardware.  If an application
doesn't finish writing a period, libasound will nonetheless send the
partial buffer (with undefined trailing data).  This causes noise at
the end of playback.  This patch attempts to track the current
position within the period buffer, and generates silence at the end,
before calling snd_pcm_drain().
2009-11-09 22:22:31 +01:00
Max Kellermann
f66edccffd fd_util: added O_NONBLOCK functions
Changed the wrappers for pipe(), socket(), accept().  On WIN32, this
does not work for pipe().
2009-11-08 22:11:35 +01:00
Max Kellermann
e3af0032b2 set the close-on-exec flag on all file descriptors
Added the "fd_util" library, which attempts to use the new thread-safe
Linux system calls pipe2(), accept4() and the options O_CLOEXEC,
SOCK_CLOEXEC.  Without these, it falls back to FD_CLOEXEC, which is
not thread safe.

This is particularly important for the "pipe" output plugin (and
others, such as JACK/PulseAudio), because we were heavily leaking file
descriptors to child processes.
2009-11-07 18:55:16 +01:00
Max Kellermann
375fd5ed4c output/jack: added option "server_name" 2009-11-07 17:26:21 +01:00
Max Kellermann
c9f726048c output/httpd: moved code to httpd_output_bind() 2009-11-07 16:52:44 +01:00
Max Kellermann
41f3f12709 output/jack: free source port names on exit
Make valgrind happy.
2009-11-07 15:17:48 +01:00
Max Kellermann
ba34d48cf0 output/jack: dynamic source port list
Same as the previous patch: create up to 16 configured source ports.
The plugin tries to do its best at guessing the right combination for
the given input file, the number of source and destination ports.
2009-11-06 18:58:35 +01:00
Max Kellermann
2598dd5109 output/jack: dynamic destination port list
Support up to 16 configured destination ports, that should really be
enough for everybody.
2009-11-06 18:55:26 +01:00
Max Kellermann
fac6e9ecdb output/jack: renamed option "ports" to "destination_ports"
Be more clear which kind of port should be configured here.
2009-11-06 01:54:58 +01:00
Max Kellermann
dbbead6e72 output/jack: renamed "output ports" to "destination ports"
Use the same name as in the libjack API documentation.
2009-11-06 01:35:19 +01:00
Max Kellermann
945287358b output/httpd: bind port when output is enabled
Implement the methods enable() and disable().  Bind the HTTP port in
the enable() method, but reject all incoming connections until the
output is opened.
2009-11-05 23:47:29 +01:00
Max Kellermann
979cd5a768 output/jack: support mono input
When MPD plays a mono song (audio_format.channel==1), connect only one
source port to both destination ports.
2009-11-05 20:02:04 +01:00
Max Kellermann
a68da8a475 output/jack: clear ring buffers before activating
After playback has stopped, the ring buffers may still contain
samples.  These will be played when playback is started the next
time.  We should clear the buffers each time.
2009-11-05 20:01:50 +01:00
Max Kellermann
2a9685cb3a output/jack: use jack_client_open() instead of jack_client_new()
jack_client_new() is deprecated.  This requires libjack 0.100
(released nearly 5 years ago).  We havn't been testing older libjack
versions anyway.

As a side effect, there is the new option "autostart".
2009-11-05 20:01:18 +01:00
Max Kellermann
88abfc0d0f output/jack: added option "client_name"
Instead of using MPD's audio output name (setting "name"), use a
separate configuration option.  Change the default to "Music Player
Daemon".
2009-11-05 19:55:00 +01:00
Jeffrey Middleton
4dc25d3908 alsa_plugin.c: workaround snd_pcm_drain bug
Reintroduce a fix from commit 52a0653 (Warren Dukes): "don't call
snd_pcm_drain unless we're already in the RUNNING state". This prevents
ALSA with dmix from sometimes hanging when snd_pcm_drain is called, e.g.
when moving from one song to the next (as in mantis issue 2634).
2009-11-02 23:58:15 -06:00
Viliam Mateicka
bb5acc939f httpd: add config option to limit number of clients 2009-10-29 22:38:18 +01:00
Max Kellermann
1403172ef3 output_plugin: added method "drain"
drain() is the opposite of cancel(): it waits until all data in the
buffer has finished playing.  Instead of implicitly draining in the
close() method like the ALSA plugin has been doing it forever, let the
output thread decide whether to drain or to cancel.
2009-10-29 15:59:40 +01:00
Max Kellermann
f74ee1a352 output/alsa: don't recover on CANCEL
The recovery is for nothing if we get CLOSE afterwards.  Let's not
recover in the cancel() method, and let the next play() call sort it
out.
2009-10-29 15:59:35 +01:00
Max Kellermann
82af161210 output/pulse: initialize pulse_output.mixer
This variable was uninitialized and led to crashes.
2009-10-29 15:58:18 +01:00
Alam Arias
83a9cf74fb include pulse/version.h for PA_CHECK_VERSION 2009-10-27 07:46:53 +01:00
Max Kellermann
ac830468bf output/jack: implement methods enable()/disable()
Don't connect to JACK before MPD has daemonized.
2009-10-23 10:56:25 +02:00
Max Kellermann
7547b1170b output/pulse: implement methods enable()/disable()
Don't connect to PulseAudio before MPD has daemonized.
2009-10-23 10:56:16 +02:00
Max Kellermann
e53ca368a5 output_plugin: added methods enable() and disable()
With these methods, an output plugin can allocate some global
resources only if it is actually enabled.  The method enable() is
called after daemonization, which allows for more sophisticated
resource allocation during that method.
2009-10-23 10:55:52 +02:00
Max Kellermann
c426a0bc5c output/pulse: call mixer on state changes
Don't let the mixer plugin "override" the libpulse callbacks.
Instead, add a "mixer" attribute to the pulse_output struct, and call
the mixer on all interesting events.
2009-10-23 10:33:26 +02:00
Max Kellermann
80ac82c8fb output/fifo: renamed source to fifo_output_plugin.c 2009-10-22 19:23:30 +02:00
Max Kellermann
9526fdbe73 audio_format: wildcards allowed in audio_format configuration
An asterisk means that this attribute should not be enforced, and
stays whatever it used to be.  This way, some configuration values
work like masks.
2009-10-21 23:01:04 +02:00
Max Kellermann
83844ec239 output/jack: make ringbuffer_size a size_t 2009-10-21 21:39:26 +02:00
Max Kellermann
1bfd25be35 output/jack: connect to server on MPD startup
.. and keep up the JACK connection while MPD runs.  Allocate the ring
buffers on the first open, and free them at MPD exit.
2009-10-21 21:37:11 +02:00
Max Kellermann
cee216f2dc output/jack: removed the empty "cancel" method
JACK doesn't need cancel() because it won't do much anyway.  Buffers
are small.
2009-10-21 21:01:00 +02:00
Max Kellermann
27c246e8d9 output/jack: renamed parameter "error" to "error_r"
It's a double pointer.
2009-10-21 20:13:39 +02:00
Max Kellermann
1ff39476eb output/jack: implement the "pause" method
Don't disconnect from JACK during pause.
2009-10-21 18:33:05 +02:00
Max Kellermann
acfd9a73bc output/jack: renamed source to jack_output_plugin.c 2009-10-21 18:33:01 +02:00
Max Kellermann
b479a264b6 pulse: code rewrite using the asynchronous libpulse API
This is a complete rewrite of the PulseAudio output plugin.  It uses
the asynchronous API, which gives us more control over everything.
Additionally, it connects to the PulseAudio server on startup, and
keeps this connection up while MPD runs.  During pause, instead of
closing the stream, it enables "cork".
2009-10-21 10:30:42 +02:00
Max Kellermann
097e200a97 mixer/{oss,alsa}: renamed the mixer source files 2009-10-20 21:23:05 +02:00
Max Kellermann
bd28caed3c output/pulse: renamed context to "Music Player Daemon"
This looks nicer in the PulseAudio manager than just "mpd".
2009-10-20 21:07:38 +02:00
Max Kellermann
bc4266bef8 pulse: renamed source files 2009-10-20 21:05:11 +02:00
Max Kellermann
bc629c8a3e pulse: announce "media.role=music"
This allows PulseAudio to do some advanced tweaks.
2009-10-20 21:02:10 +02:00
Max Kellermann
ea616b3ed4 tag: removed the "_ITEM_" suffix from the enum names 2009-10-13 16:12:45 +02:00
Max Kellermann
4390d72b14 configure.ac: require GLib 2.16
Accidently, MPD has been using several GLib 2.16 functions for a
while, and nobody noticed yet.  To simplify the code base, let's bump
the minimum GLib version for MPD to 2.16.  That version is old enough,
and it's reasonable to expect users to have it.
2009-10-13 16:12:43 +02:00
Patrik Weiskircher
32f212cb86 output/osx: fix the OS X 10.6 build
Include CoreServices/CoreServices.h.
2009-09-20 23:30:37 +02:00
Patrik Weiskircher
803a698f98 output/osx: fix the OS X 10.6 build
Include CoreServices/CoreServices.h.
2009-09-20 23:28:07 +02:00
Serge Ziryukin
761771ad24 output/openal: support OpenAL plugin on Mac OS X 2009-09-07 15:52:32 +02:00
Serge Ziryukin
eefef369ea output/openal: fix default device name 2009-09-06 22:22:17 +02:00
Serge Ziryukin
8b6a5d19d0 openal output plugin 2009-09-06 17:34:56 +02:00
Max Kellermann
4a0d4a02a6 output/recorder: new output plugin for recording radio streams
The recorder plugin writes audio played by MPD to a file.  This may be
useful for recording radio streams.

This implementation is incomplete, because support for tags is
missing, and MPD should be able to record each track to a different
file.
2009-08-24 18:57:06 +02:00
Max Kellermann
f401c1059c Merged release 0.15.2 from branch 'v0.15.x'
Conflicts:

	NEWS
	configure.ac
2009-08-15 21:18:38 +02:00
Max Kellermann
f38ce5408b output/shout: minimize the unpause latency
During the pause loop, manually sleep for 500ms if shout_delay()
returns a value greater than that.  Don't exhaust libshout's buffer.
2009-08-14 11:52:36 +02:00
David Woodhouse
49ede85827 Support wrong-endian ALSA output 2009-07-19 17:15:35 +01:00
Max Kellermann
58dd6eee5d output/httpd: removed duplicate sys/types.h include
The first patch by Patrick didn't work, because his "#ifdef HAVE_OSX"
line would have required config.h.
2009-07-14 14:23:44 +02:00
Max Kellermann
64ca94c910 output/httpd: include sys/types.h
On Mac OS X, the httpd plugin cannot be compiled, because OS X's
system headers do nto include sys/types.h, although they use
u_int32_t.
2009-07-06 14:40:06 +02:00
Max Kellermann
ddc2694419 conf: eliminated CamelCase
Renamed all remaining CamelCase functions.
2009-06-03 06:55:04 +02:00
Patrik Weiskircher
7e678d2ba9 latest git, httpd_output_plugin compile fix, mac os x
Hello,

While compiling latest git I've received a compile error in the
httpd_output_plugin.
Small patch attached.

Patrik
2009-05-10 21:15:53 +02:00
Max Kellermann
4818d38677 httpd_output: save the page generated by encoder_tag()
Flush the encoder before calling encoder_tag().  The first page
generated by the encoder after sending the tag will be the new
"header" page, which is sent to all HTTP clients when they connect.
This is a little bit specific to the vorbis encoder, but there are no
other encoders which support tags (yet).
2009-05-05 22:51:17 +02:00
Max Kellermann
e55e560d4e httpd_output: moved code to httpd_output_encoder_to_clients()
Moved some code from httpd_output_encode_and_play() into separate
functions httpd_output_broadcast_page() and
httpd_output_encoder_to_clients().
2009-05-05 22:43:28 +02:00
Max Kellermann
9080797025 httpd_output: disable Icy-Metadata when encoder supports tags
There's no reason to send both encoder tags and Icy-Metadata to the
client.  Let's disable Icy-Metadata when the encoder supports embedded
tags.
2009-05-05 22:41:36 +02:00
Max Kellermann
795569208a httpd_output: assert that tag!=NULL
In the tag() method, MPD guarantees that it does not pass tag==NULL.
Converted the runtime check to an assertion.
2009-05-05 22:36:44 +02:00
Max Kellermann
85658965c9 alsa_output: don't use atexit() to clean up the ALSA library
Call snd_config_update_free_global() manually in our finish() method,
don't use atexit().
2009-04-21 22:47:12 +02:00
Max Kellermann
9919704be3 httpd: use C99 "bool" instead of GLib's gboolean
Plain "bool" consumes only one byte instead of four.
2009-04-13 19:39:19 +02:00
Max Kellermann
3f81f5b476 httpd: use g_ascii_strncasecmp() to compare headers
In HTTP, header names are case insensitive.
2009-04-13 19:39:16 +02:00
Hagen Schink
92ba754fc6 Implemented basic icy support for the httpd output
[mk: folded with patch "Put icy related functions in extra source
files"; moved icy_server.c from HAVE_CURL to ENABLE_HTTPD_OUTPUT;
removed an unused variable]
2009-04-13 19:35:02 +02:00
Max Kellermann
cd6182862a httpd: don't pass uninitialized page to httpd_client_check_queue()
The httpd_client_check_queue() callback function does not use its
"user_data" argument.  Don't pass any, and fix the gcc warning.
2009-04-01 22:45:21 +02:00
Max Kellermann
52575d1b9d pulse: make configuration strings const
Nobody needs to modify these strings.  We can make them const, and
convert config_dup_block_string() to config_get_block_string().  This
also fixes memory leaks in the pulse mixer.
2009-03-26 19:50:10 +01:00
Max Kellermann
cd4964cdee pulse: don't check config_param!=NULL
The conf.h functions deal well with config_param==NULL and will return
the specified default value then.
2009-03-26 19:50:02 +01:00
Max Kellermann
66a2c5669e output_plugin: replaced output_plugin.get_mixer() with mixer_plugin
The mixer core library is now responsible for creating and managing
the mixer object.  This removes duplicated code from the output
plugins.
2009-03-26 18:23:23 +01:00
Jeffrey Middleton
91f3370913 httpd: fixed encoder plugin check
Check if encoder_plugin!=NULL, not encoder_plugin_get (which is a
function).
2009-03-17 06:52:23 +01:00
Max Kellermann
bba127a392 solaris: new audio output plugin for Solaris /dev/audio 2009-03-16 09:55:10 +01:00
Max Kellermann
870706519a httpd_output: check client->write_source_id in handler
Due to a race condition, httpd_client_out_event() could be called even
when its GLib event source was already removed.  Check that case.
2009-03-15 19:06:14 +01:00
Max Kellermann
58844aabac httpd_output: clear the client's page queue on cancel
When the httpd output is cancelled, it freed all pages, but didn't
remove them from the queue.  Call g_queue_clear() and remove the
write source id.
2009-03-15 19:06:10 +01:00
Max Kellermann
e62580db0b httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup!  MPD can do better if it's doing the HTTP server
stuff on its own.  This new plugin has several advantages:

- easier to set up - only one daemon, no password settings, no mount
  settings
- MPD controls the encoder and thus already knows the packet
  boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening

This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...).  It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server.  Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
Max Kellermann
b488355df8 mixer_api: moved mixer_plugin imports to mixer_list.h
This patch allows the output plugins to import only mixer_list.h,
instead of the full mixer_api.h (which would expose internal
structures).
2009-03-14 11:36:59 +01:00
Max Kellermann
a5017a2d7c mixer_api: moved functions to mixer_control.c
mixer_control.h should provide the functions needed to manipulate a
mixer, without exposing the internal mixer API (which is provided by
mixer_api.h).
2009-03-14 11:36:50 +01:00
Avuton Olrich
0aee49bdf8 all: Update copyright header.
This updates the copyright header to all be the same, which is
pretty much an update of where to mail request for a copy of the GPL
and the years of the MPD project. This also puts all committers under
'The Music Player Project' umbrella. These entries should go
individually in the AUTHORS file, for consistancy.
2009-03-13 11:51:55 -07:00
Max Kellermann
cff29f5e86 alsa: use snd_pcm_sframes_t instead of int
snd_pcm_writei() returns the type snd_pcm_sframes_t, not int.  Use the
correct variable type.
2009-03-10 21:31:13 +01:00
Max Kellermann
855054fee1 alsa: don't close PCM handle in alsa_recover()
If the PCM handle gets disconnected, don't close and clear it in
alsa_recover().  The MPD core will call alsa_close() anyway.  This
way, we can always assume that alsa_data.pcm is always valid.
2009-03-10 21:25:45 +01:00
Max Kellermann
ab656a52da alsa: determine buffer_time if not already known
This patch fixes a theoretical (but practically impossible) flaw: the
variable "buffer_time" may be uninitialized when it is used.
Initialize the variable with snd_pcm_hw_params_get_buffer_time().
2009-03-08 04:11:30 +01:00