Mercurial > audlegacy
changeset 1479:825349772a96 trunk
[svn] - a little more fault tolerance (stick a fork in it, it's done)
author | nenolod |
---|---|
date | Thu, 03 Aug 2006 00:12:56 -0700 |
parents | b5318012eb1b |
children | a62c3f7b277b |
files | ChangeLog Plugins/Input/cue/cuesheet.c |
diffstat | 2 files changed, 46 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Aug 02 23:44:16 2006 -0700 +++ b/ChangeLog Thu Aug 03 00:12:56 2006 -0700 @@ -1,3 +1,12 @@ +2006-08-03 06:44:16 +0000 William Pitcock <nenolod@nenolod.net> + revision [1870] + - well not exactly, but this is :) + + + Changes: Modified: + +2 -2 trunk/Plugins/Input/cue/cuesheet.c + + 2006-08-03 06:42:10 +0000 William Pitcock <nenolod@nenolod.net> revision [1868] - the other half of the equasion wrt seeking
--- a/Plugins/Input/cue/cuesheet.c Wed Aug 02 23:44:16 2006 -0700 +++ b/Plugins/Input/cue/cuesheet.c Thu Aug 03 00:12:56 2006 -0700 @@ -51,6 +51,7 @@ } cue_tracks[MAX_CUE_TRACKS]; static gint timeout_tag = 0; static gint finetune_seek = 0; +static gint pl_seek = 0; static InputPlugin *real_ip = NULL; @@ -197,6 +198,8 @@ { if (real_ip != NULL) real_ip->seek(time); + + pl_seek = time; } static void stop(void) @@ -256,7 +259,6 @@ else { real_ip->seek(finetune_seek / 1000); - finetune_seek = 0; } } @@ -273,26 +275,55 @@ /******************************************************* watchdog */ +/* + * This is fairly hard to explain. + * + * Basically we loop until we have reached the correct track. + * Then we set a finetune adjustment to make sure we stay in the + * right place. + * + * I used to recurse here (it was prettier), but that didn't work + * as well as I was hoping. + * + * Anyhow, yeah. The logic here isn't great, but it works, so I'm + * cool with it. + * + * - nenolod + */ static gint watchdog_func(gpointer unused) { gint time = get_output_time(); + gboolean dir = FALSE; - /* recurse until we're in the basically right place. */ - if (time < cue_tracks[cur_cue_track].index) + if (finetune_seek != 0) + { + if (real_ip != NULL) + real_ip->seek(finetune_seek / 1000); + + finetune_seek = 0; + } + + while (time < cue_tracks[cur_cue_track].index) { cur_cue_track--; playlist_prev(); - watchdog_func(NULL); finetune_seek = time; + dir = TRUE; + time = get_output_time() - 1000; + g_usleep(10000); } - else if (cur_cue_track != last_cue_track && (time > cue_tracks[cur_cue_track + 1].index)) + + while (dir == FALSE && cur_cue_track != last_cue_track && (time > cue_tracks[cur_cue_track + 1].index)) { cur_cue_track++; playlist_next(); - watchdog_func(NULL); finetune_seek = time; + time = get_output_time() + 1000; + g_usleep(10000); } + pl_seek = 0; + return TRUE; }