本文整理汇总了C++中QVideoSurfaceFormat::frameWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ QVideoSurfaceFormat::frameWidth方法的具体用法?C++ QVideoSurfaceFormat::frameWidth怎么用?C++ QVideoSurfaceFormat::frameWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QVideoSurfaceFormat
的用法示例。
在下文中一共展示了QVideoSurfaceFormat::frameWidth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bytesPerLine
int DirectShowMediaType::bytesPerLine(const QVideoSurfaceFormat &format)
{
switch (format.pixelFormat()) {
// 32 bpp packed formats.
case QVideoFrame::Format_RGB32:
case QVideoFrame::Format_AYUV444:
return format.frameWidth() * 4;
// 24 bpp packed formats.
case QVideoFrame::Format_RGB24:
return PAD_TO_DWORD(format.frameWidth() * 3);
// 16 bpp packed formats.
case QVideoFrame::Format_RGB565:
case QVideoFrame::Format_RGB555:
case QVideoFrame::Format_YUYV:
case QVideoFrame::Format_UYVY:
return PAD_TO_DWORD(format.frameWidth() * 2);
// Planar formats.
case QVideoFrame::Format_IMC1:
case QVideoFrame::Format_IMC2:
case QVideoFrame::Format_IMC3:
case QVideoFrame::Format_IMC4:
case QVideoFrame::Format_YV12:
case QVideoFrame::Format_NV12:
case QVideoFrame::Format_YUV420P:
return PAD_TO_DWORD(format.frameWidth());
default:
return 0;
}
}
示例2: constructNull
void tst_QVideoSurfaceFormat::constructNull()
{
QVideoSurfaceFormat format;
QVERIFY(!format.isValid());
QCOMPARE(format.handleType(), QAbstractVideoBuffer::NoHandle);
QCOMPARE(format.pixelFormat(), QVideoFrame::Format_Invalid);
QCOMPARE(format.frameSize(), QSize());
QCOMPARE(format.frameWidth(), -1);
QCOMPARE(format.frameHeight(), -1);
QCOMPARE(format.viewport(), QRect());
QCOMPARE(format.scanLineDirection(), QVideoSurfaceFormat::TopToBottom);
QCOMPARE(format.frameRate(), 0.0);
QCOMPARE(format.pixelAspectRatio(), QSize(1, 1));
QCOMPARE(format.yCbCrColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined);
}
示例3: start
bool QX11VideoSurface::start(const QVideoSurfaceFormat &format)
{
if (m_image)
XFree(m_image);
int xvFormatId = 0;
for (int i = 0; i < m_supportedPixelFormats.count(); ++i) {
if (m_supportedPixelFormats.at(i) == format.pixelFormat()) {
xvFormatId = m_formatIds.at(i);
break;
}
}
if (xvFormatId == 0) {
setError(UnsupportedFormatError);
} else {
XvImage *image = XvCreateImage(
QX11Info::display(),
m_portId,
xvFormatId,
0,
format.frameWidth(),
format.frameHeight());
if (!image) {
setError(ResourceError);
} else {
m_viewport = format.viewport();
m_image = image;
QVideoSurfaceFormat newFormat = format;
newFormat.setProperty("portId", QVariant(quint64(m_portId)));
newFormat.setProperty("xvFormatId", xvFormatId);
newFormat.setProperty("dataSize", image->data_size);
return QAbstractVideoSurface::start(newFormat);
}
}
if (m_image) {
m_image = 0;
QAbstractVideoSurface::stop();
}
return false;
}