gnustep-dev
[Top][All Lists]
Advanced

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

Re: Displaying live video -- how to notify main loop from another thread


From: icicle
Subject: Re: Displaying live video -- how to notify main loop from another thread?
Date: Fri, 9 Jul 2010 14:26:32 +0200
User-agent: Internet Messaging Program (IMP) H3 (4.0.4)

Hi!

This could help:

http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html#//apple_ref/occ/instm/NSObject/performSelectorOnMainThread:withObject:waitUntilDone:

TOM

Zitat von Marek Peca <address@hidden>:

Dear GNUsteppers,

I am writing a scientific imaging application, which should display a live video coming from camera with some grid and text superimposed on it. I have achieved the basic operation using NSBitmapImageRep, filled with camera images, displayed by a descendant of NSView.

The GNUstep GUI (application event loop) runs in one thread, while the camera input runs in another thread (there is a blocking select). The problem is, how to notify the GUI, that redrawing of camera image is needed. I thought, that NSView->setNeedsDisplay: YES exists for this purpose, however, it does not seem to work for me. The image is not updated, until some GUI events interrupt the loop (eg. mouse input).

How can I solve this issue? It would be fine, if I could somehow propagate the request from another thread. If this is not possible, I would appreciate at least, if GNUstep supports external "file" events, like XtAppAddInput in XToolkit. Does it?

And the second question is, whether I have chosen the right method of image display: I am calling NSBitmapImageRep->draw from within ImgView->drawRect:, where ImgView is descendant of NSView. Camera is grabbing at few fps, 640x480x8bit, calling [imgView setNeedsDisplay: YES]; if the event queue is being refreshed by continuous mouse motion, I can easily get CPU load 60% on my 3GHz Pentium. (Similar program under Gtk takes 2% CPU.) So I am asking, whether, and what am I doing wrong.

And my last question, do you know about some program or a demo under GNUstep, displaying live "webcam"?


Thank you very much for your help.

Best regards,
Marek

_______________________________________________
Gnustep-dev mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/gnustep-dev







reply via email to

[Prev in Thread] Current Thread [Next in Thread]