Commit Graph

3281 Commits

Author SHA1 Message Date
Max Kellermann 9512704055 output: set a GLib log domain 2009-02-25 19:53:38 +01:00
Max Kellermann d56ae1e9c2 fifo: return bool values
Return true/false for success/failure instead of returning 0/-1.
2009-02-25 19:53:27 +01:00
Max Kellermann 74af4e4c3d fifo: no CamelCase
Renamed types, functions and variables.
2009-02-25 19:53:24 +01:00
Max Kellermann ee7cf9c9b8 fifo: removed timer!=NULL checks
The MPD core guarantees that the audio_output object is always
consistent, and our timer!=NULL checks are superfluous.
2009-02-25 19:09:38 +01:00
Max Kellermann ba4dd651ef ao: no CamelCase
Renamed functions and variables.
2009-02-25 19:08:49 +01:00
Max Kellermann 074d5ae13e ao: removed AoData.device!=NULL checks
The MPD core guarantees that the audio_output object is always in a
consistent state: either open or closed.  When open, it will not call
the open() method again, and when closed, it will not call play().
Removed several checks and the NULL initialization.
2009-02-25 18:48:27 +01:00
Max Kellermann 8a882209c3 ao: removed implementation of method cancel()
The method is empty, and we can simply set the method pointer to NULL
instead.
2009-02-25 18:45:09 +01:00
Max Kellermann dcd84c19cd output_plugin: don't pass audio_output object to method init()
audio_output_get_name() has been removed, which was the only function
left in output_api.h.  The output plugin doesn't need the audio_output
object at all, remove the parameter from the init() method.
2009-02-25 18:34:02 +01:00
Max Kellermann 0cf4f09e4f output_api: removed audio_output_get_name()
Use config_get_block_string("name") instead of audio_output_get_name().
2009-02-25 17:32:58 +01:00
Max Kellermann 6823217697 ls: moved generic URI utilities to uri.c
"ls" is a bad name for a library which parses URIs.  We'll move the
rest of the "ls" library later.
2009-02-25 16:44:06 +01:00
Max Kellermann 2054464c01 vorbis_encoder: vorbis_encoder_clear() returns void
Don't return an uninitialized bool variable.
2009-02-24 19:06:37 +01:00
Max Kellermann e065c4db33 jack: initialize local variable "space"
Fix a gcc warning, initialize the "space" variable at the beginning of
mpd_jack_play().
2009-02-24 19:06:34 +01:00
Max Kellermann 1630fe00a2 listen: fix unused parameter warnings when TCP is disabled
Work around gcc warnings by casting the parameters to void.
2009-02-24 19:06:31 +01:00
Max Kellermann d0a17ffb9d listen: removed is_ipv6_enabled()
Don't explicitly check is_ipv6_enabled(), just try calling
listen_add_port_ipv6(), but check its error code.
2009-02-24 18:55:12 +01:00
Max Kellermann adf044eb09 listen: splitted listen_add_port() into IPv4 and IPv6
Some more code simplification.
2009-02-24 18:49:09 +01:00
Max Kellermann d40c439424 listen: don't call listen_add_config_param(NULL)
For default bind_to_address settings, don't call
listen_add_config_param(NULL), use listen_add_port() directly.
2009-02-24 18:36:31 +01:00
Max Kellermann 739c23cca5 listen: moved code to listen_add_host()
Split code from the rather large function listen_add_config_param(),
part 3.
2009-02-24 18:29:53 +01:00
Max Kellermann 33749e7ea9 listen: moved code to listen_add_path()
Split code from the rather large function listen_add_config_param(),
part 2.
2009-02-24 17:51:39 +01:00
Max Kellermann 36b1a860d3 listen: moved code to listen_add_port()
Split code from the rather large function listen_add_config_param().
2009-02-24 17:51:32 +01:00
Max Kellermann dbb067c016 listen: listen_add_address() returns bool/GError
Don't return -1 on failure, and abort on fatal error - do proper error
reporting with GError, and return false on failure.
2009-02-24 17:43:10 +01:00
Max Kellermann 7de4e7228f listen: removed unused macro "MAXHOSTNAME" 2009-02-24 17:42:37 +01:00
Max Kellermann 9bb3f2d060 listen: no CamelCase
Renamed functions.
2009-02-24 17:42:36 +01:00
Avuton Olrich 39a33344f2 ffmpeg: add all known ffmpeg extensions and mime-types.
After much research[1][2][3] this should be the majority of currently
supported file extensions and mime-types for the currently supported
ffmpeg formats. This list maybe incomplete, but it's more complete
than anything else out there that I've been able to find. This list
needs to be updated every now and again as the ffmpeg sources support
more formats.

 1. Sources
 2. wiki.multimedia.cx
 3. filext.com
