Merge branch 'v0.17.x'

This commit is contained in:
Max Kellermann 2013-01-03 22:53:53 +01:00
commit 6837e5a6a0
6 changed files with 84 additions and 14 deletions

4
.gitignore vendored
View File

@ -67,3 +67,7 @@ test/run_ntp_server
test/run_resolver test/run_resolver
test/run_tcp_connect test/run_tcp_connect
test/test_pcm test/test_pcm
test/dump_rva2
test/dump_text_file
test/test_byte_reverse
test/test_vorbis_encoder

3
NEWS
View File

@ -21,6 +21,9 @@ ver 0.17.3 (2012/??/??)
* decoder: * decoder:
- ffmpeg: ignore negative time stamps - ffmpeg: ignore negative time stamps
- ffmpeg: support planar audio - ffmpeg: support planar audio
* playlist:
- cue: fix memory leak
- cue: fix CUE files with only one track
ver 0.17.2 (2012/09/30) ver 0.17.2 (2012/09/30)
* protocol: * protocol:

View File

@ -73,7 +73,8 @@ AC_DEFUN([MPD_AUTO_PKG_LIB], [
[eval "found_$1=yes"], [eval "found_$1=yes"],
AC_CHECK_LIB($4, $5, AC_CHECK_LIB($4, $5,
[eval "found_$1=yes $2_LIBS='$6' $2_CFLAGS='$7'"], [eval "found_$1=yes $2_LIBS='$6' $2_CFLAGS='$7'"],
[eval "found_$1=no"])) [eval "found_$1=no"],
[$6]))
fi fi
MPD_AUTO_RESULT([$1], [$8], [$9]) MPD_AUTO_RESULT([$1], [$8], [$9])

View File

@ -1,6 +1,6 @@
[Unit] [Unit]
Description=Music Player Daemon Description=Music Player Daemon
After=sound.target After=network.target sound.target
[Service] [Service]
ExecStart=@prefix@/bin/mpd --no-daemon ExecStart=@prefix@/bin/mpd --no-daemon

View File

@ -217,12 +217,12 @@ parse_cmdline(int argc, char **argv, struct options *options,
if(g_file_test(system_path, if(g_file_test(system_path,
G_FILE_TEST_IS_REGULAR)) { G_FILE_TEST_IS_REGULAR)) {
ret = config_read_file(system_path,error_r); ret = config_read_file(system_path,error_r);
g_free(system_path);
break; break;
} } else
++i;; g_free(system_path);
++i;
} }
g_free(system_path);
g_free(&system_config_dirs);
} }
#else /* G_OS_WIN32 */ #else /* G_OS_WIN32 */
char *path2; char *path2;

View File

@ -58,9 +58,35 @@ struct cue_parser {
char *filename; 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; 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 * struct cue_parser *
@ -73,6 +99,7 @@ cue_parser_new(void)
parser->current = NULL; parser->current = NULL;
parser->previous = NULL; parser->previous = NULL;
parser->finished = NULL; parser->finished = NULL;
parser->end = false;
return parser; return parser;
} }
@ -85,6 +112,9 @@ cue_parser_free(struct cue_parser *parser)
if (parser->current != NULL) if (parser->current != NULL)
song_free(parser->current); song_free(parser->current);
if (parser->previous != NULL)
song_free(parser->previous);
if (parser->finished != NULL) if (parser->finished != NULL)
song_free(parser->finished); song_free(parser->finished);
@ -201,10 +231,32 @@ cue_parse_position(const char *p)
return minutes * 60000 + seconds * 1000 + frames * 1000 / 75; 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 static void
cue_parser_feed2(struct cue_parser *parser, char *p) cue_parser_feed2(struct cue_parser *parser, char *p)
{ {
assert(parser != NULL); assert(parser != NULL);
assert(!parser->end);
assert(p != NULL); assert(p != NULL);
const char *command = cue_next_token(&p); const char *command = cue_next_token(&p);
@ -235,7 +287,7 @@ cue_parser_feed2(struct cue_parser *parser, char *p)
else if (parser->state == TRACK) else if (parser->state == TRACK)
cue_add_tag(parser->current->tag, TAG_TITLE, p); cue_add_tag(parser->current->tag, TAG_TITLE, p);
} else if (strcmp(command, "FILE") == 0) { } else if (strcmp(command, "FILE") == 0) {
cue_parser_finish(parser); cue_parser_commit(parser);
const char *filename = cue_next_value(&p); const char *filename = cue_next_value(&p);
if (filename == NULL) if (filename == NULL)
@ -258,7 +310,7 @@ cue_parser_feed2(struct cue_parser *parser, char *p)
} else if (parser->state == IGNORE_FILE) { } else if (parser->state == IGNORE_FILE) {
return; return;
} else if (strcmp(command, "TRACK") == 0) { } else if (strcmp(command, "TRACK") == 0) {
cue_parser_finish(parser); cue_parser_commit(parser);
const char *nr = cue_next_token(&p); const char *nr = cue_next_token(&p);
if (nr == NULL) if (nr == NULL)
@ -310,6 +362,7 @@ void
cue_parser_feed(struct cue_parser *parser, const char *line) cue_parser_feed(struct cue_parser *parser, const char *line)
{ {
assert(parser != NULL); assert(parser != NULL);
assert(!parser->end);
assert(line != NULL); assert(line != NULL);
char *allocated = g_strdup(line); char *allocated = g_strdup(line);
@ -320,12 +373,12 @@ cue_parser_feed(struct cue_parser *parser, const char *line)
void void
cue_parser_finish(struct cue_parser *parser) cue_parser_finish(struct cue_parser *parser)
{ {
if (parser->finished != NULL) if (parser->end)
song_free(parser->finished); /* has already been called, ignore */
return;
parser->finished = parser->previous; cue_parser_commit(parser);
parser->previous = parser->current; parser->end = true;
parser->current = NULL;
} }
struct song * struct song *
@ -333,6 +386,15 @@ cue_parser_get(struct cue_parser *parser)
{ {
assert(parser != NULL); 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; struct song *song = parser->finished;
parser->finished = NULL; parser->finished = NULL;
return song; return song;