Laszlo Ashin
d68df99ef4
wavpack: added prefix to local function names
...
There are some functions in the wavpack-mpd input streams wrapper
which had too commonly used names (especially can_seek). I prefixed
these with "wavpack_input_".
2008-11-08 13:07:40 +01:00
Laszlo Ashin
ff2e69c003
wavpack: unified code style
...
Not every function header has its return type in a distinct line. This
patch corrects that. This way there is more space for the arguments.
2008-11-08 13:07:09 +01:00
Tom Servo
ea92576219
listen: fix namespace collision on OpenSolaris
...
The listen.c module breaks the build because the variable name used
("sun") for the Unix domain socket part collides with something else
on an OpenSolaris system, likely Sun specific. Renaming it to _sun
(or something else of choice) fixes the build.
[mk: renamed to "s_un"]
2008-11-07 10:33:48 +01:00
Laszlo Ashin
2e0ba90208
wavpack: check wvc seekability
...
Using wvc streams the seekableness depends on the seekability of the
wvc stream as well.
2008-11-06 06:48:33 +01:00
Laszlo Ashin
56d2b51056
wavpack: close wvc stream on error
...
The input stream opened for wvc is not closed in an if branch. A
close call has been added.
2008-11-06 06:48:33 +01:00
Laszlo Ashin
089c9b7e5c
wavpack: enable seeking
...
Somehow seeking is disabled on all kinds of wavpack playbacks now in
the git version. This patch corrects that.
2008-11-06 06:48:33 +01:00
Max Kellermann
dcfb205c46
input_curl: retrieve error message from ERRORBUFFER
...
libcurl provides better error messages than curl_multi_strerror() when
you set the ERRORBUFFER option.
2008-11-06 06:48:30 +01:00
Max Kellermann
e2d7318a18
input_curl: return 0 on error from read()
...
The read() method must not return a negative value. Make it return 0
on error, just like the file input stream. Also set the "error"
attribute to -1.
2008-11-06 06:44:19 +01:00
Max Kellermann
a8e81326d0
input_curl: enable FAILONERROR
...
I had this option enabled during development, but at some point, it
must have gotten lost. FAILONERROR makes the curl stream fail when
the server returns a status code 400 or higher. We are not interested
in the server's error document.
2008-11-06 06:36:25 +01:00
Max Kellermann
19d3345ab8
path: removed superfluous error check in path_set_fs_charset()
...
The code which had a possible error condition had been removed.
2008-11-05 21:42:55 +01:00
Max Kellermann
5b2e981253
log: check if log_charset is set
...
When logging to a file, log_charset would be NULL and g_convert()
would abort.
2008-11-05 21:40:08 +01:00
Max Kellermann
b0f1bc4856
Makefile.am: distribute input_curl.h
...
input_curl.h was missing in the tarball because it was not listed in
$(mpd_headers).
2008-11-05 21:23:56 +01:00
Max Kellermann
7f880ab8ba
main: print usage to stdout
...
Using the logging library here is inappropriate.
2008-11-05 20:52:14 +01:00
Max Kellermann
130fa94423
log: convert messages to system charset
...
When logging to the terminal, we should print messages in the system
character set. Convert all messages in this case.
2008-11-05 18:39:13 +01:00
Max Kellermann
787c6f5e18
log: use bool
...
Use the bool data type for flags.
2008-11-05 18:39:10 +01:00
Max Kellermann
4c967a6ba2
log: provide a GLib logging handler
...
Install a default handler which writes to stdout or stderr, and
prepends a time stamp. This looks just like the 0.13.x logger.
2008-11-05 18:38:55 +01:00
Max Kellermann
a5348a3786
log: use GLib message logging
...
The logging functions from log.h are deprecated, and the code should
use GLib logging instead. Make ERROR(), WARNING() etc. call g_logv()
internally.
2008-11-05 18:38:30 +01:00
Max Kellermann
a05fa5cdbb
log: no CamelCase
...
Renamed the variable "logLevel" to "log_threshold".
2008-11-05 18:38:23 +01:00
Max Kellermann
08aaf57ff0
log: removed warning buffer
...
The warning buffer is a complex piece of code for no good reason.
Remove it and find a better solution, e.g. open the log file earlier.
2008-11-05 18:37:40 +01:00
Max Kellermann
b35ca9e5c4
main: initialize locale (LC_CTYPE)
...
Initialize libc's locale functions. Currently, we are only interested
in LC_CTYPE (character classification), because this is what is used
by GLib's g_get_charset().
2008-11-05 18:37:39 +01:00
Max Kellermann
2a1a37107f
path: don't allocate charset twice
...
Make the local variable "charset" const, and don't duplicate its
value. It is already duplicated by path_set_fs_charset().
2008-11-05 18:26:45 +01:00
Max Kellermann
6a7a26fe42
path: get filesystem charset from GLib
...
GLib provides the function g_get_filename_charsets() which determines
the file system character set. This changes MPD's fallback: GLib
prefers UTF-8 as a fallback. MPD used to fall back to ISO Latin 1.
2008-11-05 18:25:57 +01:00
Max Kellermann
3002fd18cb
path: no CamelCase
...
Rename variables and functions.
2008-11-05 18:21:52 +01:00
Max Kellermann
259c6ed164
enable GLib threading
...
Call g_thread_init() from main() to enable the GLib features which
make it thread safe.
2008-11-05 18:21:49 +01:00
Max Kellermann
06f9b6c379
main: don't close all file descriptors on startup
...
Removed closeAllFDs(). The caller is responsible for closing all file
handles.
2008-11-05 18:21:36 +01:00
Max Kellermann
5d6e96e986
pulse: removed reconnect interval
...
The output thread automatically waits some time before retrying to
open the device. Don't duplicate this check in the pulse plugin.
2008-11-05 08:10:13 +01:00
Max Kellermann
3defcef5f3
pulse: check if connection is open in pulse_cancel()
...
The pulse plugin crashed with a segmentation fault when the pulse
server was killed.
2008-11-05 08:06:39 +01:00
Max Kellermann
eedbd28ec9
wavpack: read_bytes() should not return after partial reads
...
libwavpack expects the read_bytes() stream method to fill the whole
buffer, and fails badly when we return a partial read (i.e. not enough
data available yet). This caused wavpack streams to break.
Re-implement the buffer filling loop.
2008-11-05 07:24:57 +01:00
Max Kellermann
010a27cd95
wavpack: don't close the stream
...
The input_stream object is opened and closed by the caller.
2008-11-05 07:13:55 +01:00
Max Kellermann
85a7d1a148
decoder: removed stream_types
...
Instead of checking the stream_types bit set, we can simply check
whether the methods stream_decode() and file_decode() are implemented.
2008-11-04 17:10:19 +01:00
Max Kellermann
59c20e5afe
wavpack: removed NULL element from tagtypes
...
The number of tag types is known at compile time. Use the GLib macro
G_N_ELEMENTS instead of having a NULL element at the end.
2008-11-04 17:10:17 +01:00
Max Kellermann
66eb3e90c3
wavpack: use enum tag_type
...
Don't store tag type values in a plain integer, use the proper enum.
2008-11-04 17:10:13 +01:00
Max Kellermann
946e69b2f6
wavpack: use GLib instead of utils.h / log.h
...
Replace deprecated code with GLib.
2008-11-04 17:10:10 +01:00
Max Kellermann
097bccd4ae
wavpack: read first byte from wvc stream
...
Instead of manually waiting for the input stream to become ready (to
catch server errors), just read the first byte. Since the
wavpack_input has the capability to push back one byte, we can simply
re-feed it. Advantage is: decoder_read() handles everything for us,
i.e. waiting for the stream, polling for decoder commands and error
handling.
2008-11-04 17:10:03 +01:00
Max Kellermann
3cf54591e9
wavpack: use the bool data type
...
Use boolean true/false instead of 1/0.
2008-11-04 17:10:01 +01:00
Max Kellermann
b6ea410ca7
wavpack: no CamelCase
...
Renamed functions and variables.
2008-11-04 17:08:59 +01:00
Max Kellermann
c1dfa52cbf
wavpack: fix indent
...
Fixed the indent of the switch statement in format_samples_int().
2008-11-04 17:08:57 +01:00
Max Kellermann
fef14683ae
mp4: get decoder command from decoder_data()
...
Eliminate a superfluous decoder_get_command() call. decoder_data()
already returns the command.
2008-11-04 17:05:08 +01:00
Max Kellermann
11404b5d10
mp4: initialize audio_format before decoder_initialized()
...
Removed the duplicate audio_format initialization.
2008-11-04 17:05:05 +01:00
Max Kellermann
290347c482
mp4: use decoder_read() instead of input_stream_read()
...
decoder_read() handles decoder commands, and should be used in decoder
plugins.
2008-11-04 17:05:02 +01:00
Max Kellermann
9ecfc57c3a
mp4: pass struct mp4_context to the mp4ff_callback_t methods
...
We need the decoder object, so we have to begin passing a new struct
to these callbacks, instead of only the pointer to the input_stream
object.
2008-11-04 17:05:00 +01:00
Max Kellermann
632dc7c96b
mp4: use GLib instead of utils.h / log.h
...
Replace deprecated code with GLib.
2008-11-04 17:04:57 +01:00
Max Kellermann
01706dd46c
mp4: use tag_is_empty() instead of passing the tag_is_found flag
...
The API of mp4_load_tag() was strange: it always returned a tag
object, no matter if a tag was found in the file; the existence of a
tag was indicated with the tag_found integer reference. This flag is
superfluous, since we can simply check whether the tag is empty or
not.
2008-11-04 17:04:54 +01:00
Max Kellermann
02a172f2c2
mp4: static mp4ff_callback_t variables
...
Allocate the mp4ff_callback_t object on the stack. This is easier to
handle, since we don't have to free it. Incidentally, this fixes a
memory leak in mp4_load_tag().
2008-11-04 16:55:12 +01:00
Max Kellermann
8712a1f7bf
mp4: no CamelCasee
...
Renamed functions and variables.
2008-11-04 16:55:12 +01:00
Max Kellermann
ab07cdd453
ffmpeg: removed loop from mpd_ffmpeg_read()
...
The function decoder_read() already cares about the decoder command,
and loops until data is available. Reduced mpd_ffmpeg_read() to no
more than the decoder_read() call.
2008-11-04 16:55:12 +01:00
Max Kellermann
292334a27a
ffmpeg: removed ffmpeg_context.codec
...
That variable is never used except during initialization in
ffmpeg_helper().
2008-11-04 16:55:12 +01:00
Max Kellermann
7e84c73b17
ffmpeg: moved code to ffmpeg_find_audio_stream()
2008-11-04 16:55:12 +01:00
Max Kellermann
5e486964e8
ffmpeg: no CamelCase
...
Renamed variables.
2008-11-04 16:55:11 +01:00
Max Kellermann
e26bff9b92
tag: added tag_is_empty()
2008-11-04 16:55:11 +01:00
Max Kellermann
d7b2d93ccc
osx: fix gcc warnings
...
Fix prototypes and unused variables.
2008-11-04 11:26:04 +01:00
Max Kellermann
37696dcbbf
osx: adapt to new output plugin API
...
The OS X output plugin wasn't adapted to the new output plugin yet,
because I had no Mac to test...
2008-11-04 11:19:37 +01:00
Max Kellermann
095a62a1d0
decoder: update dc.error after input stream failure
...
dc.error wasn't updated when the input stream failed to initialize.
2008-11-03 21:49:47 +01:00
Max Kellermann
75d2a39768
input_curl: use curl_multi_info_read()
...
The function curl_multi_info_read() provides access to errors from the
curl easy interface.
2008-11-03 21:49:43 +01:00
Max Kellermann
fdf0d46e3d
player: converted PLAYER_ERROR_* to enum
2008-11-03 21:49:40 +01:00
Max Kellermann
eca0e6db3b
player: removed "volatile" attributes
...
Removed the "volatile" attributes from several variables which are not
important for synchronization.
2008-11-03 21:49:36 +01:00
Max Kellermann
862bbc21a1
player: no CamelCase
...
Renamed variables and internal functions. Most of the
player_control.h API remains in CamelCase for now.
2008-11-03 21:49:29 +01:00
Max Kellermann
cfaf85e37d
decoder: converted DECODE_ERROR_* to enum
2008-11-03 21:48:17 +01:00
Max Kellermann
ec6d26788a
decoder: removed "volatile" modifier
...
The variable "next_song" is already protected by a memory barrier.
"total_time" is not important for synchronization, and we don't need
"volatile" here.
2008-11-03 21:44:12 +01:00
Max Kellermann
863badd91e
decoder: no CamelCase
...
Renamed variables and functions.
2008-11-03 21:43:02 +01:00
Max Kellermann
b3dfcfef52
decoder_api: send song tag in decoder_data()
...
Before passing the first chunk to the audio output device, send the
current song's tag.
2008-11-03 20:20:09 +01:00
Max Kellermann
ac96022c1d
decoder_api: automatically send stream tag
...
If an input stream provides tags (e.g. from an icecast server), send
them in the decoder_data() and decoder_tag() methods. Removed the
according code from the mp3 and oggvorbis plugins - decoders shouldn't
have to care about stream tags.
This patch also adds the missing decoder_tag() invocation to the mp3
plugin.
2008-11-03 18:24:01 +01:00
Max Kellermann
8bb2da063f
tag: added function tag_has_type()
...
tag_has_type() checks whether the tag contains one or more items with
the specified type.
2008-11-03 18:24:00 +01:00
Max Kellermann
b9d456a041
decoder_api: no CamelCase
...
Renamed variables.
2008-11-03 17:56:41 +01:00
Max Kellermann
f70dccdce1
configure.ac: separate the "aac" and "mp4" decoder tests
...
MPD used to have a copy of the mp4ff library. Since that has been
removed, AAC suport was disabled when there was no libmp4ff. Separate
the libmp4ff test, and enable AAC support no matter if libmp4ff is
available.
2008-11-03 16:48:12 +01:00
Max Kellermann
9074f924e9
alsa: initialize "device" with NULL
...
When using autodetection, AlsaData.device wasn't properly initialized
with NULL. This broke autodetection randomly.
2008-11-03 07:40:54 +01:00
Max Kellermann
e6f334a088
mod: removed boolean globals for lazy init
...
The variables mod_mikModInitiated and mod_mikModInitError were used to
control lazy initialization, but they are superfluous now.
2008-11-03 07:32:02 +01:00
Max Kellermann
bb15c3bd45
mod: always initialize libmikmod
...
The "mod" decoder plugin was being initialized lazily, but was
deinitialized unconditionally. That led to segmentation faults.
Convert mod_initMikMod() to be the global module initialization
method. The MPD core should care about lazy initialization.
2008-11-03 07:30:42 +01:00
Max Kellermann
79d70f124d
output: don't allow length==0
...
Nobody should call playAudio() with an empty chunk. Add some
assertions on that.
2008-11-02 20:16:56 +01:00
Max Kellermann
cc164cc884
player: don't play empty chunks
...
An empty chunk may happen when it only contains a tag, but no PCM
data. Don't call playAudio() then.
2008-11-02 20:14:55 +01:00
Max Kellermann
e5137706d1
ffmpeg: fix boolean inversion in ffmpeg_tag()
...
ffmpeg_tag() deleted the tag when ffmpeg_helper() returned success.
The return value was interpreted incorrectly, it should return the tag
on success.
2008-11-02 17:32:40 +01:00
Max Kellermann
1e0acb2e1a
removed unused sources
...
Cleaning up artifacts from a merge gone wrong. Also remove the
ringbuf library, which is not being used.
2008-11-02 17:16:07 +01:00
Max Kellermann
fb233df7a9
player: copy stream tag to the song struct
...
Non-local songs used to have no tags. If the decoder sends us a tag,
we should incorporate it into the song struct. This way, clients can
always show the correct song name (if provided by the server).
2008-11-02 17:13:26 +01:00
Max Kellermann
7e7704e42b
player: added player.song
...
Always remember which song is currently being sent to the audio
device.
2008-11-02 17:10:26 +01:00
Max Kellermann
accc82cd6c
ffmpeg: don't rewind stream in url_close()
...
Rewinding the stream here is not useful, but may consume valuable
resources (and time).
2008-11-02 17:10:12 +01:00
Max Kellermann
2124df1390
decoder: rewind input stream after try_decode()
...
The try_decode() method may have read some data from the stream, which
is now lost. To make this data available to other methods, get it
back by rewinding the input stream after each try_decode() invocation.
The ogg and wavpack plugins did this manually and inconsistently; this
code can now be removed.
2008-11-02 17:10:02 +01:00
Max Kellermann
395aa4e847
decoder: moved code to decoder_try_decode()
2008-11-02 17:07:39 +01:00
Max Kellermann
5183d85886
player: send chunk tag to audio device
...
If a chunk contains a tag, send it to the audio output device. Few
output plugins support this, e.g. shout has support for sending tags.
2008-11-02 17:07:31 +01:00
Max Kellermann
aa9b31f1cf
crossfade: copy tag
...
If the source chunk has a tag, merge it into the destination chunk.
The source chunk gets deleted after that, and this is our last chance
to grab the tag.
2008-11-02 17:07:13 +01:00
Max Kellermann
0f80428fda
ffmpeg: use decoder_read() wrapper instead of direct input_stream_read()
...
decoder_read() checks the decoder command. Without this patch, the
ffmpeg plugin could become unresponsive.
2008-11-02 17:06:53 +01:00
Max Kellermann
4d069b4991
ogg, ffmpeg: try to decode, even when the stream is not seekable
...
Ogg and ffmpeg detection was disabled when the stream was not
seekable, because the detection was too expensive. Since the curl
input stream can now rewind the stream cheaply, we can re-enable
detection on streams.
2008-11-02 17:06:32 +01:00
Max Kellermann
460b15d29c
input_curl: buffered rewinding
...
During codec detection, the beginning of the stream is consumed. This
is a common operation, which takes a lot of time when handling remote
resources. To optimize this, remember the first 64 kB of a stream.
This way, we can rewind the stream without actually fetching the start
of the stream again.
2008-11-02 17:06:15 +01:00
Max Kellermann
020c04e702
decoder_api: added decoder_tag()
...
Provide an API for submitting additional tags from the stream.
2008-11-02 17:02:28 +01:00
Max Kellermann
5b13f067cd
aac, mod: moved decoder command check into loop condition
...
Avoid while(true) loops, and convert them to a loop with a proper
condition.
2008-11-02 17:02:23 +01:00
Max Kellermann
3f6fcfd38e
aac, mod: don't check for SEEK command
...
Since the aac and mod plugins have told MPD that they cannot seek, MPD
will never send a SEEK command to them. Removed the SEEK comand
checks from both plugins.
2008-11-02 17:02:00 +01:00
Max Kellermann
c9e15bc418
decoder_api: pass "seekable" flag to decoder_initialized()
...
Don't pass the "seekable" flag with every decoder_data() invocation.
Since that flag won't change within the file, it is enough to pass it
to decoder_initialized() once per file.
2008-11-02 17:01:51 +01:00
Max Kellermann
c7a374bdcb
music_pipe: add tag pointer to the music_chunk struct
...
Each music chunk can now carry a tag object. Decoder plugins which
support it (e.g. oggvorbis) may use this to inject decoded tags into
their output.
2008-11-02 17:01:00 +01:00
Max Kellermann
fcc11bc9d8
music_pipe: added functions chunk_init() and chunk_free()
...
These two functions will care about memory allocation and deallocation
in the future.
2008-11-02 16:58:49 +01:00
Max Kellermann
85b6ff7b59
music_pipe: document struct music_chunk
...
Add doxygen compatible comments.
2008-11-02 16:58:45 +01:00
Max Kellermann
b42dad9b05
music_pipe: removed "volatile"
...
The "volatile" keyword doesn't help here, because we have proper
memory barriers, but it disables some optimizations. Remove it.
2008-11-02 16:58:42 +01:00
Max Kellermann
39bf84aa9f
music_pipe: renamed "size" to "num_chunks"
...
The name "num_chunks" expresses the meaning of the variable better.
2008-11-02 16:57:37 +01:00
Max Kellermann
5347cca29d
music_pipe: no CamelCase
...
Rename all variables and struct members.
2008-11-02 16:57:16 +01:00
Max Kellermann
8490c1b4cf
music_pipe: set bit_rate and time in music_pipe_append()
...
Don't bother to pass these values as parameters to tail_chunk().
2008-11-02 16:57:15 +01:00
Max Kellermann
cd61f6570f
music_pipe: moved code to music_chunk_append()
2008-11-02 16:56:49 +01:00
Max Kellermann
e9e9d2bc2d
music_pipe: renamed "ob" to "music_pipe"
...
Last music_pipe rename patch: renamed the global variable (singleton).
2008-11-02 16:56:09 +01:00
Max Kellermann
d430b1dc54
music_pipe: more wrapper functions
...
Replace all direct music_pipe struct accesses with wrapper functions.
The compiled machine code is the same, but this way, we can change
struct internals more easily.
2008-11-02 16:55:53 +01:00
Max Kellermann
260a0cc33c
music_pipe: use GLib instead of utils.h
...
Eliminate the deprecated utils.h memory allocation functions.
2008-11-02 16:55:48 +01:00
Max Kellermann
8b1f6ff3c8
decoder: replaced music_pipe.audioFormat with dc.out_audio_format
...
.. and rename dc.audioFormat to dc.in_audio_format. The music pipe
does not need to know the audio format, and its former "audioFormat"
property indicated the format of the most recently added chunk, which
might be confusing when you are reading the oldest chunks.
2008-11-02 16:55:43 +01:00
Max Kellermann
30fca5e5a9
music_pipe: pass frame size to tail_chunk()
...
Don't make tail_chunk() calculate the frame size again.
2008-11-02 14:18:34 +01:00
Max Kellermann
fd0f195bb7
music_pipe: renamed ob_* functions to music_pipe_*
...
Rename all functions to the new prefix.
2008-11-02 14:18:34 +01:00
Max Kellermann
8964c69a64
music_pipe: renamed struct output_buffer to struct music_pipe
...
.. and rename ob_chunk to struct music_chunk.
2008-11-02 14:15:47 +01:00
Max Kellermann
767b4c95bd
renamed outputBuffer.[ch] to pipe.[ch]
...
No CamelCase in the file name. The output_buffer struct is going to
be renamed to music_pipe. There are so many buffer levels in MPD, and
calling this one "output buffer" is wrong, because it's not the last
buffer before the music reaches the output devices.
2008-11-02 14:12:52 +01:00
Max Kellermann
b48ae8c26f
decoder: enable decoders even if they have no init() method
...
Commit 1a4a3e1f
moved decoders into a static array, but failed to
enable those plugins who did not have an init() method at all.
This patch corrects the "enabled" check.
2008-11-02 13:30:26 +01:00
Max Kellermann
4c1b96c307
decoder: make the suffixes and mime_types arrays really const
...
The strings were constant, but the pointers weren't. C syntax is
somewhat tricky..
2008-11-01 14:55:23 +01:00
Max Kellermann
0b614fbaae
decoder: make all decoder_plugin structs const
...
All decoder_plugin structs are initialized at compile time, and must
never change.
2008-11-01 14:54:09 +01:00
Max Kellermann
1a4a3e1f1f
decoder: manage decoder list in a static array
...
Currently, there is no way to dynamically load decoder plugins, thus
we don't need a dynamic list to manage them.
2008-11-01 14:53:30 +01:00
Max Kellermann
5036368f54
decoder: return const decoder_plugin structs
...
The decoder_plugin structs must never change. Don't work with
non-const pointers.
2008-11-01 14:51:41 +01:00
Max Kellermann
83f6222ae7
permission: store passwords in GHashTable
...
Eliminating the deprecated linked list library.
2008-11-01 14:33:25 +01:00
Max Kellermann
aa772ebc02
tag: use GLib instead of utils.h
...
Don't use the deprecated functions from utils.h.
2008-11-01 14:33:14 +01:00
Max Kellermann
35710a81ea
utils: use GUINT32_FROM_LE() instead of readLEuint32()
...
Eliminate code already provided by GLib.
2008-11-01 14:11:19 +01:00
Max Kellermann
b996108675
tag: don't return const string from fix_utf8()
...
Return NULL instead of the input value if there is nothing to fix.
This way, the caller doesn't have to use the xfree() hack.
2008-11-01 14:04:15 +01:00
Max Kellermann
aa33422de6
alsa, jack: no const pointers for allocated strings
...
Make the pointers "device" and "name" non-const, so we don't need the
xfree() hack. The default value is expressed as NULL.
2008-11-01 14:04:14 +01:00
Max Kellermann
9fdac529b4
path: removed sanitizePathDup()
...
We don't need to sanitize the path, because the mapper already checks
for malformed paths.
2008-10-31 16:50:51 +01:00
Max Kellermann
f291876772
mapper: check for "." and ".."
...
Make map_directory_child_fs() refuse the names "." and "..". This is
currently the interface where an attacker may inject a manipulated
path (through the "update" command).
2008-10-31 16:48:58 +01:00
Max Kellermann
a5f8d4386c
update: check return values
...
Nearly all mapper functions can fail and will then return NULL. Add
checks to all callers.
2008-10-31 16:47:21 +01:00
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
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
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