-/* $OpenBSD: utvfu.c,v 1.12 2021/11/22 10:17:14 mglocker Exp $ */
+/* $OpenBSD: utvfu.c,v 1.13 2021/11/24 21:57:56 mglocker Exp $ */
/*
* Copyright (c) 2013 Lubomir Rintel
* Copyright (c) 2013 Federico Simoncelli
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE;
cap->device_caps |= V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
+
return (0);
}
i->type = V4L2_INPUT_TYPE_CAMERA;
i->std = utvfu_norm_params[sc->sc_normi].norm;
+
return (0);
}
strlcpy(f->description, "16 bpp YUY2, 4:2:2, packed",
sizeof(f->description));
f->pixelformat = V4L2_PIX_FMT_YUYV;
+
return (0);
}
fsizes->type = V4L2_FRMSIZE_TYPE_DISCRETE;
fsizes->discrete.width = utvfu_norm_params[sc->sc_normi].cap_width;
fsizes->discrete.height = utvfu_norm_params[sc->sc_normi].cap_height;
+
return (0);
}
f->fmt.pix.bytesperline = f->fmt.pix.width * 2;
f->fmt.pix.sizeimage = (f->fmt.pix.bytesperline * f->fmt.pix.height);
f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
+
return (0);
}
{
if (f->fmt.pix.pixelformat != V4L2_PIX_FMT_YUYV)
return (EINVAL);
+
return (0);
}
utvfu_g_std(void *v, v4l2_std_id *norm)
{
struct utvfu_softc *sc = v;
+
*norm = utvfu_norm_params[sc->sc_normi].norm;
+
return (0);
}
utvfu_g_input(void *v, int *i)
{
struct utvfu_softc *sc = v;
+
*i = sc->sc_input;
+
return (0);
}
utvfu_vs_start_isoc(struct utvfu_softc *sc)
{
int i;
+
for (i = 0; i < UTVFU_ISOC_TRANSFERS; i++)
utvfu_vs_start_isoc_ixfer(sc, &sc->sc_iface.ixfer[i]);
}
int
utvfu_find_queued(struct utvfu_softc *sc)
{
- int i;
+ int i;
/* find a buffer which is ready for queueing */
for (i = 0; i < sc->sc_mmap_count; i++) {
if (sc->sc_mmap[i].v4l2_buf.flags & V4L2_BUF_FLAG_QUEUED)
return (i);
}
+
return (-1);
}
utvfu_get_bufsize(void *v)
{
struct utvfu_softc *sc = v;
+
/* YUYV/YUV-422: 4 bytes/2 pixel */
return (utvfu_norm_params[sc->sc_normi].cap_width *
utvfu_norm_params[sc->sc_normi].cap_height * 2);
utvfu_streamoff(void *v, int type)
{
utvfu_vs_close(v);
+
return (0);
}
utvfu_queryctrl(void *v, struct v4l2_queryctrl *qctrl)
{
qctrl->flags = V4L2_CTRL_FLAG_DISABLED;
+
return (0);
}
if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return (EINVAL);
+
/*
* XXX Unsure whether there is a way to negotiate this with the
* device, but returning 0 will allow xenocara's video to run
parm->parm.capture.timeperframe.denominator = 1;
break;
}
+
return (0);
}
{
if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return (EINVAL);
+
return (0);
}
if (cp->type != AUDIO_MIXER_ENUM ||
cp->un.ord < 0 || cp->un.ord > 1)
return (EINVAL);
-/* XXX TODO */
+
+ /* XXX TODO */
+
DPRINTF(1, "%s %s: cp->un.ord=%d\n", DEVNAME(sc), __func__, cp->un.ord);
+
return (0);
}
if (cp->type != AUDIO_MIXER_ENUM ||
cp->un.ord < 0 || cp->un.ord > 1)
return (EINVAL);
-/* XXX TODO */
+
+ /* XXX TODO */
+
DPRINTF(1, "%s %s: cp->un.ord=%d\n", DEVNAME(sc), __func__, cp->un.ord);
+
return (0);
}
if (mi->index != 0)
return (EINVAL);
-/* XXX SOMEONE WITH AUDIO EXPERTIZE NEEDS TO HELP HERE */
+ /* XXX SOMEONE WITH AUDIO EXPERTIZE NEEDS TO HELP HERE */
strlcpy(mi->label.name, "mix0-i0", sizeof(mi->label.name));
mi->type = AUDIO_MIXER_ENUM;
mi->un.e.num_mem = 2;