42 if (m_surface != surface && m_surface && m_surface->isActive()) {
57 int w = m_format->frameWidth();
69 int h = m_format->frameHeight();
79 if(m_surface->isActive() && (m_format->frameWidth() != frame->size().width() ||
80 m_format->frameHeight() != frame->size().height()))
87 if (!m_surface->isActive())
89 QSize s = frame->size();
90 QVideoFrame::PixelFormat f = frame->pixelFormat();
91 m_format =
new QVideoSurfaceFormat(s, f);
93 bool b = m_surface->start(*m_format);
96 qDebug(
"Surface STARTED! Dimensions: %dx%d -- PixelFormat: %d", s.width(), s.height(), (
int)f);
100 qDebug(
"Surface START ERROR");
107 if (m_surface && m_format){
108 bool b = m_surface->present(*frame);
110 qWarning(
"Surface PRESENT ERROR");
114 if(m_frame !=
nullptr){
117 m_frame =
new QVideoFrame(*frame);
131 if (m_frame ==
nullptr || x>=m_frame->size().width() || y>=m_frame->size().height() || x<0 || y<0){
133 return QString(
"Invalid");
135 m_frame->map( QAbstractVideoBuffer::ReadOnly );
136 QImage
image(m_frame->bits(), m_frame->width(),
137 m_frame->height(), m_frame->bytesPerLine(),
138 QImage::Format_RGB32);
140 QRgb pixelVal =
image.pixel(x,y);
142 rgbHex += QString::number(pixelVal,16);
void setVideoSurface(QAbstractVideoSurface *surface)
sets the abstract surface
void resizeWindowRequest()
QString getPixelAsStr(int x, int y)
Pics the rgb value of the pixel specified by x and y and return it as a string.
QAbstractVideoSurface * videoSurface
int getHeight()
returns the height of the surface
int getWidth()
returns the width of the surface
void onNewVideoContentReceived(QVideoFrame *frame)
This gets the frame and presents it to the abstract surface.
VideoProducer(QObject *parent=0)