[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mgp-users 01398] Re: Auto-advancement and repeat?



I've done this patch, the only problem is that there is a significant
memory leak when it's left running for a long time. I've not had the time
to investigate the leak so I've just used a work around by restarting the
process every night at 2am.

(This is driving a plasma screen in our reception)

I've attached my patch against 1.11b

It's not pretty - but it works :)

There's no way with this to make the timing different for individual
slides - like I said - not pretty!

The way you use it is the same as using the -d (demo) flag, but use -r
(repeat) with a time interval - this will make it cycle through all the
slides repeatedly pausing for the specified number of seconds on each
slide. At the end it will check to see if the source file has been updated
and reload it if necessary (this is where the memory leak is btw).

Let me know if this is useful.

Regards,

Jonathan

On Fri, 25 Feb 2005, Ethan wrote:

> Date: Fri, 25 Feb 2005 21:16:47 -0500 (EST)
> From: Ethan <telmnstr@757.org>
> To: mgp-users@mew.org
> Subject: [mgp-users 01397] Auto-advancement and repeat?
>
> Hello everyone.
>
>  I'm looking at possible solutions for a project. Mainly right now I'm
> looking at RealPlayer's SMIL 2.0 capabilities versus MagicPoint. I feel
> more confident in the stability and speed of MagicPoint over realplayer.
>
>  One issue... I need to be able to embed timing commands to automatically
> step thru the presentation. I also need to repeat.
>
>  Stepping thru: I tried to use the -T command to test to see if that
> writes some sort of cue file for automating playback, but didn't seem to
> get output.
>
>  Obviously a script could be used to repeat the presentation at the end by
> killing and restarting the program, but I'd like to come up with something
> better.
>
>  I'm thinking it should be fairly trivial to hack in the repeat
> functionality. I noticed the -d demo mode that seems to run thru the
> presentation automatically. That would be perfect, if there is some what
> to adjust timing per slide? For instance, I'd like to have slides that
> have local music listings at one speed, then upon hitting a slide that
> calls mplayer pause long enough to run out the video clip.
>
>  Thoughts?
>
> --
>                                // Ethan O'Toole
>                                // http://users.757.org/~ethan
>
>
>

!---------------------------------------------------------------------------
= Jonathan Nicholson - Team Leader : System Support "Special Projects"       =
= The Sanger Centre, Wellcome Trust Genome Campus, Hinxton, Cambs, CB10 1SA  =
= Email: jjn@sanger.ac.uk -=- Tel: 01223 834244 x4987  -=- Fax: 01223 494919 =
 ----------------------------------------------------------------------------
diff -Naur magicpoint-1.11b.orig/mgp.c magicpoint-1.11b/mgp.c
--- magicpoint-1.11b.orig/mgp.c	2004-09-24 17:42:51.000000000 +0100
+++ magicpoint-1.11b/mgp.c	2004-09-28 16:31:36.000000000 +0100
@@ -255,7 +255,7 @@
 	argv=tmp_argv;
 	argc=tmp_argc;
 
-#define ACCEPTOPTS	"Bd:vVob:c:eg:f:hlGp:qt:Q:PSUT:D:CORw:X:x:nF:E:"
+#define ACCEPTOPTS	"Bd:vVob:c:eg:f:hlGp:qt:Q:PSUT:D:CORw:X:x:nF:E:r:"
 	while ((opt = getopt(argc, argv, ACCEPTOPTS)) != -1) {
 #undef ACCEPTOPTS
 		switch (opt) {
@@ -263,6 +263,11 @@
 			mgp_flag |= FL_BIMAGE;
 			break;
 
+		case 'r':
+			mgp_flag |= FL_DEMO | FL_CONTDEMO;
+			if (isdigit(optarg[0])) demointerval = atoi(optarg);
+			else optind--;
+			break;
 		case 'd':
 			mgp_flag |= FL_DEMO;
 			if (isdigit(optarg[0])) demointerval = atoi(optarg);
@@ -460,16 +465,32 @@
 		genhtml(start_page);
 	else if (mgp_flag & FL_DEMO) {
 		struct render_state state;
+		int real_start_page;
+
+		real_start_page = start_page;
 
 		memset(&state, 0, sizeof(struct render_state));
 		state.target = window;	/*XXX*/
 		state.width = window_width;
 		state.height = window_height;
-		while (start_page <= maxpage) {
-			state_goto(&state, start_page, 0);
-			draw_page(&state, NULL);
-			start_page++;
-			sleep(demointerval);	/*XXX*/
+		while(1) {
+			while (start_page <= maxpage) {
+				state_goto(&state, start_page, 0);
+				draw_page(&state, NULL);
+				start_page++;
+				sleep(demointerval);	/*XXX*/
+			}
+			start_page = real_start_page;
+			if (mgp_flag & FL_CONTDEMO) {
+				if(wantreload()) {
+					draw_reinit(&state);
+					cleanup_file();
+					load_file(mgp_fname);
+				}
+			}
+			else {
+				break;
+			}
 		}
 	} else {
 		init_win3();
diff -Naur magicpoint-1.11b.orig/mgp.h magicpoint-1.11b/mgp.h
--- magicpoint-1.11b.orig/mgp.h	2004-09-07 17:57:42.000000000 +0100
+++ magicpoint-1.11b/mgp.h	2004-09-28 16:31:42.000000000 +0100
@@ -189,7 +189,7 @@
 #define	FL_FRDCACHE		0x8000
 #define	FL_NOXFT		0x10000
 #define	FL_NOM17N		0x20000
-
+#define FL_CONTDEMO		0x40000
 /* 	page attribute flags 	*/
 #define PGFLAG_NODEF	0x01	/* nodefault */