2009-02-23 10:48:43 -08:00
Max Kellermann 3b1a9aeca0 Makefile.am: no recursive makefiles
Recursive Makefiles are inefficient and error prone (no proper way to
declare dependencies).  Since there's no disadvantage in having one
single Makefile, let's do it.
2009-02-23 10:04:51 +01:00
Max Kellermann a4dfab2aee output: pass the music chunk pointer as void*, not char*
The meaning of the chunk depends on the audio format; don't suggest a
specific format by declaring the pointer as "char*", pass "void*"
instead.
2009-02-23 09:34:26 +01:00
Max Kellermann 5a898c15e7 output_api: play() returns a length
The old API required an output plugin to not return until all data
passed to the play() method is consumed.  Some output plugins have to
loop to fulfill that requirement, and may block during that.  Simplify
these, by letting them consume only part of the buffer: make play()
return the length of the consumed data.
2009-02-23 09:29:56 +01:00
Max Kellermann d50a3d513e shout: removed shout_plugin.h
There are no plugins left which require shout_plugin.h.  Moved the
struct declaration to shout_plugin.c.
2009-02-22 17:52:37 +01:00
Max Kellermann 1c56edd1c8 shout: removed shout_encoder_plugins
This array is empty, and is not used anymore.
2009-02-22 17:51:12 +01:00
Max Kellermann f6e5c00726 shout: use the new encoder API
Removed shout's encoder plugin API in favor of the new generic encoder
plugin API.
2009-02-22 17:18:28 +01:00
Max Kellermann f7c685f1ab encoder: added lame mp3 encoder
This new LAME encoder plugin is based on the existing shout_mp3.c
plugin.
2009-02-22 17:18:03 +01:00
Max Kellermann 3a6619d62c encoder: added vorbis encoder
This new vorbis encoder plugin is based on the existing shout_ogg.c
plugin.
2009-02-22 17:17:26 +01:00
Max Kellermann a9dde676be added the encoder API
The new generic encoder API will replace shout's custom encoder API.
2009-02-22 17:11:14 +01:00
Max Kellermann e79a82ba3a shout: merged open_shout_conn() into my_shout_open_device()
The method implementation my_shout_open_device() consists of only one
line, the call to open_shout_conn().  Merge both functions into one.
2009-02-22 15:24:41 +01:00
Max Kellermann cece6c00f4 shout: bool return values instead of int
Return true/false instead of 0/-1.
2009-02-22 15:18:58 +01:00
Max Kellermann f0554d9a75 pcm: added API documentation 2009-02-21 18:14:20 +01:00
Max Kellermann cae7c160a3 crossfade: added API documentation 2009-02-20 14:57:32 +01:00
Max Kellermann 91ebf46853 path: don't export path_set_fs_charset()
The function path_set_fs_charset() is only used in path.c.
2009-02-20 14:49:57 +01:00
Max Kellermann 09ecfb6567 path: validate configured character set 2009-02-20 12:31:00 +01:00
Max Kellermann adea76a6ed decoder_api: fixed shadow warning, rename "wait"
The parameter name "wait" overlaps with the POSIX wait() function.
Rename it.
2009-02-19 13:33:06 +01:00
Max Kellermann e7131b5da2 utils: use g_usleep() instead of my_usleep()
Now that I've found this nice function in the GLib docs, we can
finally remove our custom sleep function.  Still all those callers of
g_usleep() have to be migrated one day to use events, instead of
regular polling.
2009-02-19 13:33:03 +01:00
Max Kellermann c228635489 faad: use faacDecFrameInfo instead of NeAACDecFrameInfo
Don't use libfaad's internal type names.
2009-02-19 13:29:15 +01:00
Max Kellermann eac2da635d added G_LOG_DOMAIN macros to several libraries
Define the GLib logging domain in the following libraries: conf,
daemon, event_pipe, log.
2009-02-19 09:24:59 +01:00
Max Kellermann 11e680d640 conf: log the effective configuration file name
For better debugging aid when something goes wrong, log the name of
the effective configuration file.
2009-02-19 08:35:22 +01:00
Max Kellermann 0a0736fc4e log: added log_early_init() for early debug messages 2009-02-19 08:35:20 +01:00
Max Kellermann 84437acffb Makefile.am: add new headers to $(mpd_headers)
I forgot to add these, and this broke "make distcheck".
2009-02-19 08:12:46 +01:00
Peter Colberg de6cc2691f mms: fix assertion in input_stream_open
Hi,

