Commit Graph

4672 Commits

Author SHA1 Message Date
Max Kellermann e28a0e97b5 decoder_control: protect command, state with a mutex
Replace decoder_control.notify with decoder_control.mutex and
decoder_control.cond.  Lock the mutex on all accesses to
decoder_control.command and decoder_control.state.
2009-08-13 23:33:46 +02:00
Mike Frysinger 499ed62dd7 use daemon() when the C library provides it
For systems that cannot support fork() (like no-mmu Linux), use daemon() if
it is available for the daemonizing code.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-08-13 17:25:30 +02:00
Max Kellermann c3e02bec3b test: initialize locale in read_tags.c 2009-08-04 00:41:06 +02:00
Max Kellermann 4363c49443 tag_id3: moved id3_genre_name() call to tag_id3_import_text()
The ID3_FRAME_GENRE field is queried only in tag_id3_import_text().
Don't pass the tag type to import_id3_string().
2009-08-04 00:15:46 +02:00
Max Kellermann 09571fcc55 tag_id3: splitted function tag_id3_import_frame()
Splitted tag_id3_import_frame() into two specialized functions:
tag_id3_import_text() and tag_id3_import_comment().  Use
id3_frame_field() instead of directly accessing id3_frame.fields.
2009-08-04 00:15:43 +02:00
Max Kellermann c7563a5783 tag_id3: corrected parameter types
Changed "int type" to "enum tag_type".  Converted "int is_id3v1" to
"bool".
2009-08-04 00:14:24 +02:00
Max Kellermann b06b4f937d tag_id3: converted tag_is_id3v1() to an inline function
Prefer C over CPP.
2009-08-04 00:13:22 +02:00
Max Kellermann 86c6bb618b tag_id3: no CamelCase
Renamed functions.
2009-08-04 00:13:22 +02:00
Anton Khirnov bff72634ca ffmpeg_plugin: convert metadata to generic format 2009-08-03 17:40:22 +02:00
Max Kellermann 6f060081be command: moved command_process_list() to client.c 2009-07-29 08:00:01 +02:00
Courtney Cavin 7f865f722c playlist: CamelCaseIsBad
Renamed all playlist functions to non-CamelCase.
2009-07-28 18:07:01 -04:00
Courtney Cavin 614a011845 input/lastfm: Ensure multiple identical xml entities are decoded.
Previously, if two identical entities appeared in one string, only the
first would get decoded. This fixes that bug.
2009-07-28 16:40:52 -04:00
Max Kellermann 0c66832b3b doc: removed deprecated mixer options from manpage
Removed documentation about the global options mixer_type,
mixer_device and mixer_control.
2009-07-28 17:22:55 +02:00
Max Kellermann f78366910e client: splitted client.c into several pieces
The soure file client.c has nearly 1000 lines, time for splitting it
into smaller pieces to improve readability.
2009-07-28 17:17:23 +02:00
Max Kellermann c426bbcf95 client: moved struct client to client_internal.h
Prepare splitting client.c into several sources.
2009-07-28 16:42:40 +02:00
Courtney Cavin 6d71094ce5 input/lastfm: use metadata
Added a patch to flush out the last.fm input plugin slightly. It
basically turns it into a wrapper for the appropriate plugin. Most
notably metadata is now extracted.
2009-07-28 16:41:50 +02:00
Max Kellermann 9322f04529 cmdline: obey $(sysconfdir) for default mpd.conf location
Instead of hard-coding the path "/etc/mpd.conf", use the configured
$(sysconfdir) path.  This can be set with:

 ./configure --sysconfdir=/etc

Note that this changes the default path to "/usr/local/etc/mpd.conf",
given the default prefix "/usr/local".  This is actually more correct
than the old default.
2009-07-28 16:17:18 +02:00
Max Kellermann 884201b919 client: moved some code to client_list_X()
Make the client list management a separate sub-library.
2009-07-23 19:20:30 +02:00
Max Kellermann a0afd0369f client: don't include socket headers
The client code uses portable GLib I/O functions and doesn't need the
OS specific socket headers.
2009-07-23 17:32:12 +02:00
Max Kellermann caf48ee973 player_thread: don't use precalculated size_to_time
Calculate the total play time with the audio_format object each time,
using audio_format_time_to_size().  The function
audioFormatSizeToTime() is not needed anymore, and will be removed
with this patch.
2009-07-23 12:27:05 +02:00
Max Kellermann 0749dbfadf player_thread: moved code to update_song_tag() 2009-07-23 12:26:26 +02:00
Max Kellermann 54889c72e3 pcm_convert: use GError for error handling
Don't abort the whole MPD process when the conversion fails.  This has
been a denial-of-service attack vector for years.
2009-07-23 12:01:03 +02:00
Max Kellermann cba126ceb8 pcm_resample_fallback: don't include glib.h
This library does not use GLib directly.
2009-07-22 19:54:57 +02:00
Max Kellermann c95663312a pcm_resample_fallback: removed G_GNUC_UNUSED attribute 2009-07-22 19:52:25 +02:00
Max Kellermann 00ee3de7b2 pcm_channels: num_channels is unsigned
You cannot have a negative number of channels, let's pass it as
uint8_t instead of int8_t.
2009-07-22 19:12:04 +02:00
Max Kellermann 172a1dbdb9 pcm_byteswap: converted NULL checks to assertions
It is illegal to pass a NULL buffer to pcm_byteswap_X().  The result
of this is that pcm_byteswap_X() never returns NULL.
2009-07-22 19:04:38 +02:00
Max Kellermann c5a662f405 pcm_convert: added pcm_convert_state.byteswap_buffer
Currently, byteswapping is performed on the format_buffer.  This can
go wrong when this buffer is used twice during one run.  Add a
separate buffer for swapping the byte order.
2009-07-22 15:56:56 +02:00
Max Kellermann 9277950441 filter/volume: check the flag audio_format.reverse_endian
The volume plugin does not work for reverse_endian samples.
2009-07-22 15:56:50 +02:00
Max Kellermann 44c97a8f6d audio_format: added API documentation 2009-07-22 15:56:48 +02:00
Max Kellermann 6a071efa27 audio_format: initialize reverse_endian in audio_format_init()
This line was missing in the reverse_endian patch, and led to
undefined values and crashes in that attribute.
2009-07-22 15:56:36 +02:00
Michal Nazarewicz bfed1c04cc daemon: daemonize_close_stdin() optimised.
Changed function to first close standard input (this may
fail but we don't care) and then try to open /dev/null (this
may fail but it shouldn't on Unix platforms plus we don't
know what to do in such case anyways).  Since standard input
has the "zeroth" descriptor number next "open" will use it.

