Video player example updated to display histogram using QVideoProbe.

Change-Id: Iaeba751280133bd405fe90a0d5d07be446c95738
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
Lev Zelenskiy
2012-02-21 17:23:47 +10:00
committed by Qt by Nokia
parent b56d3e70df
commit 03a14a95fe
5 changed files with 219 additions and 3 deletions

View File

@@ -42,9 +42,11 @@
#include "playercontrols.h"
#include "playlistmodel.h"
#include "histogramwidget.h"
#include <qmediaservice.h>
#include <qmediaplaylist.h>
#include <qvideoprobe.h>
#include <QtWidgets>
@@ -95,6 +97,16 @@ Player::Player(QWidget *parent)
labelDuration = new QLabel(this);
connect(slider, SIGNAL(sliderMoved(int)), this, SLOT(seek(int)));
labelHistogram = new QLabel(this);
labelHistogram->setText("Histogram:");
histogram = new HistogramWidget(this);
QHBoxLayout *histogramLayout = new QHBoxLayout;
histogramLayout->addWidget(labelHistogram);
histogramLayout->addWidget(histogram, 1);
probe = new QVideoProbe(this);
connect(probe, SIGNAL(videoFrameProbed(const QVideoFrame&)), histogram, SLOT(processFrame(QVideoFrame)));
probe->setSource(player);
QPushButton *openButton = new QPushButton(tr("Open"), this);
@@ -152,6 +164,7 @@ Player::Player(QWidget *parent)
hLayout->addWidget(labelDuration);
layout->addLayout(hLayout);
layout->addLayout(controlLayout);
layout->addLayout(histogramLayout);
setLayout(layout);
@@ -368,7 +381,6 @@ void Player::updateDurationInfo(qint64 currentInfo)
labelDuration->setText(tStr);
}
#ifndef PLAYER_NO_COLOROPTIONS
void Player::showColorDialog()
{
@@ -415,3 +427,4 @@ void Player::showColorDialog()
colorDialog->show();
}
#endif