upon trying to play an MMS stream added to the play list, I got this:

    mpd: /tmp/mpd/./src/input_stream.c:85: input_stream_open: Assertion `is->plugin->open == ((void *)0) || is->plugin == plugin' failed.

With the following patch applied, it works perfectly.

Thanks for having implemented MMS support :-).

Best regards,
Peter
2009-02-19 07:34:07 +01:00
Max Kellermann 7f701744a7 pcm_volume: optimized pcm_volume_change_24() on i386
Added an inline assembly function for the 64 bit multiplication.

Benchmark results on a Pentium II 266 MHz, 512 MB of 24 bit PCM data:

 dd if=/dev/zero bs=64k count=8k |
     time ./test/software_volume 48000:24:2 >/dev/null

Before this patch 22.94s, after this patch 7.24s.
2009-02-18 22:27:58 +01:00
Max Kellermann fcf65de46b mp4ff: always free the mp4ff_read_sample() buffer
When mp4ff_read_sample() returns a value bigger than zero, it
guarantees that the buffer is set.  Remove the check.
2009-02-18 19:08:52 +01:00
Max Kellermann 5900ea5299 mp4ff: don't allocate seek_table when input is not seekable
Don't waste any precious memory when the seek_table cannot be used.
2009-02-18 18:40:40 +01:00
Max Kellermann 8aa3edb6af mp4ff: include cleanup
Don't include limits.h, use GLib constants instead.
2009-02-18 18:40:33 +01:00
Max Kellermann 51c59f6228 mp4ff: use faacDecInit2() to find the AAC track
Use faacDecInit2() instead of AudioSpecificConfig() to detect the AAC
track in the MP4 file.  This has a great advantage: it initializes the
libfaad decoder, which the caller would normally do anyway - but now
we can go without the AudioSpecificConfig() call.  When decoder==NULL
(called from mp4_tag_dup()), fall back to a mp4ff_get_track_type()==1
check, like other audio players do.
2009-02-18 18:39:12 +01:00
Max Kellermann 111c73e701 mp4ff: moved code to mp4_faad_new()
Moved the libfaad decoder initialization to mp4_faad_new(), and also
fill the audio_format struct there.  This eliminates a little bit of
complexity in mp4_decode().
2009-02-18 18:38:09 +01:00
Max Kellermann 2bc0fabe73 mp4ff: call decoder_initialized() after libfaad initialization
Don't wait for the first frame to be decoded.  We already have the
sample rate and the channel count from faacDecInit2().
2009-02-18 18:18:29 +01:00
Max Kellermann 47e3eab872 mp4ff: merged mp4_load_tag() into mp4_tag_dup()
The function mp4_load_tag() is used only once, and mp4_tag_dup() is a
one-liner.  Merge them.
2009-02-18 18:18:25 +01:00
Max Kellermann 9d2f16d827 player_thread: don't drop audio buffers when not seekable
When a file is not seekable, MPD dropped the audio buffers before even
attempting to seek.  This caused noticable sound corruption.  Fix:
first attempt to seek, and only if that succeeds, call
audio_output_all_cancel().
2009-02-17 23:57:10 +01:00
Max Kellermann 4aca1fa493 faad: variable cleanup
Make some variables more local, and eliminate superfluous ones.
2009-02-17 23:44:29 +01:00
Max Kellermann 122e0f3338 faad: added source code comments 2009-02-17 23:42:06 +01:00
Max Kellermann 76b0601f6b faad: faad_decoder_init() returns an audio_format
Instead of returning the sample rate and channel count as separate
values, fill an audio_format struct.
2009-02-17 23:35:49 +01:00
Max Kellermann 161bfc4bc0 faad: call decoder_initialized() after libfaad initialization
Don't wait for the first frame to be decoded.  We already have the
sample rate and the channel count from faacDecInit().
2009-02-17 23:26:51 +01:00
Max Kellermann a72c7a7b18 faad: removed DECODE_COMMAND_SEEK check
The MPD core will never send a SEEK command to a decoder which has
declared to be not seekable.
2009-02-17 23:20:16 +01:00
Max Kellermann 9245bd0c69 input_file, input_curl, icy_metadata: added GLib log domains
Define G_LOG_DOMAIN.
2009-02-17 22:58:27 +01:00
Max Kellermann 7b84f1e6b3 faad: use the decoder_buffer library
Replace this plugin's own buffer library with the new decoder_buffer
library.
2009-02-17 22:56:42 +01:00
Max Kellermann 7cea5357e3 faad: check the result of adts_find_frame()
Instead of checking if the buffer is empty after adts_find_frame(),
check adts_find_frame()'s return value.  This is more robust.
2009-02-17 22:56:07 +01:00
Max Kellermann 77db32f8fb faad: added libfaad wrappers
Moved libfaad API quirks to the wrapper functions faad_decoder_init()
and faad_decoder_decode().
2009-02-17 22:54:26 +01:00
Max Kellermann 6a72db22d7 faad: functions return duration, no float pointer
Instead of writing the song duration into a float pointer, return it
from the function.
2009-02-17 22:54:01 +01:00
Max Kellermann e30ba2e4cf faad: removed length==NULL check in faad_song_duration()
There are no callers which pass NULL here.
2009-02-17 22:53:28 +01:00
Max Kellermann 867ae1cf6f faad: fill buffer in adts_find_frame()
All callers of adts_find_frame() use faad_buffer_fill() before that.
Move that faad_buffer_fill() call into adts_find_frame() instead.
adts_find_frame() will get its own logic for on-demand filling.
2009-02-17 22:53:25 +01:00
Max Kellermann 1a9756156e added the "decoder buffer" library
The decoder buffer library may be used by decoder libraries such as
"faad".
2009-02-17 22:39:45 +01:00
Max Kellermann 66b4a3ab2e faad: converted length check to assertion in adts_check_frame()
adts_check_frame() must not be called with a buffer length smaller
than 8.  We can eliminate that duplicate check, and convert it into an
assertion.
2009-02-17 19:28:11 +01:00
Max Kellermann 8edd407918 faad: added length check before comparing "ADIF"
It's not valid to use the buffer's data without ensuring that the
buffer contains enough data.
2009-02-17 19:27:36 +01:00
Max Kellermann d75ce5c4a0 faad: renamed internal functions
"aac" -> "faad"
2009-02-17 19:27:01 +01:00
Max Kellermann 943b17c99a wavpack: added GLib log domain 2009-02-17 19:26:36 +01:00
Max Kellermann 656d5c9c7b pcm_convert: removed pcm_convert_size()
The function is unused, since we added the pcm_buffer library.
2009-02-17 19:26:32 +01:00
Max Kellermann ac3e2de28b pcm_buffer: set size after allocation
When I implemented the pcm_buffer library, I forgot to set the new
buffer size.  This caused a new allocation in each pcm_buffer_get(),
fortunately no memory was leaked.
2009-02-17 18:27:00 +01:00
Max Kellermann d8db46edfa decoders: added and fixed GLib log domains
Fixed the log domains of the renamed decoders.  Added G_LOG_DOMAIN
macros in decoders which don't have one already.
2009-02-17 08:51:34 +01:00
Max Kellermann c4d69f0ae1 renamed decoder plugin "mpc" to "mpcdec"
This plugin is based on "libmpcdec".
2009-02-17 08:48:20 +01:00
Max Kellermann 70523657bf renamed decoder plugin "mp4" to "mp4ff"
This plugin is based on "libmp4ff".
2009-02-17 08:45:26 +01:00
Max Kellermann f4ff7eab9d tag: fixed typo in MUSICBRAINZ_TRACKID tag name 2009-02-17 06:48:57 +01:00
Max Kellermann 68314c33e9 faad: no CamelCase
Renamed functions and variables.
2009-02-16 19:31:11 +01:00
Max Kellermann 8d2e6bf54c faad: removed AacBuffer.fileOffset
The element fileOffset is only written, but never read.  It can be
removed safely.
2009-02-16 19:31:08 +01:00
Max Kellermann c6205bd461 renamed decoder plugin "oggvorbis" to "vorbis"
This plugin uses libvorbis.
2009-02-16 19:31:06 +01:00
Max Kellermann cafaf33aa8 renamed decoder plugin "aac" to "faad"
A decoder plugin should be named after the library which is used.
2009-02-16 19:30:54 +01:00
Max Kellermann c5edb53797 renamed decoder plugin "mp3" to "mad"
A decoder plugin should be named after the library which is used.
2009-02-16 19:30:45 +01:00
Max Kellermann 585f81ece1 output_api: don't include config.h
If an output plugin requires config.h, it should include it directly.
2009-02-16 18:41:30 +01:00
Max Kellermann 02c99d7716 mixer: include cleanup
Don't include conf.h in mixer_api.h.  Use a forward struct declaration
instead.
2009-02-16 18:40:04 +01:00
Max Kellermann 46c15e4ab3 output: include cleanup
Don't include output_api.h in output_internal.h.  This change requires
adding missing includes in several sources.
2009-02-16 01:51:50 +01:00
Max Kellermann 83ce0e5325 mixer_api: replaced method "control()" with "{get,set}_volume()"
The method control() is too complicated, and overengineered.  Replace
it with two trivial functions: get_volume() and set_volume().
2009-02-16 01:39:52 +01:00
Max Kellermann 37bc31d161 output_plugin: replaced method "control()" with "mixer()"
The output plugin shouldn't know any specifics of the mixer API.  Make
it return the mixer object, and let the caller deal with it.
2009-02-16 01:39:00 +01:00
Max Kellermann 79b50b7d9c output_plugin: added inline wrapper functions
Similar to the decoder plugin API: added wrapper functions to increase
code readability.
2009-02-16 01:38:10 +01:00
Max Kellermann 67da4cfe3c output_plugin: reorder method declarations
Initialization and deinitialization first, then tag functions, then
play/cancel/pause.
2009-02-16 01:38:09 +01:00
Max Kellermann 80702fa3a2 output_api: moved "struct audio_output_plugin" to output_plugin.h
If we move the plugin struct to a separate header, we don't have to
include the big fat output_api.h everywhere.
2009-02-16 01:37:42 +01:00
Max Kellermann a5c0394007 output_api: moved "enum output_command" to output_internal.h
Now that the output_command enum isn't exposed to output plugins
anymore, we can hide its definition within output_internal.h.
2009-02-16 00:43:12 +01:00
Max Kellermann 3a82283b19 output_control: no CamelCase
Renamed variables.
2009-02-16 00:43:06 +01:00
Max Kellermann ed591f19ef wildmidi: check if configurationn file exists
Don't call WildMidi_Init() if the configuration file does not exist.
Don't let libwildmidi clutter stderr with its warning message.
2009-02-15 18:41:05 +01:00
Max Kellermann 5c68f91dae wildmidi: obtain timidity.cfg location from mpd.conf 2009-02-15 18:41:03 +01:00
Max Kellermann 1f88cd73d4 decoder_list: added configuration option to disable decoder plugins 2009-02-15 18:40:47 +01:00
Max Kellermann 6cfacc778c decoder_list: added configuration block "decoder"
The "decoder" configuration block may contain the configuration of one
decoder plugin.
2009-02-15 18:35:19 +01:00
Max Kellermann dec5d48f80 decoder_plugin: pass struct config_param to init() method
Preparing for per-plugin configuration sections in mpd.conf.
2009-02-15 18:34:14 +01:00
Max Kellermann 900784bb4e decoder_api: moved enum decoder_command to decoder_command.h
Minimize header dependencies, again.
2009-02-15 18:33:31 +01:00
Max Kellermann 3e3c524264 decoder_plugin: added inline wrapper functions
Increase code readability, always use the wrapper functions instead of
calling the plugin method pointers directly.
2009-02-15 18:33:28 +01:00