Beispiel #1
0
bool takeOneOutputFrame(int fd, int index = -1/* if index is not -1, simple enque it*/)
{
    struct v4l2_buffer buf;
    struct v4l2_plane planes[1];
    int ioctlRet = -1;

    memset(&buf, 0, sizeof(buf));
    memset(planes, 0, sizeof(planes));
    buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; //it indicates output buffer type
    buf.memory = outputMemoryType; // chromeos v4l2vea uses this mode only
    buf.m.planes = planes;
    buf.length = 1;

    if (index == -1) {
        ioctlRet = YamiV4L2_Ioctl(fd, VIDIOC_DQBUF, &buf);

        if (isEncodeEOS) {
            if (ioctlRet == -1) {
                isOutputEOS = true;
                YamiV4L2_SetDevicePollInterrupt(fd);
                return true;
            }
        }
        if (ioctlRet == -1)
            return false;

        if (!writeOneOutputFrame(outputFrames[buf.index], buf.bytesused)) {
            ASSERT(0);
            return false;
        }
    } else {
        buf.index = index;
    }

    ioctlRet = YamiV4L2_Ioctl(fd, VIDIOC_QBUF, &buf);
    ASSERT(ioctlRet != -1);

    return true;
}
 int32_t setDevicePollInterrupt()
 {
     return YamiV4L2_SetDevicePollInterrupt(m_fd);
 }