コード例 #1
0
ファイル: tests.py プロジェクト: PSC-SR/robotpy
def foreach_device_output(fd, func):
    original_index = v4l2.c_int()
    ioctl(fd, v4l2.VIDIOC_G_OUTPUT, original_index)

    for output in get_device_outputs(fd):
        if output_.index != original_index.value:
            try:
                ioctl(fd, v4l2.VIDIOC_S_OUTPUT, v4l2.c_int(output.index))
            except IOError, e:
                if e.errno == errno.EBUSY:
                    continue
                else:
                    raise
        func(fd, output)
コード例 #2
0
ファイル: v4l_test.py プロジェクト: jshafer817/uvscada
def foreach_device_input(fd, func):
    original_index = v4l2.c_int()
    fcntl.ioctl(fd, v4l2.VIDIOC_G_INPUT, original_index)

    for input_ in get_device_inputs(fd):
        if input_.index != original_index.value:
            try:
                fcntl.ioctl(fd, v4l2.VIDIOC_S_INPUT, v4l2.c_int(input_.index))
            except IOError, e:
                if e.errno == errno.EBUSY:
                    continue
                else:
                    raise
        func(fd, input_)
コード例 #3
0
def test_VIDIOC_G_OUTPUT(fd):
    cap = v4l2.v4l2_capability()
    ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap)

    if not cap.capabilities & v4l2.V4L2_CAP_VIDEO_OUTPUT:
        # test does not apply for this device
        return

    index = v4l2.c_int()
    ioctl(fd, v4l2.VIDIOC_G_OUTPUT, index)
コード例 #4
0
ファイル: tests.py プロジェクト: Cobra-Kao/ropon
def test_VIDIOC_G_OUTPUT(fd):
    cap = v4l2.v4l2_capability()
    ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap)

    if not cap.capabilities & v4l2.V4L2_CAP_VIDEO_OUTPUT:
        # test does not apply for this device
        return

    index = v4l2.c_int()
    ioctl(fd, v4l2.VIDIOC_G_OUTPUT, index)
コード例 #5
0
ファイル: tests.py プロジェクト: PSC-SR/robotpy
def test_VIDIOC_S_INPUT(fd):
    cap = v4l2.v4l2_capability()
    ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap)

    if not cap.capabilities & v4l2.V4L2_CAP_VIDEO_CAPTURE:
        # test does not apply for this device
        return

    index = v4l2.c_int(0)
    try:
        ioctl(fd, v4l2.VIDIOC_S_INPUT, index)
    except IOError, e:
        assert e.errno == errno.EBUSY
        return
コード例 #6
0
def test_VIDIOC_S_OUTPUT(fd):
    cap = v4l2.v4l2_capability()
    ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap)

    if not cap.capabilities & v4l2.V4L2_CAP_VIDEO_OUTPUT:
        # test does not apply for this device
        return

    index = v4l2.c_int(0)
    ioctl(fd, v4l2.VIDIOC_S_OUTPUT, index)

    index.value = 1 << 31
    try:
        ioctl(fd, v4l2.VIDIOC_S_OUTPUT, index)
    except IOError as e:
        assert e.errno == errno.EINVAL
コード例 #7
0
ファイル: tests.py プロジェクト: Cobra-Kao/ropon
def test_VIDIOC_S_OUTPUT(fd):
    cap = v4l2.v4l2_capability()
    ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap)

    if not cap.capabilities & v4l2.V4L2_CAP_VIDEO_OUTPUT:
        # test does not apply for this device
        return

    index = v4l2.c_int(0)
    ioctl(fd, v4l2.VIDIOC_S_OUTPUT, index)

    index.value = 1 << 31
    try:
        ioctl(fd, v4l2.VIDIOC_S_OUTPUT, index)
    except IOError, e:
        assert e.errno == errno.EINVAL