please help - I'm stumped




For the last few months I've been trying to write a gtk application that reads
data from a video card and shows the video in a window. I don't understand
how to write an equivalent of the gtk_main_loop but with calls to the framegrabber
thrown in.

I've tried the following approach:

----------------------
GtkWidget *mainwin, *imgwin;
GdkImage  *im;

/* make a main window */
mainwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);

/* make a gdkimage */
im = gdk_image_new(GDK_IMAGE_NORMAL, gtk_widget_get_visual(mainwin), width, height);

/* make an image window*/
imgwin = gtk_image_new(im, NULL);

/* specify exit callback for main window */
gtk_signal_connect (GTK_OBJECT (mainwin), "delete_event",
                    GTK_SIGNAL_FUNC (destroy_main), NULL);

/* add the image window to the main window */
gtk_container_add(GTK_CONTAINER (mainwin), imgwin);

/* go into the main loop */
for(;;)
   {
	while(gtk_events_pending())
          gtk_main_iteration_do (FALSE);

	getframe(im->mem); /* This grabs the image and shoves it into the image */
	gtk_widget_show(imgwin);
	gtk_widget_show(mainwin);

	gdk_flush();
    }	
-----------------------------------------

But it simply loads the first image and freezes, it doesn't refresh. It doesn't
respond to the delete_event either.

What am I doing wrong? and How do i fix it to display video at frame rate?

(The framegrabber, does work - I've been able to display video with other programs )


			Thanks in advance,    
					      Sajit



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