I am trying to grab individual frames out of a video using
QMediaPlayer and QVideoGraphicsItem.
My general strategy is to pause() the player and then setPosition(n).
Some time later, the frame will be available in the QVideoGraphicsItem
and I can render it to a scene (and in turn a QImage).
The problem is determining when that frame is available.
First question: Is there any existing solution to this in the current code?
If not, next question: Can that functionality be added?
My solution, which seems to work, is to add a frameChanged() signal to
QVideoGraphicsItem that is emitted when _q_present() is called (see
patch below).
Is this a reasonable solution?
If not, what are other ideas/directions?
Here's the trivial patch for 'frameChanged()':
diff --git a/src/multimedia/qgraphicsvideoitem.cpp
b/src/multimedia/qgraphicsvideoitem.cpp
index db1f299..14ddb99 100644
--- a/src/multimedia/qgraphicsvideoitem.cpp
+++ b/src/multimedia/qgraphicsvideoitem.cpp
@@ -144,6 +144,8 @@ void QGraphicsVideoItemPrivate::_q_present()
} else {
q_ptr->update(boundingRect);
}
+
+ emit q_ptr->frameChanged();
}
void QGraphicsVideoItemPrivate::_q_formatChanged(const
QVideoSurfaceFormat &format)
diff --git a/src/multimedia/qgraphicsvideoitem.h
b/src/multimedia/qgraphicsvideoitem.h
index a447f67..35425c9 100644
--- a/src/multimedia/qgraphicsvideoitem.h
+++ b/src/multimedia/qgraphicsvideoitem.h
@@ -86,6 +86,7 @@ public:
Q_SIGNALS:
void nativeSizeChanged(const QSizeF &size);
+ void frameChanged();
protected:
void timerEvent(QTimerEvent *event);
_______________________________________________
Qt-mobility-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-mobility-feedback