Commit Graph

2971 Commits

Author SHA1 Message Date
Max Kellermann d8e877e335 path: moved playlist_dir to mapper.c
Added the function map_spl_utf8_to_fs() which replaces
utf8_to_fs_playlist_path().
2008-10-31 16:47:14 +01:00
Max Kellermann ef54271619 mapper: use g_warning() for logging
g_error() is fatal by default.  Use g_warning() for non-fatal
initialization errors.
2008-10-31 16:46:46 +01:00
Max Kellermann f098db149e decoder: eliminate gotos in decodeStart()
http://xkcd.com/292/
2008-10-31 16:29:45 +01:00
Max Kellermann a1ca32168c decoder: don't wake up player when command==NONE
If nobody sent a command, the player isn't waiting for the decoder.
Don't wake it up.
2008-10-31 16:29:39 +01:00
Max Kellermann 63682eb1b8 decoder: notify player after stop
The player should always be woken up when the decoder quits.
2008-10-31 16:29:34 +01:00
Max Kellermann 347e816247 decoder: reset state and command in decoder_task()
Eliminate one goto in decodeStart() by moving some cleanup to
decoder_task().
2008-10-31 16:29:24 +01:00
Max Kellermann 86fbac54fd decoder: introduce switch statement in decoder_task()
switch looks much nicer than if/elseif/... and gcc generates nice
warnings when a new command is added to the enum.
2008-10-31 16:29:22 +01:00
Max Kellermann 78448fe1a5 decoder_api: pass constant path pointers 2008-10-31 15:56:43 +01:00
Max Kellermann 6d6e615825 input_stream: pass const url to input_stream_open() 2008-10-31 15:50:59 +01:00
Max Kellermann a92903983d client: use bool
Return bool instead of int.
2008-10-31 13:58:00 +01:00
Max Kellermann 6757c17689 removed UTF-8 library, use GLib instead
Removed duplicated code.
2008-10-31 13:57:10 +01:00
Alam Arias f61bb4c8cf update mpdconf.example that shout ouput encoding and protocol settings are optional 2008-10-31 13:54:46 +01:00
Alam Arias 78f60c9c6d removed unneed check for protocol in shout plugin, will assume icecast2 protocol if not exist in config 2008-10-31 12:20:49 +01:00
Alam Arias 0c43f78b11 replace tabs with space in shout audio_output example 2008-10-31 12:20:49 +01:00
Max Kellermann 71fe7ad81a path: free GLib error in fs_charset_to_utf8()
g_error_free() was missing in case g_convert() failed.
2008-10-31 12:20:48 +01:00
Max Kellermann 8f9d9cc042 directory: directory_free() frees children
directory_free() should free all of its children (subdirectories and
songs).  This way, db_finish() properly frees all allocated memory.
2008-10-31 09:20:02 +01:00
Max Kellermann ea515494cb added prefix to header macros
"LOG_H" is a macro which is also used by ffmpeg/log.h.  This is
ffmpeg's fault, because short macros should be reserved for
applications, but since it's always a good idea to choose prefixed
macro names, even for applications, we are going to do that in MPD.
2008-10-31 09:19:53 +01:00
Max Kellermann 5ef17ac1aa client: don't try again after partial write
After a partial write, chances are vanishing that another write() will
succeed.  Don't try immediately.
2008-10-31 09:19:40 +01:00
Max Kellermann b7ee6febaa removed the sllist library
The "simple singly-linked-list" library has been replaced with GLib's
GList and GQueue.
2008-10-31 09:19:34 +01:00
Max Kellermann 94cbdffb72 client: use GQueue instead of sllist.h for deferred_send
Another custom data structore converted to GLib.
2008-10-31 09:18:11 +01:00
Max Kellermann 90e9079142 client: use GSList instead of struct strnode for command lists
Replace a custom data structure with a GLib one.
2008-10-31 09:17:56 +01:00
Max Kellermann e5ef2d8a37 client: removed list_cache
The list cache aims to save memory allocations, and complicates the
code a bit.  We should rather use GLib slices later, which are easy to
use.
2008-10-31 09:17:52 +01:00
Max Kellermann 8f37f7c838 ogg: don't include _flac_common.h
The source _ogg_common.c does not need any symbols from
_flac_common.h, but including it leads to compiler errors when libflac
isn't available.
2008-10-31 08:52:09 +01:00
Max Kellermann d65d6548a3 oggflac: adapt to new API
Again, I forgot to adapt oggflac to the new API (struct input_stream,
bool return values).
2008-10-31 08:52:09 +01:00
Max Kellermann 5024f0b6cc ffmpeg: pass input_stream pointer to decoder_data()
decoder_data() uses wait times to let the input stream continue its
transfer.
2008-10-30 19:09:20 +01:00
Max Kellermann b15c4cdeb5 ffmpeg: use return value of decoder_data()
decoder_data() always returns the current command.  If we use this, we
can save a lot of decoder_get_command() calls.
2008-10-30 19:03:41 +01:00
Max Kellermann f3b4a28518 ffmpeg: output buffer size cannot be negative
Converted the runtime check to an assertion.
2008-10-30 19:03:38 +01:00
Max Kellermann 130fc58b36 ffmpeg: break immediately after av_read_frame()
Remove one indent level.
2008-10-30 19:03:31 +01:00
Max Kellermann 5f1df0a927 ffmpeg: moved code to ffmpeg_send_frame()
Move code from ffmpeg_decode_internal() to make it smaller and more
readable.
2008-10-30 19:03:20 +01:00
Max Kellermann 048d62a628 ffmpeg: report seek errors to MPD
The decoder API provides the function decoder_seek_error() to report
seek errors.  Use this function instead of logging the error.
2008-10-30 19:02:38 +01:00
Max Kellermann cd7a720426 ffmpeg: simplified mpdurl_read()
The function mpdurl_read() is too complicated, and uses the wrong data
types.
2008-10-30 19:02:01 +01:00
Max Kellermann 964442c5ad ffmpeg: call tag_free() instead of free()
tag objects must be freed with tag_free() to ensure that all resources
are freed.
2008-10-30 19:01:36 +01:00
Max Kellermann 25f4efcdb8 ffmpeg: eliminated local variable "tag"
The function ffmpeg_tag() already has the variable base.tag, which can
be used for this.
2008-10-30 19:01:31 +01:00
Max Kellermann 7cbd9821c6 ffmpeg: make ffmpeg_helper() return bool
ffmpeg_try_decode() did not interpret ffmpeg_helper()'s return value
properly; migrate everything to bool to make it consistent.
2008-10-30 19:01:23 +01:00
Max Kellermann 078d83ca13 ffmpeg: removed debug messages
We don't need those anymore, they just fill the log.
2008-10-30 19:01:18 +01:00
Max Kellermann b180d0b47f ffmpeg: initialize base.decoder
ffmpeg_tag() did not initialize base.decoder, which made valgrind
unhappy, and can lead to a egmentation fault.
2008-10-30 18:08:52 +01:00
Max Kellermann 4d72bda4c3 listen: set file mode 666 on the unix socket
Depending on MPD's umask, the file permissions of the unix socket were
too restrictive, and many clients were not able to connect.  Do a
chmod(0666) on the socket, to allow everybody to connect.
2008-10-30 18:03:18 +01:00
Max Kellermann 9ec695559f pulse: fix segfault without sink name
Commit d692e9 broke configurations without explicit server or sink
configuration.  Check for getBlockParam()==NULL.
2008-10-30 17:46:56 +01:00
Richard Brown bc5429580e autogen.sh: don't call aclocal with the $PWD prefix
calling aclocal -I PWD/m4 in autogen.sh, rather than aclocal -I m4 is
causing autotools to to not include the m4 directory in the dist
tarball. This makes it quite hard to regenerate aclocal/configure.
2008-10-30 10:37:41 +01:00
Max Kellermann 5f6383d68c mpc: provide 24 bit samples
Similar to libmad, libmpcdec provides samples with higher quality than
16 bit.  Send 24 bit samples to MPD, which allows MPD to apply
dithering just in case the output devices are only 16 bit capable.
2008-10-30 08:45:00 +01:00
Max Kellermann 0db07a920e mpc: moved sample size into a constant
Don't hard-code the "16 bits" or "2 bytes" in multiple locations.
2008-10-30 08:44:51 +01:00
Max Kellermann 6773dea5b0 mpc: renamed variable "s16" to "dest"
The name "s16" implies 16 bit integers.  To make the code more
generic, rename it to "dest".
2008-10-30 08:44:43 +01:00
Max Kellermann 51348d6992 mpc: fix broken integer sample conversion
The conversion of integer samples was completely broken, which
presumably didn't annoy anybody because libmpcdec provides float
samples on most installations.
2008-10-30 08:44:28 +01:00
Max Kellermann ecd485acbd mpc: fix boolean interpretation of input_stream_seek()
When input_stream_seek() was converted to return a bool, this wasn't
adjusted in the musepack plugin.
2008-10-30 08:42:18 +01:00
Max Kellermann 62d4fa9306 decoder: use bool for return values and flags
Don't return 0/-1 on success/error, but true/false.  Instead of int,
use bool for storing flags.
2008-10-30 08:38:54 +01:00
Max Kellermann d29bad4410 mp3: make mp3_read() return bool
Its only caller in mp3_decode() just compared its value with
DECODE_BREAK.  Convert that to bool, and return false if the loop
should be ended.  Also eliminate some superfluous command checking
code, which was already done in the preceding while loop.
2008-10-30 06:09:28 +01:00
Max Kellermann f8722913cf output: removed audio_output.result
Since open() and play() close the device on error, we can simply check
audio_output.open instead of audio_output.result after a call.
2008-10-29 22:34:37 +01:00
Max Kellermann 7da0e005f3 output: delay reopen after device failure
When one of several output devices failed, MPD tried to reopen it
quite often, wasting a lot of resources.  This patch adds a delay:
wait 10 seconds before retrying.  This might be changed to exponential
delays later, but for now, it makes the problem go away.
2008-10-29 22:32:50 +01:00
Max Kellermann 0eae1c55ad output: moved code to audio_output_update()
Moved code from syncAudioDeviceStates() to audio_output_update().
2008-10-29 22:17:44 +01:00
Max Kellermann 678314534a output: always call cancel() before stop()
Stopping an audio output device without cancelling its buffer doesn't
make sense.  Combine the two operations, which saves several cancel
calls.
2008-10-29 22:17:42 +01:00