From 83f6498aac5f3d62611d392c8a35f1b1fcf1e75a Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 30 Sep 2011 08:37:36 +0200 Subject: Install systemd service file if systemd is available --- NEWS | 1 + 1 file changed, 1 insertion(+) (limited to 'NEWS') diff --git a/NEWS b/NEWS index f810c88e..df870fc4 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,7 @@ ver 0.16.5 (2010/??/??) - ffmpeg: don't require key frame for seeking - fix CUE track seeking * WIN32: close sockets properly +* install systemd service file if systemd is available ver 0.16.4 (2011/09/01) -- cgit v1.2.3 From 37f026a0a67b9014754e4ab1fcc22229e384fee3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 5 Oct 2011 22:13:13 +0200 Subject: player_thread: handle SEEK while not playing --- NEWS | 3 +++ src/player_thread.c | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'NEWS') diff --git a/NEWS b/NEWS index df870fc4..7e7f128c 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,9 @@ ver 0.16.5 (2010/??/??) - ffmpeg: higher precision timestamps - ffmpeg: don't require key frame for seeking - fix CUE track seeking +* player: + - make seeking to CUE track more reliable + - the "seek" command works when MPD is stopped * WIN32: close sockets properly * install systemd service file if systemd is available diff --git a/src/player_thread.c b/src/player_thread.c index b6375854..31bb3d50 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -145,8 +145,12 @@ player_dc_start(struct player *player, struct music_pipe *pipe) assert(player->queued || pc.command == PLAYER_COMMAND_SEEK); assert(pc.next_song != NULL); + unsigned start_ms = pc.next_song->start_ms; + if (pc.command == PLAYER_COMMAND_SEEK) + start_ms += (unsigned)(pc.seek_where * 1000); + dc_start(dc, pc.next_song, - pc.next_song->start_ms, pc.next_song->end_ms, + start_ms, pc.next_song->end_ms, player_buffer, pipe); } @@ -835,6 +839,10 @@ static void do_play(struct decoder_control *dc) } player_lock(); + + if (pc.command == PLAYER_COMMAND_SEEK) + player.elapsed_time = pc.seek_where; + pc.state = PLAYER_STATE_PLAY; player_command_finished_locked(); @@ -1013,6 +1021,7 @@ static gpointer player_task(G_GNUC_UNUSED gpointer arg) while (1) { switch (pc.command) { + case PLAYER_COMMAND_SEEK: case PLAYER_COMMAND_QUEUE: assert(pc.next_song != NULL); @@ -1026,7 +1035,6 @@ static gpointer player_task(G_GNUC_UNUSED gpointer arg) /* fall through */ - case PLAYER_COMMAND_SEEK: case PLAYER_COMMAND_PAUSE: pc.next_song = NULL; player_command_finished_locked(); -- cgit v1.2.3 From 8ea6c113b57c9a8b577e7048a31f46cc868c99b7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 5 Oct 2011 22:24:53 +0200 Subject: player_control: auto-start playback when seeking is requested Now that the player thread can handle SEEK commands while not (yet) playing, we can remove the "pc.state" check from pc_seek(). --- NEWS | 1 + src/player_control.c | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'NEWS') diff --git a/NEWS b/NEWS index 7e7f128c..eab7062f 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,7 @@ ver 0.16.5 (2010/??/??) * player: - make seeking to CUE track more reliable - the "seek" command works when MPD is stopped + - restore song position from state file (bug fix) * WIN32: close sockets properly * install systemd service file if systemd is available diff --git a/src/player_control.c b/src/player_control.c index a190bbd8..e3e6b773 100644 --- a/src/player_control.c +++ b/src/player_control.c @@ -309,9 +309,6 @@ pc_seek(struct song *song, float seek_time) { assert(song != NULL); - if (pc.state == PLAYER_STATE_STOP) - return false; - player_lock(); pc.next_song = song; pc.seek_where = seek_time; -- cgit v1.2.3 From b2f03e76ffd3af918d8eda0968f54c0b81bbff54 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 6 Oct 2011 20:30:46 +0200 Subject: player_thread: add flag "output_open", fixes assertion failure Previously, the condition "defined(play_audio_format)" was used to see if an output device has been opened, but if the device had failed on startup, an assertion failure could occur. This patch adds a separate flag. --- NEWS | 1 + src/player_thread.c | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'NEWS') diff --git a/NEWS b/NEWS index eab7062f..44f78e47 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,7 @@ ver 0.16.5 (2010/??/??) - make seeking to CUE track more reliable - the "seek" command works when MPD is stopped - restore song position from state file (bug fix) + - fix crash that sometimes occurred when audio device fails on startup * WIN32: close sockets properly * install systemd service file if systemd is available diff --git a/src/player_thread.c b/src/player_thread.c index 9a7c917f..52788e51 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -73,6 +73,14 @@ struct player { */ bool queued; + /** + * Was any audio output opened successfully? It might have + * failed meanwhile, but was not explicitly closed by the + * player thread. When this flag is unset, some output + * methods must not be called. + */ + bool output_open; + /** * the song currently being played */ @@ -290,6 +298,7 @@ player_open_output(struct player *player) pc.state == PLAYER_STATE_PAUSE); if (audio_output_all_open(&player->play_audio_format, player_buffer)) { + player->output_open = true; player->paused = false; player_lock(); @@ -298,6 +307,8 @@ player_open_output(struct player *player) return true; } else { + player->output_open = false; + /* pause: the user may resume playback as soon as an audio output becomes available */ player->paused = true; @@ -342,7 +353,7 @@ player_check_decoder_startup(struct player *player) decoder_unlock(dc); - if (audio_format_defined(&player->play_audio_format) && + if (player->output_open && !audio_output_all_wait(1)) /* the output devices havn't finished playing all chunks yet - wait for that */ @@ -386,6 +397,7 @@ player_check_decoder_startup(struct player *player) static bool player_send_silence(struct player *player) { + assert(player->output_open); assert(audio_format_defined(&player->play_audio_format)); struct music_chunk *chunk = music_buffer_allocate(player_buffer); @@ -579,8 +591,7 @@ static void player_process_command(struct player *player) break; case PLAYER_COMMAND_REFRESH: - if (audio_format_defined(&player->play_audio_format) && - !player->paused) { + if (player->output_open && !player->paused) { player_unlock(); audio_output_all_check(); player_lock(); @@ -831,6 +842,7 @@ static void do_play(struct decoder_control *dc) .decoder_starting = false, .paused = false, .queued = true, + .output_open = false, .song = NULL, .xfade = XFADE_UNKNOWN, .cross_fading = false, @@ -883,7 +895,7 @@ static void do_play(struct decoder_control *dc) /* not enough decoded buffer space yet */ if (!player.paused && - audio_format_defined(&player.play_audio_format) && + player.output_open && audio_output_all_check() < 4 && !player_send_silence(&player)) break; @@ -988,7 +1000,7 @@ static void do_play(struct decoder_control *dc) audio_output_all_drain(); break; } - } else { + } else if (player.output_open) { /* the decoder is too busy and hasn't provided new PCM data in time: send silence (if the output pipe is empty) */ -- cgit v1.2.3 From 039b3544902fe479fa2ce31f06de2c08377e0fc5 Mon Sep 17 00:00:00 2001 From: Jesús Bravo Álvarez Date: Thu, 6 Oct 2011 22:21:24 +0200 Subject: playlist_song: fix absolute path support in playlists Right now, a playlist with absolute pathnames can only add songs that are in the same the directory of the playlist or under it. If uri is an absolute pathname and base_uri is set, playlist_check_translate_song() will check that base_uri is a prefix of uri, excluding every other song in the music directory outside base_uri. I think in this case base_uri should be completely ignored (and made NULL) and uri should just be checked against music root directory. --- NEWS | 1 + src/playlist_song.c | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'NEWS') diff --git a/NEWS b/NEWS index 44f78e47..17169a61 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,7 @@ ver 0.16.5 (2010/??/??) - the "seek" command works when MPD is stopped - restore song position from state file (bug fix) - fix crash that sometimes occurred when audio device fails on startup + - fix absolute path support in playlists * WIN32: close sockets properly * install systemd service file if systemd is available diff --git a/src/playlist_song.c b/src/playlist_song.c index 1a543a0b..82709865 100644 --- a/src/playlist_song.c +++ b/src/playlist_song.c @@ -114,9 +114,7 @@ playlist_check_translate_song(struct song *song, const char *base_uri) if (g_path_is_absolute(uri)) { /* XXX fs_charset vs utf8? */ - char *prefix = base_uri != NULL - ? map_uri_fs(base_uri) - : map_directory_fs(db_get_root()); + char *prefix = map_directory_fs(db_get_root()); if (prefix == NULL || !g_str_has_prefix(uri, prefix) || uri[strlen(prefix)] != '/') { @@ -127,6 +125,7 @@ playlist_check_translate_song(struct song *song, const char *base_uri) return NULL; } + base_uri = NULL; uri += strlen(prefix) + 1; g_free(prefix); } -- cgit v1.2.3