QVideoProbe Class

The QVideoProbe class allows you to monitor video frames being played or recorded. 更多...

头文件: #include <QVideoProbe>
qmake: QT += multimedia
基类: QObject

公有函数

QVideoProbe(QObject *parent = Q_NULLPTR)
~QVideoProbe()
bool isActive() const
bool setSource(QMediaObject *source)
bool setSource(QMediaRecorder *mediaRecorder)
  • 32 个公有函数继承自 QObject

信号

void flush()
void videoFrameProbed(const QVideoFrame &frame)

其他继承的成员

  • 1 个属性继承自 QObject
  • 1 个公有槽函数继承自 QObject
  • 1 个公有变量继承自 QObject
  • 10 个静态公有成员继承自 QObject
  • 9 个受保护的函数继承自 QObject
  • 2 个受保护的变量继承自 QObject

详细描述

The QVideoProbe class allows you to monitor video frames being played or recorded.


  QMediaPlayer *player = new QMediaPlayer();
  QVideoProbe *probe = new QVideoProbe;

  connect(probe, SIGNAL(videoFrameProbed(QVideoFrame)), this, SLOT(processFrame(QVideoFrame)));

  probe->setSource(player); // Returns true, hopefully.

  player->setVideoOutput(myVideoSurface);
  player->setMedia(QUrl::fromLocalFile("observation.mp4"));
  player->play(); // Start receiving frames as they get presented to myVideoSurface

This same approach works with the QCamera object as well, to receive viewfinder or video frames as they are captured.

参见 QAudioProbe, QMediaPlayer, and QCamera.

成员函数

QVideoProbe::QVideoProbe(QObject *parent = Q_NULLPTR)

Creates a new QVideoProbe class with parent. After setting the source to monitor with setSource(), the videoFrameProbed() signal will be emitted when video frames are flowing in the source media object.

QVideoProbe::~QVideoProbe()

Destroys this probe and disconnects from any media object.

[signal] void QVideoProbe::flush()

This signal should be emitted when it is required to release all frames. Application must release all outstanding references to video frames.

bool QVideoProbe::isActive() const

Returns true if this probe is monitoring something, or false otherwise.

The source being monitored does not need to be active.

bool QVideoProbe::setSource(QMediaObject *source)

Sets the media object to monitor to source.

If source is zero, this probe will be deactivated and this function wil return true.

If the media object does not support monitoring video, this function will return false.

Any previously monitored objects will no longer be monitored. Passing in the same object will be ignored, but monitoring will continue.

bool QVideoProbe::setSource(QMediaRecorder *mediaRecorder)

Starts monitoring the given mediaRecorder.

If there is no mediaObject associated with mediaRecorder, or if it is zero, this probe will be deactivated and this function wil return true.

If the media recorder instance does not support monitoring video, this function will return false.

Any previously monitored objects will no longer be monitored. Passing in the same object will be ignored, but monitoring will continue.

[signal] void QVideoProbe::videoFrameProbed(const QVideoFrame &frame)

This signal should be emitted when a video frame is processed in the media service.