Re: Proposal for channel coordination between multiple v4l2 users

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Still undecided regarding my proposal is handling of event reporting.
Gerd Knorr and Michael Schimek have suggested to use S_FMT to switch
file handles into event polling mode, hence I'd like to update my
proposed interface along that line, so that only one new ioctl is
required.  If it seems acceptable I'll also update the patch.


Unchanged since my original proposal is the fact that the user needs
to open a separate file handle for event polling.  At first the user
would have to invoke ioctl S_FMT once with type set to V4L2_BUF_TYPE_
_EVENT_REPORT.  In union v4l2_format.fmt there's new member struct
v4l2_event_report with requested event masks, which will be modified
by the driver to contain supported events only and then stored
internally (in the file handle's private data) and returned to the
caller.  G_FMT can be used to query the current event mask at all
times.  Note there's no global event mask (subtle difference to G_FMT
with other types.)

After enabling event polling, poll() or select() can be used to wait
for one of the events selected in S_FMT.  When readability is indicated
the new ioctl VIDIOC_QUERYEVENT can be used to query which events
occurred since S_FMT or the last query.

I've extended the event masks (i) to hold capture on/off events, which
are useful for apps which got EBUSY in a STREAMON and want to wait for
the device to become free, and (ii) to hold up to 32 S_CTRL event bits
relative to V4L2_CID_BASE and up to 32 bits relative to V4L2_CID_
_PRIVATE_BASE, assuming control IDs will be allocated consecutively
starting at the base values. Bit 0 would refer to V4L2_CID_BASE, bit 1
to BASE+1 etc.  The only downside is that 64 additional counter bytes
are required to maintain the control events.

The following additions/changes would be required in videodev2.h:

enum v4l2_buf_type {
        /* ... */
        V4L2_BUF_TYPE_EVENT_REPORT   = 0x7f,
        V4L2_BUF_TYPE_PRIVATE        = 0x80,
};

enum v4l2_event_cap_cmd
{
        V4L2_EV_VIDEO_CAP_ON_OFF,
        V4L2_EV_VIDEO_OUT_ON_OFF,
        V4L2_EV_VIDEO_OVL_ON_OFF,
        V4L2_EV_VBI_CAP_ON_OFF,
        V4L2_EV_VBI_OUT_ON_OFF,
        V4L2_EV_S_PRIORITY,
        V4L2_EV_S_INPUT,
        V4L2_EV_S_FREQUENCY,
        V4L2_EV_S_TUNER,
        V4L2_EV_S_MODULATOR,
        V4L2_EV_S_STD,
        V4L2_EV_S_OUTPUT,
        V4L2_EV_S_AUDOUT
};

struct v4l2_event_report
{
        __u32   mask_cap_cmd;
        __u32   mask_ctrl_common;
        __u32   mask_ctrl_priv;
};

struct v4l2_format
{
        enum v4l2_buf_type type;
        union
        {
                /* ... */
                struct v4l2_event_report ev;
        } fmt;
};

#define VIDIOC_QUERYEVENT       _IOR ('V', 69, v4l2_event_report)


As always, any comments are welcome.

bye,
-tom




[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux