From a9a5907a0ffe67c5da9bc34d615ab4aa8d7ba4fa Mon Sep 17 00:00:00 2001 From: John Date: Wed, 21 Nov 2012 17:26:23 +0100 Subject: mpd.service: depend on network.target Since some configurations use the "bind_to_address" option in their /etc/mpd.conf, the systemd service file must wait for the network.target or else mpd will start before it and thus fail due to no iface. --- mpd.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpd.service.in b/mpd.service.in index 9e9282fa..65fffa7b 100644 --- a/mpd.service.in +++ b/mpd.service.in @@ -1,6 +1,6 @@ [Unit] Description=Music Player Daemon -After=sound.target +After=network.target sound.target [Service] ExecStart=@prefix@/bin/mpd --no-daemon -- cgit v1.2.3 From 01a45a53aa93977903cf467ccd54c16956b50bdb Mon Sep 17 00:00:00 2001 From: Denis Krjuchkov Date: Wed, 17 Oct 2012 23:47:21 +0600 Subject: cmdline: bunch of fixes related to config file selection - fix potential memory leak of system_path 'Potential' because currently g_get_system_config_dirs() returns single entry on Windows, but that might change. - remove incorrect g_free() call It's not required at all because g_get_system_config_dirs() returns GLib owned memory. - remove extra semicolon --- src/cmdline.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cmdline.c b/src/cmdline.c index a972daf9..cb7eff36 100644 --- a/src/cmdline.c +++ b/src/cmdline.c @@ -213,12 +213,12 @@ parse_cmdline(int argc, char **argv, struct options *options, if(g_file_test(system_path, G_FILE_TEST_IS_REGULAR)) { ret = config_read_file(system_path,error_r); + g_free(system_path); break; - } - ++i;; + } else + g_free(system_path); + ++i; } - g_free(system_path); - g_free(&system_config_dirs); } #else /* G_OS_WIN32 */ char *path2; -- cgit v1.2.3 From 0f1a180e155af52e5842d416cfce0b9141e42a3d Mon Sep 17 00:00:00 2001 From: Denis Krjuchkov Date: Thu, 3 Jan 2013 19:59:41 +0100 Subject: mpd_auto.m4: Pass libraries to AC_CHECK_LIB in MPD_AUTO_PKG_LIB Rationale: vanilla libid3tag does not have any pkg-config stuff and fails to detect because symbols from libz are not found. --- m4/mpd_auto.m4 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/m4/mpd_auto.m4 b/m4/mpd_auto.m4 index 23713d5b..122c2588 100644 --- a/m4/mpd_auto.m4 +++ b/m4/mpd_auto.m4 @@ -73,7 +73,8 @@ AC_DEFUN([MPD_AUTO_PKG_LIB], [ [eval "found_$1=yes"], AC_CHECK_LIB($4, $5, [eval "found_$1=yes $2_LIBS='$6' $2_CFLAGS='$7'"], - [eval "found_$1=no"])) + [eval "found_$1=no"], + [$6])) fi MPD_AUTO_RESULT([$1], [$8], [$9]) -- cgit v1.2.3 From 31da4bc566432424c39aec9fe55ab656a4255f57 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 3 Jan 2013 21:02:59 +0100 Subject: cue_parser: fix memory leak --- NEWS | 2 ++ src/cue/cue_parser.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/NEWS b/NEWS index fb910e52..ece0b896 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,8 @@ ver 0.17.3 (2012/??/??) * decoder: - ffmpeg: ignore negative time stamps - ffmpeg: support planar audio +* playlist: + - cue: fix memory leak ver 0.17.2 (2012/09/30) * protocol: diff --git a/src/cue/cue_parser.c b/src/cue/cue_parser.c index 2b0733f0..898c7b82 100644 --- a/src/cue/cue_parser.c +++ b/src/cue/cue_parser.c @@ -85,6 +85,9 @@ cue_parser_free(struct cue_parser *parser) if (parser->current != NULL) song_free(parser->current); + if (parser->previous != NULL) + song_free(parser->previous); + if (parser->finished != NULL) song_free(parser->finished); -- cgit v1.2.3 From d29a251547901f9b602495af983f8455152cc966 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 3 Jan 2013 21:21:29 +0100 Subject: .gitignore: add more debug programs --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 67b26103..9f4d606a 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,7 @@ test/run_ntp_server test/run_resolver test/run_tcp_connect test/test_pcm +test/dump_rva2 +test/dump_text_file +test/test_byte_reverse +test/test_vorbis_encoder -- cgit v1.2.3 From 599a56217054c139108076725d570a58782f9ce6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 3 Jan 2013 21:38:38 +0100 Subject: cue_parser: add code comments --- src/cue/cue_parser.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/cue/cue_parser.c b/src/cue/cue_parser.c index 898c7b82..4031d6c4 100644 --- a/src/cue/cue_parser.c +++ b/src/cue/cue_parser.c @@ -58,8 +58,27 @@ struct cue_parser { char *filename; - struct song *current, *previous, *finished; - + /** + * The song currently being edited. + */ + struct song *current; + + /** + * The previous song. It is remembered because its end_time + * will be set to the current song's start time. + */ + struct song *previous; + + /** + * A song that is completely finished and can be returned to + * the caller via cue_parser_get(). + */ + struct song *finished; + + /** + * Set to true after previous.end_time has been updated to the + * start time of the current song. + */ bool last_updated; }; -- cgit v1.2.3 From 9761abf3b5726cf3870ce4cb36e47c86ac8cee86 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 3 Jan 2013 21:21:01 +0100 Subject: cue_parser: fix CUE files with only one track Track whether _finish() has been called, and deliver all partial results then. Fixes Mantis ticket 0003621. --- NEWS | 1 + src/cue/cue_parser.c | 54 +++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 48 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index ece0b896..5d3fa123 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ ver 0.17.3 (2012/??/??) - ffmpeg: support planar audio * playlist: - cue: fix memory leak + - cue: fix CUE files with only one track ver 0.17.2 (2012/09/30) * protocol: diff --git a/src/cue/cue_parser.c b/src/cue/cue_parser.c index 4031d6c4..9ccc3bcd 100644 --- a/src/cue/cue_parser.c +++ b/src/cue/cue_parser.c @@ -80,6 +80,13 @@ struct cue_parser { * start time of the current song. */ bool last_updated; + + /** + * Tracks whether cue_parser_finish() has been called. If + * true, then all remaining (partial) results will be + * delivered by cue_parser_get(). + */ + bool end; }; struct cue_parser * @@ -92,6 +99,7 @@ cue_parser_new(void) parser->current = NULL; parser->previous = NULL; parser->finished = NULL; + parser->end = false; return parser; } @@ -223,10 +231,32 @@ cue_parse_position(const char *p) return minutes * 60000 + seconds * 1000 + frames * 1000 / 75; } +/** + * Commit the current song. It will be moved to "previous", so the + * next song may soon edit its end time (using the next song's start + * time). + */ +static void +cue_parser_commit(struct cue_parser *parser) +{ + /* the caller of this library must call cue_parser_get() often + enough */ + assert(parser->finished == NULL); + assert(!parser->end); + + if (parser->current == NULL) + return; + + parser->finished = parser->previous; + parser->previous = parser->current; + parser->current = NULL; +} + static void cue_parser_feed2(struct cue_parser *parser, char *p) { assert(parser != NULL); + assert(!parser->end); assert(p != NULL); const char *command = cue_next_token(&p); @@ -257,7 +287,7 @@ cue_parser_feed2(struct cue_parser *parser, char *p) else if (parser->state == TRACK) cue_add_tag(parser->current->tag, TAG_TITLE, p); } else if (strcmp(command, "FILE") == 0) { - cue_parser_finish(parser); + cue_parser_commit(parser); const char *filename = cue_next_value(&p); if (filename == NULL) @@ -280,7 +310,7 @@ cue_parser_feed2(struct cue_parser *parser, char *p) } else if (parser->state == IGNORE_FILE) { return; } else if (strcmp(command, "TRACK") == 0) { - cue_parser_finish(parser); + cue_parser_commit(parser); const char *nr = cue_next_token(&p); if (nr == NULL) @@ -332,6 +362,7 @@ void cue_parser_feed(struct cue_parser *parser, const char *line) { assert(parser != NULL); + assert(!parser->end); assert(line != NULL); char *allocated = g_strdup(line); @@ -342,12 +373,12 @@ cue_parser_feed(struct cue_parser *parser, const char *line) void cue_parser_finish(struct cue_parser *parser) { - if (parser->finished != NULL) - song_free(parser->finished); + if (parser->end) + /* has already been called, ignore */ + return; - parser->finished = parser->previous; - parser->previous = parser->current; - parser->current = NULL; + cue_parser_commit(parser); + parser->end = true; } struct song * @@ -355,6 +386,15 @@ cue_parser_get(struct cue_parser *parser) { assert(parser != NULL); + if (parser->finished == NULL && parser->end) { + /* cue_parser_finish() has been called already: + deliver all remaining (partial) results */ + assert(parser->current == NULL); + + parser->finished = parser->previous; + parser->previous = NULL; + } + struct song *song = parser->finished; parser->finished = NULL; return song; -- cgit v1.2.3