Commit Graph

2977 Commits

Author SHA1 Message Date
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 104d5120c9 configure.ac: check for avcodec_decode_audio2()
Disable the ffmpeg decoder plugin if avcodec_decode_audio2() is not
available.
2008-11-04 17:42:37 +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 792711bddd configure.ac: unset MP4FF_LIBS when MP4 support is disabled
Although there is no AC_SUBST when $enable_mp4=no, autoconf
substitutes its value in Makefile.am.  Clear it in this case.
2008-11-04 07:46:47 +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