On May 4, 2007, at 7:49 AM, Joerg Desch wrote:

> Maybe my question was not that clear, sorry. I need to subclass a  
> Fl_Box
> to get a HWND to draw to.

Ah, there are a few things still unclear here. Let me see if I can  
resolve this.

There are two different basic concepts for rendering video. Which one  
you use makes a huge difference for the implementation and the  
performance of your app.

1:

The fastest way is to let DirectVideo do the work. In this case, your  
Video window will always be derived from Fl_Window in order to obtain  
the HWND. All other FLTK widgets are purely software constructs that  
DirectVideo does not understand. And yes, you can have an Fl_Window  
inside another Fl_Window.

So for the first case, you create the Fl_Window and call "show()".  
Make sure that it is actually "shown()" (this can be done using a  
timeout, or by deriving a class and implementing the draw() function)  
and then take the give fl_xid() and pass it to DirectVideo.

Advantage: DirectVideo does all the work, you probably don't have to  
worry about threads, it's fast
Disadvantage: you still have to derive your own class in order to  
open and close you DirectVideo connection wehen needed, you cannot  
draw on ytop of the video stream

2:

If you instruct DirectVideo to create RGB images for you, and have  
FLTK render the RGB images manually, this is what you can do:

- create you video thread. Every time an image is rendered into  
memory, you thread must tell the main application that you want it to  
redraw the current image. You usually do that by calling:

Fl::lock();
VideoWidget->current_frame(theAddress);
VideoWidget->redraw();
Fl::unlock();
Fl::awake();

You then derive your own VideoWidget and implemen VideoWidget::draw()  
to render the current frame as set by your video thread. This is  
where you either BitBlt or use the Fl_RGB_Image functions.

The advantage of this solution is, that FLTK still has the decission  
on when to draw what. This solves many issues, including partially  
obscured windows, resizing, drawing over the video, and frame  
skipping if the performance is low. It also avoids 100% bus CPU's und  
unresponsiveness of this and other applications.


----
http://robowerk.com/


_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to