From 97c4bf5ba413a120e6277c73e82b1d150c459592 Mon Sep 17 00:00:00 2001 From: waker Date: Thu, 23 Jun 2011 20:18:32 +0200 Subject: fixed freeze in alsa_free on x86_64 (bug #3325101) --- plugins/alsa/alsa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c index 1cc0229a..fd71c89a 100644 --- a/plugins/alsa/alsa.c +++ b/plugins/alsa/alsa.c @@ -670,7 +670,10 @@ palsa_thread (void *context) { frames_to_deliver = snd_pcm_avail_update (audio); } UNLOCK; - usleep ((period_size-frames_to_deliver) * 1000000 / plugin.fmt.samplerate / plugin.fmt.channels); + int sleeptime = period_size-frames_to_deliver; + if (sleeptime > 0 && plugin.fmt.samplerate > 0 && plugin.fmt.channels > 0) { + usleep (sleeptime * 1000000 / plugin.fmt.samplerate / plugin.fmt.channels); + } } } -- cgit v1.2.3 From 2e702e0996c847d97d1f514d729c9f6932889804 Mon Sep 17 00:00:00 2001 From: waker Date: Thu, 23 Jun 2011 20:40:20 +0200 Subject: converter: automatically create directory structure artwork: minor readability fix in check_dir --- plugins/artwork/artwork.c | 3 +-- plugins/converter/converter.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c index 7f56b870..d603c06d 100644 --- a/plugins/artwork/artwork.c +++ b/plugins/artwork/artwork.c @@ -186,8 +186,7 @@ check_dir (const char *dir, mode_t mode) } if (slash) *slash = '/'; - } - while (slash); + } while (slash); free (tmp); return 1; } diff --git a/plugins/converter/converter.c b/plugins/converter/converter.c index 04a97777..39604785 100644 --- a/plugins/converter/converter.c +++ b/plugins/converter/converter.c @@ -693,6 +693,34 @@ get_output_path (DB_playItem_t *it, const char *outfolder, const char *outfile, trace ("converter output file is '%s'\n", out); } +static int +check_dir (const char *dir, mode_t mode) +{ + char *tmp = strdup (dir); + char *slash = tmp; + struct stat stat_buf; + do + { + slash = strstr (slash+1, "/"); + if (slash) + *slash = 0; + if (-1 == stat (tmp, &stat_buf)) + { + trace ("creating dir %s\n", tmp); + if (0 != mkdir (tmp, mode)) + { + trace ("Failed to create %s (%d)\n", tmp, errno); + free (tmp); + return 0; + } + } + if (slash) + *slash = '/'; + } while (slash); + free (tmp); + return 1; +} + int convert (DB_playItem_t *it, const char *outfolder, const char *outfile, int output_bps, int output_is_float, int preserve_folder_structure, const char *root_folder, ddb_encoder_preset_t *encoder_preset, ddb_dsp_preset_t *dsp_preset, int *abort) { if (deadbeef->pl_get_item_duration (it) <= 0) { @@ -703,6 +731,11 @@ convert (DB_playItem_t *it, const char *outfolder, const char *outfile, int outp return -1; } + if (!check_dir (outfolder, 0755)) { + fprintf (stderr, "converter: failed to create output folder: %s\n", outfolder); + return -1; + } + int err = -1; FILE *enc_pipe = NULL; FILE *temp_file = NULL; -- cgit v1.2.3 From 17c344f5a0f97c54072afccadfe6f0b810bc8aad Mon Sep 17 00:00:00 2001 From: waker Date: Thu, 23 Jun 2011 21:34:27 +0200 Subject: fixed shuffle tracks bug, when part of the tracks were skipped --- streamer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/streamer.c b/streamer.c index 74398e34..1acf72b3 100644 --- a/streamer.c +++ b/streamer.c @@ -386,7 +386,7 @@ streamer_move_to_nextsong (int reason) { } if (pl_order == PLAYBACK_ORDER_SHUFFLE_TRACKS || pl_order == PLAYBACK_ORDER_SHUFFLE_ALBUMS) { // shuffle - if (!curr) { + if (!curr || pl_order == PLAYBACK_ORDER_SHUFFLE_TRACKS) { // find minimal notplayed playItem_t *pmin = NULL; // notplayed minimum for (playItem_t *i = plt->head[PL_MAIN]; i; i = i->next[PL_MAIN]) { @@ -405,7 +405,12 @@ streamer_move_to_nextsong (int reason) { } } if (!it) { + streamer_buffering = 0; + send_trackinfochanged (streaming_track); + playItem_t *temp; + plt_reshuffle (streamer_playlist, &temp, NULL); pl_unlock (); + streamer_set_nextsong (-2, -2); return -1; } int r = str_get_idx_of (it); -- cgit v1.2.3 From 9245c4001ff209a4eab990ac2f590972656fddf9 Mon Sep 17 00:00:00 2001 From: waker Date: Thu, 23 Jun 2011 21:48:11 +0200 Subject: shuffle/random modes: play button will start random song if cursor is not set --- streamer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/streamer.c b/streamer.c index 1acf72b3..8496b092 100644 --- a/streamer.c +++ b/streamer.c @@ -2021,9 +2021,8 @@ streamer_play_current_track (void) { return; } else { - // restart currently playing track output->stop (); - streamer_set_nextsong (0, 1); + streamer_move_to_nextsong (1); } if (plt) { plt_unref (plt); -- cgit v1.2.3