Since there is no "/dev/null" on Windows (It's not even
a valid path!) the second step is skipped if WIN32 is
defined.

As a final touch, since the function consists of merely two
function calls it has been moved to header file and declared
static inline.

[mk: un-inline daemonize_close_stdin()]
2009-07-22 13:43:21 +02:00
Eugeny N Dzhurinsky bdb1965b50 cmdline: renamed options.stderr to options.log_stderr
On FreeBSD, "stderr" is a macro, and using this name for a struct
member breaks the build.

[mk: renamed _stderr to log_stderr]
2009-07-22 13:40:19 +02:00
Max Kellermann f4b39bc263 decoder/flac: fixed indentation of flac_comment_value() 2009-07-22 13:34:33 +02:00
Max Kellermann 47ed89bd4c decoder/flac: parse all replaygain tags
The FLAC replaygain parser used the "||" operator.  This made the code
stop after the first value which was found.
2009-07-22 13:31:48 +02:00
Max Kellermann cf1fd2b0da decoder/flac: return early from flac_find_float_comment()
When one metadata check fails, return quickly.  This removes 2 levels
of indent.
2009-07-22 13:31:46 +02:00
Max Kellermann 8e2d987996 decoder/flac: removed misplaced authorship comment
This belongs into "git annotate" or AUTHORS.
2009-07-22 13:31:43 +02:00
Max Kellermann 322ef3cb80 mad: skip ID3 frames when libid3tag is disabled
When libid3tag is disabled, the libmad decoder plugin is unable to
identify ID3 frames.  If the file starts with an (unidentified) ID3
frame, it assumes that the file is not a valid MP3 song.  This patch
solves this by adding minimal stubs for the ID3 functions.
2009-07-22 12:57:03 +02:00
Max Kellermann c9d43b4d71 Merge branch 'master' of git://git.infradead.org/users/dwmw2/mpd
Conflicts:

	Makefile.am
2009-07-19 18:18:32 +02:00
David Woodhouse 49ede85827 Support wrong-endian ALSA output 2009-07-19 17:15:35 +01:00
David Woodhouse 05693e2d5d Add reverse_endian field to struct audio_format and handle conversion 2009-07-19 17:15:21 +01:00
Max Kellermann c5ec035fb4 tag_ape: simplified the apeItems array
Make "enum tag_type" the array index, and convert apeItems to a sparse
array.
2009-07-19 18:04:42 +02:00
Max Kellermann 5e2f98fdad tag_ape: moved code to tag_ape_import_item()
Improve code readability.
2009-07-19 17:59:36 +02:00
Max Kellermann 7b92750622 tag_ape: converted apeItems and tagItems to global vars
Don't initialize those arrays each time tag_ape_load() is called.
2009-07-19 17:59:35 +02:00
David Woodhouse 37754559b8 Add audio_format_init() function
It makes no difference right now, but we're about to add an endianness
flag and will want to make sure it's correctly initialised every time.
2009-07-19 16:54:11 +01:00
Max Kellermann 0ce727d5d4 ape: added protection against large memory allocations
The function tag_ape_load() retrieves a 32 bit unsigned integer from
the input file, and passes it to g_malloc().  This is dangerous, and
may be used for a denial of service attack on MPD.
2009-07-19 17:38:46 +02:00
Max Kellermann e3ff0ab6d1 tag_ape: removed redundant length check
Extend the tagLen check after reading it.  Removed the second
(redundant) check after the subtraction.
2009-07-19 17:37:02 +02:00
Max Kellermann 09008cb0ec client: return "enum command_return" instead of "int"
Several functions work with the wrong return type, this patch fixes
them.
2009-07-19 15:53:48 +02:00
Max Kellermann b58aa1f5ee removed buffer2array.c 2009-07-19 15:15:41 +02:00
Max Kellermann 38e9205d4e command: use the tokenizer library 2009-07-19 15:15:36 +02:00
Max Kellermann 16ff44ad30 conf: use the tokenizer library 2009-07-19 15:11:37 +02:00