V4L2命令之 VIDIOC_STREAMON, VIDIOC_STREAMOFF

本文介绍 Linux V4L2 接口中用于开始和停止流输入输出的 ioctl 命令 VIDIOC_STREAMON 和 VIDIOC_STREAMOFF 的使用方法。详细说明了这些命令在启动和停止捕获或输出过程中的作用,以及它们如何影响输入缓冲区的状态。

http://linuxtv.org/downloads/v4l-dvb-apis/vidioc-streamon.html

Name

VIDIOC_STREAMON, VIDIOC_STREAMOFF — Start or stop streaming I/O

Synopsis

intioctl(int fd,

int request,

const int *argp);
 

Arguments

fd

File descriptor returned byopen().

request

VIDIOC_STREAMON, VIDIOC_STREAMOFF

argp

Description

The VIDIOC_STREAMON and VIDIOC_STREAMOFF ioctl start and stop the captureor output process during streaming (memory mapping oruser pointer) I/O.

Specifically the capture hardware is disabled and no input buffers are filled (if there are any empty buffers in the incoming queue) untilVIDIOC_STREAMON has been called.Accordingly the output hardware is disabled, no video signal is produced untilVIDIOC_STREAMON has been called.The ioctl will succeed only when at least one output buffer is in the incoming queue.

The VIDIOC_STREAMOFF ioctl, apart of aborting or finishing any DMA in progress, unlocks any user pointer buffers locked in physical memory, and it removes all buffers from the incoming and outgoing queues. That means all images captured but not dequeued yet will be lost, likewise all images enqueued for output but not transmitted yet. I/O returns to the same state as after calling VIDIOC_REQBUFS and can be restarted accordingly.

Both ioctls take a pointer to an integer, the desired buffer or stream type. This is the same as struct v4l2_requestbuffers type. such as V4L2_BUF_TYPE_VIDEO_CAPTURE.

If VIDIOC_STREAMON is called when streaming is already in progress, or if VIDIOC_STREAMOFF is called when streaming is already stopped, then the ioctl does nothing and 0 is returned.

Note that applications can be preempted for unknown periods right before or after theVIDIOC_STREAMON or VIDIOC_STREAMOFF calls, there is no notion of starting or stopping "now". Buffer timestamps can be used to synchronize with other events.

Return Value

On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at theGeneric Error Codes chapter.

EINVAL

The buffertype is not supported, or no buffers have been allocated (memory mapping) or enqueued (output) yet.

EPIPE

The driver implementspad-level format configuration and the pipeline configuration is invalid.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值