From 16123f1b8e832ad1743e9ab24bd7c7663411bfa4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 30 Nov 2009 09:59:05 +0100 Subject: ffmpeg: don't try to force stereo The plugin code tried to force libavcodec to supply stereo samples. That however has never actually worked. By removing this code, we are able to play surround files for the first time. --- NEWS | 2 ++ src/decoder/ffmpeg_plugin.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 6b6944c1b..e566504d2 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.15.7 (2009/??/??) +* decoders: + - ffmpeg: don't try to force stereo ver 0.15.6 (2009/11/18) diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c index b9aafaf7b..86c20a882 100644 --- a/src/decoder/ffmpeg_plugin.c +++ b/src/decoder/ffmpeg_plugin.c @@ -289,10 +289,6 @@ ffmpeg_decode_internal(struct ffmpeg_context *ctx) total_time = 0; - if (codec_context->channels > 2) { - codec_context->channels = 2; - } - #if LIBAVCODEC_VERSION_INT >= ((51<<16)+(41<<8)+0) audio_format.bits = (uint8_t) av_get_bits_per_sample_format(codec_context->sample_fmt); #else -- cgit v1.2.3 From 7162fe85ce3008c6bcd2d4b2dfe6505b8a205479 Mon Sep 17 00:00:00 2001 From: svitoos Date: Mon, 30 Nov 2009 17:42:46 +0100 Subject: tag_id3: fix ID3v1 charset conversion If we define id3v1_encoding, then the tags are not added to the database. --- NEWS | 2 ++ src/tag_id3.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index e566504d2..c627f6dc3 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.15.7 (2009/??/??) +* tags: + - id3: fix ID3v1 charset conversion * decoders: - ffmpeg: don't try to force stereo diff --git a/src/tag_id3.c b/src/tag_id3.c index 0ae37f3ec..a33ebc00b 100644 --- a/src/tag_id3.c +++ b/src/tag_id3.c @@ -90,7 +90,7 @@ static id3_utf8_t * processID3FieldString (int is_id3v1, const id3_ucs4_t *ucs4, utf8 = (id3_utf8_t *) g_convert_with_fallback((const char*)isostr, -1, - encoding, "utf-8", + "utf-8", encoding, NULL, NULL, NULL, NULL); if (utf8 == NULL) { g_debug("Unable to convert %s string to UTF-8: '%s'", -- cgit v1.2.3 From 23e46b38ca03aa7d83c93df0df51ce5e986b7928 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 8 Dec 2009 08:06:10 +0100 Subject: mapper: fix memory leak when playlist_directory is not set Don't allocate the file name before the playlist_dir==NULL check. --- NEWS | 1 + src/mapper.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index c627f6dc3..d8b3714e7 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ ver 0.15.7 (2009/??/??) - id3: fix ID3v1 charset conversion * decoders: - ffmpeg: don't try to force stereo +* mapper: fix memory leak when playlist_directory is not set ver 0.15.6 (2009/11/18) diff --git a/src/mapper.c b/src/mapper.c index aac7c0c48..5c19021f9 100644 --- a/src/mapper.c +++ b/src/mapper.c @@ -221,12 +221,12 @@ map_spl_path(void) char * map_spl_utf8_to_fs(const char *name) { - char *filename = g_strconcat(name, PLAYLIST_FILE_SUFFIX, NULL); - char *path; + char *filename, *path; if (playlist_dir == NULL) return NULL; + filename = g_strconcat(name, PLAYLIST_FILE_SUFFIX, NULL); path = g_build_filename(playlist_dir, filename, NULL); g_free(filename); -- cgit v1.2.3 From cd69fee0a46e6b64ea9c76ccb83e601e098f3e07 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 8 Dec 2009 08:30:33 +0100 Subject: command: verify playlist name in the "rm" command Call spl_valid_name() in spl_delete(). --- NEWS | 1 + src/stored_playlist.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/NEWS b/NEWS index d8b3714e7..a48bac467 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ ver 0.15.7 (2009/??/??) * decoders: - ffmpeg: don't try to force stereo * mapper: fix memory leak when playlist_directory is not set +* command: verify playlist name in the "rm" command ver 0.15.6 (2009/11/18) diff --git a/src/stored_playlist.c b/src/stored_playlist.c index f283ab98b..131c2098a 100644 --- a/src/stored_playlist.c +++ b/src/stored_playlist.c @@ -323,6 +323,9 @@ spl_delete(const char *name_utf8) char *path_fs; int ret; + if (!spl_valid_name(name_utf8)) + return PLAYLIST_RESULT_BAD_NAME; + path_fs = map_spl_utf8_to_fs(name_utf8); if (path_fs == NULL) return PLAYLIST_RESULT_DISABLED; -- cgit v1.2.3 From f4b707b4ca6451fcb1a6af6d3f2e58579b3c01a5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 8 Dec 2009 08:17:35 +0100 Subject: mapper: apply filesystem_charset to playlists This fixes an inconsistency in the stored playlist subsystem: when obtaining the list of playlists (listplaylist, listplaylistinfo), the file names in the playlist directory are converted to UTF-8 (according to filesystem_charset), but when saving or loading playlists, the filesystem_charset setting was ignored. --- NEWS | 1 + src/mapper.c | 13 +++++++++---- src/mapper.h | 2 ++ src/playlist_save.c | 5 ++++- src/stored_playlist.c | 27 +++++++++++++++++++++------ 5 files changed, 37 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index a48bac467..3ce6b8403 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ ver 0.15.7 (2009/??/??) * decoders: - ffmpeg: don't try to force stereo * mapper: fix memory leak when playlist_directory is not set +* mapper: apply filesystem_charset to playlists * command: verify playlist name in the "rm" command diff --git a/src/mapper.c b/src/mapper.c index 5c19021f9..5518cb79e 100644 --- a/src/mapper.c +++ b/src/mapper.c @@ -221,14 +221,19 @@ map_spl_path(void) char * map_spl_utf8_to_fs(const char *name) { - char *filename, *path; + char *filename_utf8, *filename_fs, *path; if (playlist_dir == NULL) return NULL; - filename = g_strconcat(name, PLAYLIST_FILE_SUFFIX, NULL); - path = g_build_filename(playlist_dir, filename, NULL); - g_free(filename); + filename_utf8 = g_strconcat(name, PLAYLIST_FILE_SUFFIX, NULL); + filename_fs = utf8_to_fs_charset(filename_utf8); + g_free(filename_utf8); + if (filename_fs == NULL) + return NULL; + + path = g_build_filename(playlist_dir, filename_fs, NULL); + g_free(filename_fs); return path; } diff --git a/src/mapper.h b/src/mapper.h index 2667f1eee..f109de0bd 100644 --- a/src/mapper.h +++ b/src/mapper.h @@ -99,6 +99,8 @@ map_spl_path(void); * Maps a playlist name (without the ".m3u" suffix) to a file system * path. The return value is allocated on the heap and must be freed * with g_free(). + * + * @return the path in file system encoding, or NULL if mapping failed */ char * map_spl_utf8_to_fs(const char *name); diff --git a/src/playlist_save.c b/src/playlist_save.c index 776d3c385..13dbc721d 100644 --- a/src/playlist_save.c +++ b/src/playlist_save.c @@ -71,12 +71,15 @@ spl_save_queue(const char *name_utf8, const struct queue *queue) char *path_fs; FILE *file; + if (map_spl_path() == NULL) + return PLAYLIST_RESULT_DISABLED; + if (!spl_valid_name(name_utf8)) return PLAYLIST_RESULT_BAD_NAME; path_fs = map_spl_utf8_to_fs(name_utf8); if (path_fs == NULL) - return PLAYLIST_RESULT_DISABLED; + return PLAYLIST_RESULT_BAD_NAME; if (g_file_test(path_fs, G_FILE_TEST_EXISTS)) { g_free(path_fs); diff --git a/src/stored_playlist.c b/src/stored_playlist.c index 131c2098a..5ed7182f6 100644 --- a/src/stored_playlist.c +++ b/src/stored_playlist.c @@ -152,9 +152,12 @@ spl_save(GPtrArray *list, const char *utf8path) assert(utf8path != NULL); + if (map_spl_path() == NULL) + return PLAYLIST_RESULT_DISABLED; + path_fs = map_spl_utf8_to_fs(utf8path); if (path_fs == NULL) - return PLAYLIST_RESULT_DISABLED; + return PLAYLIST_RESULT_BAD_NAME; while (!(file = fopen(path_fs, "w")) && errno == EINTR); g_free(path_fs); @@ -178,7 +181,7 @@ spl_load(const char *utf8path) char buffer[MPD_PATH_MAX]; char *path_fs; - if (!spl_valid_name(utf8path)) + if (!spl_valid_name(utf8path) || map_spl_path() == NULL) return NULL; path_fs = map_spl_utf8_to_fs(utf8path); @@ -299,12 +302,15 @@ spl_clear(const char *utf8path) char *path_fs; FILE *file; + if (map_spl_path() == NULL) + return PLAYLIST_RESULT_DISABLED; + if (!spl_valid_name(utf8path)) return PLAYLIST_RESULT_BAD_NAME; path_fs = map_spl_utf8_to_fs(utf8path); if (path_fs == NULL) - return PLAYLIST_RESULT_DISABLED; + return PLAYLIST_RESULT_BAD_NAME; while (!(file = fopen(path_fs, "w")) && errno == EINTR); g_free(path_fs); @@ -323,12 +329,15 @@ spl_delete(const char *name_utf8) char *path_fs; int ret; + if (map_spl_path() == NULL) + return PLAYLIST_RESULT_DISABLED; + if (!spl_valid_name(name_utf8)) return PLAYLIST_RESULT_BAD_NAME; path_fs = map_spl_utf8_to_fs(name_utf8); if (path_fs == NULL) - return PLAYLIST_RESULT_DISABLED; + return PLAYLIST_RESULT_BAD_NAME; ret = unlink(path_fs); g_free(path_fs); @@ -373,12 +382,15 @@ spl_append_song(const char *utf8path, struct song *song) struct stat st; char *path_fs; + if (map_spl_path() == NULL) + return PLAYLIST_RESULT_DISABLED; + if (!spl_valid_name(utf8path)) return PLAYLIST_RESULT_BAD_NAME; path_fs = map_spl_utf8_to_fs(utf8path); if (path_fs == NULL) - return PLAYLIST_RESULT_DISABLED; + return PLAYLIST_RESULT_BAD_NAME; while (!(file = fopen(path_fs, "a")) && errno == EINTR); g_free(path_fs); @@ -448,6 +460,9 @@ spl_rename(const char *utf8from, const char *utf8to) char *from_path_fs, *to_path_fs; static enum playlist_result ret; + if (map_spl_path() == NULL) + return PLAYLIST_RESULT_DISABLED; + if (!spl_valid_name(utf8from) || !spl_valid_name(utf8to)) return PLAYLIST_RESULT_BAD_NAME; @@ -457,7 +472,7 @@ spl_rename(const char *utf8from, const char *utf8to) if (from_path_fs != NULL && to_path_fs != NULL) ret = spl_rename_internal(from_path_fs, to_path_fs); else - ret = PLAYLIST_RESULT_DISABLED; + ret = PLAYLIST_RESULT_BAD_NAME; g_free(from_path_fs); g_free(to_path_fs); -- cgit v1.2.3 From 5a354a1ed4addd7bc757af8da797c768580454c2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 8 Dec 2009 08:47:47 +0100 Subject: mixer: explicitly close all mixers on shutdown Mixers with the "global" flag set aren't closed automatically when the output device is closed. Thus, they might still be open when MPD shuts down. --- NEWS | 1 + src/mixer_control.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/NEWS b/NEWS index 3ce6b8403..b375eefd7 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ ver 0.15.7 (2009/??/??) - id3: fix ID3v1 charset conversion * decoders: - ffmpeg: don't try to force stereo +* mixer: explicitly close all mixers on shutdown * mapper: fix memory leak when playlist_directory is not set * mapper: apply filesystem_charset to playlists * command: verify playlist name in the "rm" command diff --git a/src/mixer_control.c b/src/mixer_control.c index a17885935..e19b82d65 100644 --- a/src/mixer_control.c +++ b/src/mixer_control.c @@ -62,6 +62,10 @@ mixer_free(struct mixer *mixer) assert(mixer->plugin != NULL); assert(mixer->mutex != NULL); + /* mixers with the "global" flag set might still be open at + this point (see mixer_auto_close()) */ + mixer_close(mixer); + g_mutex_free(mixer->mutex); mixer->plugin->finish(mixer); -- cgit v1.2.3 From 8f7bc70bf5e47da66e57e5606b978ba3ee975d89 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 11 Dec 2009 12:45:57 +0100 Subject: decoder/wavpack: don't use the nonstandard "uchar" type Use the signed C99 type int8_t instead. --- src/decoder/wavpack_plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/decoder/wavpack_plugin.c b/src/decoder/wavpack_plugin.c index 821536fb5..645c8962e 100644 --- a/src/decoder/wavpack_plugin.c +++ b/src/decoder/wavpack_plugin.c @@ -72,7 +72,7 @@ format_samples_int(int bytes_per_sample, void *buffer, uint32_t count) switch (bytes_per_sample) { case 1: { - uchar *dst = buffer; + int8_t *dst = buffer; /* * The asserts like the following one are because we do the * formatting of samples within a single buffer. The size -- cgit v1.2.3