Commit Graph

4971 Commits

Author SHA1 Message Date
Max Kellermann 937b2b1744 sticker: added fallback for sqlite3_prepare_v2()
This function was not present in SQLite < 3.4.
2009-11-10 20:55:29 +01:00
Max Kellermann 8c0680f6b9 input/lastfm: fixed variable name in GLib<2.16 code path
Should be "lastfm_user", not "lastfm_username".
2009-11-10 20:54:17 +01:00
Max Kellermann 118495d372 decoder/flac: pass void pointer to flac_convert()
That function diverts into various bit formats; it doesn't need a
typed pointer.
2009-11-10 19:57:58 +01:00
Max Kellermann a6bee71f1a decoder/flac: pass audio_format.bits to flac_convert()
Don't use audio_format_sample_size() for identifying the sample
format.
2009-11-10 19:57:28 +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 3d2a9d3545 fd_util: added function pipe_cloexec()
Same as pipe_cloexec_nonblock(), but doesn't set non-blocking mode.
2009-11-10 16:53:20 +01:00
Max Kellermann 6975c087e0 decoder_list: fix decoder_plugin_from_mime_type()
Copy'n'paste error: call decoder_plugin_supports_mime_type() instead
of decoder_plugin_supports_suffix().
2009-11-09 22:49:05 +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 8420f1420f player_thread: drain audio outputs at the end of the playlist
When there's no queued song, and the current one has finished playing,
first make sure that the hardware outputs have really finished playing
the last chunk: call the drain() method in all audio outputs.  Without
this patch, MPD stopped playback shortly before the ALSA sound card
had finished playing.
2009-11-09 22:22:27 +01:00
Max Kellermann 3359f8785e output_thread: added command DRAIN
This command manually drains the hardware buffer.  This is useful when
the player thread want to make sure that everything has been played.
2009-11-09 22:16:26 +01:00
Max Kellermann 96b974bc45 player_control: removed the "volatile" attribute
Our use of the "volatile" keyword was wrong from the start, and now
that we have proper locking, we can safely remove all of them.
2009-11-09 20:33:45 +01:00
Max Kellermann 1a4025420c fd_util: added missing NONBLOCK fallback for socket() 2009-11-08 22:24:02 +01:00
Max Kellermann 223b0db5bd fd_util: relicense under BSD 2-clause
We'll copy this code to libmpdclient, and that's easier if its license
is BSD.
2009-11-08 22:15:22 +01:00
Max Kellermann 2f4144e1cd utils: removed function set_nonblocking()
It's not used anymore, its features have been moved to fd_util.c.
2009-11-08 22:11:37 +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 b043ade456 fd_util: fixed typo in API documentation 2009-11-08 22:07:14 +01:00
Max Kellermann 217b494cc5 encoder/null: removed empty close() method
That's an optional method.
2009-11-08 21:44:01 +01:00
Max Kellermann 5ef62312af encoder/null: removed unused audio_format attribute 2009-11-08 21:43:19 +01:00
Max Kellermann 5479ed7cfb fd_util: added API documentation 2009-11-08 21:38:52 +01:00
Max Kellermann cac63bfd21 fd_util: unexport fd_set_cloexec()
This function is used only internally.
2009-11-08 21:38:38 +01:00
Max Kellermann 1573ea1485 inotify: set close-on-exec flag
Added wrapper for inotify_init1() to fd_util.c.
2009-11-07 19:02:53 +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 9b21152600 decoder_thread: close input file
An input_stream_close() call was missing after today's code
reorganization.
2009-11-07 17:58:52 +01:00
Max Kellermann c440faa94d log: redirect stdout/stderr to /dev/null if syslog is used
Don't hold a file descriptor on root's tty when syslog is used for
logging.
2009-11-07 17:48:57 +01:00
Max Kellermann 375fd5ed4c output/jack: added option "server_name" 2009-11-07 17:26:21 +01:00
Max Kellermann ec25cda68b output_all: automatically attempt to re-enable failed outputs
When an output's enable() method has failed, and playback starts,
retry to enable it.  Without this, the user may be confused, because
he sees the device is "enabled" but cannot use it, and currently there
is no error message in the log.
2009-11-07 17:22:34 +01:00
Max Kellermann c9f726048c output/httpd: moved code to httpd_output_bind() 2009-11-07 16:52:44 +01:00
Max Kellermann c2251dc5a2 exclude: use GPatternSpec instead of fnmatch()
GLib's version of fnmatch() is more portable.
2009-11-07 16:29:29 +01:00
Max Kellermann a505cbc6c9 added missing source file decoder_print.c 2009-11-07 16:28:21 +01:00
Max Kellermann c422344190 database: I/O error handling in db_save()
Check ferror() instead of the fprintf() return value.
2009-11-07 16:20:07 +01:00
Max Kellermann 1a4cfc3d90 update_walk: log new container files 2009-11-07 16:03:25 +01:00
Max Kellermann 2f1bd39be8 command: added command "decoders"
This command prints a list of decoder plugins and their suffixes /
MIME types.
2009-11-07 15:57:22 +01:00
Max Kellermann 4624dfcb30 decoder_list: moved print_all_decoders() to cmdline.c
Export the decoder_plugins array.  The function
decoder_plugin_print_all_decoders() it is UI specific and should not
live in this backend library.
2009-11-07 15:46:45 +01:00
Max Kellermann 3546d931a1 decoder_thread: check for STOP before calling the plugin
Before calling the plugin's decode method, we should ensure that we
didn't receive a STOP command during initialization.
2009-11-07 15:37:18 +01:00
Max Kellermann 4dadb965a7 decoder_thread: moved code to decoder_input_stream_open()
This function opens the stream and waits for it to become ready;
meanwhile it checks for STOP commands.  It is code moved from
decoder_run_stream().
2009-11-07 15:35:50 +01:00
Max Kellermann f2184db1cd decoder_thread: added local variable "dc" in decoder_run_file()
Simplify the expressions.
2009-11-07 15:24:38 +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 5d55b45654 decoder_list: pass previous plugin pointer to lookup functions
Remove the static integer hack, that's not thread safe and sucks.
2009-11-07 15:14:16 +01:00
Max Kellermann e3da174fca decoder_list: moved suffix/mime_type checks to decoder_plugin.c 2009-11-07 15:14:11 +01:00
Max Kellermann bb862a8ceb decoder_list: back to NULL terminated list
A NULL terminated list is easier to iterate.
2009-11-07 15:14:09 +01:00
Max Kellermann 9ba900486e decoder_thread: open input stream on demand
Moved the global input stream opener to decoder_run_stream().
decoder_run_file() now opens the input stream each time a plugin
provides a stream decoder method.
2009-11-07 15:10:12 +01:00
Max Kellermann 587284bae6 decoder_thread: moved plugin loops to separate functions
Tame the large decoder_run_song() function.
2009-11-07 14:57:46 +01:00
Max Kellermann 4c7bfa514f uri: added function attributes
Let gcc optimize a little bit more.
2009-11-07 14:17:28 +01:00
Max Kellermann f9218423b9 utils: renamed stringFoundInStringArray()
No CamelCase.  Use bool instead of int.  Make both arguments
mandatory.
2009-11-06 19:50:47 +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 8cb9f9b070 playlist_queue: use playlist plugins to load from playlist_directory
This patch allows the client to load a playlist file from the playlist
directory with a plugin.  This can be used with the "load" command,
but the client has to pass the file name including the suffix.  We
will probably use the music directory in the future, to support
playlist files inside the music directory.
2009-11-06 01:09:21 +01:00
Max Kellermann 61cb5df842 playlist_queue: moved code to playlist_open_remote_into_queue() 2009-11-06 01:07:42 +01:00