[Qt-interest] Intercepting Phonon VideoWidget frames
Trenton Tuggle
Trent at Tuggle.org
Fri Mar 27 15:46:45 CET 2009
Ha! Good catch!
I've tried two approaches with that:
I tried making the VideoWidget a child widget of the WidgetImager --
children should always be painted on their parents, right? (Not
necessarily true for VideoWidget)
I tried changing WidgetImager to derive from VideoWidget -- derived
classes *are* the parents, and should therefore receive all their
parents' events, right? (Maybe, but VideoWidet has backend-specific
private detail implementation classes which are free to do whatever...
including bypassing PaintEvents!)
Neither case receives the events because I don't believe VideoWidget
uses them in a "normal" fashion. For performance, I believe
VideoWidgets do whatever they need, bypassing the normal painting
system.
In fact, VideoWidgets seem to only be able to render() their contents
anywhere if they're stuck inside a QGraphicsScene, so, as I mentioned,
I created a "dummy" graphics scene and stuck one in it, and presto! I
was able to render() frames to a QImage.
Unfortunately, there appears now to be some problem with rendering it
too quickly... it doesn't draw anything unless I wait a second or two
between calling render()!
There are several problem with this approach. First, I'd imagine this
behavior is common to all backend-implementations, but I'm not
positive. Second, the problem with rendering frames too often.
Third, not sure of the overhead of the dummy graphicsscene. Finally,
even if it worked, you have to "poll" the video or figure out if it's
changed; there's no notification of the update.
If phonon ever gets used for more than playback, it'll probably
acquire features that'll help with what I need... but it's not there
yet, and I'm not sure I'll be able to make it work within my time
constraints on this project. Perhaps next time...
-Trent Tuggle <Trent at Tuggle.Org>
On Mar 27, 2009, at 4:03 AM, Richard Moe Gustavsen wrote:
>> I've tried creating a QWidget-derived container (the source code I
>> posted earlier) but it still didn't receive PaintEvents.
>
> I took a quick look at the code, but I'm a bit uncertain about it.
> As far as
> I can read, that code should only receive paint events for the
> WidgetImager,
> and not from any video widget?
>
> Have you tried installing an event filter on the video widget (or more
> important, it's children, since thats where the drawing happends)
> and look
> for paint events?
>
> -Richard
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090327/27c4586c/attachment.html
More information about the Qt-interest-old
mailing list