本文整理汇总了C++中VideoFrame::setCaptureTime方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoFrame::setCaptureTime方法的具体用法?C++ VideoFrame::setCaptureTime怎么用?C++ VideoFrame::setCaptureTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoFrame
的用法示例。
在下文中一共展示了VideoFrame::setCaptureTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generateHistogram
void HistogramFilter::generateHistogram()
{
if(!m_frame)
return;
QImage image = frameImage();
QImage histo = makeHistogram(image);
VideoFrame *frame = new VideoFrame(histo,m_frame->holdTime());
if(m_includeOriginalImage)
frame->setCaptureTime(m_frame->captureTime());
enqueue(frame);
}
示例2: VideoFrame
VideoFrame *SimpleV4L2::readFrame()
{
struct v4l2_buffer buf;
unsigned int i;
VideoFrame *frame = new VideoFrame();
frame->setPixelFormat(QVideoFrame::Format_RGB32);
frame->setCaptureTime(QTime::currentTime());
frame->setBufferType(VideoFrame::BUFFER_POINTER);
frame->setHoldTime(1000/30);
frame->setSize(m_imageSize);
if(!m_startedCapturing)
return frame;
/* struct timeval tv_start, tv_end;
if (gettimeofday(&tv_start, 0) < 0) {
errno_exit("Error getting time");
}*/
//QByteArray array;
switch (m_io) {
case IO_METHOD_READ:
if (-1 == read (m_fd, m_buffers[0].start, m_buffers[0].length)) {
switch (errno) {
case EAGAIN:
return frame;
case EIO:
/* Could ignore EIO, see spec. */
/* fall through */
default:
errno_exit ("read");
}
}
//array.append((char*)m_buffers[0].start, m_buffers[0].length);
//frame->setByteArray(array);
//frame->pointer = (uchar*)malloc(sizeof(uchar) * m_buffers[0].length);
memcpy(frame->allocPointer(m_buffers[0].length), m_buffers[0].start, m_buffers[0].length);
break;
case IO_METHOD_MMAP:
CLEAR (buf);
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
if (-1 == xioctl (m_fd, VIDIOC_DQBUF, &buf)) {
switch (errno) {
case EAGAIN:
return frame;
case EIO:
/* Could ignore EIO, see spec. */
/* fall through */
default:
errno_exit ("VIDIOC_DQBUF");
}
}
assert (buf.index < m_numBuffers);
// array.append((char*)m_buffers[buf.index].start, m_buffers[buf.index].length);
// frame->setByteArray(array);
//frame->pointer = (uchar*)malloc(sizeof(uchar) * m_buffers[buf.index].length);
{
uchar *pointer = frame->allocPointer(m_buffers[buf.index].length);
//qDebug() << "SimpleV4L2::readFrame: Read "<<m_buffers[buf.index].length<<" bytes into pointer "<<pointer;
memcpy(pointer, m_buffers[buf.index].start, m_buffers[buf.index].length);
}
if (-1 == xioctl (m_fd, VIDIOC_QBUF, &buf))
errno_exit ("VIDIOC_QBUF");
break;
case IO_METHOD_USERPTR:
CLEAR (buf);
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_USERPTR;
if (-1 == xioctl (m_fd, VIDIOC_DQBUF, &buf)) {
switch (errno) {
case EAGAIN:
return frame;
case EIO:
//.........这里部分代码省略.........