changeset 1477:b22164c8eb51 trunk

[svn] - the other half of the equasion wrt seeking
author nenolod
date Wed, 02 Aug 2006 23:42:10 -0700
parents 5dbe7cfdcaf5
children b5318012eb1b
files ChangeLog Plugins/Input/cue/cuesheet.c
diffstat 2 files changed, 29 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Aug 02 23:33:49 2006 -0700
+++ b/ChangeLog	Wed Aug 02 23:42:10 2006 -0700
@@ -1,3 +1,12 @@
+2006-08-03 06:33:49 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [1866]
+  - support the notion of a watchdog function to keep things bound to the proper playlist entry. (half there)
+  
+
+  Changes:        Modified:
+  +19 -5          trunk/Plugins/Input/cue/cuesheet.c  
+
+
 2006-08-03 05:57:08 +0000  William Pitcock <nenolod@nenolod.net>
   revision [1864]
   - better support cuesheets outside of your directory
--- a/Plugins/Input/cue/cuesheet.c	Wed Aug 02 23:33:49 2006 -0700
+++ b/Plugins/Input/cue/cuesheet.c	Wed Aug 02 23:42:10 2006 -0700
@@ -50,6 +50,7 @@
 	gint index;
 } cue_tracks[MAX_CUE_TRACKS];
 static gint timeout_tag = 0;
+static gint finetune_seek = 0;
 
 static InputPlugin *real_ip = NULL;
 
@@ -249,7 +250,14 @@
 		real_ip->set_info = set_info_override;
 		real_ip->output = cue_ip.output;
 		real_ip->play_file(cue_file);
-		real_ip->seek(cue_tracks[track].index / 1000);	/* XXX: seek doesn't use frames? strange... -nenolod */
+
+		if (finetune_seek == 0)
+			real_ip->seek(cue_tracks[track].index / 1000);	/* XXX: seek doesn't use frames? strange... -nenolod */
+		else
+		{
+			real_ip->seek(finetune_seek / 1000);
+			finetune_seek = 0;
+		}
 	}
 
 	cur_cue_track = track;
@@ -269,10 +277,21 @@
 {
 	gint time = get_output_time();
 
+	/* recurse until we're in the basically right place. */
 	if (time < cue_tracks[cur_cue_track].index)
+	{
+		cur_cue_track--;
 		playlist_prev();
+		watchdog_func(NULL);
+	}
 	else if (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;
 
 	return TRUE;
 }