[Gridflow-cvs] [svn] commit: r3650 - in /trunk/format: opengl.c quicktimeapple.c

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Fri Apr 25 11:55:53 EDT 2008


Author: matju
Date: Fri Apr 25 11:55:52 2008
New Revision: 3650

Log:
another blind update for new source_filter

Modified:
    trunk/format/opengl.c
    trunk/format/quicktimeapple.c

Modified: trunk/format/opengl.c
==============================================================================
--- trunk/format/opengl.c (original)
+++ trunk/format/opengl.c Fri Apr 25 11:55:52 2008
@@ -48,10 +48,34 @@
 	P<Dim> dim;
 	uint8 *buf;
 	t_clock *clock;
-	\decl void call ();
-	\decl void initialize (t_symbol *mode);
+	void call ();
 	\decl 0 resize_window (int sx, int sy);
 	\grin 0
+	\constructor (t_symbol *mode) {
+		if (in_use) RAISE("only one #io:opengl object at a time; sorry");
+		in_use=true;
+		if (mode!=gensym("out")) RAISE("write-only, sorry");
+		int dummy = 0;
+		glutInit(&dummy,0);
+		glutInitDisplayMode(GLUT_RGBA);
+		resize_window(0,0,320,240);
+		gltex = 0;
+		glEnable(GL_TEXTURE_2D);
+		glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
+		glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+		glClear(GL_COLOR_BUFFER_BIT);
+		glDisable(GL_ALPHA_TEST);
+		glDisable(GL_CULL_FACE);
+		glDisable(GL_DITHER);
+		glDisable(GL_DEPTH_TEST);
+		glDisable(GL_LIGHTING);
+		window = 0xDeadBeef;
+		uint32 mask[3] = {0xff000000,0x00ff0000,0x0000ff00};
+		bit_packing = new BitPacking(4,4,3,mask);
+		clock = clock_new(this,(t_method)FormatOpenGL_call);
+		clock_delay(clock,0);
+	}
+
 	~FormatOpenGL () {
 		clock_unset(clock);
 		if (gltex) glDeleteTextures(1, (GLuint*)&gltex);
@@ -143,34 +167,6 @@
 	} GRID_FINISH {
 } GRID_END
 
