Changes to QMediaPlayer GStreamer backend to allow setPosition before pause

Do not display prerolled frames in stopped state.
Instead store prerolled frame and display it only after switching to
pause or playback state.
Added new unit test with a sample video file to check this functionality.

Change-Id: I3fd159a199b65ca10fdf9843af5675c5ae9dad05
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
Lev Zelenskiy
2012-02-06 13:52:56 +10:00
committed by Qt by Nokia
parent 7415e4c879
commit 39c96db2b3
5 changed files with 199 additions and 6 deletions

View File

@@ -97,6 +97,9 @@ public:
GstFlowReturn render(GstBuffer *buffer);
GstBuffer *lastPrerolledBuffer() const { return m_lastPrerolledBuffer; }
void setLastPrerolledBuffer(GstBuffer *lastPrerolledBuffer); // set prerolledBuffer to 0 to discard prerolled buffer
private slots:
void queuedStart();
void queuedStop();
@@ -118,6 +121,8 @@ private:
QVideoSurfaceFormat m_format;
QVideoFrame m_frame;
GstFlowReturn m_renderReturn;
// this pointer is not 0 when there is a prerolled buffer waiting to be displayed
GstBuffer *m_lastPrerolledBuffer;
int m_bytesPerLine;
bool m_started;
bool m_startCanceled;
@@ -131,6 +136,8 @@ public:
static QVideoSurfaceGstSink *createSink(QAbstractVideoSurface *surface);
static QVideoSurfaceFormat formatForCaps(GstCaps *caps, int *bytesPerLine = 0);
static void handleShowPrerollChange(GObject *o, GParamSpec *p, gpointer d);
private:
static GType get_type();
static void class_init(gpointer g_class, gpointer class_data);