GStreamer backend changes for media probing API.

QGstreamerPlayerSession: Using GStreamer buffer probes
to access media data.

Change-Id: Ibc056283fdedaebba90456cc4e86ab63eae5f5f7
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
Lev Zelenskiy
2012-02-09 16:50:30 +10:00
committed by Qt by Nokia
parent 4f38f950b0
commit 0374f0de5e
13 changed files with 777 additions and 24 deletions

View File

@@ -43,11 +43,13 @@
#define QGSTREAMERPLAYERSESSION_H
#include <QObject>
#include <QtCore/qmutex.h>
#include <QtNetwork/qnetworkrequest.h>
#include "qgstreamerplayercontrol.h"
#include <private/qgstreamerbushelper_p.h>
#include <qmediaplayer.h>
#include <qmediastreamscontrol.h>
#include <qaudioformat.h>
#if defined(HAVE_GST_APPSRC)
#include "qgstappsrc.h"
@@ -61,6 +63,8 @@ class QGstreamerBusHelper;
class QGstreamerMessage;
class QGstreamerVideoRendererInterface;
class QGstreamerVideoProbeControl;
class QGstreamerAudioProbeControl;
class QGstreamerPlayerSession : public QObject,
public QGstreamerBusMessageFilter
@@ -119,6 +123,14 @@ public:
bool isLiveSource() const;
void addProbe(QGstreamerVideoProbeControl* probe);
void removeProbe(QGstreamerVideoProbeControl* probe);
static gboolean padVideoBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data);
void addProbe(QGstreamerAudioProbeControl* probe);
void removeProbe(QGstreamerAudioProbeControl* probe);
static gboolean padAudioBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data);
public slots:
void loadFromUri(const QNetworkRequest &url);
void loadFromStream(const QNetworkRequest &url, QIODevice *stream);
@@ -169,6 +181,13 @@ private:
static void handleElementAdded(GstBin *bin, GstElement *element, QGstreamerPlayerSession *session);
void processInvalidMedia(QMediaPlayer::Error errorCode, const QString& errorString);
void removeVideoBufferProbe();
void addVideoBufferProbe();
void removeAudioBufferProbe();
void addAudioBufferProbe();
void flushVideoProbes();
void resumeVideoProbes();
QNetworkRequest m_request;
QMediaPlayer::State m_state;
QMediaPlayer::State m_pendingState;
@@ -184,6 +203,8 @@ private:
GstElement* m_pendingVideoSink;
GstElement* m_nullVideoSink;
GstElement* m_audioSink;
GstBus* m_bus;
QObject *m_videoOutput;
QGstreamerVideoRendererInterface *m_renderer;
@@ -199,6 +220,13 @@ private:
QList<QMediaStreamsControl::StreamType> m_streamTypes;
QMap<QMediaStreamsControl::StreamType, int> m_playbin2StreamOffset;
QList<QGstreamerVideoProbeControl*> m_videoProbes;
QMutex m_videoProbeMutex;
int m_videoBufferProbeId;
QList<QGstreamerAudioProbeControl*> m_audioProbes;
QMutex m_audioProbeMutex;
int m_audioBufferProbeId;
int m_volume;
qreal m_playbackRate;