-\def void initialize (t_symbol *mode) {
-	SUPER;
-	if (in_use) RAISE("only one #io:opengl object at a time; sorry");
-	in_use=true;
-	if (mode!="out") RAISE("write-only, sorry");
-	int dummy = 0;
-	glutInit(&dummy,0);
-	glutInitDisplayMode(GLUT_RGBA);
-	resize_window(0,0,320,240);
-	
-	gltex = 0;
-	glEnable(GL_TEXTURE_2D);
-	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
-	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
-	glClear(GL_COLOR_BUFFER_BIT);
-	glDisable(GL_ALPHA_TEST);
-	glDisable(GL_CULL_FACE);
-	glDisable(GL_DITHER);
-	glDisable(GL_DEPTH_TEST);
-	glDisable(GL_LIGHTING);
-	window = 0xDeadBeef;
-
-	uint32 mask[3] = {0xff000000,0x00ff0000,0x0000ff00};
-	bit_packing = new BitPacking(4,4,3,mask);
-	clock = clock_new(this,(t_method)FormatOpenGL_call);
-	clock_delay(clock,0);
-}
-
 \classinfo {install_format("#io.opengl",2,"");}
 \end class FormatOpenGL
 void startup_opengl () {

Modified: trunk/format/quicktimeapple.c
==============================================================================
--- trunk/format/quicktimeapple.c (original)
+++ trunk/format/quicktimeapple.c Fri Apr 25 11:55:52 2008
@@ -207,7 +207,6 @@
 
 \def void initialize (t_symbol *mode, string filename) {
 //vdc = SGGetVideoDigitizerComponent(c);
-  SUPER;
   dim = new Dim(240,320,4);
   OSErr e;
   rect.top=rect.left=0;
@@ -332,8 +331,34 @@
 	uint8 *buffer;
 	P<Dim> dim;
 	int nframe, nframes;
-	FormatQuickTimeApple() : movie(0), time(0), movie_file(0), gw(0),
-		buffer(), dim(0), nframe(0), nframes(0) {}
+	\constructor (t_symbol *mode, string filename) {
+		movie=0; time=0; movie_file=0; gw=0; buffer=0; dim=0; nframe=0; nframes=0;
+		int err;
+		filename = gf_find_file(filename);
+		FSSpec fss;
+		FSRef fsr;
+		err = FSPathMakeRef((const UInt8 *)filename.data(), &fsr, NULL);      if (err) goto err;
+		err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, &fss, NULL); if (err) goto err;
+		err = OpenMovieFile(&fss,&movie_file,fsRdPerm);                       if (err) goto err;
+		NewMovieFromFile(&movie, movie_file, NULL, NULL, newMovieActive, NULL);
+		Rect r;
+		GetMovieBox(movie, &r);
+		post("handle=%d movie=%d tracks=%d", movie_file, movie, GetMovieTrackCount(movie));
+		post("duration=%d; timescale=%d cHz", (long)GetMovieDuration(movie), (long)GetMovieTimeScale(movie));
+		nframes = GetMovieDuration(movie); /* i don't think so */
+		gfpost("rect=((%d..%d),(%d..%d))", r.top, r.bottom, r.left, r.right);
+		OffsetRect(&r, -r.left, -r.top);
+		SetMovieBox(movie, &r);
+		dim = new Dim(r.bottom-r.top, r.right-r.left, 4);
+		SetMoviePlayHints(movie, hintsHighQuality, hintsHighQuality);
+		buffer = new uint8[dim->prod()];
+		err = QTNewGWorldFromPtr(&gw, k32ARGBPixelFormat, &r, NULL, NULL, 0, buffer, dim->prod(1));
+		if (err) goto err;
+		return;
+	err:
+	//	RAISE("can't open file `%s': error #%d (%s)", filename.data(), err, rb_str_ptr(rb_funcall(mGridFlow,SI(macerr),1,INT2NUM(err))));
+		RAISE("can't open file `%s': error #%d (0x%08x)", filename.data(), err, err);
+	}
 	~FormatQuickTimeApple() {
 		if (movie) {
 			DisposeMovie(movie);
@@ -341,7 +366,6 @@
 			CloseMovieFile(movie_file);
 		}
 	}
-	\decl void initialize (t_symbol *mode, string filename);
 	\decl 0 codec_m (string c);
 	\decl 0 colorspace_m (string c);
 	\decl 0 bang ();
@@ -407,43 +431,6 @@
 \def 0 codec_m      (string c) { RAISE("Unimplemented. Sorry."); }
 \def 0 colorspace_m (string c) { RAISE("Unimplemented. Sorry."); }
 
-\def void initialize (t_symbol *mode, string filename) {
-	int err;
-	SUPER;
-	filename = gf_find_file(filename);
-	FSSpec fss;
-	FSRef fsr;
-	err = FSPathMakeRef((const UInt8 *)filename.data(), &fsr, NULL);
-	if (err) goto err;
-	err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, &fss, NULL);
-	if (err) goto err;
-	err = OpenMovieFile(&fss,&movie_file,fsRdPerm);
-	if (err) goto err;
-	NewMovieFromFile(&movie, movie_file, NULL, NULL, newMovieActive, NULL);
-	Rect r;
-	GetMovieBox(movie, &r);
-	gfpost("handle=%d movie=%d tracks=%d",
-		movie_file, movie, GetMovieTrackCount(movie));
-	gfpost("duration=%d; timescale=%d cHz",
-		(long)GetMovieDuration(movie),
-		(long)GetMovieTimeScale(movie));
-	nframes = GetMovieDuration(movie); /* i don't think so */
-	gfpost("rect=((%d..%d),(%d..%d))",
-		r.top, r.bottom, r.left, r.right);
-	OffsetRect(&r, -r.left, -r.top);
-	SetMovieBox(movie, &r);
-	dim = new Dim(r.bottom-r.top, r.right-r.left, 4);
-	SetMoviePlayHints(movie, hintsHighQuality, hintsHighQuality);
-	buffer = new uint8[dim->prod()];
-	err = QTNewGWorldFromPtr(&gw, k32ARGBPixelFormat, &r,
-		NULL, NULL, 0, buffer, dim->prod(1));
-	if (err) goto err;
-	return;
-err:
-//	RAISE("can't open file `%s': error #%d (%s)", filename.data(), err, rb_str_ptr(rb_funcall(mGridFlow,SI(macerr),1,INT2NUM(err))));
-	RAISE("can't open file `%s': error #%d (0x%08x)", filename.data(), err, err);
-}
-
 \classinfo {
 	EnterMovies();
 	install_format("#io.quicktime",4,"mov");



More information about the Gridflow-cvs mailing list