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: Marek Peca
Subject: Re: Displaying live video -- how to notify main loop from another thread?
Date: Fri, 9 Jul 2010 15:02:08 +0200 (CEST)

Hello,

For playing video, Eric wrote a simple view a while ago that used an NSOpenGLView, so bypassed the entire GNUstep drawing stack and gave good performance, so you might consider this approach. This also has the advantage that the image stays in VRAM as a texture once the camera has captured it, so redraws are very cheap.

thanks for the info, I'll look at it. However, I would like to not include a dependence on OpenGL, while all the application is strictly 2D... (yes, I know, that accelerated 2D video is often done these days using OpenGL, but I am unsure, whether this is the right way).

You can receive notification of data available on a file descriptor by wrapping it in an NSFileHandle and then calling a method like -waitForDataInBackgroundAndNotify. This will post a notification when there is data available for drawing.

Great, so this is something like that XtAppAddInput, right?

-setNeedsDisplay: also ought to work.  I think this is a bug in GNUstep
- this ought to wake up the main thread if it is sleeping and trigger a redraw.

It seemed to me, because there is a statement, that this message is thread-safe in contrast to lots of other GNUstep GUI calls. Is the bug tracked somewhere? Can I help?

If it doesn't, you can poke the main thread with -performSelectorInMainThread:

As Tom did said, thanks for the confirmation. I wonder, whether it is OK to work with pthreads, or if it may break the things.


Best regards,
Marek



reply via email to

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