[Gridflow-cvs] [svn] commit: r3801 - in /trunk/format: mpeg3.c quicktimehw.c

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Wed Jun 4 17:00:12 EDT 2008


Author: matju
Date: Wed Jun  4 17:00:12 2008
New Revision: 3801

Log:
clip seek so that it does seek to the first or last frame instead of not seeking, when the frame number overflows.

Modified:
    trunk/format/mpeg3.c
    trunk/format/quicktimehw.c

Modified: trunk/format/mpeg3.c
==============================================================================
--- trunk/format/mpeg3.c (original)
+++ trunk/format/mpeg3.c Wed Jun  4 17:00:12 2008
@@ -50,13 +50,15 @@
 	\decl 0 bang ();
 };
 
-\def 0 seek (int frame) { mpeg3_set_frame(mpeg,frame,track); }
+\def 0 seek (int frame) {
+	mpeg3_set_frame(mpeg,clip(frame,0,mpeg3_video_frames(mpeg,track)-1),track);
+}
 \def 0 rewind () {_0_seek(0,0,0);}
 
 \def 0 bang () {
 	int nframe = mpeg3_get_frame(mpeg,track);
 	int nframes = mpeg3_video_frames(mpeg,track);
-	post("track=%d; nframe=%d; nframes=%d",track,nframe,nframes);
+	//post("track=%d; nframe=%d; nframes=%d",track,nframe,nframes);
 	if (nframe >= nframes) {outlet_bang(bself->te_outlet); return;}
 	int sx = mpeg3_video_width(mpeg,track);
 	int sy = mpeg3_video_height(mpeg,track);

Modified: trunk/format/quicktimehw.c
==============================================================================
--- trunk/format/quicktimehw.c (original)
+++ trunk/format/quicktimehw.c Wed Jun  4 17:00:12 2008
@@ -86,7 +86,9 @@
 };
 
 \def 0 force_size (int32 height, int32 width) { force = new Dim(height, width); }
-\def 0 seek (int frame) {quicktime_set_video_position(anim,frame,track);}
+\def 0 seek (int frame) {
+	quicktime_set_video_position(anim,clip(frame,0,quicktime_video_length(anim,track)-1,track);
+}
 \def 0 rewind () {_0_seek(0,0,0);}
 
 \def 0 bang () {



More information about the Gridflow-cvs mailing list