本文整理汇总了C++中VideoFrame::data方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoFrame::data方法的具体用法?C++ VideoFrame::data怎么用?C++ VideoFrame::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoFrame
的用法示例。
在下文中一共展示了VideoFrame::data方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: upload
bool VaApiMixer::upload(const VideoFrame &frame, bool deint) {
if (!m_glSurface)
return false;
static const int specs[MP_CSP_COUNT] = {
0, //MP_CSP_AUTO,
VA_SRC_BT601, //MP_CSP_BT_601,
VA_SRC_BT709, //MP_CSP_BT_709,
VA_SRC_SMPTE_240, //MP_CSP_SMPTE_240M,
0, //MP_CSP_RGB,
0, //MP_CSP_XYZ,
0, //MP_CSP_YCGCO,
};
static const int field[] = {
// Picture = 0, Top = 1, Bottom = 2
VA_FRAME_PICTURE, VA_TOP_FIELD, VA_BOTTOM_FIELD, VA_FRAME_PICTURE
};
const auto id = (VASurfaceID)(quintptr)frame.data(3);
int flags = specs[frame.format().colorspace()];
if (deint)
flags |= field[frame.field() & VideoFrame::Interlaced];
if (!check(vaCopySurfaceGLX(VaApi::glx(), m_glSurface, id, flags), "Cannot copy OpenGL surface."))
return false;
if (!check(vaSyncSurface(VaApi::glx(), id), "Cannot sync video surface."))
return false;
return true;
}
示例2: doDeepCopy
void VideoFrame::doDeepCopy(const VideoFrame &frame) {
d.detach();
Q_ASSERT(d->format == frame.format());
auto p = d->buffer.data();
for (int i=0; i<d->format.planes(); ++i) {
const int len = d->format.bytesPerPlain(i);
memcpy(p, frame.data(i), len);
p += len;
}
}
示例3: upload
bool VdaMixer::upload(const VideoFrame &frame, bool /*deint*/) {
Q_ASSERT(frame.format().imgfmt() == IMGFMT_VDA);
CGLError error = kCGLNoError;
for (auto &texture : m_textures) {
const auto cgl = CGLGetCurrentContext();
const auto surface = CVPixelBufferGetIOSurface((CVPixelBufferRef)frame.data(3));
texture.bind();
const auto w = IOSurfaceGetWidthOfPlane(surface, texture.plane());
const auto h = IOSurfaceGetHeightOfPlane(surface, texture.plane());
if (_Change(error, CGLTexImageIOSurface2D(cgl, texture.target(), texture.format(), w, h, texture.transfer().format, texture.transfer().type, surface, texture.plane()))) {
_Error("CGLError: %%(0x%%)", CGLErrorString(error), _N(error, 16));
return false;
}
}
return true;
}